@gfed-medusa/sf-lib-common 2.2.0 → 2.3.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.
Files changed (79) hide show
  1. package/dist/components/breadcrumbs/index.d.ts +2 -2
  2. package/dist/components/breadcrumbs/index.d.ts.map +1 -1
  3. package/dist/components/cart-mismatch-banner/index.d.ts +2 -2
  4. package/dist/components/cart-mismatch-banner/index.d.ts.map +1 -1
  5. package/dist/components/delete-button/index.d.ts +2 -2
  6. package/dist/components/delete-button/index.d.ts.map +1 -1
  7. package/dist/components/delete-button/index.js +5 -2
  8. package/dist/components/delete-button/index.js.map +1 -1
  9. package/dist/components/error-message/index.d.ts +2 -2
  10. package/dist/components/error-message/index.d.ts.map +1 -1
  11. package/dist/components/free-shipping-price-nudge/index.d.ts +2 -2
  12. package/dist/components/interactive-link/index.d.ts +2 -2
  13. package/dist/components/interactive-link/index.d.ts.map +1 -1
  14. package/dist/components/line-item-options/index.d.ts +2 -2
  15. package/dist/components/line-item-options/index.d.ts.map +1 -1
  16. package/dist/components/line-item-price/index.d.ts +2 -2
  17. package/dist/components/line-item-price/index.d.ts.map +1 -1
  18. package/dist/components/localized-client-link/index.d.ts +2 -2
  19. package/dist/components/localized-client-link/index.d.ts.map +1 -1
  20. package/dist/components/modal/index.d.ts +2 -2
  21. package/dist/components/modal/index.d.ts.map +1 -1
  22. package/dist/components/preview-price/index.d.ts +2 -2
  23. package/dist/components/product-card/index.d.ts +2 -2
  24. package/dist/components/product-preview/index.d.ts +2 -2
  25. package/dist/components/product-preview/index.d.ts.map +1 -1
  26. package/dist/components/submit-button/index.d.ts +2 -2
  27. package/dist/components/submit-button/index.d.ts.map +1 -1
  28. package/dist/lib/context/apollo-context.d.ts +2 -2
  29. package/dist/lib/context/apollo-context.d.ts.map +1 -1
  30. package/dist/lib/context/modal-context.d.ts +2 -2
  31. package/dist/lib/context/modal-context.d.ts.map +1 -1
  32. package/dist/lib/data/cart.d.ts.map +1 -1
  33. package/dist/lib/data/cart.js +12 -14
  34. package/dist/lib/data/cart.js.map +1 -1
  35. package/dist/lib/data/client-actions.d.ts +14 -0
  36. package/dist/lib/data/client-actions.d.ts.map +1 -0
  37. package/dist/lib/data/client-actions.js +19 -0
  38. package/dist/lib/data/client-actions.js.map +1 -0
  39. package/dist/lib/data/context.d.ts +5 -9
  40. package/dist/lib/data/context.d.ts.map +1 -1
  41. package/dist/lib/data/context.js +2 -1
  42. package/dist/lib/data/context.js.map +1 -1
  43. package/dist/lib/data/cookies.d.ts +1 -5
  44. package/dist/lib/data/cookies.d.ts.map +1 -1
  45. package/dist/lib/data/cookies.js +3 -13
  46. package/dist/lib/data/cookies.js.map +1 -1
  47. package/dist/lib/data/customer.d.ts.map +1 -1
  48. package/dist/lib/data/customer.js +5 -5
  49. package/dist/lib/data/customer.js.map +1 -1
  50. package/dist/lib/data/next-context.d.ts +1 -1
  51. package/dist/lib/data/next-context.d.ts.map +1 -1
  52. package/dist/lib/data/next-context.js +10 -16
  53. package/dist/lib/data/next-context.js.map +1 -1
  54. package/dist/lib/data/orders.js +1 -1
  55. package/dist/lib/data/regions.js +1 -1
  56. package/dist/lib/globals/expose-globals.d.ts +8 -0
  57. package/dist/lib/globals/expose-globals.d.ts.map +1 -0
  58. package/dist/lib/globals/expose-globals.js +32 -0
  59. package/dist/lib/globals/expose-globals.js.map +1 -0
  60. package/dist/lib/gql/fragments/cart.d.ts +9 -9
  61. package/dist/lib/gql/fragments/customer.d.ts +3 -3
  62. package/dist/lib/gql/fragments/customer.d.ts.map +1 -1
  63. package/dist/lib/gql/fragments/product.d.ts +8 -8
  64. package/dist/lib/gql/mutations/cart.d.ts +4 -4
  65. package/dist/lib/gql/mutations/cart.d.ts.map +1 -1
  66. package/dist/lib/gql/queries/cart.d.ts +2 -2
  67. package/dist/lib/gql/queries/cart.d.ts.map +1 -1
  68. package/dist/lib/gql/queries/collections.d.ts +2 -2
  69. package/dist/lib/gql/queries/collections.d.ts.map +1 -1
  70. package/dist/lib/gql/queries/customer.d.ts +2 -2
  71. package/dist/lib/gql/queries/footer.d.ts +2 -2
  72. package/dist/lib/gql/queries/product.d.ts +3 -3
  73. package/dist/lib/gql/queries/product.d.ts.map +1 -1
  74. package/dist/lib/hooks/use-apollo.d.ts +2 -2
  75. package/dist/lib/hooks/use-cart.d.ts +15 -0
  76. package/dist/lib/hooks/use-cart.d.ts.map +1 -0
  77. package/dist/lib/hooks/use-cart.js +26 -0
  78. package/dist/lib/hooks/use-cart.js.map +1 -0
  79. package/package.json +7 -6
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime8 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/breadcrumbs/index.d.ts
4
4
  declare const SEPARATOR_ICONS: Record<string, React.ComponentType<{
@@ -14,7 +14,7 @@ declare function Breadcrumbs({
14
14
  iconClassName,
15
15
  iconSize,
16
16
  separatorIcon
17
- }: BreadcrumbsProps): react_jsx_runtime8.JSX.Element;
17
+ }: BreadcrumbsProps): react_jsx_runtime14.JSX.Element;
18
18
  //#endregion
19
19
  export { Breadcrumbs };
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":[],"mappings":";;;cAiBM,iBAAiB,eAErB,KAAA,CAAM;;;AAyCW,CAAA,CAAA,CAAA;AA3CU,UAQnB,gBAAA,CAAgB;EA+BjB,aAAA,CAAW,EAAA,MAAA,OA9BW,eA8BX;EAClB,QAAA,CAAA,EAAA,MAAA;EACA,aAAA,CAAA,EAAA,MAAA;;iBAFO,WAAA,CAIN;EAAA,aAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAA,gBAAA,CAAA,EAAgB,kBAAA,CAAA,GAAA,CAAA,OAAhB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":[],"mappings":";;;cAiBM,iBAAiB,eAErB,KAAA,CAAM;;;AAyCW,CAAA,CAAA,CAAA;AA3CU,UAQnB,gBAAA,CAAgB;EA+BjB,aAAA,CAAW,EAAA,MAAA,OA9BW,eA8BX;EAClB,QAAA,CAAA,EAAA,MAAA;EACA,aAAA,CAAA,EAAA,MAAA;;iBAFO,WAAA,CAIN;EAAA,aAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAA,gBAAA,CAAA,EAAgB,mBAAA,CAAA,GAAA,CAAA,OAAhB"}
@@ -1,11 +1,11 @@
1
1
  import { Cart, Customer } from "../../types/graphql.js";
2
- import * as react_jsx_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/cart-mismatch-banner/index.d.ts
5
5
  declare function CartMismatchBanner(props: {
6
6
  customer: Customer;
7
7
  cart: Cart;
8
- }): react_jsx_runtime7.JSX.Element | undefined;
8
+ }): react_jsx_runtime15.JSX.Element | undefined;
9
9
  //#endregion
10
10
  export { CartMismatchBanner };
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/cart-mismatch-banner/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAYS,kBAAA;YAAsC;EAAtC,IAAA,EAAsD,IAAtD;CAAsC,CAAA,EAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA,GAAtB,SAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/cart-mismatch-banner/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAYS,kBAAA;YAAsC;EAAtC,IAAA,EAAsD,IAAtD;CAAsC,CAAA,EAAsB,mBAAA,CAAA,GAAA,CAAA,OAAA,GAAtB,SAAA"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/delete-button/index.d.ts
4
4
  declare const DeleteButton: ({
@@ -9,7 +9,7 @@ declare const DeleteButton: ({
9
9
  id: string;
10
10
  children?: React.ReactNode;
11
11
  className?: string;
12
- }) => react_jsx_runtime3.JSX.Element;
12
+ }) => react_jsx_runtime0.JSX.Element;
13
13
  //#endregion
14
14
  export { DeleteButton };
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":[],"mappings":";;;cAQM;;;;;;aAMO,KAAA,CAAM;EANb,SAAA,CAAA,EAAA,MAmCL;CAnCqB,EAAA,GAQrB,kBAAA,CAAA,GAAA,CAAA,OARqB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":[],"mappings":";;;cASM;;;;;;aAMO,KAAA,CAAM;EANb,SAAA,CAAA,EAAA,MAuCL;CAvCqB,EAAA,GAQrB,kBAAA,CAAA,GAAA,CAAA,OARqB"}
@@ -1,5 +1,6 @@
1
- import { useStorefrontContext } from "../../lib/data/context.js";
2
1
  import { deleteLineItem } from "../../lib/data/cart.js";
2
+ import { useStorefrontContext } from "../../lib/data/context.js";
3
+ import { mutateCart } from "../../lib/hooks/use-cart.js";
3
4
  import { useState } from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { Spinner, Trash } from "@medusajs/icons";
