@gfed-medusa/sf-lib-common 3.0.0 → 3.1.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 (43) 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/error-message/index.d.ts +2 -2
  7. package/dist/components/free-shipping-price-nudge/index.d.ts +2 -2
  8. package/dist/components/interactive-link/index.d.ts +2 -2
  9. package/dist/components/interactive-link/index.d.ts.map +1 -1
  10. package/dist/components/line-item-options/index.d.ts +2 -2
  11. package/dist/components/line-item-options/index.d.ts.map +1 -1
  12. package/dist/components/line-item-price/index.d.ts +2 -2
  13. package/dist/components/line-item-price/index.d.ts.map +1 -1
  14. package/dist/components/localized-client-link/index.d.ts +6 -7
  15. package/dist/components/localized-client-link/index.d.ts.map +1 -1
  16. package/dist/components/localized-client-link/index.js +26 -6
  17. package/dist/components/localized-client-link/index.js.map +1 -1
  18. package/dist/components/modal/index.d.ts +2 -2
  19. package/dist/components/modal/index.d.ts.map +1 -1
  20. package/dist/components/preview-price/index.d.ts +2 -2
  21. package/dist/components/product-card/index.d.ts +2 -2
  22. package/dist/components/product-preview/index.d.ts +2 -2
  23. package/dist/lib/data/context.d.ts +2 -2
  24. package/dist/lib/gql/fragments/cart.d.ts +9 -9
  25. package/dist/lib/gql/fragments/customer.d.ts +3 -3
  26. package/dist/lib/gql/fragments/customer.d.ts.map +1 -1
  27. package/dist/lib/gql/mutations/cart.d.ts +6 -6
  28. package/dist/lib/gql/queries/cart.d.ts +2 -2
  29. package/dist/lib/gql/queries/collections.d.ts +2 -2
  30. package/dist/lib/gql/queries/customer.d.ts +2 -2
  31. package/dist/lib/gql/queries/footer.d.ts +2 -2
  32. package/dist/lib/gql/queries/footer.d.ts.map +1 -1
  33. package/dist/lib/gql/queries/order.d.ts +4 -4
  34. package/dist/lib/gql/queries/product.d.ts +3 -3
  35. package/dist/lib/gql/queries/regions.d.ts +3 -3
  36. package/dist/lib/gql/queries/shipping.d.ts +3 -3
  37. package/dist/lib/hooks/use-apollo.d.ts +2 -2
  38. package/dist/lib/hooks/use-apollo.d.ts.map +1 -1
  39. package/dist/lib/hooks/use-customer.d.ts +13 -0
  40. package/dist/lib/hooks/use-customer.d.ts.map +1 -0
  41. package/dist/lib/hooks/use-customer.js +27 -0
  42. package/dist/lib/hooks/use-customer.js.map +1 -0
  43. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime8 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime12 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_runtime12.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_runtime9 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 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_runtime9.JSX.Element | undefined;
8
+ }): react_jsx_runtime11.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_runtime15 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime13 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_runtime15.JSX.Element;
12
+ }) => react_jsx_runtime13.JSX.Element;
13
13
  //#endregion
14
14
  export { DeleteButton };
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime12 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime14 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_runtime12.JSX.Element | null;
10
+ }) => react_jsx_runtime14.JSX.Element | null;
11
11
  //#endregion
12
12
  export { ErrorMessage };
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Cart, ShippingOption } from "../../types/graphql.js";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/free-shipping-price-nudge/index.d.ts
5
5
  declare function ShippingPriceNudge({
@@ -10,7 +10,7 @@ declare function ShippingPriceNudge({
10
10
  variant?: 'popup' | 'inline';
11
11
  cart: Cart;
12
12
  shippingOptions: ShippingOption[];
13
- }): react_jsx_runtime13.JSX.Element | undefined;
13
+ }): react_jsx_runtime15.JSX.Element | undefined;
14
14
  //#endregion
