@gfed-medusa/sf-lib-common 3.1.1 → 3.3.5

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.
Files changed (139) hide show
  1. package/dist/components/breadcrumbs/index.d.ts +2 -2
  2. package/dist/components/breadcrumbs/index.js +6 -2
  3. package/dist/components/breadcrumbs/index.js.map +1 -1
  4. package/dist/components/cart-mismatch-banner/index.d.ts +2 -2
  5. package/dist/components/cart-mismatch-banner/index.d.ts.map +1 -1
  6. package/dist/components/cart-mismatch-banner/index.js +11 -2
  7. package/dist/components/cart-mismatch-banner/index.js.map +1 -1
  8. package/dist/components/country-select/index.js +3 -1
  9. package/dist/components/country-select/index.js.map +1 -1
  10. package/dist/components/delete-button/index.d.ts +2 -2
  11. package/dist/components/error-message/index.d.ts +2 -2
  12. package/dist/components/error-message/index.d.ts.map +1 -1
  13. package/dist/components/error-message/index.js +3 -1
  14. package/dist/components/error-message/index.js.map +1 -1
  15. package/dist/components/free-shipping-price-nudge/index.js +64 -47
  16. package/dist/components/free-shipping-price-nudge/index.js.map +1 -1
  17. package/dist/components/interactive-link/index.d.ts +9 -6
  18. package/dist/components/interactive-link/index.d.ts.map +1 -1
  19. package/dist/components/interactive-link/index.js +6 -6
  20. package/dist/components/interactive-link/index.js.map +1 -1
  21. package/dist/components/line-item-options/index.d.ts +2 -2
  22. package/dist/components/line-item-price/index.d.ts +2 -2
  23. package/dist/components/localized-client-link/index.d.ts +2 -2
  24. package/dist/components/localized-client-link/index.d.ts.map +1 -1
  25. package/dist/components/localized-client-link/index.js +10 -6
  26. package/dist/components/localized-client-link/index.js.map +1 -1
  27. package/dist/components/modal/index.d.ts +2 -2
  28. package/dist/components/modal/index.d.ts.map +1 -1
  29. package/dist/components/preview-price/index.d.ts +2 -2
  30. package/dist/components/preview-price/index.d.ts.map +1 -1
  31. package/dist/components/preview-price/index.js +3 -1
  32. package/dist/components/preview-price/index.js.map +1 -1
  33. package/dist/components/product-card/index.d.ts +2 -2
  34. package/dist/components/product-card/index.d.ts.map +1 -1
  35. package/dist/components/product-card/index.js +15 -10
  36. package/dist/components/product-card/index.js.map +1 -1
  37. package/dist/components/product-preview/index.d.ts +7 -3
  38. package/dist/components/product-preview/index.d.ts.map +1 -1
  39. package/dist/components/product-preview/index.js +4 -2
  40. package/dist/components/product-preview/index.js.map +1 -1
  41. package/dist/components/submit-button/index.d.ts +2 -2
  42. package/dist/components/submit-button/index.d.ts.map +1 -1
  43. package/dist/components/thumbnail/index.d.ts +2 -0
  44. package/dist/components/thumbnail/index.d.ts.map +1 -1
  45. package/dist/components/thumbnail/index.js +8 -4
  46. package/dist/components/thumbnail/index.js.map +1 -1
  47. package/dist/lib/config/medusa.js +3 -2
  48. package/dist/lib/config/medusa.js.map +1 -1
  49. package/dist/lib/context/apollo-context.d.ts +2 -2
  50. package/dist/lib/context/apollo-context.js +2 -1
  51. package/dist/lib/context/apollo-context.js.map +1 -1
  52. package/dist/lib/context/modal-context.d.ts +2 -2
  53. package/dist/lib/context/modal-context.d.ts.map +1 -1
  54. package/dist/lib/context/modal-context.js +3 -1
  55. package/dist/lib/context/modal-context.js.map +1 -1
  56. package/dist/lib/data/cart.js +35 -17
  57. package/dist/lib/data/cart.js.map +1 -1
  58. package/dist/lib/data/categories.js +2 -1
  59. package/dist/lib/data/categories.js.map +1 -1
  60. package/dist/lib/data/client-actions.js +7 -2
  61. package/dist/lib/data/client-actions.js.map +1 -1
  62. package/dist/lib/data/collections.js +9 -6
  63. package/dist/lib/data/collections.js.map +1 -1
  64. package/dist/lib/data/context.d.ts +2 -2
  65. package/dist/lib/data/context.js +3 -1
  66. package/dist/lib/data/context.js.map +1 -1
  67. package/dist/lib/data/cookies-actions.d.ts.map +1 -1
  68. package/dist/lib/data/cookies-actions.js +20 -10
  69. package/dist/lib/data/cookies-actions.js.map +1 -1
  70. package/dist/lib/data/cookies-utils.js +9 -3
  71. package/dist/lib/data/cookies-utils.js.map +1 -1
  72. package/dist/lib/data/customer.js +19 -10
  73. package/dist/lib/data/customer.js.map +1 -1
  74. package/dist/lib/data/footer.js +2 -1
  75. package/dist/lib/data/footer.js.map +1 -1
  76. package/dist/lib/data/orders.js +3 -2
  77. package/dist/lib/data/orders.js.map +1 -1
  78. package/dist/lib/data/regions.js +9 -6
  79. package/dist/lib/data/regions.js.map +1 -1
  80. package/dist/lib/globals/expose-globals.js +1 -1
  81. package/dist/lib/gql/apollo-client.js +12 -7
  82. package/dist/lib/gql/apollo-client.js.map +1 -1
  83. package/dist/lib/gql/fragments/cart.d.ts +9 -9
  84. package/dist/lib/gql/fragments/customer.d.ts +3 -3
  85. package/dist/lib/gql/fragments/product.d.ts +9 -9
  86. package/dist/lib/gql/fragments/product.d.ts.map +1 -1
  87. package/dist/lib/gql/fragments/product.js +12 -10
  88. package/dist/lib/gql/fragments/product.js.map +1 -1
  89. package/dist/lib/gql/mutations/cart.d.ts +6 -6
  90. package/dist/lib/gql/queries/cart.d.ts +2 -2
  91. package/dist/lib/gql/queries/cart.d.ts.map +1 -1
  92. package/dist/lib/gql/queries/collections.d.ts +4 -3
  93. package/dist/lib/gql/queries/collections.d.ts.map +1 -1
  94. package/dist/lib/gql/queries/collections.js +14 -2
  95. package/dist/lib/gql/queries/collections.js.map +1 -1
  96. package/dist/lib/gql/queries/customer.d.ts +2 -2
  97. package/dist/lib/gql/queries/customer.d.ts.map +1 -1
  98. package/dist/lib/gql/queries/order.d.ts +4 -4
  99. package/dist/lib/gql/queries/order.d.ts.map +1 -1
  100. package/dist/lib/gql/queries/order.js +1 -0
  101. package/dist/lib/gql/queries/order.js.map +1 -1
  102. package/dist/lib/gql/queries/product.d.ts +3 -4
  103. package/dist/lib/gql/queries/product.d.ts.map +1 -1
  104. package/dist/lib/gql/queries/product.js +2 -12
  105. package/dist/lib/gql/queries/product.js.map +1 -1
  106. package/dist/lib/gql/queries/regions.d.ts +3 -3
  107. package/dist/lib/gql/queries/shipping.d.ts +3 -3
  108. package/dist/lib/hooks/use-apollo.d.ts +2 -2
  109. package/dist/lib/hooks/use-apollo.js +2 -1
  110. package/dist/lib/hooks/use-apollo.js.map +1 -1
  111. package/dist/lib/hooks/use-cart.js +3 -1
  112. package/dist/lib/hooks/use-cart.js.map +1 -1
  113. package/dist/lib/hooks/use-customer.js +3 -1
  114. package/dist/lib/hooks/use-customer.js.map +1 -1
  115. package/dist/lib/utils/data-types.js +1 -1
  116. package/dist/lib/utils/data-types.js.map +1 -1
  117. package/dist/lib/utils/get-percentage-diff.js +3 -1
  118. package/dist/lib/utils/get-percentage-diff.js.map +1 -1
  119. package/dist/lib/utils/get-product-price.js +15 -5
  120. package/dist/lib/utils/get-product-price.js.map +1 -1
  121. package/dist/lib/utils/imagekit.d.ts +9 -0
  122. package/dist/lib/utils/imagekit.d.ts.map +1 -0
  123. package/dist/lib/utils/imagekit.js +26 -0
  124. package/dist/lib/utils/imagekit.js.map +1 -0
  125. package/dist/lib/utils/medusa-error.js +5 -2
  126. package/dist/lib/utils/medusa-error.js.map +1 -1
  127. package/dist/types/graphql.d.ts +27 -50
  128. package/dist/types/graphql.d.ts.map +1 -1
  129. package/dist/types/graphql.js +279 -186
  130. package/dist/types/graphql.js.map +1 -1
  131. package/package.json +5 -5
  132. package/dist/lib/data/search.d.ts +0 -9
  133. package/dist/lib/data/search.d.ts.map +0 -1
  134. package/dist/lib/data/search.js +0 -23
  135. package/dist/lib/data/search.js.map +0 -1
  136. package/dist/lib/hooks/use-search.d.ts +0 -22
  137. package/dist/lib/hooks/use-search.d.ts.map +0 -1
  138. package/dist/lib/hooks/use-search.js +0 -69
  139. package/dist/lib/hooks/use-search.js.map +0 -1