@@ -11,7 +12,9 @@ const DeleteButton = ({ id, children, className }) => {
11
12
  const [isDeleting, setIsDeleting] = useState(false);
12
13
  const handleDelete = async (id$1) => {
13
14
  setIsDeleting(true);
14
- await deleteLineItem(id$1, ctx).catch((err) => {
15
+ await deleteLineItem(id$1, ctx).then(() => {
16
+ mutateCart();
17
+ }).catch((err) => {
15
18
  setIsDeleting(false);
16
19
  });
17
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["id"],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { Spinner, Trash } from '@medusajs/icons';\nimport { clx } from '@medusajs/ui';\n\nimport { deleteLineItem } from '@/lib/data/cart';\nimport { useStorefrontContext } from '@/lib/data/context';\n\nconst DeleteButton = ({\n id,\n children,\n className,\n}: {\n id: string;\n children?: React.ReactNode;\n className?: string;\n}) => {\n const ctx = useStorefrontContext();\n const [isDeleting, setIsDeleting] = useState(false);\n\n const handleDelete = async (id: string) => {\n setIsDeleting(true);\n await deleteLineItem(id, ctx).catch((err) => {\n setIsDeleting(false);\n });\n };\n\n return (\n <div\n className={clx(\n 'text-small-regular flex items-center justify-between',\n className\n )}\n >\n <button\n className=\"text-ui-fg-subtle hover:text-ui-fg-base flex cursor-pointer gap-x-1\"\n onClick={() => handleDelete(id)}\n >\n {isDeleting ? <Spinner className=\"animate-spin\" /> : <Trash />}\n <span>{children}</span>\n </button>\n </div>\n );\n};\n\nexport { DeleteButton };\n"],"mappings":";;;;;;;;AAQA,MAAM,gBAAgB,EACpB,IACA,UACA,gBAKI;CACJ,MAAM,MAAM,sBAAsB;CAClC,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CAEnD,MAAM,eAAe,OAAO,SAAe;AACzC,gBAAc,KAAK;AACnB,QAAM,eAAeA,MAAI,IAAI,CAAC,OAAO,QAAQ;AAC3C,iBAAc,MAAM;IACpB;;AAGJ,QACE,oBAAC;EACC,WAAW,IACT,wDACA,UACD;YAED,qBAAC;GACC,WAAU;GACV,eAAe,aAAa,GAAG;cAE9B,aAAa,oBAAC,WAAQ,WAAU,iBAAiB,GAAG,oBAAC,UAAQ,EAC9D,oBAAC,UAAM,WAAgB;IAChB;GACL"}
1
+ {"version":3,"file":"index.js","names":["id"],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { Spinner, Trash } from '@medusajs/icons';\nimport { clx } from '@medusajs/ui';\n\nimport { deleteLineItem } from '@/lib/data/cart';\nimport { useStorefrontContext } from '@/lib/data/context';\nimport { mutateCart } from '@/lib/hooks/use-cart';\n\nconst DeleteButton = ({\n id,\n children,\n className,\n}: {\n id: string;\n children?: React.ReactNode;\n className?: string;\n}) => {\n const ctx = useStorefrontContext();\n const [isDeleting, setIsDeleting] = useState(false);\n\n const handleDelete = async (id: string) => {\n setIsDeleting(true);\n await deleteLineItem(id, ctx)\n .then(() => {\n mutateCart();\n })\n .catch((err) => {\n setIsDeleting(false);\n });\n };\n\n return (\n <div\n className={clx(\n 'text-small-regular flex items-center justify-between',\n className\n )}\n >\n <button\n className=\"text-ui-fg-subtle hover:text-ui-fg-base flex cursor-pointer gap-x-1\"\n onClick={() => handleDelete(id)}\n >\n {isDeleting ? <Spinner className=\"animate-spin\" /> : <Trash />}\n <span>{children}</span>\n </button>\n </div>\n );\n};\n\nexport { DeleteButton };\n"],"mappings":";;;;;;;;;AASA,MAAM,gBAAgB,EACpB,IACA,UACA,gBAKI;CACJ,MAAM,MAAM,sBAAsB;CAClC,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CAEnD,MAAM,eAAe,OAAO,SAAe;AACzC,gBAAc,KAAK;AACnB,QAAM,eAAeA,MAAI,IAAI,CAC1B,WAAW;AACV,eAAY;IACZ,CACD,OAAO,QAAQ;AACd,iBAAc,MAAM;IACpB;;AAGN,QACE,oBAAC;EACC,WAAW,IACT,wDACA,UACD;YAED,qBAAC;GACC,WAAU;GACV,eAAe,aAAa,GAAG;cAE9B,aAAa,oBAAC,WAAQ,WAAU,iBAAiB,GAAG,oBAAC,UAAQ,EAC9D,oBAAC,UAAM,WAAgB;IAChB;GACL"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime10 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/error-message/index.d.ts
4
4
  declare const ErrorMessage: ({
@@ -7,7 +7,7 @@ declare const ErrorMessage: ({
7
7
  }: {
8
8
  error?: string | null;
9
9
  "data-testid"?: string;
10
- }) => react_jsx_runtime10.JSX.Element | null;
10
+ }) => react_jsx_runtime5.JSX.Element | null;
11
11
  //#endregion
12
12
  export { ErrorMessage };
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/error-message/index.tsx"],"sourcesContent":[],"mappings":";;;cAAM;;iBAAgB;AAMrB;;;AAAA,CAAA,EAAA,GAAA,mBAAA,CAAA,GAAA,CAAA,OAAA,GAaA,IAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/error-message/index.tsx"],"sourcesContent":[],"mappings":";;;cAAM;;iBAAgB;AAMrB;;;AAAA,CAAA,EAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA,GAaA,IAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Cart } from "../../types/graphql.js";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import { StoreCartShippingOption } from "@medusajs/types";
4
4
 
5
5
  //#region src/components/free-shipping-price-nudge/index.d.ts
@@ -11,7 +11,7 @@ declare function ShippingPriceNudge({
11
11
  variant?: 'popup' | 'inline';
12
12
  cart: Cart;
13
13
  shippingOptions: StoreCartShippingOption[];
14
- }): react_jsx_runtime2.JSX.Element | undefined;
14
+ }): react_jsx_runtime0.JSX.Element | undefined;
15
15
  //#endregion
16
16
  export { ShippingPriceNudge };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime11 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/interactive-link/index.d.ts
4
4
  type InteractiveLinkProps = {
@@ -11,7 +11,7 @@ declare const InteractiveLink: ({
11
11
  children,
12
12
  onClick,
13
13
  ...props
14
- }: InteractiveLinkProps) => react_jsx_runtime11.JSX.Element;
14
+ }: InteractiveLinkProps) => react_jsx_runtime1.JSX.Element;
15
15
  //#endregion
16
16
  export { InteractiveLink };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/interactive-link/index.tsx"],"sourcesContent":[],"mappings":";;;KAKK,oBAAA;;aAEQ,KAAA,CAAM;EAFd,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;AAEuB,CAAA;cAItB,eAAmB,EAAA,CAAA;EAAA,IAAA;EAAA,QAAA;EAAA,OAAA;EAAA,GAAA;AAAA,CAAA,EAKtB,oBALsB,EAAA,GAKF,mBAAA,CAAA,GAAA,CAAA,OALE"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/interactive-link/index.tsx"],"sourcesContent":[],"mappings":";;;KAKK,oBAAA;;aAEQ,KAAA,CAAM;EAFd,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;AAEuB,CAAA;cAItB,eAAmB,EAAA,CAAA;EAAA,IAAA;EAAA,QAAA;EAAA,OAAA;EAAA,GAAA;AAAA,CAAA,EAKtB,oBALsB,EAAA,GAKF,kBAAA,CAAA,GAAA,CAAA,OALE"}
@@ -1,5 +1,5 @@
1
1
  import { Maybe, ProductVariant } from "../../types/graphql.js";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/line-item-options/index.d.ts
5
5
  type LineItemOptionsProps = {
@@ -11,7 +11,7 @@ declare const LineItemOptions: ({
11
11
  variant,
12
12
  "data-testid": dataTestid,
13
13
  "data-value": dataValue
14
- }: LineItemOptionsProps) => react_jsx_runtime13.JSX.Element;
14
+ }: LineItemOptionsProps) => react_jsx_runtime2.JSX.Element;
15
15
  //#endregion
16
16
  export { LineItemOptions };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-options/index.tsx"],"sourcesContent":[],"mappings":";;;;KAIK,oBAAA;YACO,MAAM;;EADb,YAAA,CAAA,EAGY,KAHZ,CAGkB,cAHE,CAAA;CACP;cAKZ,eALM,EAAA,CAAA;EAAA,OAAA;EAAA,aAAA,EAKa,UALb;EAAA,YAAA,EAKa;AALb,CAAA,EAST,oBATS,EAAA,GASW,mBAAA,CAAA,GAAA,CAAA,OATX"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-options/index.tsx"],"sourcesContent":[],"mappings":";;;;KAIK,oBAAA;YACO,MAAM;;EADb,YAAA,CAAA,EAGY,KAHZ,CAGkB,cAHE,CAAA;CACP;cAKZ,eALM,EAAA,CAAA;EAAA,OAAA;EAAA,aAAA,EAKa,UALb;EAAA,YAAA,EAKa;AALb,CAAA,EAST,oBATS,EAAA,GASW,kBAAA,CAAA,GAAA,CAAA,OATX"}
@@ -1,5 +1,5 @@
1
1
  import { LineItem } from "../../types/graphql.js";
2
- import * as react_jsx_runtime12 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/line-item-price/index.d.ts
5
5
  type LineItemPriceProps = {
@@ -11,7 +11,7 @@ declare const LineItemPrice: ({
11
11
  item,
12
12
  style,
13
13
  currencyCode
14
- }: LineItemPriceProps) => react_jsx_runtime12.JSX.Element;
14
+ }: LineItemPriceProps) => react_jsx_runtime3.JSX.Element;
15
15
  //#endregion
16
16
  export { LineItemPrice };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-price/index.tsx"],"sourcesContent":[],"mappings":";;;;KAMK,kBAAA;QACG;;EADH,YAAA,EAAA,MAAA;AACW,CAAA;cAKV,aAAiB,EAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAIpB,kBAJoB,EAAA,GAIF,mBAAA,CAAA,GAAA,CAAA,OAJE"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-price/index.tsx"],"sourcesContent":[],"mappings":";;;;KAMK,kBAAA;QACG;;EADH,YAAA,EAAA,MAAA;AACW,CAAA;cAKV,aAAiB,EAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAIpB,kBAJoB,EAAA,GAIF,kBAAA,CAAA,GAAA,CAAA,OAJE"}
@@ -1,5 +1,5 @@
1
1
  import { AnchorHTMLAttributes, DetailedHTMLProps } from "react";
2
- import * as react_jsx_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/localized-client-link/index.d.ts
5
5
  type LocalizedClientLinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
@@ -11,7 +11,7 @@ declare const LocalizedClientLink: ({
11
11
  children,
12
12
  href,
13
13
  ...props
14
- }: LocalizedClientLinkProps) => react_jsx_runtime15.JSX.Element;
14
+ }: LocalizedClientLinkProps) => react_jsx_runtime4.JSX.Element;
15
15
  //#endregion
16
16
  export { LocalizedClientLink };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":[],"mappings":";;;;KAEK,wBAAA,GAA2B,kBAC9B,qBAAqB,oBACrB;;;AAJ8D;;cAW1D,mBARJ,EAAA,CAAA;EAAA,QAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAYC,wBAZD,EAAA,GAYyB,mBAAA,CAAA,GAAA,CAAA,OAZzB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":[],"mappings":";;;;KAEK,wBAAA,GAA2B,kBAC9B,qBAAqB,oBACrB;;;AAJ8D;;cAW1D,mBARJ,EAAA,CAAA;EAAA,QAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAYC,wBAZD,EAAA,GAYyB,kBAAA,CAAA,GAAA,CAAA,OAZzB"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/modal/index.d.ts
5
5
  type ModalProps = {
@@ -20,7 +20,7 @@ declare const Modal: {
20
20
  children,
21
21
  "data-testid": dataTestId,
22
22
  "aria-label": ariaLabel
23
- }: ModalProps): react_jsx_runtime14.JSX.Element;
23
+ }: ModalProps): react_jsx_runtime6.JSX.Element;
24
24
  Title: React.FC<{
25
25
  children: React.ReactNode;
26
26
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/modal/index.tsx"],"sourcesContent":[],"mappings":";;;;KAQK,UAAA;;;EAAA,IAAA,CAAA,EAAA,OAAU,GAAA,QAAA,GAKH,OAAM;EAKZ,MAAA,CAAA,EAqEL,OAAA;YA1EW,KAAA,CAAM;;;;cAKZ;;;;;;;;;KAQH,aAAU,mBAAA,CAAA,GAAA,CAAA;;IAAV,QAAA,EA+D+B,KAAA,CAAM,SA/DrC;EAAU,CAAA,CAAA;EA+DqB,WAAM,UAAA,CAAA;cAeA,KAAA,CAAM;EAAN,CAAA,CAAA;;IAQD,QAAA,EAAN,KAAA,CAAM,SAAA;;EAIJ,MAAM,UAAA,CAAA;cAAN,KAAA,CAAM"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/modal/index.tsx"],"sourcesContent":[],"mappings":";;;;KAQK,UAAA;;;EAAA,IAAA,CAAA,EAAA,OAAU,GAAA,QAAA,GAKH,OAAM;EAKZ,MAAA,CAAA,EAqEL,OAAA;YA1EW,KAAA,CAAM;;;;cAKZ;;;;;;;;;KAQH,aAAU,kBAAA,CAAA,GAAA,CAAA;;IAAV,QAAA,EA+D+B,KAAA,CAAM,SA/DrC;EAAU,CAAA,CAAA;EA+DqB,WAAM,UAAA,CAAA;cAeA,KAAA,CAAM;EAAN,CAAA,CAAA;;IAQD,QAAA,EAAN,KAAA,CAAM,SAAA;;EAIJ,MAAM,UAAA,CAAA;cAAN,KAAA,CAAM"}
@@ -1,12 +1,12 @@
1
1
  import { VariantPrice } from "../../types/prices.js";