15
15
  export { ShippingPriceNudge };
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime10 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 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_runtime10.JSX.Element;
14
+ }: InteractiveLinkProps) => react_jsx_runtime7.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_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 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_runtime14.JSX.Element;
14
+ }: LineItemOptionsProps) => react_jsx_runtime6.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_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime8 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_runtime11.JSX.Element;
14
+ }: LineItemPriceProps) => react_jsx_runtime8.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,17 +1,16 @@
1
1
  import { AnchorHTMLAttributes, DetailedHTMLProps } from "react";
2
- import * as react_jsx_runtime6 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/localized-client-link/index.d.ts
5
- type LocalizedClientLinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
6
- /**
7
- * Use this component to create an anchor link that persists the current country code in the url,
8
- * without having to explicitly pass it as a prop.
9
- */
5
+ type LocalizedClientLinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & {
6
+ locale?: string;
7
+ };
10
8
  declare const LocalizedClientLink: ({
11
9
  children,
12
10
  href,
11
+ locale,
13
12
  ...props
14
- }: LocalizedClientLinkProps) => react_jsx_runtime6.JSX.Element;
13
+ }: LocalizedClientLinkProps) => react_jsx_runtime9.JSX.Element;
15
14
  //#endregion
16
15
  export { LocalizedClientLink };
17
16
  //# 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,kBAAA,CAAA,GAAA,CAAA,OAZzB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":[],"mappings":";;;;KAWK,wBAAA,GAA2B,kBAC9B,qBAAqB,oBACrB;;;AANa,cAWT,mBAPuB,EAAA,CAAA;EAAA,QAAA;EAAA,IAAA;EAAA,MAAA;EAAA,GAAA;AAAA,CAAA,EAY1B,wBAZ0B,EAAA,GAYF,kBAAA,CAAA,GAAA,CAAA,OAZE"}
@@ -1,13 +1,33 @@
1
+ 'use client';
2
+
3
+ import { useEffect, useState } from "react";
1
4
  import { jsx } from "react/jsx-runtime";
2
5
 
3
6
  //#region src/components/localized-client-link/index.tsx