@@ -1,18 +1,21 @@
1
1
  'use server';
2
2
 
3
3
  import { graphqlFetch } from "../gql/apollo-client.js";
4
- import { GET_COLLECTIONS_QUERY } from "../gql/queries/collections.js";
4
+ import { GET_COLLECTIONS_HOME_QUERY } from "../gql/queries/collections.js";
5
5
 
6
6
  //#region src/lib/data/collections.ts
7
7
  const listCollections = async (queryParams = {}) => {
8
8
  try {
9
- return { collections: (await graphqlFetch({
10
- query: GET_COLLECTIONS_QUERY,
9
+ const limit = parseInt(queryParams.limit || "50");
10
+ const offset = parseInt(queryParams.offset || "0");
11
+ const data = await graphqlFetch({
12
+ query: GET_COLLECTIONS_HOME_QUERY,
11
13
  variables: {
12
- limit: parseInt(queryParams.limit || "100"),
13
- offset: parseInt(queryParams.offset || "0")
14
+ limit,
15
+ offset
14
16
  }
15
- }))?.collections };
17
+ });
18
+ return { collections: data?.collections };
16
19
  } catch (error) {
17
20
  console.error("Error fetching collections from BFF:", error);
18
21
  return { collections: [] };
@@ -1 +1 @@
1
- {"version":3,"file":"collections.js","names":[],"sources":["../../../src/lib/data/collections.ts"],"sourcesContent":["'use server';\n\nimport { graphqlFetch } from '@/lib/gql/apollo-client';\nimport { GET_COLLECTIONS_QUERY } from '@/lib/gql/queries/collections';\nimport {\n GetCollectionsQuery,\n GetCollectionsQueryVariables,\n} from '@/types/graphql';\n\nexport const listCollections = async (\n queryParams: Record<string, string> = {}\n) => {\n try {\n const limit = parseInt(queryParams.limit || '100');\n const offset = parseInt(queryParams.offset || '0');\n\n const data = await graphqlFetch<\n GetCollectionsQuery,\n GetCollectionsQueryVariables\n >({\n query: GET_COLLECTIONS_QUERY,\n variables: { limit, offset },\n });\n\n return {\n collections: data?.collections,\n };\n } catch (error) {\n console.error('Error fetching collections from BFF:', error);\n return { collections: [] };\n }\n};\n"],"mappings":";;;;;;AASA,MAAa,kBAAkB,OAC7B,cAAsC,EAAE,KACrC;AACH,KAAI;AAYF,SAAO,EACL,cATW,MAAM,aAGjB;GACA,OAAO;GACP,WAAW;IAAE,OARD,SAAS,YAAY,SAAS,MAAM;IAQ5B,QAPP,SAAS,YAAY,UAAU,IAAI;IAOpB;GAC7B,CAAC,GAGmB,aACpB;UACM,OAAO;AACd,UAAQ,MAAM,wCAAwC,MAAM;AAC5D,SAAO,EAAE,aAAa,EAAE,EAAE"}
1
+ {"version":3,"file":"collections.js","names":[],"sources":["../../../src/lib/data/collections.ts"],"sourcesContent":["'use server';\n\nimport { graphqlFetch } from '@/lib/gql/apollo-client';\nimport { GET_COLLECTIONS_HOME_QUERY } from '@/lib/gql/queries/collections';\nimport {\n GetCollectionsQuery,\n GetCollectionsQueryVariables,\n} from '@/types/graphql';\n\nexport const listCollections = async (\n queryParams: Record<string, string> = {}\n) => {\n try {\n const limit = parseInt(queryParams.limit || '50');\n const offset = parseInt(queryParams.offset || '0');\n\n const data = await graphqlFetch<\n GetCollectionsQuery,\n GetCollectionsQueryVariables\n >({\n query: GET_COLLECTIONS_HOME_QUERY,\n variables: { limit, offset },\n });\n\n return {\n collections: data?.collections,\n };\n } catch (error) {\n console.error('Error fetching collections from BFF:', error);\n return { collections: [] };\n }\n};\n"],"mappings":";;;;;;AASA,MAAa,kBAAkB,OAC7B,cAAsC,EAAE,KACrC;AACH,KAAI;EACF,MAAM,QAAQ,SAAS,YAAY,SAAS,KAAK;EACjD,MAAM,SAAS,SAAS,YAAY,UAAU,IAAI;EAElD,MAAM,OAAO,MAAM,aAGjB;GACA,OAAO;GACP,WAAW;IAAE;IAAO;IAAQ;GAC7B,CAAC;AAEF,SAAO,EACL,aAAa,MAAM,aACpB;UACM,OAAO;AACd,UAAQ,MAAM,wCAAwC,MAAM;AAC5D,SAAO,EAAE,aAAa,EAAE,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import { useStorefrontActions } from "./client-actions.js";
2
2
  import { ReactNode } from "react";
3
- import * as react_jsx_runtime8 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/lib/data/context.d.ts
6
6
  interface StorefrontContext {
@@ -15,7 +15,7 @@ interface StorefrontProviderProps {
15
15
  declare const StorefrontProvider: ({
16
16
  children,
17
17
  value
18
- }: StorefrontProviderProps) => react_jsx_runtime8.JSX.Element;
18
+ }: StorefrontProviderProps) => react_jsx_runtime6.JSX.Element;
19
19
  declare const useStorefrontContext: () => StorefrontContext;
20
20
  //#endregion
21
21
  export { StorefrontContext, StorefrontProvider, useStorefrontActions, useStorefrontContext };
@@ -12,7 +12,9 @@ const StorefrontReactContext = createContext({
12
12
  });
13
13
  const fetchContext = async () => {
14
14
  const response = await fetch("/api/horz/context", { credentials: "include" });
15
- if (!response.ok) throw new Error("Failed to fetch context");
15
+ if (!response.ok) {
16
+ throw new Error("Failed to fetch context");
17
+ }
16
18
  return response.json();
17
19
  };
18
20
  const StorefrontProvider = ({ children, value }) => {
@@ -1 +1 @@
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/horz/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,qBAAqB,EAChD,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
+ {"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/horz/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,qBAAqB,EAChD,aAAa,WACd,CAAC;AAEF,KAAI,CAAC,SAAS,IAAI;AAChB,QAAM,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 +1 @@
1
- {"version":3,"file":"cookies-actions.d.ts","names":[],"sources":["../../../src/lib/data/cookies-actions.ts"],"sourcesContent":[],"mappings":";iBAEsB,eAAA,cAA0B;AAA1B,iBAWA,kBAAA,CAAA,CAX0B,EAWR,OAXQ,CAAA,IAAA,CAAA;AAW1B,iBAMA,kBAAA,CANkB,KAAA,EAAA,MAAA,CAAA,EAMc,OANd,CAAA,IAAA,CAAA;AAMlB,iBAWA,qBAAA,CAAA,CAXgC,EAWX,OAXW,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"cookies-actions.d.ts","names":[],"sources":["../../../src/lib/data/cookies-actions.ts"],"sourcesContent":[],"mappings":";iBAKsB,eAAA,cAA0B;AAA1B,iBAaA,kBAAA,CAAA,CAb0B,EAaR,OAbQ,CAAA,IAAA,CAAA;AAa1B,iBAMA,kBAAA,CANkB,KAAA,EAAA,MAAA,CAAA,EAMc,OANd,CAAA,IAAA,CAAA;AAMlB,iBAaA,qBAAA,CAAA,CAbgC,EAaX,OAbW,CAAA,IAAA,CAAA"}
@@ -1,31 +1,41 @@
1
1
  'use server';
2
2
 
3
3
  //#region src/lib/data/cookies-actions.ts
4
+ const isProd = "development" === "production";
5
+ console.log("development");
4
6
  async function setCartIdAction(id) {
7
+ const isProd$1 = "development" === "production";
5
8
  const { cookies } = await import("next/headers");
6
- (await cookies()).set("_medusa_cart_id", id, {
7
- maxAge: 3600 * 24 * 7,
9
+ const c = await cookies();
10
+ c.set("_medusa_cart_id", id, {
11
+ maxAge: 60 * 60 * 24 * 7,
8
12
  httpOnly: true,
9
- sameSite: "strict",
10
- secure: false
13
+ sameSite: isProd$1 ? "none" : "lax",
14
+ secure: isProd$1,
15
+ domain: isProd$1 ? ".justgood.win" : undefined
11
16
  });
12
17
  }
13
18
  async function removeCartIdAction() {
14
19
  const { cookies } = await import("next/headers");
15
- (await cookies()).set("_medusa_cart_id", "", { maxAge: -1 });
20
+ const c = await cookies();
21
+ c.set("_medusa_cart_id", "", { maxAge: -1 });
16
22
  }
17
23
  async function setAuthTokenAction(token) {
24
+ const isProd$1 = "development" === "production";
18
25
  const { cookies } = await import("next/headers");
19
- (await cookies()).set("_medusa_jwt", token, {
20
- maxAge: 3600 * 24 * 7,
26
+ const c = await cookies();
27
+ c.set("_medusa_jwt", token, {
28
+ maxAge: 60 * 60 * 24 * 7,
21
29
  httpOnly: true,
22
- sameSite: "strict",
23
- secure: false
30
+ sameSite: isProd$1 ? "none" : "lax",
31
+ secure: isProd$1,
32
+ domain: isProd$1 ? ".justgood.win" : undefined
24
33
  });
25
34
  }
26
35
  async function removeAuthTokenAction() {
27
36
  const { cookies } = await import("next/headers");
28
- (await cookies()).set("_medusa_jwt", "", { maxAge: -1 });
37
+ const c = await cookies();
38
+ c.set("_medusa_jwt", "", { maxAge: -1 });
29
39
  }
30
40
 
31
41
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"cookies-actions.js","names":[],"sources":["../../../src/lib/data/cookies-actions.ts"],"sourcesContent":["'use server';\n\nexport async function setCartIdAction(id: string) {\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_cart_id', id, {\n maxAge: 60 * 60 * 24 * 7,\n httpOnly: true,\n sameSite: 'strict',\n secure: process.env.NODE_ENV === 'production',\n });\n}\n\nexport async function removeCartIdAction() {\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_cart_id', '', { maxAge: -1 });\n}\n\nexport async function setAuthTokenAction(token: string) {\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_jwt', token, {\n maxAge: 60 * 60 * 24 * 7,\n httpOnly: true,\n sameSite: 'strict',\n secure: process.env.NODE_ENV === 'production',\n });\n}\n\nexport async function removeAuthTokenAction() {\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_jwt', '', { maxAge: -1 });\n}\n"],"mappings":";;;AAEA,eAAsB,gBAAgB,IAAY;CAChD,MAAM,EAAE,YAAY,MAAM,OAAO;AAEjC,EADU,MAAM,SAAS,EACvB,IAAI,mBAAmB,IAAI;EAC3B,QAAQ,OAAU,KAAK;EACvB,UAAU;EACV,UAAU;EACV,QAAQ;EACT,CAAC;;AAGJ,eAAsB,qBAAqB;CACzC,MAAM,EAAE,YAAY,MAAM,OAAO;AAEjC,EADU,MAAM,SAAS,EACvB,IAAI,mBAAmB,IAAI,EAAE,QAAQ,IAAI,CAAC;;AAG9C,eAAsB,mBAAmB,OAAe;CACtD,MAAM,EAAE,YAAY,MAAM,OAAO;AAEjC,EADU,MAAM,SAAS,EACvB,IAAI,eAAe,OAAO;EAC1B,QAAQ,OAAU,KAAK;EACvB,UAAU;EACV,UAAU;EACV,QAAQ;EACT,CAAC;;AAGJ,eAAsB,wBAAwB;CAC5C,MAAM,EAAE,YAAY,MAAM,OAAO;AAEjC,EADU,MAAM,SAAS,EACvB,IAAI,eAAe,IAAI,EAAE,QAAQ,IAAI,CAAC"}
1
+ {"version":3,"file":"cookies-actions.js","names":["isProd"],"sources":["../../../src/lib/data/cookies-actions.ts"],"sourcesContent":["'use server';\n\nconst isProd = process.env.NODE_ENV === 'production';\nconsole.log(process.env.NODE_ENV);\n\nexport async function setCartIdAction(id: string) {\n const isProd = process.env.NODE_ENV === 'production';\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_cart_id', id, {\n maxAge: 60 * 60 * 24 * 7,\n httpOnly: true,\n sameSite: isProd ? 'none' : 'lax',\n secure: isProd,\n domain: isProd ? '.justgood.win' : undefined,\n });\n}\n\nexport async function removeCartIdAction() {\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_cart_id', '', { maxAge: -1 });\n}\n\nexport async function setAuthTokenAction(token: string) {\n const isProd = process.env.NODE_ENV === 'production';\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_jwt', token, {\n maxAge: 60 * 60 * 24 * 7,\n httpOnly: true,\n sameSite: isProd ? 'none' : 'lax',\n secure: isProd,\n domain: isProd ? '.justgood.win' : undefined,\n });\n}\n\nexport async function removeAuthTokenAction() {\n const { cookies } = await import('next/headers');\n const c = await cookies();\n c.set('_medusa_jwt', '', { maxAge: -1 });\n}\n"],"mappings":";;;AAEA,MAAM,2BAAkC;AACxC,QAAQ,kBAAyB;AAEjC,eAAsB,gBAAgB,IAAY;CAChD,MAAMA,6BAAkC;CACxC,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,IAAI,MAAM,SAAS;AACzB,GAAE,IAAI,mBAAmB,IAAI;EAC3B,QAAQ,KAAK,KAAK,KAAK;EACvB,UAAU;EACV,UAAUA,WAAS,SAAS;EAC5B,QAAQA;EACR,QAAQA,WAAS,kBAAkB;EACpC,CAAC;;AAGJ,eAAsB,qBAAqB;CACzC,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,IAAI,MAAM,SAAS;AACzB,GAAE,IAAI,mBAAmB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC;;AAG9C,eAAsB,mBAAmB,OAAe;CACtD,MAAMA,6BAAkC;CACxC,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,IAAI,MAAM,SAAS;AACzB,GAAE,IAAI,eAAe,OAAO;EAC1B,QAAQ,KAAK,KAAK,KAAK;EACvB,UAAU;EACV,UAAUA,WAAS,SAAS;EAC5B,QAAQA;EACR,QAAQA,WAAS,kBAAkB;EACpC,CAAC;;AAGJ,eAAsB,wBAAwB;CAC5C,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,IAAI,MAAM,SAAS;AACzB,GAAE,IAAI,eAAe,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC"}
@@ -1,13 +1,19 @@
1
1
  //#region src/lib/data/cookies-utils.ts
2
2
  const getCacheTag = (tag, ctx) => {
3
3
  const cacheId = ctx.cacheId;
4
- if (!cacheId) return "";
4
+ if (!cacheId) {
5
+ return "";
6
+ }
5
7
  return `${tag}-${cacheId}`;
6
8
  };
7
9
  const getCacheOptions = (tag, ctx) => {
8
- if (typeof window !== "undefined") return {};
10
+ if (typeof window !== "undefined") {
11
+ return {};
12
+ }
9
13
  const cacheTag = getCacheTag(tag, ctx);
10
- if (!cacheTag) return {};
14
+ if (!cacheTag) {
15
+ return {};
16
+ }
11
17
  return { tags: [`${cacheTag}`] };
12
18
  };
13
19
  const getCartId = (ctx) => {
@@ -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 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"}
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,SAAS;AACZ,SAAO;;AAGT,QAAO,GAAG,IAAI,GAAG;;AAGnB,MAAa,mBACX,KACA,QAC4B;AAC5B,KAAI,OAAO,WAAW,aAAa;AACjC,SAAO,EAAE;;CAGX,MAAM,WAAW,YAAY,KAAK,IAAI;AAEtC,KAAI,CAAC,UAAU;AACb,SAAO,EAAE;;AAGX,QAAO,EAAE,MAAM,CAAC,GAAG,WAAW,EAAE;;AAGlC,MAAa,aAAa,QAA2B;AACnD,QAAO,IAAI"}
@@ -6,18 +6,25 @@ 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 apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
9
+ const cookieHeader = ctx.cookieHeader ?? "";
10
+ const apolloClient = createServerApolloClient(cookieHeader);
10
11
  const cartId = getCartId(ctx);
11
- if (!cartId) return null;
12
+ if (!cartId) {
13
+ return null;
14
+ }
12
15
  try {
13
- const cart = (await graphqlMutation({
16
+ const result = await graphqlMutation({
14
17
  mutation: TRANSFER_CART_MUTATION,
15
18
  variables: { cartId }
16
- }, apolloClient))?.transferCart ?? null;
17
- if (cart) try {
18
- const { revalidateTag } = await import("next/cache");
19
- revalidateTag(getCacheTag("carts", ctx));
20
- } catch {}
19
+ }, apolloClient);
20
+ const cart = result?.transferCart ?? null;
21
+ if (cart) {
22
+ try {
23
+ const { revalidateTag } = await import("next/cache");
24
+ const cartCacheTag = getCacheTag("carts", ctx);
25
+ revalidateTag(cartCacheTag);
26
+ } catch {}
27
+ }
21
28
  return cart;
22
29
  } catch (err) {
23
30
  medusaError(err);
@@ -25,12 +32,14 @@ const transferCart = async (ctx) => {
25
32
  }
26
33
  };
27
34
  const retrieveCustomer = async (ctx) => {
28
- const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
35
+ const cookieHeader = ctx.cookieHeader ?? "";
36
+ const apolloClient = createServerApolloClient(cookieHeader);
29
37
  try {
30
- return await graphqlFetch({
38
+ const customer = await graphqlFetch({
31
39
  query: GET_CUSTOMER_QUERY,
32
40
  fetchPolicy: "network-only"
33
41
  }, apolloClient).then((response) => response?.me ?? null);
42
+ return customer;
34
43
  } catch {
35
44
  return null;
36
45
  }
@@ -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;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"}
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;CACzD,MAAM,eAAe,IAAI,gBAAgB;CACzC,MAAM,eAAe,yBAAyB,aAAa;CAC3D,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,QAAQ;AACX,SAAO;;AAGT,KAAI;EACF,MAAM,SAAS,MAAM,gBAInB;GACE,UAAU;GACV,WAAW,EACT,QACD;GACF,EACD,aACD;EAED,MAAM,OAAO,QAAQ,gBAAgB;AAErC,MAAI,MAAM;AACR,OAAI;IACF,MAAM,EAAE,kBAAkB,MAAM,OAAO;IACvC,MAAM,eAAe,YAAY,SAAS,IAAI;AAC9C,kBAAc,aAAa;WACrB;;AAKV,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;AAChB,SAAO;;;AAIX,MAAa,mBAAmB,OAC9B,QAC6B;CAC7B,MAAM,eAAe,IAAI,gBAAgB;CACzC,MAAM,eAAe,yBAAyB,aAAa;AAC3D,KAAI;EACF,MAAM,WAAW,MAAM,aAIrB;GACE,OAAO;GACP,aAAa;GACd,EACD,aACD,CAAC,MAAM,aAAa,UAAU,MAAM,KAAK;AAC1C,SAAO;SACD;AACN,SAAO"}
@@ -4,7 +4,8 @@ import { GET_FOOTER_QUERY } from "../gql/queries/footer.js";
4
4
  //#region src/lib/data/footer.ts
5
5
  const getFooterContent = async () => {
6
6
  try {
7
- return (await graphqlFetch({ query: GET_FOOTER_QUERY }))?.footer || null;
7
+ const data = await graphqlFetch({ query: GET_FOOTER_QUERY });
8
+ return data?.footer || null;
8
9
  } catch (error) {
9
10
  console.error("Error fetching footer content:", error);
10
11
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"footer.js","names":[],"sources":["../../../src/lib/data/footer.ts"],"sourcesContent":["import { graphqlFetch } from '@/lib/gql/apollo-client';\nimport { GET_FOOTER_QUERY } from '@/lib/gql/queries/footer';\nimport { GetFooterQuery, GetFooterQueryVariables } from '@/types/graphql';\n\nexport const getFooterContent = async () => {\n try {\n const data = await graphqlFetch<GetFooterQuery, GetFooterQueryVariables>({\n query: GET_FOOTER_QUERY,\n });\n return data?.footer || null;\n } catch (error) {\n console.error('Error fetching footer content:', error);\n return null;\n }\n};\n"],"mappings":";;;;AAIA,MAAa,mBAAmB,YAAY;AAC1C,KAAI;AAIF,UAHa,MAAM,aAAsD,EACvE,OAAO,kBACR,CAAC,GACW,UAAU;UAChB,OAAO;AACd,UAAQ,MAAM,kCAAkC,MAAM;AACtD,SAAO"}
1
+ {"version":3,"file":"footer.js","names":[],"sources":["../../../src/lib/data/footer.ts"],"sourcesContent":["import { graphqlFetch } from '@/lib/gql/apollo-client';\nimport { GET_FOOTER_QUERY } from '@/lib/gql/queries/footer';\nimport { GetFooterQuery, GetFooterQueryVariables } from '@/types/graphql';\n\nexport const getFooterContent = async () => {\n try {\n const data = await graphqlFetch<GetFooterQuery, GetFooterQueryVariables>({\n query: GET_FOOTER_QUERY,\n });\n return data?.footer || null;\n } catch (error) {\n console.error('Error fetching footer content:', error);\n return null;\n }\n};\n"],"mappings":";;;;AAIA,MAAa,mBAAmB,YAAY;AAC1C,KAAI;EACF,MAAM,OAAO,MAAM,aAAsD,EACvE,OAAO,kBACR,CAAC;AACF,SAAO,MAAM,UAAU;UAChB,OAAO;AACd,UAAQ,MAAM,kCAAkC,MAAM;AACtD,SAAO"}
@@ -5,10 +5,11 @@ import { GET_ORDER_QUERY } from "../gql/queries/order.js";
5
5
  const retrieveOrder = async (id, ctx) => {
6
6
  const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
7
7
  try {
8
- return (await graphqlFetch({
8
+ const data = await graphqlFetch({
9
9
  query: GET_ORDER_QUERY,
10
10
  variables: { id }
11
- }, apolloClient))?.order ?? null;
11
+ }, apolloClient);
12
+ return data?.order ?? null;
12
13
  } catch (err) {
13
14
  console.error("Failed to fetch order:", err);
14
15
  return null;
@@ -1 +1 @@
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"}
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;EACF,MAAM,OAAO,MAAM,aACjB;GAAE,OAAO;GAAiB,WAAW,EAAE,IAAI;GAAE,EAC7C,aACD;AACD,SAAO,MAAM,SAAS;UACf,KAAK;AACZ,UAAQ,MAAM,0BAA0B,IAAI;AAC5C,SAAO"}
@@ -3,7 +3,7 @@ import { medusaError } from "../utils/medusa-error.js";
3
3
  import { GET_REGION_QUERY, LIST_REGIONS_QUERY } from "../gql/queries/regions.js";
4
4
 
5
5
  //#region src/lib/data/regions.ts
6
- const regionMap = /* @__PURE__ */ new Map();
6
+ const regionMap = new Map();
7
7
  const listRegions = async (ctx) => {
8
8
  const apolloClient = createServerApolloClient(ctx.cookieHeader ?? "");
9
9
  return graphqlFetch({
@@ -21,15 +21,18 @@ const retrieveRegion = async (id, ctx) => {
21
21
  };
22
22
  const getRegion = async (countryCode, ctx) => {
23
23
  try {
24
- if (regionMap.has(countryCode)) return regionMap.get(countryCode) ?? null;
24
+ if (regionMap.has(countryCode)) {
25
+ return regionMap.get(countryCode) ?? null;
26
+ }
25
27
  const regions = await listRegions(ctx);
26
28
  if (!regions) return null;
27
- regions.forEach((region) => {
28
- region.countries?.forEach((c) => {
29
- regionMap.set(c?.iso2 ?? "", region);
29
+ regions.forEach((region$1) => {
30
+ region$1.countries?.forEach((c) => {
31
+ regionMap.set(c?.iso2 ?? "", region$1);
30
32
  });
31
33
  });
32
- return countryCode ? regionMap.get(countryCode) ?? null : regionMap.get("us") ?? null;
34
+ const region = countryCode ? regionMap.get(countryCode) ?? null : regionMap.get("us") ?? null;
35
+ return region;
33
36
  } catch {
34
37
  return null;
35
38
  }
@@ -1 +1 @@
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
+ {"version":3,"file":"regions.js","names":["region"],"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,YAAY,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,EAAE;AAC9B,UAAO,UAAU,IAAI,YAAY,IAAI;;EAGvC,MAAM,UAAU,MAAM,YAAY,IAAI;AAEtC,MAAI,CAAC,QAAS,QAAO;AAErB,UAAQ,SAAS,aAAW;AAC1B,YAAO,WAAW,SAAS,MAAM;AAC/B,cAAU,IAAI,GAAG,QAAQ,IAAIA,SAAO;KACpC;IACF;EAEF,MAAM,SAAS,cACV,UAAU,IAAI,YAAY,IAAI,OAC9B,UAAU,IAAI,KAAK,IAAI;AAE5B,SAAO;SACD;AACN,SAAO"}
@@ -5,8 +5,8 @@ import * as SWRNamespace from "swr";
5
5
  import useSWR from "swr";
6
6
  import * as Apollo from "@apollo/client";
7
7
  import * as ReactDOM from "react-dom";
8
- import Medusa from "@medusajs/js-sdk";
9
8
  import * as ReactDOMClient from "react-dom/client";
9
+ import Medusa from "@medusajs/js-sdk";
10
10
 
11
11
  //#region src/lib/globals/expose-globals.ts
12
12
  if (typeof window !== "undefined") {
@@ -24,14 +24,17 @@ const apolloClient = new ApolloClient({
24
24
  * @returns Server-side Apollo client
25
25
  */
26
26
  function createServerApolloClient(cookieHeader) {
27
- return new ApolloClient({
28
- link: new ApolloLink((operation, forward) => {
29
- if (cookieHeader) operation.setContext({
27
+ const authLink = new ApolloLink((operation, forward) => {
28
+ if (cookieHeader) {
29
+ operation.setContext({
30
30
  http: { includeCredentials: true },
31
31
  headers: { Cookie: cookieHeader }
32
32
  });
33
- return forward(operation);
34
- }).concat(httpLink),
33
+ }
34
+ return forward(operation);
35
+ });
36
+ return new ApolloClient({
37
+ link: authLink.concat(httpLink),
35
38
  cache: new InMemoryCache({}),
36
39
  defaultOptions: { watchQuery: { notifyOnNetworkStatusChange: true } }
37
40
  });
@@ -45,7 +48,8 @@ function initializeApollo(req = null) {
45
48
  }
46
49
  async function graphqlFetch(options, apolloClientOverride) {
47
50
  try {
48
- const { data } = await (apolloClientOverride || apolloClient).query({
51
+ const client = apolloClientOverride || apolloClient;
52
+ const { data } = await client.query({
49
53
  ...options,
50
54
  fetchPolicy: "network-only"
51
55
  });
@@ -56,7 +60,8 @@ async function graphqlFetch(options, apolloClientOverride) {
56
60
  }
57
61
  async function graphqlMutation(options, apolloClientOverride) {
58
62
  try {
59
- const { data } = await (apolloClientOverride || apolloClient).mutate({
63
+ const client = apolloClientOverride || apolloClient;
64
+ const { data } = await client.mutate({
60
65
  ...options,
61
66
  fetchPolicy: "network-only"
62
67
  });
@@ -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 { getBaseURL } from '../utils/env';\n\nconst isServer = () => typeof window === 'undefined';\n\nconst getGraphQLEndpoint = () => {\n const endpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;\n if (endpoint) return isServer() ? `${getBaseURL()}${endpoint}` : endpoint;\n\n // Defaults to home's graphql endpoint\n return isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql';\n};\n\nconst httpLink = new HttpLink({\n uri: getGraphQLEndpoint(),\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,2BAA2B;CAC/B,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,SAAU,QAAO,UAAU,GAAG,GAAG,YAAY,GAAG,aAAa;AAGjE,QAAO,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;;AAGtD,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,oBAAoB;CACzB,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
+ {"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 getGraphQLEndpoint = () => {\n const endpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;\n if (endpoint) return isServer() ? `${getBaseURL()}${endpoint}` : endpoint;\n\n // Defaults to home's graphql endpoint\n return isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql';\n};\n\nconst httpLink = new HttpLink({\n uri: getGraphQLEndpoint(),\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,2BAA2B;CAC/B,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,SAAU,QAAO,UAAU,GAAG,GAAG,YAAY,GAAG,aAAa;AAGjE,QAAO,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;;AAGtD,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,oBAAoB;CACzB,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;CAC9D,MAAM,WAAW,IAAI,YAAY,WAAW,YAAY;AACtD,MAAI,cAAc;AAChB,aAAU,WAAW;IACnB,MAAM,EACJ,oBAAoB,MACrB;IACD,SAAS,EACP,QAAQ,cACT;IACF,CAAC;;AAGJ,SAAO,QAAQ,UAAU;GACzB;AAEF,QAAO,IAAI,aAAa;EACtB,MAAM,SAAS,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;EACF,MAAM,SAAS,wBAAwB;EAEvC,MAAM,EAAE,SAAS,MAAM,OAAO,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;EACF,MAAM,SAAS,wBAAwB;EAEvC,MAAM,EAAE,SAAS,MAAM,OAAO,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 _apollo_client0 from "@apollo/client";
1
+ import * as _apollo_client6 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/cart.d.ts
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;
4
+ declare const LINE_ITEM_FRAGMENT: _apollo_client6.DocumentNode;
5
+ declare const COUNTRY_FRAGMENT: _apollo_client6.DocumentNode;
6
+ declare const REGION_FRAGMENT: _apollo_client6.DocumentNode;
7
+ declare const SHIPPING_METHODS_FRAGMENT: _apollo_client6.DocumentNode;
8
+ declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client6.DocumentNode;
9
+ declare const ADDRESS_FRAGMENT: _apollo_client6.DocumentNode;
10
+ declare const PROMOTION_FRAGMENT: _apollo_client6.DocumentNode;
11
+ declare const CART_FRAGMENT: _apollo_client6.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,8 +1,8 @@
1
- import * as _apollo_client10 from "@apollo/client";
1
+ import * as _apollo_client19 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/customer.d.ts
4
- declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client10.DocumentNode;
5
- declare const CUSTOMER_FRAGMENT: _apollo_client10.DocumentNode;
4
+ declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client19.DocumentNode;
5
+ declare const CUSTOMER_FRAGMENT: _apollo_client19.DocumentNode;
6
6
  //#endregion
7
7
  export { CUSTOMER_ADDRESS_FRAGMENT, CUSTOMER_FRAGMENT };
8
8
  //# sourceMappingURL=customer.d.ts.map
@@ -1,13 +1,13 @@
1
- import * as _apollo_client12 from "@apollo/client";
1
+ import * as _apollo_client21 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/product.d.ts
4
- declare const PRICE_FRAGMENT: _apollo_client12.DocumentNode;
5
- declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client12.DocumentNode;
6
- declare const PRODUCT_HIT_FRAGMENT: _apollo_client12.DocumentNode;
7
- declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client12.DocumentNode;
8
- declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client12.DocumentNode;
9
- declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client12.DocumentNode;
10
- declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client12.DocumentNode;
4
+ declare const PRICE_FRAGMENT: _apollo_client21.DocumentNode;
5
+ declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client21.DocumentNode;
6
+ declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client21.DocumentNode;
7
+ declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client21.DocumentNode;
8
+ declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client21.DocumentNode;
9
+ declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client21.DocumentNode;
10
+ declare const COLLECTION_PRODUCTS_HOME_FRAGMENT: _apollo_client21.DocumentNode;
11
11
  //#endregion
12
- export { COLLECTION_PRODUCTS_FRAGMENT, PRICE_FRAGMENT, PRODUCT_CATEGORY_FRAGMENT, PRODUCT_COLLECTION_FRAGMENT, PRODUCT_HIT_FRAGMENT, PRODUCT_IMAGE_FRAGMENT, PRODUCT_VARIANT_FRAGMENT };
12
+ export { COLLECTION_PRODUCTS_FRAGMENT, COLLECTION_PRODUCTS_HOME_FRAGMENT, PRICE_FRAGMENT, PRODUCT_CATEGORY_FRAGMENT, PRODUCT_COLLECTION_FRAGMENT, PRODUCT_IMAGE_FRAGMENT, PRODUCT_VARIANT_FRAGMENT };
13
13
  //# sourceMappingURL=product.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/product.ts"],"sourcesContent":[],"mappings":";;;cAEa,gBAMZ,gBAAA,CAN0B;cAQd,0BAqBZ,gBAAA,CArBoC;cAuBxB,sBAQZ,gBAAA,CARgC;AA/BpB,cAyCA,yBAnCZ,EA0CA,gBAAA,CAPqC,YAnCrC;AAEY,cA0CA,2BArBZ,EA2BA,gBAAA,CANuC,YArBvC;AAEY,cA2BA,sBAnBZ,EAwBA,gBAAA,CALkC,YAnBlC;AAEY,cAwBA,4BAjBZ,EAwCA,gBAAA,CAvBwC,YAjBxC"}
1
+ {"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/product.ts"],"sourcesContent":[],"mappings":";;;cAEa,gBAMZ,gBAAA,CAN0B;cAQd,0BAqBZ,gBAAA,CArBoC;cAuBxB,2BAOZ,gBAAA,CAPqC;AA/BzB,cAwCA,2BAlCZ,EAwCA,gBAAA,CANuC,YAlCvC;AAEY,cAwCA,sBAnBZ,EAwBA,gBAAA,CALkC,YAnBlC;AAEY,cAwBA,4BAjBZ,EAwCA,gBAAA,CAvBwC,YAjBxC;AAEY,cAwCA,iCAlCZ,EA4CA,gBAAA,CAV6C,YAlC7C"}
@@ -30,15 +30,6 @@ const PRODUCT_VARIANT_FRAGMENT = gql`
30
30
  }
31
31
  ${PRICE_FRAGMENT}
32
32
  `;
33
- const PRODUCT_HIT_FRAGMENT = gql`
34
- fragment ProductHit on ProductHit {
35
- id
36
- title
37
- description
38
- handle
39
- thumbnail
40
- }
41
- `;
42
33
  const PRODUCT_CATEGORY_FRAGMENT = gql`
43
34
  fragment ProductCategory on ProductCategory {
44
35
  id
@@ -84,7 +75,18 @@ const COLLECTION_PRODUCTS_FRAGMENT = gql`
84
75
  ${PRODUCT_IMAGE_FRAGMENT}
85
76
  ${PRICE_FRAGMENT}
86
77
  `;
78
+ const COLLECTION_PRODUCTS_HOME_FRAGMENT = gql`
79
+ fragment CollectionProductsHome on ProductList {
80
+ count
81
+ items {
82
+ id
83
+ title
84
+ handle
85
+ thumbnail
86
+ }
87
+ }
88
+ `;
87
89
 
88
90
  //#endregion
89
- export { COLLECTION_PRODUCTS_FRAGMENT, PRICE_FRAGMENT, PRODUCT_CATEGORY_FRAGMENT, PRODUCT_COLLECTION_FRAGMENT, PRODUCT_HIT_FRAGMENT, PRODUCT_IMAGE_FRAGMENT, PRODUCT_VARIANT_FRAGMENT };
91
+ export { COLLECTION_PRODUCTS_FRAGMENT, COLLECTION_PRODUCTS_HOME_FRAGMENT, PRICE_FRAGMENT, PRODUCT_CATEGORY_FRAGMENT, PRODUCT_COLLECTION_FRAGMENT, PRODUCT_IMAGE_FRAGMENT, PRODUCT_VARIANT_FRAGMENT };
90
92
  //# sourceMappingURL=product.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","names":[],"sources":["../../../../src/lib/gql/fragments/product.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const PRICE_FRAGMENT = gql`\n fragment Price on Price {\n amount\n currencyCode\n priceType\n }\n`;\n\nexport const PRODUCT_VARIANT_FRAGMENT = gql`\n fragment ProductVariant on ProductVariant {\n id\n sku\n inventoryQuantity\n allowBackorder\n manageInventory\n title\n options {\n id\n optionId\n value\n }\n price {\n ...Price\n }\n originalPrice {\n ...Price\n }\n }\n ${PRICE_FRAGMENT}\n`;\n\nexport const PRODUCT_HIT_FRAGMENT = gql`\n fragment ProductHit on ProductHit {\n id\n title\n description\n handle\n thumbnail\n }\n`;\n\nexport const PRODUCT_CATEGORY_FRAGMENT = gql`\n fragment ProductCategory on ProductCategory {\n id\n name\n description\n handle\n }\n`;\n\nexport const PRODUCT_COLLECTION_FRAGMENT = gql`\n fragment ProductCollection on Collection {\n id\n title\n handle\n }\n`;\n\nexport const PRODUCT_IMAGE_FRAGMENT = gql`\n fragment ProductImage on ProductImage {\n id\n url\n }\n`;\n\nexport const COLLECTION_PRODUCTS_FRAGMENT = gql`\n fragment CollectionProducts on ProductList {\n count\n items {\n id\n title\n handle\n thumbnail\n images {\n ...ProductImage\n }\n variants {\n price {\n ...Price\n }\n originalPrice {\n ...Price\n }\n }\n }\n }\n ${PRODUCT_IMAGE_FRAGMENT}\n ${PRICE_FRAGMENT}\n`;\n"],"mappings":";;;AAEA,MAAa,iBAAiB,GAAG;;;;;;;AAQjC,MAAa,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;IAoBvC,eAAe;;AAGnB,MAAa,uBAAuB,GAAG;;;;;;;;;AAUvC,MAAa,4BAA4B,GAAG;;;;;;;;AAS5C,MAAa,8BAA8B,GAAG;;;;;;;AAQ9C,MAAa,yBAAyB,GAAG;;;;;;AAOzC,MAAa,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;IAqB3C,uBAAuB;IACvB,eAAe"}
1
+ {"version":3,"file":"product.js","names":[],"sources":["../../../../src/lib/gql/fragments/product.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const PRICE_FRAGMENT = gql`\n fragment Price on Price {\n amount\n currencyCode\n priceType\n }\n`;\n\nexport const PRODUCT_VARIANT_FRAGMENT = gql`\n fragment ProductVariant on ProductVariant {\n id\n sku\n inventoryQuantity\n allowBackorder\n manageInventory\n title\n options {\n id\n optionId\n value\n }\n price {\n ...Price\n }\n originalPrice {\n ...Price\n }\n }\n ${PRICE_FRAGMENT}\n`;\n\nexport const PRODUCT_CATEGORY_FRAGMENT = gql`\n fragment ProductCategory on ProductCategory {\n id\n name\n description\n handle\n }\n`;\n\nexport const PRODUCT_COLLECTION_FRAGMENT = gql`\n fragment ProductCollection on Collection {\n id\n title\n handle\n }\n`;\n\nexport const PRODUCT_IMAGE_FRAGMENT = gql`\n fragment ProductImage on ProductImage {\n id\n url\n }\n`;\n\nexport const COLLECTION_PRODUCTS_FRAGMENT = gql`\n fragment CollectionProducts on ProductList {\n count\n items {\n id\n title\n handle\n thumbnail\n images {\n ...ProductImage\n }\n variants {\n price {\n ...Price\n }\n originalPrice {\n ...Price\n }\n }\n }\n }\n ${PRODUCT_IMAGE_FRAGMENT}\n ${PRICE_FRAGMENT}\n`;\n\nexport const COLLECTION_PRODUCTS_HOME_FRAGMENT = gql`\n fragment CollectionProductsHome on ProductList {\n count\n items {\n id\n title\n handle\n thumbnail\n }\n }\n`;\n"],"mappings":";;;AAEA,MAAa,iBAAiB,GAAG;;;;;;;AAQjC,MAAa,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;IAoBvC,eAAe;;AAGnB,MAAa,4BAA4B,GAAG;;;;;;;;AAS5C,MAAa,8BAA8B,GAAG;;;;;;;AAQ9C,MAAa,yBAAyB,GAAG;;;;;;AAOzC,MAAa,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;IAqB3C,uBAAuB;IACvB,eAAe;;AAGnB,MAAa,oCAAoC,GAAG"}
@@ -1,11 +1,11 @@
1
- import * as _apollo_client20 from "@apollo/client";
1
+ import * as _apollo_client14 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/mutations/cart.d.ts
4
- declare const CREATE_CART_MUTATION: _apollo_client20.DocumentNode;
5
- declare const CREATE_LINE_ITEM_MUTATION: _apollo_client20.DocumentNode;
6
- declare const UPDATE_CART_MUTATION: _apollo_client20.DocumentNode;
7
- declare const DELETE_LINE_ITEM_MUTATION: _apollo_client20.DocumentNode;
8
- declare const TRANSFER_CART_MUTATION: _apollo_client20.DocumentNode;
4
+ declare const CREATE_CART_MUTATION: _apollo_client14.DocumentNode;
5
+ declare const CREATE_LINE_ITEM_MUTATION: _apollo_client14.DocumentNode;
6
+ declare const UPDATE_CART_MUTATION: _apollo_client14.DocumentNode;
7
+ declare const DELETE_LINE_ITEM_MUTATION: _apollo_client14.DocumentNode;
8
+ declare const TRANSFER_CART_MUTATION: _apollo_client14.DocumentNode;
9
9
  //#endregion
10
10
  export { CREATE_CART_MUTATION, CREATE_LINE_ITEM_MUTATION, DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
11
11
  //# sourceMappingURL=cart.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client19 from "@apollo/client";
1
+ import * as _apollo_client0 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/cart.d.ts
4
- declare const GET_CART_QUERY: _apollo_client19.DocumentNode;
4
+ declare const GET_CART_QUERY: _apollo_client0.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_CART_QUERY };
7
7
  //# sourceMappingURL=cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,gBAOZ,gBAAA,CAP0B"}
1
+ {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,gBAOZ,eAAA,CAP0B"}
@@ -1,7 +1,8 @@
1
- import * as _apollo_client25 from "@apollo/client";
1
+ import * as _apollo_client0 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/collections.d.ts
4
- declare const GET_COLLECTIONS_QUERY: _apollo_client25.DocumentNode;
4
+ declare const GET_COLLECTIONS_QUERY: _apollo_client0.DocumentNode;
5
+ declare const GET_COLLECTIONS_HOME_QUERY: _apollo_client0.DocumentNode;
5
6
  //#endregion
6
- export { GET_COLLECTIONS_QUERY };
7
+ export { GET_COLLECTIONS_HOME_QUERY, GET_COLLECTIONS_QUERY };
7
8
  //# sourceMappingURL=collections.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collections.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/collections.ts"],"sourcesContent":[],"mappings":";;;cAOa,uBAWZ,gBAAA,CAXiC"}
1
+ {"version":3,"file":"collections.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/collections.ts"],"sourcesContent":[],"mappings":";;;cAQa,uBAWZ,eAAA,CAXiC;cAarB,4BAWZ,eAAA,CAXsC"}