2
- import * as react_jsx_runtime9 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/preview-price/index.d.ts
5
5
  declare function PreviewPrice({
6
6
  price
7
7
  }: {
8
8
  price: VariantPrice;
9
- }): react_jsx_runtime9.JSX.Element | null;
9
+ }): react_jsx_runtime7.JSX.Element | null;
10
10
  //#endregion
11
11
  export { PreviewPrice };
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  import * as class_variance_authority_types0 from "class-variance-authority/types";
4
4
 
@@ -59,7 +59,7 @@ declare function ProductCard({
59
59
  variant,
60
60
  size,
61
61
  className
62
- }: ProductCardProps): react_jsx_runtime4.JSX.Element;
62
+ }: ProductCardProps): react_jsx_runtime9.JSX.Element;
63
63
  //#endregion
64
64
  export { ProductCard };
65
65
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Product } from "../../types/graphql.js";
2
- import * as react_jsx_runtime5 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime10 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/product-preview/index.d.ts
5
5
  type ProductPreviewProps = {
@@ -9,7 +9,7 @@ type ProductPreviewProps = {
9
9
  declare function ProductPreview({
10
10
  product,
11
11
  isFeatured
12
- }: ProductPreviewProps): react_jsx_runtime5.JSX.Element;
12
+ }: ProductPreviewProps): react_jsx_runtime10.JSX.Element;
13
13
  //#endregion
14
14
  export { ProductPreview, ProductPreviewProps };
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-preview/index.tsx"],"sourcesContent":[],"mappings":";;;;KASY,mBAAA;WACD;;AADX,CAAA;AAGE,iBAEO,cAAA,CAAc;EAAA,OAAA;EAAA;AAAA,CAAA,EAA0B,mBAA1B,CAAA,EAA6C,kBAAA,CAAA,GAAA,CAAA,OAA7C"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-preview/index.tsx"],"sourcesContent":[],"mappings":";;;;KASY,mBAAA;WACD;;AADX,CAAA;AAGE,iBAEO,cAAA,CAAc;EAAA,OAAA;EAAA;AAAA,CAAA,EAA0B,mBAA1B,CAAA,EAA6C,mBAAA,CAAA,GAAA,CAAA,OAA7C"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime6 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/submit-button/index.d.ts
5
5
  declare function SubmitButton({
@@ -14,7 +14,7 @@ declare function SubmitButton({
14
14
  className?: string;
15
15
  'data-testid'?: string;
16
16
  isLoading?: boolean;
17
- }): react_jsx_runtime6.JSX.Element;
17
+ }): react_jsx_runtime11.JSX.Element;
18
18
  //#endregion
19
19
  export { SubmitButton };
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/submit-button/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAQS,YAAA;;;;iBAIQ;;;YAGL,KAAA,CAAM;;EAPT,SAAA,CAAA,EAAA,MAAY;EACnB,aAAA,CAAA,EAAA,MAAA;EACA,SAAA,CAAA,EAAA,OAAA;CACA,CAAA,EASD,kBAAA,CAAA,GAAA,CAAA,OATC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/submit-button/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAQS,YAAA;;;;iBAIQ;;;YAGL,KAAA,CAAM;;EAPT,SAAA,CAAA,EAAA,MAAY;EACnB,aAAA,CAAA,EAAA,MAAA;EACA,SAAA,CAAA,EAAA,OAAA;CACA,CAAA,EASD,mBAAA,CAAA,GAAA,CAAA,OATC"}
@@ -1,10 +1,10 @@
1
1
  import { PropsWithChildren } from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/lib/context/apollo-context.d.ts
5
5
  declare function ApolloClientProvider({
6
6
  children
7
- }: PropsWithChildren): react_jsx_runtime0.JSX.Element;
7
+ }: PropsWithChildren): react_jsx_runtime12.JSX.Element;
8
8
  //#endregion
9
9
  export { ApolloClientProvider };
10
10
  //# sourceMappingURL=apollo-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-context.d.ts","names":[],"sources":["../../../src/lib/context/apollo-context.tsx"],"sourcesContent":[],"mappings":";;;;iBAQS,oBAAA;;GAAmC,oBAAiB,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"apollo-context.d.ts","names":[],"sources":["../../../src/lib/context/apollo-context.tsx"],"sourcesContent":[],"mappings":";;;;iBAQS,oBAAA;;GAAmC,oBAAiB,mBAAA,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/lib/context/modal-context.d.ts
5
5
  interface ModalContext {
@@ -13,7 +13,7 @@ interface ModalProviderProps {
13
13
  declare const ModalProvider: ({
14
14
  children,
15
15
  close
16
- }: ModalProviderProps) => react_jsx_runtime0.JSX.Element;
16
+ }: ModalProviderProps) => react_jsx_runtime13.JSX.Element;
17
17
  declare const useModal: () => ModalContext;
18
18
  //#endregion
19
19
  export { ModalProvider, useModal };
@@ -1 +1 @@
1
- {"version":3,"file":"modal-context.d.ts","names":[],"sources":["../../../src/lib/context/modal-context.tsx"],"sourcesContent":[],"mappings":";;;;UAIU,YAAA;;;AAF+C,cAMnD,YAJgB,EAIJ,KAAA,CAAA,OAJI,CAIJ,YAJI,GAAA,IAAA,CAAA;AAAA,UAMZ,kBAAA,CAFmD;EAEnD,QAAA,CAAA,EACG,KAAA,CAAM,SADS;EAKtB,KAAA,EAAA,GAAA,GAAA,IAUL;;cAVK,aAAiB,EAAA,CAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAqB,kBAArB,EAAA,GAAuC,kBAAA,CAAA,GAAA,CAAA,OAAvC;cAYjB,QAZsC,EAAA,GAAA,GAY9B,YAZ8B"}
1
+ {"version":3,"file":"modal-context.d.ts","names":[],"sources":["../../../src/lib/context/modal-context.tsx"],"sourcesContent":[],"mappings":";;;;UAIU,YAAA;;;AAF+C,cAMnD,YAJgB,EAIJ,KAAA,CAAA,OAJI,CAIJ,YAJI,GAAA,IAAA,CAAA;AAAA,UAMZ,kBAAA,CAFmD;EAEnD,QAAA,CAAA,EACG,KAAA,CAAM,SADS;EAKtB,KAAA,EAAA,GAAA,GAAA,IAUL;;cAVK,aAAiB,EAAA,CAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAqB,kBAArB,EAAA,GAAuC,mBAAA,CAAA,GAAA,CAAA,OAAvC;cAYjB,QAZsC,EAAA,GAAA,GAY9B,YAZ8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":[],"mappings":";;;;;cA2Ba,oBACN,sBACJ,QAAQ;cAmBE,mBACL,0CACD,sBACJ,QAAQ;AAxBE,cA6DA,cA1CZ,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,GAAA,EA4CM,iBA5CN,EAAA,GA6CE,OA7CF,CA6CU,sBA7CV,CAAA,gBAAA,CAAA,GAAA,IAAA,CAAA;AAlBM,iBAuGe,eAAA,CAvGf,GAAA,EAuGoC,iBAvGpC,CAAA,EAuGqD,OAvGrD,CAAA;EACI,gBAAA,EAgHW,SAAA,CAAU,uBAhHrB,EAAA;CAAR,CAAA"}
1
+ {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":[],"mappings":";;;;;cA2Ba,oBACN,sBACJ,QAAQ;cAmBE,mBACL,0CACD,sBACJ,QAAQ;AAxBE,cA8DA,cA3CZ,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,GAAA,EA6CM,iBA7CN,EAAA,GA8CE,OA9CF,CA8CU,sBA9CV,CAAA,gBAAA,CAAA,GAAA,IAAA,CAAA;AAlBM,iBA6Ge,eAAA,CA7Gf,GAAA,EA6GoC,iBA7GpC,CAAA,EA6GqD,OA7GrD,CAAA;EACI,gBAAA,EAsHW,SAAA,CAAU,uBAtHrB,EAAA;CAAR,CAAA"}
@@ -1,9 +1,9 @@
1
- import { graphqlFetch, graphqlMutation } from "../gql/apollo-client.js";
2
- import { DELETE_LINE_ITEM_MUTATION, UPDATE_CART_MUTATION } from "../gql/mutations/cart.js";
3
- import { medusaError } from "../utils/medusa-error.js";
4
1
  import { getAuthHeaders, getCacheOptions, getCacheTag, getCartId } from "./cookies.js";
5
2
  import { sdk } from "../config/medusa.js";
3
+ import { graphqlFetch, graphqlMutation } from "../gql/apollo-client.js";
4
+ import { DELETE_LINE_ITEM_MUTATION, UPDATE_CART_MUTATION } from "../gql/mutations/cart.js";
6
5
  import { GET_CART_QUERY } from "../gql/queries/cart.js";
6
+ import { medusaError } from "../utils/medusa-error.js";
7
7
 
8
8
  //#region src/lib/data/cart.ts
9
9
  const retrieveCart = async (ctx) => {
@@ -30,11 +30,10 @@ const updateCart = async (data, ctx) => {
30
30
  data
31
31
  }
32
32
  }))?.updateCart ?? null;
33
- if (cart && ctx.revalidate) {
34
- const cartCacheTag = getCacheTag("carts", ctx);
35
- ctx.revalidate(cartCacheTag);
36
- const fulfillmentCacheTag = getCacheTag("fulfillment", ctx);
37
- ctx.revalidate(fulfillmentCacheTag);
33
+ if (cart) {
34
+ const { revalidateTag } = await import("next/cache");
35
+ revalidateTag(getCacheTag("carts", ctx));
36
+ revalidateTag(getCacheTag("fulfillment", ctx));
38
37
  }
39
38
  return cart;
40
39
  } catch (err) {
@@ -53,12 +52,11 @@ const deleteLineItem = async (lineId, ctx) => {
53
52
  lineItemId: lineId
54
53
  }
55
54
  }))?.deleteLineItem ?? null;
56
- if (deletedLineItem && ctx.revalidate) {
57
- const cartCacheTag = getCacheTag("carts", ctx);
58
- ctx.revalidate(cartCacheTag);
59
- const fulfillmentCacheTag = getCacheTag("fulfillment", ctx);
60
- ctx.revalidate(fulfillmentCacheTag);
61
- }
55
+ if (deletedLineItem) try {
56
+ const { revalidateTag } = await import("next/cache");
57
+ revalidateTag(getCacheTag("carts", ctx));
58
+ revalidateTag(getCacheTag("fulfillment", ctx));
59
+ } catch {}
62
60
  return deletedLineItem;