4
- /**
5
- * Use this component to create an anchor link that persists the current country code in the url,
6
- * without having to explicitly pass it as a prop.
7
- */
8
- const LocalizedClientLink = ({ children, href, ...props }) => {
7
+ const LOCALE_REGEX = /^[a-z]{2}(?:-[A-Z]{2})?$/;
8
+ const LocalizedClientLink = ({ children, href, locale, ...props }) => {
9
+ const [pathname, setPathname] = useState("");
10
+ useEffect(() => {
11
+ setPathname(window.location.pathname);
12
+ }, []);
13
+ const getLocaleFromPathname = (pathname$1) => {
14
+ const pathLocale = pathname$1.split("/")[1];
15
+ if (pathLocale && LOCALE_REGEX.test(pathLocale)) return pathLocale;
16
+ return "dk";
17
+ };
18
+ const activeLocale = locale || getLocaleFromPathname(pathname);
19
+ const normalizeHref = (href$1) => {
20
+ if (!href$1) return "";
21
+ return href$1.startsWith("/") ? href$1 : `/${href$1}`;
22
+ };
23
+ if (href?.startsWith("http") || href?.startsWith("//")) return /* @__PURE__ */ jsx("a", {
24
+ href,
25
+ ...props,
26
+ children
27
+ });
9
28
  return /* @__PURE__ */ jsx("a", {
10
- href: `/dk${href}`,
29
+ href: `/${activeLocale}${normalizeHref(href)}`,
30
+ suppressHydrationWarning: true,
11
31
  ...props,
12
32
  children
13
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, DetailedHTMLProps } from 'react';\n\ntype LocalizedClientLinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n>;\n\n/**\n * Use this component to create an anchor link that persists the current country code in the url,\n * without having to explicitly pass it as a prop.\n */\nconst LocalizedClientLink = ({\n children,\n href,\n ...props\n}: LocalizedClientLinkProps) => {\n return (\n <a href={`/dk${href}`} {...props}>\n {children}\n </a>\n );\n};\n\nexport { LocalizedClientLink };\n"],"mappings":";;;;;;;AAWA,MAAM,uBAAuB,EAC3B,UACA,MACA,GAAG,YAC2B;AAC9B,QACE,oBAAC;EAAE,MAAM,MAAM;EAAQ,GAAI;EACxB;GACC"}
1
+ {"version":3,"file":"index.js","names":["pathname","href"],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n AnchorHTMLAttributes,\n DetailedHTMLProps,\n useEffect,\n useState,\n} from 'react';\n\nconst LOCALE_REGEX = /^[a-z]{2}(?:-[A-Z]{2})?$/;\n\ntype LocalizedClientLinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> & {\n locale?: string;\n};\n\nconst LocalizedClientLink = ({\n children,\n href,\n locale,\n ...props\n}: LocalizedClientLinkProps) => {\n const [pathname, setPathname] = useState('');\n\n useEffect(() => {\n setPathname(window.location.pathname);\n }, []);\n\n const getLocaleFromPathname = (pathname: string): string => {\n const pathLocale = pathname.split('/')[1];\n if (pathLocale && LOCALE_REGEX.test(pathLocale)) {\n return pathLocale;\n }\n return 'dk';\n };\n\n const activeLocale = locale || getLocaleFromPathname(pathname);\n\n const normalizeHref = (href?: string) => {\n if (!href) return '';\n return href.startsWith('/') ? href : `/${href}`;\n };\n\n if (href?.startsWith('http') || href?.startsWith('//')) {\n return (\n <a href={href} {...props}>\n {children}\n </a>\n );\n }\n\n return (\n <a\n href={`/${activeLocale}${normalizeHref(href)}`}\n suppressHydrationWarning\n {...props}\n >\n {children}\n </a>\n );\n};\n\nexport { LocalizedClientLink };\n"],"mappings":";;;;;;AASA,MAAM,eAAe;AASrB,MAAM,uBAAuB,EAC3B,UACA,MACA,QACA,GAAG,YAC2B;CAC9B,MAAM,CAAC,UAAU,eAAe,SAAS,GAAG;AAE5C,iBAAgB;AACd,cAAY,OAAO,SAAS,SAAS;IACpC,EAAE,CAAC;CAEN,MAAM,yBAAyB,eAA6B;EAC1D,MAAM,aAAaA,WAAS,MAAM,IAAI,CAAC;AACvC,MAAI,cAAc,aAAa,KAAK,WAAW,CAC7C,QAAO;AAET,SAAO;;CAGT,MAAM,eAAe,UAAU,sBAAsB,SAAS;CAE9D,MAAM,iBAAiB,WAAkB;AACvC,MAAI,CAACC,OAAM,QAAO;AAClB,SAAOA,OAAK,WAAW,IAAI,GAAGA,SAAO,IAAIA;;AAG3C,KAAI,MAAM,WAAW,OAAO,IAAI,MAAM,WAAW,KAAK,CACpD,QACE,oBAAC;EAAQ;EAAM,GAAI;EAChB;GACC;AAIR,QACE,oBAAC;EACC,MAAM,IAAI,eAAe,cAAc,KAAK;EAC5C;EACA,GAAI;EAEH;GACC"}
@@ -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_runtime10 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_runtime0.JSX.Element;
23
+ }: ModalProps): react_jsx_runtime10.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,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
+ {"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,12 +1,12 @@
1
1
  import { VariantPrice } from "../../types/prices.js";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 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_runtime0.JSX.Element | null;
9
+ }): react_jsx_runtime5.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_runtime0 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_runtime0.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_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 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_runtime7.JSX.Element;
12
+ }: ProductPreviewProps): react_jsx_runtime0.JSX.Element;
13
13
  //#endregion
14
14
  export { ProductPreview, ProductPreviewProps };
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { useStorefrontActions } from "./client-actions.js";
2
2
  import { ReactNode } from "react";
3
- import * as react_jsx_runtime5 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime4 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_runtime5.JSX.Element;
18
+ }: StorefrontProviderProps) => react_jsx_runtime4.JSX.Element;
19
19
  declare const useStorefrontContext: () => StorefrontContext;
20
20
  //#endregion
21
21
  export { StorefrontContext, StorefrontProvider, useStorefrontActions, useStorefrontContext };
@@ -1,14 +1,14 @@
1
- import * as _apollo_client0 from "@apollo/client";
1
+ import * as _apollo_client1 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_client1.DocumentNode;
5
+ declare const COUNTRY_FRAGMENT: _apollo_client1.DocumentNode;
6
+ declare const REGION_FRAGMENT: _apollo_client1.DocumentNode;
7
+ declare const SHIPPING_METHODS_FRAGMENT: _apollo_client1.DocumentNode;
8
+ declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client1.DocumentNode;
9
+ declare const ADDRESS_FRAGMENT: _apollo_client1.DocumentNode;
10
+ declare const PROMOTION_FRAGMENT: _apollo_client1.DocumentNode;
11
+ declare const CART_FRAGMENT: _apollo_client1.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_client33 from "@apollo/client";
1
+ import * as _apollo_client0 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/customer.d.ts
4
- declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client33.DocumentNode;
5
- declare const CUSTOMER_FRAGMENT: _apollo_client33.DocumentNode;
4
+ declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client0.DocumentNode;
5
+ declare const CUSTOMER_FRAGMENT: _apollo_client0.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,gBAAA,CAlBqC;cAoBzB,mBAeZ,gBAAA,CAf6B"}
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,11 +1,11 @@
1
- import * as _apollo_client28 from "@apollo/client";
1
+ import * as _apollo_client29 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/mutations/cart.d.ts
4
- declare const CREATE_CART_MUTATION: _apollo_client28.DocumentNode;
5
- declare const CREATE_LINE_ITEM_MUTATION: _apollo_client28.DocumentNode;
6
- declare const UPDATE_CART_MUTATION: _apollo_client28.DocumentNode;
7
- declare const DELETE_LINE_ITEM_MUTATION: _apollo_client28.DocumentNode;
8
- declare const TRANSFER_CART_MUTATION: _apollo_client28.DocumentNode;
4
+ declare const CREATE_CART_MUTATION: _apollo_client29.DocumentNode;
5
+ declare const CREATE_LINE_ITEM_MUTATION: _apollo_client29.DocumentNode;
6
+ declare const UPDATE_CART_MUTATION: _apollo_client29.DocumentNode;
7
+ declare const DELETE_LINE_ITEM_MUTATION: _apollo_client29.DocumentNode;
8
+ declare const TRANSFER_CART_MUTATION: _apollo_client29.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_client17 from "@apollo/client";
1
+ import * as _apollo_client34 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/cart.d.ts
4
- declare const GET_CART_QUERY: _apollo_client17.DocumentNode;
4
+ declare const GET_CART_QUERY: _apollo_client34.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_CART_QUERY };
7
7
  //# sourceMappingURL=cart.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client16 from "@apollo/client";
1
+ import * as _apollo_client26 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/collections.d.ts
4
- declare const GET_COLLECTIONS_QUERY: _apollo_client16.DocumentNode;
4
+ declare const GET_COLLECTIONS_QUERY: _apollo_client26.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_COLLECTIONS_QUERY };
7
7
  //# sourceMappingURL=collections.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client18 from "@apollo/client";
1
+ import * as _apollo_client28 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/customer.d.ts
4
- declare const GET_CUSTOMER_QUERY: _apollo_client18.DocumentNode;
4
+ declare const GET_CUSTOMER_QUERY: _apollo_client28.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_client8 from "@apollo/client";
1
+ import * as _apollo_client18 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/footer.d.ts
4
- declare const GET_FOOTER_QUERY: _apollo_client8.DocumentNode;
4
+ declare const GET_FOOTER_QUERY: _apollo_client18.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_FOOTER_QUERY };
7
7
  //# sourceMappingURL=footer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"footer.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/footer.ts"],"sourcesContent":[],"mappings":";;;cAEa,kBAcZ,eAAA,CAd4B"}