63
61
  } catch (error) {
64
62
  console.error("GraphQL deleteLineItem error:", error.message);
@@ -1 +1 @@
1
- {"version":3,"file":"cart.js","names":["error: any"],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":["import { HttpTypes } from '@medusajs/types';\n\nimport {\n Cart,\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables,\n GetCartQuery,\n GetCartQueryVariables,\n UpdateCartMutation,\n UpdateCartMutationVariables,\n} from '../../types/graphql';\nimport { sdk } from '../config/medusa';\nimport { graphqlFetch, graphqlMutation } from '../gql/apollo-client';\nimport {\n DELETE_LINE_ITEM_MUTATION,\n UPDATE_CART_MUTATION,\n} from '../gql/mutations/cart';\nimport { GET_CART_QUERY } from '../gql/queries/cart';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\nimport {\n getAuthHeaders,\n getCacheOptions,\n getCacheTag,\n getCartId,\n} from './cookies';\n\nexport const retrieveCart = async (\n ctx: StorefrontContext\n): Promise<Cart | null> => {\n const id = getCartId(ctx);\n if (!id) {\n return null;\n }\n\n try {\n const data = await graphqlFetch<GetCartQuery, GetCartQueryVariables>({\n query: GET_CART_QUERY,\n variables: { id },\n });\n\n return data?.cart ?? null;\n } catch (error) {\n console.error('Failed to fetch cart:', error);\n return null;\n }\n};\n\nexport const updateCart = async (\n data: UpdateCartMutationVariables['data'],\n ctx: StorefrontContext\n): Promise<UpdateCartMutation['updateCart'] | null> => {\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error(\n 'No existing cart found, please create one before updating'\n );\n }\n\n try {\n const result = await graphqlMutation<\n UpdateCartMutation,\n UpdateCartMutationVariables\n >({\n mutation: UPDATE_CART_MUTATION,\n variables: {\n id: cartId,\n data,\n },\n });\n\n const cart = result?.updateCart ?? null;\n\n if (cart && ctx.revalidate) {\n const cartCacheTag = getCacheTag('carts', ctx);\n ctx.revalidate(cartCacheTag);\n\n const fulfillmentCacheTag = getCacheTag('fulfillment', ctx);\n ctx.revalidate(fulfillmentCacheTag);\n }\n\n return cart;\n } catch (err) {\n medusaError(err);\n }\n};\n\nexport const deleteLineItem = async (\n lineId: string,\n ctx: StorefrontContext\n): Promise<DeleteLineItemMutation['deleteLineItem'] | null> => {\n if (!lineId) {\n throw new Error('Missing lineItem ID when deleting line item');\n }\n\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error('Missing cart ID when deleting line item');\n }\n\n try {\n const result = await graphqlMutation<\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables\n >({\n mutation: DELETE_LINE_ITEM_MUTATION,\n variables: {\n cartId,\n lineItemId: lineId,\n },\n });\n\n const deletedLineItem = result?.deleteLineItem ?? null;\n\n if (deletedLineItem && ctx.revalidate) {\n const cartCacheTag = getCacheTag('carts', ctx);\n ctx.revalidate(cartCacheTag);\n\n const fulfillmentCacheTag = getCacheTag('fulfillment', ctx);\n ctx.revalidate(fulfillmentCacheTag);\n }\n\n return deletedLineItem;\n } catch (error: any) {\n console.error('GraphQL deleteLineItem error:', error.message);\n throw error;\n }\n};\n\nexport async function listCartOptions(ctx: StorefrontContext) {\n const cartId = getCartId(ctx);\n const headers = {\n ...getAuthHeaders(ctx),\n };\n const next = {\n ...getCacheOptions('shippingOptions', ctx),\n };\n\n return await sdk.client.fetch<{\n shipping_options: HttpTypes.StoreCartShippingOption[];\n }>('/store/shipping-options', {\n query: { cart_id: cartId },\n next,\n headers,\n cache: 'force-cache',\n });\n}\n"],"mappings":";;;;;;;;AA2BA,MAAa,eAAe,OAC1B,QACyB;CACzB,MAAM,KAAK,UAAU,IAAI;AACzB,KAAI,CAAC,GACH,QAAO;AAGT,KAAI;AAMF,UALa,MAAM,aAAkD;GACnE,OAAO;GACP,WAAW,EAAE,IAAI;GAClB,CAAC,GAEW,QAAQ;UACd,OAAO;AACd,UAAQ,MAAM,yBAAyB,MAAM;AAC7C,SAAO;;;AAIX,MAAa,aAAa,OACxB,MACA,QACqD;CACrD,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,OAAM,IAAI,MACR,4DACD;AAGH,KAAI;EAYF,MAAM,QAXS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW;IACT,IAAI;IACJ;IACD;GACF,CAAC,GAEmB,cAAc;AAEnC,MAAI,QAAQ,IAAI,YAAY;GAC1B,MAAM,eAAe,YAAY,SAAS,IAAI;AAC9C,OAAI,WAAW,aAAa;GAE5B,MAAM,sBAAsB,YAAY,eAAe,IAAI;AAC3D,OAAI,WAAW,oBAAoB;;AAGrC,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;;;AAIpB,MAAa,iBAAiB,OAC5B,QACA,QAC6D;AAC7D,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,8CAA8C;CAGhE,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,0CAA0C;AAG5D,KAAI;EAYF,MAAM,mBAXS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW;IACT;IACA,YAAY;IACb;GACF,CAAC,GAE8B,kBAAkB;AAElD,MAAI,mBAAmB,IAAI,YAAY;GACrC,MAAM,eAAe,YAAY,SAAS,IAAI;AAC9C,OAAI,WAAW,aAAa;GAE5B,MAAM,sBAAsB,YAAY,eAAe,IAAI;AAC3D,OAAI,WAAW,oBAAoB;;AAGrC,SAAO;UACAA,OAAY;AACnB,UAAQ,MAAM,iCAAiC,MAAM,QAAQ;AAC7D,QAAM;;;AAIV,eAAsB,gBAAgB,KAAwB;CAC5D,MAAM,SAAS,UAAU,IAAI;CAC7B,MAAM,UAAU,EACd,GAAG,eAAe,IAAI,EACvB;CACD,MAAM,OAAO,EACX,GAAG,gBAAgB,mBAAmB,IAAI,EAC3C;AAED,QAAO,MAAM,IAAI,OAAO,MAErB,2BAA2B;EAC5B,OAAO,EAAE,SAAS,QAAQ;EAC1B;EACA;EACA,OAAO;EACR,CAAC"}
1
+ {"version":3,"file":"cart.js","names":["error: any"],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":["import { HttpTypes } from '@medusajs/types';\n\nimport {\n Cart,\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables,\n GetCartQuery,\n GetCartQueryVariables,\n UpdateCartMutation,\n UpdateCartMutationVariables,\n} from '../../types/graphql';\nimport { sdk } from '../config/medusa';\nimport { graphqlFetch, graphqlMutation } from '../gql/apollo-client';\nimport {\n DELETE_LINE_ITEM_MUTATION,\n UPDATE_CART_MUTATION,\n} from '../gql/mutations/cart';\nimport { GET_CART_QUERY } from '../gql/queries/cart';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\nimport {\n getAuthHeaders,\n getCacheOptions,\n getCacheTag,\n getCartId,\n} from './cookies';\n\nexport const retrieveCart = async (\n ctx: StorefrontContext\n): Promise<Cart | null> => {\n const id = getCartId(ctx);\n if (!id) {\n return null;\n }\n\n try {\n const data = await graphqlFetch<GetCartQuery, GetCartQueryVariables>({\n query: GET_CART_QUERY,\n variables: { id },\n });\n\n return data?.cart ?? null;\n } catch (error) {\n console.error('Failed to fetch cart:', error);\n return null;\n }\n};\n\nexport const updateCart = async (\n data: UpdateCartMutationVariables['data'],\n ctx: StorefrontContext\n): Promise<UpdateCartMutation['updateCart'] | null> => {\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error(\n 'No existing cart found, please create one before updating'\n );\n }\n\n try {\n const result = await graphqlMutation<\n UpdateCartMutation,\n UpdateCartMutationVariables\n >({\n mutation: UPDATE_CART_MUTATION,\n variables: {\n id: cartId,\n data,\n },\n });\n\n const cart = result?.updateCart ?? null;\n\n if (cart) {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n\n const fulfillmentCacheTag = getCacheTag('fulfillment', ctx);\n revalidateTag(fulfillmentCacheTag);\n }\n\n return cart;\n } catch (err) {\n medusaError(err);\n }\n};\n\nexport const deleteLineItem = async (\n lineId: string,\n ctx: StorefrontContext\n): Promise<DeleteLineItemMutation['deleteLineItem'] | null> => {\n if (!lineId) {\n throw new Error('Missing lineItem ID when deleting line item');\n }\n\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error('Missing cart ID when deleting line item');\n }\n\n try {\n const result = await graphqlMutation<\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables\n >({\n mutation: DELETE_LINE_ITEM_MUTATION,\n variables: {\n cartId,\n lineItemId: lineId,\n },\n });\n\n const deletedLineItem = result?.deleteLineItem ?? null;\n\n if (deletedLineItem) {\n try {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n\n const fulfillmentCacheTag = getCacheTag('fulfillment', ctx);\n revalidateTag(fulfillmentCacheTag);\n } catch {\n // Not in Next.js environment\n }\n }\n\n return deletedLineItem;\n } catch (error: any) {\n console.error('GraphQL deleteLineItem error:', error.message);\n throw error;\n }\n};\n\nexport async function listCartOptions(ctx: StorefrontContext) {\n const cartId = getCartId(ctx);\n const headers = {\n ...getAuthHeaders(ctx),\n };\n const next = {\n ...getCacheOptions('shippingOptions', ctx),\n };\n\n return await sdk.client.fetch<{\n shipping_options: HttpTypes.StoreCartShippingOption[];\n }>('/store/shipping-options', {\n query: { cart_id: cartId },\n next,\n headers,\n cache: 'force-cache',\n });\n}\n"],"mappings":";;;;;;;;AA2BA,MAAa,eAAe,OAC1B,QACyB;CACzB,MAAM,KAAK,UAAU,IAAI;AACzB,KAAI,CAAC,GACH,QAAO;AAGT,KAAI;AAMF,UALa,MAAM,aAAkD;GACnE,OAAO;GACP,WAAW,EAAE,IAAI;GAClB,CAAC,GAEW,QAAQ;UACd,OAAO;AACd,UAAQ,MAAM,yBAAyB,MAAM;AAC7C,SAAO;;;AAIX,MAAa,aAAa,OACxB,MACA,QACqD;CACrD,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,OAAM,IAAI,MACR,4DACD;AAGH,KAAI;EAYF,MAAM,QAXS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW;IACT,IAAI;IACJ;IACD;GACF,CAAC,GAEmB,cAAc;AAEnC,MAAI,MAAM;GACR,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,iBADqB,YAAY,SAAS,IAAI,CACnB;AAG3B,iBAD4B,YAAY,eAAe,IAAI,CACzB;;AAGpC,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;;;AAIpB,MAAa,iBAAiB,OAC5B,QACA,QAC6D;AAC7D,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,8CAA8C;CAGhE,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,0CAA0C;AAG5D,KAAI;EAYF,MAAM,mBAXS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW;IACT;IACA,YAAY;IACb;GACF,CAAC,GAE8B,kBAAkB;AAElD,MAAI,gBACF,KAAI;GACF,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,iBADqB,YAAY,SAAS,IAAI,CACnB;AAG3B,iBAD4B,YAAY,eAAe,IAAI,CACzB;UAC5B;AAKV,SAAO;UACAA,OAAY;AACnB,UAAQ,MAAM,iCAAiC,MAAM,QAAQ;AAC7D,QAAM;;;AAIV,eAAsB,gBAAgB,KAAwB;CAC5D,MAAM,SAAS,UAAU,IAAI;CAC7B,MAAM,UAAU,EACd,GAAG,eAAe,IAAI,EACvB;CACD,MAAM,OAAO,EACX,GAAG,gBAAgB,mBAAmB,IAAI,EAC3C;AAED,QAAO,MAAM,IAAI,OAAO,MAErB,2BAA2B;EAC5B,OAAO,EAAE,SAAS,QAAQ;EAC1B;EACA;EACA,OAAO;EACR,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction } from "./cookies.js";
2
+ import { StorefrontContext } from "./context.js";
3
+
4
+ //#region src/lib/data/client-actions.d.ts
5
+ declare const useStorefrontActions: (ctx?: StorefrontContext) => {
6
+ setCartId: typeof setCartIdAction;
7
+ removeCartId: typeof removeCartIdAction;
8
+ setAuthToken: typeof setAuthTokenAction;
9
+ removeAuthToken: typeof removeAuthTokenAction;
10
+ updateRegion: (countryCode: string, currentPath: string) => Promise<void>;
11
+ };
12
+ //#endregion
13
+ export { useStorefrontActions };
14
+ //# sourceMappingURL=client-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-actions.d.ts","names":[],"sources":["../../../src/lib/data/client-actions.tsx"],"sourcesContent":[],"mappings":";;;;cAWa,6BAA8B;;EAA9B,YAAA,EAAA,yBAYZ;EAZ0C,YAAA,EAAA,yBAAA;;8DAUlC"}
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+ import { removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction } from "./cookies.js";
4
+ import { updateRegionAction } from "./next-context.js";
5
+
6
+ //#region src/lib/data/client-actions.tsx
7
+ const useStorefrontActions = (ctx) => {
8
+ return {
9
+ setCartId: setCartIdAction,
10
+ removeCartId: removeCartIdAction,
11
+ setAuthToken: setAuthTokenAction,
12
+ removeAuthToken: removeAuthTokenAction,
13
+ updateRegion: ((countryCode, currentPath) => updateRegionAction(countryCode, currentPath, ctx))
14
+ };
15
+ };
16
+
17
+ //#endregion
18
+ export { useStorefrontActions };
19
+ //# sourceMappingURL=client-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-actions.js","names":[],"sources":["../../../src/lib/data/client-actions.tsx"],"sourcesContent":["'use client';\n\nimport { StorefrontContext } from './context';\nimport {\n removeAuthTokenAction,\n removeCartIdAction,\n setAuthTokenAction,\n setCartIdAction,\n} from './cookies';\nimport { updateRegionAction } from './next-context';\n\nexport const useStorefrontActions = (ctx?: StorefrontContext) => {\n return {\n setCartId: setCartIdAction,\n removeCartId: removeCartIdAction,\n setAuthToken: setAuthTokenAction,\n removeAuthToken: removeAuthTokenAction,\n updateRegion: ((countryCode: string, currentPath: string) =>\n updateRegionAction(countryCode, currentPath, ctx)) as (\n countryCode: string,\n currentPath: string\n ) => Promise<void>,\n };\n};\n"],"mappings":";;;;;;AAWA,MAAa,wBAAwB,QAA4B;AAC/D,QAAO;EACL,WAAW;EACX,cAAc;EACd,cAAc;EACd,iBAAiB;EACjB,gBAAgB,aAAqB,gBACnC,mBAAmB,aAAa,aAAa,IAAI;EAIpD"}
@@ -1,5 +1,6 @@
1
+ import { useStorefrontActions } from "./client-actions.js";
1
2
  import { ReactNode } from "react";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
3
4
 
4
5
  //#region src/lib/data/context.d.ts
5
6
  interface StorefrontContext {
@@ -7,12 +8,7 @@ interface StorefrontContext {
7
8
  customerToken: string;
8
9
  cacheId: string;
9
10
  cookieHeader: string;
10
- revalidate: (tag: string) => void;
11
- updateRegion: (countryCode: string, currentPath: string) => Promise<void>;
12
- setCartId: (id: string) => Promise<void>;
13
- removeCartId: () => Promise<void>;
14
- setAuthToken: (token: string) => Promise<void>;
15
- removeAuthToken: () => Promise<void>;
11
+ revalidate?: (tag: string) => void;
16
12
  }
17
13
  declare const StorefrontProvider: ({
18
14
  children,
@@ -20,8 +16,8 @@ declare const StorefrontProvider: ({
20
16
  }: {
21
17
  children: ReactNode;
22
18
  value: StorefrontContext;
23
- }) => react_jsx_runtime1.JSX.Element;
19
+ }) => react_jsx_runtime8.JSX.Element;
24
20
  declare const useStorefrontContext: () => StorefrontContext;
25
21
  //#endregion
26
- export { StorefrontContext, StorefrontProvider, useStorefrontContext };
22
+ export { StorefrontContext, StorefrontProvider, useStorefrontActions, useStorefrontContext };
27
23
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":[],"mappings":";;;;UAIiB,iBAAA;;;EAAA,OAAA,EAAA,MAAA;EAM6C,YAAA,EAAA,MAAA;EACjC,UAAA,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,IAAA;EACP,YAAA,EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,EAAA,GAFwC,OAExC,CAAA,IAAA,CAAA;EACa,SAAA,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,GAFN,OAEM,CAAA,IAAA,CAAA;EACV,YAAA,EAAA,GAAA,GAFH,OAEG,CAAA,IAAA,CAAA;EAAO,YAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GADG,OACH,CAAA,IAAA,CAAA;EAOnB,eAAA,EAAA,GAAA,GAPY,OAmBxB,CAAA,IAAA,CAAA;;AAZkC,cAAtB,kBAAsB,EAAA,CAAA;EAAA,QAAA;EAAA;CAAA,EAAA;EAIvB,QAAA,EAAA,SAAA;EACH,KAAA,EAAA,iBAAA;CACR,EAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA;AAMA,cAEY,oBAFZ,EAAA,GAAA,GAEgC,iBAFhC"}
1
+ {"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":[],"mappings":";;;;;UAIiB,iBAAA;;;;EAAA,YAAA,EAAA,MAAiB;EAYrB,UAAA,CAAA,EAAA,CAAA,GAAA,EAAA,MAYZ,EAAA,GAAA,IAAA;;AAZkC,cAAtB,kBAAsB,EAAA,CAAA;EAAA,QAAA;EAAA;CAAA,EAAA;EAIvB,QAAA,EAAA,SAAA;EACH,KAAA,EAAA,iBAAA;CACR,EAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA;AAMA,cAEY,oBAFZ,EAAA,GAAA,GAEgC,iBAFhC"}
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { useStorefrontActions } from "./client-actions.js";
3
4
  import { createContext, useContext } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
 
@@ -14,5 +15,5 @@ const StorefrontProvider = ({ children, value }) => {
14
15
  const useStorefrontContext = () => useContext(StorefrontReactContext);
15
16
 
16
17
  //#endregion
17
- export { StorefrontProvider, useStorefrontContext };
18
+ export { StorefrontProvider, useStorefrontActions, useStorefrontContext };
18
19
  //# sourceMappingURL=context.js.map
@@ -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 customerToken: string;\n cacheId: string;\n cookieHeader: string;\n revalidate: (tag: string) => void;\n updateRegion: (countryCode: string, currentPath: string) => Promise<void>;\n setCartId: (id: string) => Promise<void>;\n removeCartId: () => Promise<void>;\n setAuthToken: (token: string) => Promise<void>;\n removeAuthToken: () => Promise<void>;\n}\n\nconst StorefrontReactContext = createContext<StorefrontContext>(\n {} as StorefrontContext\n);\n\nexport const StorefrontProvider = ({\n children,\n value,\n}: {\n children: ReactNode;\n value: StorefrontContext;\n}) => {\n return (\n <StorefrontReactContext.Provider value={value}>\n {children}\n </StorefrontReactContext.Provider>\n );\n};\n\nexport const useStorefrontContext = () => useContext(StorefrontReactContext);\n"],"mappings":";;;;;;AAiBA,MAAM,yBAAyB,cAC7B,EAAE,CACH;AAED,MAAa,sBAAsB,EACjC,UACA,YAII;AACJ,QACE,oBAAC,uBAAuB;EAAgB;EACrC;GAC+B;;AAItC,MAAa,6BAA6B,WAAW,uBAAuB"}
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 customerToken: string;\n cacheId: string;\n cookieHeader: string;\n revalidate?: (tag: string) => void;\n}\n\nconst StorefrontReactContext = createContext<StorefrontContext>(\n {} as StorefrontContext\n);\n\nexport const StorefrontProvider = ({\n children,\n value,\n}: {\n children: ReactNode;\n value: StorefrontContext;\n}) => {\n return (\n <StorefrontReactContext.Provider value={value}>\n {children}\n </StorefrontReactContext.Provider>\n );\n};\n\nexport const useStorefrontContext = () => useContext(StorefrontReactContext);\nexport { useStorefrontActions } from './client-actions';\n"],"mappings":";;;;;;;AAYA,MAAM,yBAAyB,cAC7B,EAAE,CACH;AAED,MAAa,sBAAsB,EACjC,UACA,YAII;AACJ,QACE,oBAAC,uBAAuB;EAAgB;EACrC;GAC+B;;AAItC,MAAa,6BAA6B,WAAW,uBAAuB"}
@@ -13,10 +13,6 @@ declare function setCartIdAction(id: string): Promise<void>;
13
13
  declare function removeCartIdAction(): Promise<void>;
14
14
  declare function setAuthTokenAction(token: string): Promise<void>;
15
15
  declare function removeAuthTokenAction(): Promise<void>;
16
- declare const setCartId: (id: string, ctx: StorefrontContext) => Promise<void>;
17
- declare const removeCartId: (ctx: StorefrontContext) => Promise<void>;
18
- declare const setAuthToken: (token: string, ctx: StorefrontContext) => Promise<void>;
19
- declare const removeAuthToken: (ctx: StorefrontContext) => Promise<void>;
20
16
  //#endregion
21
- export { getAuthHeaders, getCacheOptions, getCacheTag, getCartId, removeAuthToken, removeAuthTokenAction, removeCartId, removeCartIdAction, setAuthToken, setAuthTokenAction, setCartId, setCartIdAction };
17
+ export { getAuthHeaders, getCacheOptions, getCacheTag, getCartId, removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction };
22
18
  //# sourceMappingURL=cookies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookies.d.ts","names":[],"sources":["../../../src/lib/data/cookies.ts"],"sourcesContent":[],"mappings":";;;cAEa,sBACN;;AADP,CAAA,GAAa,CAAA,CAAA;AAYA,cAAA,WAAiC,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAiB,EAAjB,iBAAiB,EAAA,GAAA,MAAA;AAUlD,cAAA,eAEN,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAiB,EAAjB,iBAAiB,EAAA,GAAA;EAeX,IAAA,EAAA,MAEZ,EAAA;AAED,CAAA,GAAsB,CAAA,CAAA;AAWA,cAfT,SAe2B,EAAA,CAAA,GAAA,EAfT,iBAeS,EAAA,GAAA,MAAA;AAMlB,iBAjBA,eAAA,CAiBgC,EAAA,EAAA,MAAA,CAAA,EAjBN,OAiBM,CAAA,IAAA,CAAA;AAWhC,iBAjBA,kBAAA,CAAA,CAiBqB,EAjBH,OAiBG,CAAA,IAAA,CAAA;AAM9B,iBAjBS,kBAAA,CAiB2B,KAAiB,EAAA,MAAA,CAAA,EAjBZ,OAiBY,CAAA,IAAA,CAAA;AAMrD,iBAZS,qBAAA,CAAA,CAYkB,EAZG,OAYc,CAAA,IAAA,CAAA;AAM5C,cAZA,SAgBZ,EAJsD,CAAA,EAAA,EAAA,MAAA,EAAA,GAAA,EAZN,iBAYuB,EAAA,GAZN,OAYM,CAAA,IAAA,CAAA;AAM3D,cAZA,YAgBZ,EAJ0C,CAAA,GAAA,EAZH,iBAYoB,EAAA,GAZH,OAYG,CAAA,IAAA,CAAA;cAN/C,mCAA0C,sBAAiB;cAM3D,uBAA8B,sBAAiB"}
1
+ {"version":3,"file":"cookies.d.ts","names":[],"sources":["../../../src/lib/data/cookies.ts"],"sourcesContent":[],"mappings":";;;cAIa,sBACN;;AADP,CAAA,GAAa,CAAA,CAAA;AAYA,cAAA,WAAiC,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAiB,EAAjB,iBAAiB,EAAA,GAAA,MAAA;AAUlD,cAAA,eAEN,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAiB,EAAjB,iBAAiB,EAAA,GAAA;EAeX,IAAA,EAAA,MAEZ,EAAA;AAED,CAAA,GAAsB,CAAA,CAAA;AAWA,cAfT,SAe2B,EAAA,CAAA,GAAA,EAfT,iBAeS,EAAA,GAAA,MAAA;AAMlB,iBAjBA,eAAA,CAiBgC,EAAA,EAAA,MAAA,CAAA,EAjBN,OAiBM,CAAA,IAAA,CAAA;AAWhC,iBAjBA,kBAAA,CAAA,CAiBqB,EAjBH,OAiBG,CAAA,IAAA,CAAA;iBAXrB,kBAAA,iBAAgC;iBAWhC,qBAAA,CAAA,GAAqB"}
@@ -1,3 +1,5 @@
1
+ 'use server';
2
+
1
3
  //#region src/lib/data/cookies.ts
2
4
  const getAuthHeaders = (ctx) => {
3
5
  const token = ctx.customerToken;
@@ -44,19 +46,7 @@ async function removeAuthTokenAction() {
44
46
  const { cookies } = await import("next/headers");
45
47
  (await cookies()).set("_medusa_jwt", "", { maxAge: -1 });
46
48
  }
47
- const setCartId = async (id, ctx) => {
48
- if (ctx.setCartId) await ctx.setCartId(id);
49
- };
50
- const removeCartId = async (ctx) => {
51
- if (ctx.removeCartId) await ctx.removeCartId();
52
- };
53
- const setAuthToken = async (token, ctx) => {
54
- if (ctx.setAuthToken) await ctx.setAuthToken(token);
55
- };
56
- const removeAuthToken = async (ctx) => {
57
- if (ctx.removeAuthToken) await ctx.removeAuthToken();
58
- };
59
49
 
60
50
  //#endregion
61
- export { getAuthHeaders, getCacheOptions, getCacheTag, getCartId, removeAuthToken, removeAuthTokenAction, removeCartId, removeCartIdAction, setAuthToken, setAuthTokenAction, setCartId, setCartIdAction };
51
+ export { getAuthHeaders, getCacheOptions, getCacheTag, getCartId, removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction };
62
52
  //# sourceMappingURL=cookies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookies.js","names":[],"sources":["../../../src/lib/data/cookies.ts"],"sourcesContent":["import type { StorefrontContext } from './context';\n\nexport const getAuthHeaders = (\n ctx: StorefrontContext\n): { authorization: string } | {} => {\n const token = ctx.customerToken;\n\n if (!token) {\n return {};\n }\n\n return { authorization: `Bearer ${token}` };\n};\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\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\nexport const setCartId = async (id: string, ctx: StorefrontContext) => {\n if (ctx.setCartId) {\n await ctx.setCartId(id);\n }\n};\n\nexport const removeCartId = async (ctx: StorefrontContext) => {\n if (ctx.removeCartId) {\n await ctx.removeCartId();\n }\n};\n\nexport const setAuthToken = async (token: string, ctx: StorefrontContext) => {\n if (ctx.setAuthToken) {\n await ctx.setAuthToken(token);\n }\n};\n\nexport const removeAuthToken = async (ctx: StorefrontContext) => {\n if (ctx.removeAuthToken) {\n await ctx.removeAuthToken();\n }\n};\n"],"mappings":";AAEA,MAAa,kBACX,QACmC;CACnC,MAAM,QAAQ,IAAI;AAElB,KAAI,CAAC,MACH,QAAO,EAAE;AAGX,QAAO,EAAE,eAAe,UAAU,SAAS;;AAG7C,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;;AAGb,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;;AAG1C,MAAa,YAAY,OAAO,IAAY,QAA2B;AACrE,KAAI,IAAI,UACN,OAAM,IAAI,UAAU,GAAG;;AAI3B,MAAa,eAAe,OAAO,QAA2B;AAC5D,KAAI,IAAI,aACN,OAAM,IAAI,cAAc;;AAI5B,MAAa,eAAe,OAAO,OAAe,QAA2B;AAC3E,KAAI,IAAI,aACN,OAAM,IAAI,aAAa,MAAM;;AAIjC,MAAa,kBAAkB,OAAO,QAA2B;AAC/D,KAAI,IAAI,gBACN,OAAM,IAAI,iBAAiB"}
1
+ {"version":3,"file":"cookies.js","names":[],"sources":["../../../src/lib/data/cookies.ts"],"sourcesContent":["'use server';\n\nimport type { StorefrontContext } from './context';\n\nexport const getAuthHeaders = (\n ctx: StorefrontContext\n): { authorization: string } | {} => {\n const token = ctx.customerToken;\n\n if (!token) {\n return {};\n }\n\n return { authorization: `Bearer ${token}` };\n};\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\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":";;;AAIA,MAAa,kBACX,QACmC;CACnC,MAAM,QAAQ,IAAI;AAElB,KAAI,CAAC,MACH,QAAO,EAAE;AAGX,QAAO,EAAE,eAAe,UAAU,SAAS;;AAG7C,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;;AAGb,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 +1 @@
1
- {"version":3,"file":"customer.d.ts","names":[],"sources":["../../../src/lib/data/customer.ts"],"sourcesContent":[],"mappings":";;;;cAkBa,oBACN,sBACJ,QAAQ;cAgCE,wBACN,sBACJ,QAAQ"}
1
+ {"version":3,"file":"customer.d.ts","names":[],"sources":["../../../src/lib/data/customer.ts"],"sourcesContent":[],"mappings":";;;;cAkBa,oBACN,sBACJ,QAAQ;cAiCE,wBACN,sBACJ,QAAQ"}
@@ -1,8 +1,8 @@
1
+ import { getCacheTag, getCartId } from "./cookies.js";
1
2
  import { createServerApolloClient, graphqlFetch, graphqlMutation } from "../gql/apollo-client.js";
2
3
  import { TRANSFER_CART_MUTATION } from "../gql/mutations/cart.js";
3
- import { GET_CUSTOMER_QUERY } from "../gql/queries/customer.js";
4
4
  import { medusaError } from "../utils/medusa-error.js";
5
- import { getCacheTag, getCartId } from "./cookies.js";
5
+ 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) => {
@@ -13,9 +13,9 @@ const transferCart = async (ctx) => {
13
13
  mutation: TRANSFER_CART_MUTATION,
14
14
  variables: { cartId }
15
15
  }))?.transferCart ?? null;
16
- if (cart && ctx.revalidate) {
17
- const cartCacheTag = getCacheTag("carts", ctx);
18
- ctx.revalidate(cartCacheTag);
16
+ if (cart) {
17
+ const { revalidateTag } = await import("next/cache");
18
+ revalidateTag(getCacheTag("carts", ctx));
19
19
  }
20
20
  return cart;
21
21
  } catch (err) {
@@ -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';\n\nexport const transferCart = async (\n ctx: StorefrontContext\n): Promise<TransferCartMutation['transferCart'] | null> => {\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 mutation: TRANSFER_CART_MUTATION,\n variables: {\n cartId,\n },\n });\n\n const cart = result?.transferCart ?? null;\n\n if (cart && ctx.revalidate) {\n const cartCacheTag = getCacheTag('carts', ctx);\n ctx.revalidate(cartCacheTag);\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\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\n return customer;\n } catch {\n return null;\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,eAAe,OAC1B,QACyD;CACzD,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,QAAO;AAGT,KAAI;EAWF,MAAM,QAVS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW,EACT,QACD;GACF,CAAC,GAEmB,gBAAgB;AAErC,MAAI,QAAQ,IAAI,YAAY;GAC1B,MAAM,eAAe,YAAY,SAAS,IAAI;AAC9C,OAAI,WAAW,aAAa;;AAG9B,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;AAChB,SAAO;;;AAIX,MAAa,mBAAmB,OAC9B,QAC6B;CAC7B,MAAM,eAAe,IAAI;CACzB,MAAM,eAAe,yBAAyB,aAAa;AAE3D,KAAI;AAYF,SAXiB,MAAM,aAIrB;GACE,OAAO;GACP,aAAa;GACd,EACD,aACD,CAAC,MAAM,aAAa,UAAU,MAAM,KAAK;SAGpC;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';\n\nexport const transferCart = async (\n ctx: StorefrontContext\n): Promise<TransferCartMutation['transferCart'] | null> => {\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 mutation: TRANSFER_CART_MUTATION,\n variables: {\n cartId,\n },\n });\n\n const cart = result?.transferCart ?? null;\n\n if (cart) {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\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\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\n return customer;\n } catch {\n return null;\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,eAAe,OAC1B,QACyD;CACzD,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,QAAO;AAGT,KAAI;EAWF,MAAM,QAVS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW,EACT,QACD;GACF,CAAC,GAEmB,gBAAgB;AAErC,MAAI,MAAM;GACR,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,iBADqB,YAAY,SAAS,IAAI,CACnB;;AAG7B,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;AAChB,SAAO;;;AAIX,MAAa,mBAAmB,OAC9B,QAC6B;CAC7B,MAAM,eAAe,IAAI;CACzB,MAAM,eAAe,yBAAyB,aAAa;AAE3D,KAAI;AAYF,SAXiB,MAAM,aAIrB;GACE,OAAO;GACP,aAAa;GACd,EACD,aACD,CAAC,MAAM,aAAa,UAAU,MAAM,KAAK;SAGpC;AACN,SAAO"}
@@ -2,7 +2,7 @@ import { StorefrontContext } from "./context.js";
2
2
 
3
3
  //#region src/lib/data/next-context.d.ts
4
4
  declare const resolveNextContext: () => Promise<StorefrontContext>;
5
- declare function updateRegionAction(countryCode: string, currentPath: string): Promise<void>;
5
+ declare function updateRegionAction(countryCode: string, currentPath: string, ctx?: StorefrontContext): Promise<void>;
6
6
  //#endregion
7
7
  export { resolveNextContext, updateRegionAction };
8
8
  //# sourceMappingURL=next-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-context.d.ts","names":[],"sources":["../../../src/lib/data/next-context.ts"],"sourcesContent":[],"mappings":";;;cAkBa,0BAA+B,QAAQ;iBAiB9B,kBAAA,4CAED"}
1
+ {"version":3,"file":"next-context.d.ts","names":[],"sources":["../../../src/lib/data/next-context.ts"],"sourcesContent":[],"mappings":";;;cAWa,0BAA+B,QAAQ;iBAW9B,kBAAA,iDAGd,oBAAiB"}
@@ -1,6 +1,6 @@
1
1
  'use server';
2
2
 
3
- import { getCacheTag, getCartId, removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction } from "./cookies.js";
3
+ import { getCacheTag, getCartId } from "./cookies.js";
4
4
  import { updateCart } from "./cart.js";
5
5
  import { getRegion } from "./regions.js";
6
6
  import { redirect } from "next/navigation";
@@ -14,26 +14,20 @@ const resolveNextContext = async () => {
14
14
  cartId: cookieStore.get("_medusa_cart_id")?.value ?? "",
15
15
  customerToken: cookieStore.get("_medusa_jwt")?.value ?? "",
16
16
  cacheId: cookieStore.get("_medusa_cache_id")?.value ?? "",
17
- cookieHeader: cookieStore.toString(),
18
- revalidate: (tag) => revalidateTag(tag),
19
- updateRegion: updateRegionAction,
20
- setCartId: setCartIdAction,
21
- removeCartId: removeCartIdAction,
22
- setAuthToken: setAuthTokenAction,
23
- removeAuthToken: removeAuthTokenAction
17
+ cookieHeader: cookieStore.toString()
24
18
  };
25
19
  };
26
- async function updateRegionAction(countryCode, currentPath) {
27
- const ctx = await resolveNextContext();
28
- const cartId = getCartId(ctx);
29
- const region = await getRegion(countryCode, ctx);
20
+ async function updateRegionAction(countryCode, currentPath, ctx) {
21
+ const context = ctx || await resolveNextContext();
22
+ const cartId = getCartId(context);
23
+ const region = await getRegion(countryCode, context);
30
24
  if (!region) throw new Error(`Region not found for country code: ${countryCode}`);
31
25
  if (cartId) {
32
- await updateCart({ regionId: region.id }, ctx);
33
- revalidateTag(getCacheTag("carts", ctx));
26
+ await updateCart({ regionId: region.id }, context);
27
+ revalidateTag(getCacheTag("carts", context));
34
28
  }
35
- revalidateTag(getCacheTag("regions", ctx));
36
- revalidateTag(getCacheTag("products", ctx));
29
+ revalidateTag(getCacheTag("regions", context));
30
+ revalidateTag(getCacheTag("products", context));
37
31
  redirect(`/${countryCode}${currentPath}`);
38
32
  }
39
33
 
@@ -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 {\n getCacheTag,\n getCartId,\n removeAuthTokenAction,\n removeCartIdAction,\n setAuthTokenAction,\n setCartIdAction,\n} from './cookies';\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 customerToken: cookieStore.get('_medusa_jwt')?.value ?? '',\n cacheId: cookieStore.get('_medusa_cache_id')?.value ?? '',\n cookieHeader: cookieStore.toString(),\n revalidate: (tag: string) => revalidateTag(tag),\n updateRegion: updateRegionAction,\n setCartId: setCartIdAction,\n removeCartId: removeCartIdAction,\n setAuthToken: setAuthTokenAction,\n removeAuthToken: removeAuthTokenAction,\n };\n};\n\nexport async function updateRegionAction(\n countryCode: string,\n currentPath: string\n) {\n const ctx = await resolveNextContext();\n const cartId = getCartId(ctx);\n const region = await getRegion(countryCode, ctx);\n\n if (!region) {\n throw new Error(`Region not found for country code: ${countryCode}`);\n }\n\n if (cartId) {\n await updateCart({ regionId: region.id }, ctx);\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n }\n\n const regionCacheTag = getCacheTag('regions', ctx);\n revalidateTag(regionCacheTag);\n\n const productsCacheTag = getCacheTag('products', ctx);\n revalidateTag(productsCacheTag);\n\n redirect(`/${countryCode}${currentPath}`);\n}\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,qBAAqB,YAAwC;CACxE,MAAM,cAAc,MAAM,SAAS;AAEnC,QAAO;EACL,QAAQ,YAAY,IAAI,kBAAkB,EAAE,SAAS;EACrD,eAAe,YAAY,IAAI,cAAc,EAAE,SAAS;EACxD,SAAS,YAAY,IAAI,mBAAmB,EAAE,SAAS;EACvD,cAAc,YAAY,UAAU;EACpC,aAAa,QAAgB,cAAc,IAAI;EAC/C,cAAc;EACd,WAAW;EACX,cAAc;EACd,cAAc;EACd,iBAAiB;EAClB;;AAGH,eAAsB,mBACpB,aACA,aACA;CACA,MAAM,MAAM,MAAM,oBAAoB;CACtC,MAAM,SAAS,UAAU,IAAI;CAC7B,MAAM,SAAS,MAAM,UAAU,aAAa,IAAI;AAEhD,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,sCAAsC,cAAc;AAGtE,KAAI,QAAQ;AACV,QAAM,WAAW,EAAE,UAAU,OAAO,IAAI,EAAE,IAAI;AAE9C,gBADqB,YAAY,SAAS,IAAI,CACnB;;AAI7B,eADuB,YAAY,WAAW,IAAI,CACrB;AAG7B,eADyB,YAAY,YAAY,IAAI,CACtB;AAE/B,UAAS,IAAI,cAAc,cAAc"}
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';\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 customerToken: cookieStore.get('_medusa_jwt')?.value ?? '',\n cacheId: cookieStore.get('_medusa_cache_id')?.value ?? '',\n cookieHeader: cookieStore.toString(),\n };\n};\n\nexport async function updateRegionAction(\n countryCode: string,\n currentPath: string,\n ctx?: StorefrontContext\n) {\n const context = ctx || (await resolveNextContext());\n const cartId = getCartId(context);\n const region = await getRegion(countryCode, context);\n\n if (!region) {\n throw new Error(`Region not found for country code: ${countryCode}`);\n }\n\n if (cartId) {\n await updateCart({ regionId: region.id }, context);\n const cartCacheTag = getCacheTag('carts', context);\n revalidateTag(cartCacheTag);\n }\n\n const regionCacheTag = getCacheTag('regions', context);\n revalidateTag(regionCacheTag);\n\n const productsCacheTag = getCacheTag('products', context);\n revalidateTag(productsCacheTag);\n\n redirect(`/${countryCode}${currentPath}`);\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,qBAAqB,YAAwC;CACxE,MAAM,cAAc,MAAM,SAAS;AAEnC,QAAO;EACL,QAAQ,YAAY,IAAI,kBAAkB,EAAE,SAAS;EACrD,eAAe,YAAY,IAAI,cAAc,EAAE,SAAS;EACxD,SAAS,YAAY,IAAI,mBAAmB,EAAE,SAAS;EACvD,cAAc,YAAY,UAAU;EACrC;;AAGH,eAAsB,mBACpB,aACA,aACA,KACA;CACA,MAAM,UAAU,OAAQ,MAAM,oBAAoB;CAClD,MAAM,SAAS,UAAU,QAAQ;CACjC,MAAM,SAAS,MAAM,UAAU,aAAa,QAAQ;AAEpD,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,sCAAsC,cAAc;AAGtE,KAAI,QAAQ;AACV,QAAM,WAAW,EAAE,UAAU,OAAO,IAAI,EAAE,QAAQ;AAElD,gBADqB,YAAY,SAAS,QAAQ,CACvB;;AAI7B,eADuB,YAAY,WAAW,QAAQ,CACzB;AAG7B,eADyB,YAAY,YAAY,QAAQ,CAC1B;AAE/B,UAAS,IAAI,cAAc,cAAc"}
@@ -1,6 +1,6 @@
1
- import { medusaError } from "../utils/medusa-error.js";
2
1
  import { getAuthHeaders, getCacheOptions } from "./cookies.js";
3
2
  import { sdk } from "../config/medusa.js";
3
+ import { medusaError } from "../utils/medusa-error.js";
4
4
  import { normalizeOrder } from "../utils/normalize-functions.js";
5
5
 
6
6
  //#region src/lib/data/orders.ts
@@ -1,6 +1,6 @@
1
- import { medusaError } from "../utils/medusa-error.js";
2
1
  import { getCacheOptions } from "./cookies.js";
3
2
  import { sdk } from "../config/medusa.js";
3
+ import { medusaError } from "../utils/medusa-error.js";
4
4
  import { normalizeRegion } from "../utils/normalize-functions.js";
5
5
 
6
6
  //#region src/lib/data/regions.ts
@@ -0,0 +1,8 @@
1
+ //#region src/lib/globals/expose-globals.d.ts
2
+ declare global {
3
+ interface Window {
4
+ __GFED_GLOBALS__: Record<string, unknown>;
5
+ __MFE_BUNDLE_URL__?: string;
6
+ }
7
+ }
8
+ //# sourceMappingURL=expose-globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expose-globals.d.ts","names":[],"sources":["../../../src/lib/globals/expose-globals.ts"],"sourcesContent":[],"mappings":";;;sBAasB;IAAA,kBAAM,CAAA,EAAA,MAAA;EAAA"}
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+
3
+ import * as React$1 from "react";
4
+ import Medusa from "@medusajs/js-sdk";
5
+ import * as Apollo from "@apollo/client";
6
+ import * as SWRNamespace from "swr";
7
+ import useSWR from "swr";
8
+ import * as ReactDOM from "react-dom";
9
+ import * as ReactDOMClient from "react-dom/client";
10
+
11
+ //#region src/lib/globals/expose-globals.ts
12
+ if (typeof window !== "undefined") {
13
+ const SWR = Object.assign(useSWR, SWRNamespace);
14
+ if (!SWR.default) SWR.default = SWR;
15
+ const globals = {
16
+ React: React$1,
17
+ ReactDOM,
18
+ ReactDOMClient,
19
+ Apollo,
20
+ SWR,
21
+ Medusa
22
+ };
23
+ window.__GFED_GLOBALS__ = Object.freeze(globals);
24
+ if (window.__MFE_BUNDLE_URL__) {
25
+ const script = document.createElement("script");
26
+ script.src = window.__MFE_BUNDLE_URL__;
27
+ document.body.appendChild(script);
28
+ }
29
+ }
30
+
31
+ //#endregion
32
+ //# sourceMappingURL=expose-globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expose-globals.js","names":[],"sources":["../../../src/lib/globals/expose-globals.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as ReactDOM from 'react-dom';\nimport * as ReactDOMClient from 'react-dom/client';\nimport useSWR, * as SWRNamespace from 'swr';\n\nimport * as Apollo from '@apollo/client';\nimport Medusa from '@medusajs/js-sdk';\n\ndeclare global {\n interface Window {\n __GFED_GLOBALS__: Record<string, unknown>;\n __MFE_BUNDLE_URL__?: string;\n }\n}\n\nif (typeof window !== 'undefined') {\n const SWR = Object.assign(useSWR, SWRNamespace);\n if (!SWR.default) SWR.default = SWR;\n const globals = {\n React,\n ReactDOM,\n ReactDOMClient,\n Apollo,\n SWR,\n Medusa,\n };\n\n window.__GFED_GLOBALS__ = Object.freeze(globals);\n\n if (window.__MFE_BUNDLE_URL__) {\n const script = document.createElement('script');\n script.src = window.__MFE_BUNDLE_URL__;\n document.body.appendChild(script);\n }\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAI,OAAO,WAAW,aAAa;CACjC,MAAM,MAAM,OAAO,OAAO,QAAQ,aAAa;AAC/C,KAAI,CAAC,IAAI,QAAS,KAAI,UAAU;CAChC,MAAM,UAAU;EACd;EACA;EACA;EACA;EACA;EACA;EACD;AAED,QAAO,mBAAmB,OAAO,OAAO,QAAQ;AAEhD,KAAI,OAAO,oBAAoB;EAC7B,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,SAAO,MAAM,OAAO;AACpB,WAAS,KAAK,YAAY,OAAO"}
@@ -1,14 +1,14 @@
1
- import * as _apollo_client0 from "@apollo/client";
1
+ import * as _apollo_client7 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_client7.DocumentNode;
5
+ declare const COUNTRY_FRAGMENT: _apollo_client7.DocumentNode;
6
+ declare const REGION_FRAGMENT: _apollo_client7.DocumentNode;
7
+ declare const SHIPPING_METHODS_FRAGMENT: _apollo_client7.DocumentNode;
8
+ declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client7.DocumentNode;
9
+ declare const ADDRESS_FRAGMENT: _apollo_client7.DocumentNode;
10
+ declare const PROMOTION_FRAGMENT: _apollo_client7.DocumentNode;
11
+ declare const CART_FRAGMENT: _apollo_client7.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_client8 from "@apollo/client";
1
+ import * as _apollo_client17 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/customer.d.ts
4
- declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client8.DocumentNode;
5
- declare const CUSTOMER_FRAGMENT: _apollo_client8.DocumentNode;
4
+ declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client17.DocumentNode;
5
+ declare const CUSTOMER_FRAGMENT: _apollo_client17.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,eAAA,CAlBqC;cAoBzB,mBAeZ,eAAA,CAf6B"}
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 _apollo_client10 from "@apollo/client";
1
+ import * as _apollo_client19 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/product.d.ts
4
- declare const PRICE_FRAGMENT: _apollo_client10.DocumentNode;
5
- declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client10.DocumentNode;
6
- declare const PRODUCT_HIT_FRAGMENT: _apollo_client10.DocumentNode;
7
- declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client10.DocumentNode;
8
- declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client10.DocumentNode;
9
- declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client10.DocumentNode;
10
- declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client10.DocumentNode;
4
+ declare const PRICE_FRAGMENT: _apollo_client19.DocumentNode;
5
+ declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client19.DocumentNode;
6
+ declare const PRODUCT_HIT_FRAGMENT: _apollo_client19.DocumentNode;
7
+ declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client19.DocumentNode;
8
+ declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client19.DocumentNode;
9
+ declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client19.DocumentNode;
10
+ declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client19.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,9 @@
1
- import * as _apollo_client17 from "@apollo/client";
1
+ import * as _apollo_client2 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/mutations/cart.d.ts
4
- declare const UPDATE_CART_MUTATION: _apollo_client17.DocumentNode;
5
- declare const DELETE_LINE_ITEM_MUTATION: _apollo_client17.DocumentNode;
6
- declare const TRANSFER_CART_MUTATION: _apollo_client17.DocumentNode;
4
+ declare const UPDATE_CART_MUTATION: _apollo_client2.DocumentNode;
5
+ declare const DELETE_LINE_ITEM_MUTATION: _apollo_client2.DocumentNode;
6
+ declare const TRANSFER_CART_MUTATION: _apollo_client2.DocumentNode;
7
7
  //#endregion
8
8
  export { DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
9
9
  //# sourceMappingURL=cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/mutations/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,sBAgBZ,gBAAA,CAhBgC;cAkBpB,2BAQZ,gBAAA,CARqC;cAUzB,wBAOZ,gBAAA,CAPkC"}
1
+ {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/mutations/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,sBAgBZ,eAAA,CAhBgC;cAkBpB,2BAQZ,eAAA,CARqC;cAUzB,wBAOZ,eAAA,CAPkC"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client21 from "@apollo/client";
1
+ import * as _apollo_client5 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/cart.d.ts
4
- declare const GET_CART_QUERY: _apollo_client21.DocumentNode;
4
+ declare const GET_CART_QUERY: _apollo_client5.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,7 @@
1
- import * as _apollo_client20 from "@apollo/client";
1
+ import * as _apollo_client6 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/collections.d.ts
4
- declare const GET_COLLECTIONS_QUERY: _apollo_client20.DocumentNode;
4
+ declare const GET_COLLECTIONS_QUERY: _apollo_client6.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_COLLECTIONS_QUERY };
7
7
  //# 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":";;;cAOa,uBAWZ,eAAA,CAXiC"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client22 from "@apollo/client";
1
+ import * as _apollo_client15 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/customer.d.ts
4
- declare const GET_CUSTOMER_QUERY: _apollo_client22.DocumentNode;
4
+ declare const GET_CUSTOMER_QUERY: _apollo_client15.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_CUSTOMER_QUERY };
7
7
  //# sourceMappingURL=customer.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client23 from "@apollo/client";
1
+ import * as _apollo_client16 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/footer.d.ts
4
- declare const GET_FOOTER_QUERY: _apollo_client23.DocumentNode;
4
+ declare const GET_FOOTER_QUERY: _apollo_client16.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_FOOTER_QUERY };
7
7
  //# sourceMappingURL=footer.d.ts.map
@@ -1,8 +1,8 @@
1
- import * as _apollo_client24 from "@apollo/client";
1
+ import * as _apollo_client0 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/product.d.ts
4
- declare const SEARCH_SUGGESTIONS_QUERY: _apollo_client24.DocumentNode;
5
- declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client24.DocumentNode;
4
+ declare const SEARCH_SUGGESTIONS_QUERY: _apollo_client0.DocumentNode;
5
+ declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client0.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_PRODUCT_CATEGORIES_QUERY, SEARCH_SUGGESTIONS_QUERY };
8
8
  //# sourceMappingURL=product.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/product.ts"],"sourcesContent":[],"mappings":";;;cAOa,0BASZ,gBAAA,CAToC;cAWxB,8BA4BZ,gBAAA,CA5BwC"}
1
+ {"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/product.ts"],"sourcesContent":[],"mappings":";;;cAOa,0BASZ,eAAA,CAToC;cAWxB,8BA4BZ,eAAA,CA5BwC"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client7 from "@apollo/client";
1
+ import * as _apollo_client0 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/hooks/use-apollo.d.ts
4
- declare function useApollo(): _apollo_client7.ApolloClient;
4
+ declare function useApollo(): _apollo_client0.ApolloClient;
5
5
  //#endregion
6
6
  export { useApollo };
7
7
  //# sourceMappingURL=use-apollo.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { Cart } from "../../types/graphql.js";
2
+ import * as swr0 from "swr";
3
+
4
+ //#region src/lib/hooks/use-cart.d.ts
5
+ declare const CART_SWR_KEY = "medusa-cart";
6
+ declare const useCart: () => {
7
+ cart: Cart | null | undefined;
8
+ error: any;
9
+ isLoading: boolean;
10
+ mutate: swr0.KeyedMutator<Cart | null>;
11
+ };
12
+ declare const mutateCart: () => Promise<any>;
13
+ //#endregion
14
+ export { CART_SWR_KEY, mutateCart, useCart };
15
+ //# sourceMappingURL=use-cart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-cart.d.ts","names":[],"sources":["../../../src/lib/hooks/use-cart.ts"],"sourcesContent":[],"mappings":";;;;cAMa,YAAA;cAEA;;EAFA,KAAA,EAAA,GAAA;EAEA,SAAA,EAmBZ,OAAA;;;cAEY,kBAAU"}
@@ -0,0 +1,26 @@
1
+ import { retrieveCart } from "../data/cart.js";
2
+ import { useStorefrontContext } from "../data/context.js";
3
+ import useSWR, { mutate } from "swr";
4
+
5
+ //#region src/lib/hooks/use-cart.ts
6
+ const CART_SWR_KEY = "medusa-cart";
7
+ const useCart = () => {
8
+ const ctx = useStorefrontContext();
9
+ const { data, error, isLoading, mutate: swrMutate } = useSWR(CART_SWR_KEY, () => retrieveCart(ctx), {
10
+ revalidateOnFocus: true,
11
+ revalidateOnReconnect: true
12
+ });
13
+ return {
14
+ cart: data,
15
+ error,
16
+ isLoading,
17
+ mutate: swrMutate
18
+ };
19
+ };
20
+ const mutateCart = () => {
21
+ return mutate(CART_SWR_KEY);
22
+ };
23
+
24
+ //#endregion
25
+ export { CART_SWR_KEY, mutateCart, useCart };
26
+ //# sourceMappingURL=use-cart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-cart.js","names":[],"sources":["../../../src/lib/hooks/use-cart.ts"],"sourcesContent":["import useSWR, { mutate } from 'swr';\n\nimport { Cart } from '../../types/graphql';\nimport { retrieveCart } from '../data/cart';\nimport { useStorefrontContext } from '../data/context';\n\nexport const CART_SWR_KEY = 'medusa-cart';\n\nexport const useCart = () => {\n const ctx = useStorefrontContext();\n\n const {\n data,\n error,\n isLoading,\n mutate: swrMutate,\n } = useSWR<Cart | null>(CART_SWR_KEY, () => retrieveCart(ctx), {\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n });\n\n return {\n cart: data,\n error,\n isLoading,\n mutate: swrMutate,\n };\n};\n\nexport const mutateCart = () => {\n return mutate(CART_SWR_KEY);\n};\n"],"mappings":";;;;;AAMA,MAAa,eAAe;AAE5B,MAAa,gBAAgB;CAC3B,MAAM,MAAM,sBAAsB;CAElC,MAAM,EACJ,MACA,OACA,WACA,QAAQ,cACN,OAAoB,oBAAoB,aAAa,IAAI,EAAE;EAC7D,mBAAmB;EACnB,uBAAuB;EACxB,CAAC;AAEF,QAAO;EACL,MAAM;EACN;EACA;EACA,QAAQ;EACT;;AAGH,MAAa,mBAAmB;AAC9B,QAAO,OAAO,aAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gfed-medusa/sf-lib-common",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -39,17 +39,18 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@apollo/client": "^4.0.9",
42
- "@gfed-medusa/sf-lib-ui": "^1.2.0",
42
+ "@gfed-medusa/sf-lib-ui": "^1.2.1",
43
43
  "@headlessui/react": "^2.2.9",
44
+ "@medusajs/icons": "^2.12.1",
44
45
  "@medusajs/js-sdk": "^2.12.1",
45
46
  "@medusajs/types": "^2.12.1",
46
- "@medusajs/icons": "^2.12.1",
47
47
  "@medusajs/ui": "^4.0.29",
48
48
  "class-variance-authority": "^0.7.1",
49
49
  "isomorphic-dompurify": "^2.34.0",
50
50
  "lucide-react": "^0.556.0",
51
51
  "react-country-flag": "^3.1.0",
52
- "server-only": "^0.0.1"
52
+ "server-only": "^0.0.1",
53
+ "swr": "^2.3.8"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@graphql-codegen/cli": "^6.0.0",
@@ -78,11 +79,11 @@
78
79
  "@packages/typescript-config": "0.0.0"
79
80
  },
80
81
  "peerDependencies": {
82
+ "@medusajs/ui": "^4.0.29",
81
83
  "next": "^15.3.8",
82
84
  "react": "^19.0.0",
83
85
  "react-dom": "^19.0.0",
84
- "tailwindcss": "^4.1.18",
85
- "@medusajs/ui": "^4.0.29"
86
+ "tailwindcss": "^4.1.18"
86
87
  },
87
88
  "scripts": {
88
89
  "build": "tsdown",