1
+ {"version":3,"file":"footer.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/footer.ts"],"sourcesContent":[],"mappings":";;;cAEa,kBAcZ,gBAAA,CAd4B"}
@@ -1,9 +1,9 @@
1
- import * as _apollo_client23 from "@apollo/client";
1
+ import * as _apollo_client19 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/order.d.ts
4
- declare const ORDER_FRAGMENT: _apollo_client23.DocumentNode;
5
- declare const GET_ORDER_QUERY: _apollo_client23.DocumentNode;
6
- declare const GET_ORDERS_QUERY: _apollo_client23.DocumentNode;
4
+ declare const ORDER_FRAGMENT: _apollo_client19.DocumentNode;
5
+ declare const GET_ORDER_QUERY: _apollo_client19.DocumentNode;
6
+ declare const GET_ORDERS_QUERY: _apollo_client19.DocumentNode;
7
7
  //#endregion
8
8
  export { GET_ORDERS_QUERY, GET_ORDER_QUERY, ORDER_FRAGMENT };
9
9
  //# sourceMappingURL=order.d.ts.map
@@ -1,8 +1,8 @@
1
- import * as _apollo_client21 from "@apollo/client";
1
+ import * as _apollo_client22 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/product.d.ts
4
- declare const SEARCH_SUGGESTIONS_QUERY: _apollo_client21.DocumentNode;
5
- declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client21.DocumentNode;
4
+ declare const SEARCH_SUGGESTIONS_QUERY: _apollo_client22.DocumentNode;
5
+ declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client22.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_PRODUCT_CATEGORIES_QUERY, SEARCH_SUGGESTIONS_QUERY };
8
8
  //# sourceMappingURL=product.d.ts.map
@@ -1,8 +1,8 @@
1
- import * as _apollo_client19 from "@apollo/client";
1
+ import * as _apollo_client24 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/regions.d.ts
4
- declare const LIST_REGIONS_QUERY: _apollo_client19.DocumentNode;
5
- declare const GET_REGION_QUERY: _apollo_client19.DocumentNode;
4
+ declare const LIST_REGIONS_QUERY: _apollo_client24.DocumentNode;
5
+ declare const GET_REGION_QUERY: _apollo_client24.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_REGION_QUERY, LIST_REGIONS_QUERY };
8
8
  //# sourceMappingURL=regions.d.ts.map
@@ -1,8 +1,8 @@
1
- import * as _apollo_client26 from "@apollo/client";
1
+ import * as _apollo_client16 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/shipping.d.ts
4
- declare const SHIPPING_OPTION_FRAGMENT: _apollo_client26.DocumentNode;
5
- declare const GET_SHIPPING_OPTIONS_QUERY: _apollo_client26.DocumentNode;
4
+ declare const SHIPPING_OPTION_FRAGMENT: _apollo_client16.DocumentNode;
5
+ declare const GET_SHIPPING_OPTIONS_QUERY: _apollo_client16.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_SHIPPING_OPTIONS_QUERY, SHIPPING_OPTION_FRAGMENT };
8
8
  //# sourceMappingURL=shipping.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client0 from "@apollo/client";
1
+ import * as _apollo_client27 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/hooks/use-apollo.d.ts
4
- declare function useApollo(): _apollo_client0.ApolloClient;
4
+ declare function useApollo(): _apollo_client27.ApolloClient;
5
5
  //#endregion
6
6
  export { useApollo };
7
7
  //# sourceMappingURL=use-apollo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-apollo.d.ts","names":[],"sources":["../../../src/lib/hooks/use-apollo.tsx"],"sourcesContent":[],"mappings":";;;iBAIgB,SAAA,CAAA,GAAS,eAAA,CAAA"}
1
+ {"version":3,"file":"use-apollo.d.ts","names":[],"sources":["../../../src/lib/hooks/use-apollo.tsx"],"sourcesContent":[],"mappings":";;;iBAIgB,SAAA,CAAA,GAAS,gBAAA,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { Customer } from "../../types/graphql.js";
2
+ import * as swr0 from "swr";
3
+
4
+ //#region src/lib/hooks/use-customer.d.ts
5
+ declare const useCustomer: () => {
6
+ customer: Customer | null | undefined;
7
+ error: any;
8
+ isLoading: boolean;
9
+ mutate: swr0.KeyedMutator<Customer | null>;
10
+ };
11
+ //#endregion
12
+ export { useCustomer };
13
+ //# sourceMappingURL=use-customer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-customer.d.ts","names":[],"sources":["../../../src/lib/hooks/use-customer.tsx"],"sourcesContent":[],"mappings":";;;;cAQa;;;EAAA,SAAA,EAAA,OAiCZ"}
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+
3
+ import useSWR from "swr";
4
+
5
+ //#region src/lib/hooks/use-customer.tsx
6
+ const CUSTOMER_SWR_KEY = "medusa-customer";
7
+ const useCustomer = () => {
8
+ const { data, error, isLoading, mutate: swrMutate } = useSWR(CUSTOMER_SWR_KEY, async () => {
9
+ const response = await fetch("/api/customer", { credentials: "include" });
10
+ if (!response.ok) throw new Error("Failed to fetch customer");
11
+ const { customer } = await response.json();
12
+ return customer;
13
+ }, {
14
+ revalidateOnFocus: true,
15
+ revalidateOnReconnect: true
16
+ });
17
+ return {
18
+ customer: data,
19
+ error,
20
+ isLoading,
21
+ mutate: swrMutate
22
+ };
23
+ };
24
+
25
+ //#endregion
26
+ export { useCustomer };
27
+ //# sourceMappingURL=use-customer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-customer.js","names":[],"sources":["../../../src/lib/hooks/use-customer.tsx"],"sourcesContent":["'use client';\n\nimport useSWR from 'swr';\n\nimport { Customer } from '../../types/graphql';\n\nconst CUSTOMER_SWR_KEY = 'medusa-customer';\n\nexport const useCustomer = () => {\n const {\n data,\n error,\n isLoading,\n mutate: swrMutate,\n } = useSWR<Customer | null>(\n CUSTOMER_SWR_KEY,\n async () => {\n const response = await fetch('/api/customer', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch customer');\n }\n\n const { customer } = await response.json();\n\n return customer;\n },\n {\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n }\n );\n\n return {\n customer: data,\n error,\n isLoading,\n mutate: swrMutate,\n };\n};\n"],"mappings":";;;;;AAMA,MAAM,mBAAmB;AAEzB,MAAa,oBAAoB;CAC/B,MAAM,EACJ,MACA,OACA,WACA,QAAQ,cACN,OACF,kBACA,YAAY;EACV,MAAM,WAAW,MAAM,MAAM,iBAAiB,EAC5C,aAAa,WACd,CAAC;AAEF,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,2BAA2B;EAG7C,MAAM,EAAE,aAAa,MAAM,SAAS,MAAM;AAE1C,SAAO;IAET;EACE,mBAAmB;EACnB,uBAAuB;EACxB,CACF;AAED,QAAO;EACL,UAAU;EACV;EACA;EACA,QAAQ;EACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gfed-medusa/sf-lib-common",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -74,9 +74,9 @@
74
74
  "tsdown": "^0.17.3",
75
75
  "typescript": "^5",
76
76
  "@packages/eslint-config": "0.0.0",
77
+ "@packages/jest-config": "0.0.0",
77
78
  "@packages/prettier-config": "0.0.0",
78
- "@packages/typescript-config": "0.0.0",
79
- "@packages/jest-config": "0.0.0"
79
+ "@packages/typescript-config": "0.0.0"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@medusajs/ui": "^4.0.29",