@gfed-medusa/sf-lib-common 3.1.0 → 3.3.3

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 (76) 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/error-message/index.d.ts +2 -2
  8. package/dist/components/free-shipping-price-nudge/index.d.ts +2 -2
  9. package/dist/components/free-shipping-price-nudge/index.d.ts.map +1 -1
  10. package/dist/components/interactive-link/index.d.ts +2 -2
  11. package/dist/components/line-item-options/index.d.ts +2 -2
  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 +2 -2
  15. package/dist/components/modal/index.d.ts +2 -2
  16. package/dist/components/modal/index.d.ts.map +1 -1
  17. package/dist/components/preview-price/index.d.ts +2 -2
  18. package/dist/components/product-card/index.d.ts +2 -2
  19. package/dist/components/product-card/index.d.ts.map +1 -1
  20. package/dist/components/product-card/index.js +14 -9
  21. package/dist/components/product-card/index.js.map +1 -1
  22. package/dist/components/product-preview/index.d.ts +2 -2
  23. package/dist/components/product-preview/index.d.ts.map +1 -1
  24. package/dist/components/submit-button/index.d.ts +2 -2
  25. package/dist/components/submit-button/index.d.ts.map +1 -1
  26. package/dist/components/thumbnail/index.js +1 -1
  27. package/dist/components/thumbnail/index.js.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/data/collections.js +3 -3
  32. package/dist/lib/data/collections.js.map +1 -1
  33. package/dist/lib/data/context.d.ts +2 -2
  34. package/dist/lib/data/context.js +1 -1
  35. package/dist/lib/data/context.js.map +1 -1
  36. package/dist/lib/gql/apollo-client.d.ts.map +1 -1
  37. package/dist/lib/gql/apollo-client.js +6 -1
  38. package/dist/lib/gql/apollo-client.js.map +1 -1
  39. package/dist/lib/gql/fragments/cart.d.ts +9 -9
  40. package/dist/lib/gql/fragments/customer.d.ts +3 -3
  41. package/dist/lib/gql/fragments/customer.d.ts.map +1 -1
  42. package/dist/lib/gql/fragments/product.d.ts +10 -9
  43. package/dist/lib/gql/fragments/product.d.ts.map +1 -1
  44. package/dist/lib/gql/fragments/product.js +12 -1
  45. package/dist/lib/gql/fragments/product.js.map +1 -1
  46. package/dist/lib/gql/mutations/cart.d.ts +6 -6
  47. package/dist/lib/gql/queries/cart.d.ts +2 -2
  48. package/dist/lib/gql/queries/collections.d.ts +4 -3
  49. package/dist/lib/gql/queries/collections.d.ts.map +1 -1
  50. package/dist/lib/gql/queries/collections.js +14 -2
  51. package/dist/lib/gql/queries/collections.js.map +1 -1
  52. package/dist/lib/gql/queries/customer.d.ts +2 -2
  53. package/dist/lib/gql/queries/footer.d.ts +4 -3
  54. package/dist/lib/gql/queries/footer.d.ts.map +1 -1
  55. package/dist/lib/gql/queries/footer.js +26 -1
  56. package/dist/lib/gql/queries/footer.js.map +1 -1
  57. package/dist/lib/gql/queries/order.d.ts +4 -4
  58. package/dist/lib/gql/queries/product.d.ts +3 -3
  59. package/dist/lib/gql/queries/regions.d.ts +3 -3
  60. package/dist/lib/gql/queries/shipping.d.ts +3 -3
  61. package/dist/lib/gql/queries/shipping.d.ts.map +1 -1
  62. package/dist/lib/hooks/use-apollo.d.ts +2 -2
  63. package/dist/lib/hooks/use-apollo.d.ts.map +1 -1
  64. package/dist/lib/hooks/use-cart.js +3 -3
  65. package/dist/lib/hooks/use-cart.js.map +1 -1
  66. package/dist/lib/hooks/use-customer.js +3 -3
  67. package/dist/lib/hooks/use-customer.js.map +1 -1
  68. package/dist/lib/utils/imagekit.d.ts +13 -0
  69. package/dist/lib/utils/imagekit.d.ts.map +1 -0
  70. package/dist/lib/utils/imagekit.js +29 -0
  71. package/dist/lib/utils/imagekit.js.map +1 -0
  72. package/dist/types/graphql.d.ts +65 -1
  73. package/dist/types/graphql.d.ts.map +1 -1
  74. package/dist/types/graphql.js +512 -1
  75. package/dist/types/graphql.js.map +1 -1
  76. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime12 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime9 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_runtime12.JSX.Element;
17
+ }: BreadcrumbsProps): react_jsx_runtime9.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,mBAAA,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,kBAAA,CAAA,GAAA,CAAA,OAAhB"}
@@ -1,11 +1,11 @@
1
1
  import { Cart, Customer } from "../../types/graphql.js";
2
- import * as react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime4 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_runtime11.JSX.Element | undefined;
8
+ }): react_jsx_runtime4.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,mBAAA,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,kBAAA,CAAA,GAAA,CAAA,OAAA,GAAtB,SAAA"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime13 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 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_runtime13.JSX.Element;
12
+ }) => react_jsx_runtime5.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":";;;cASM;;;;;;aAMO,KAAA,CAAM;EANb,SAAA,CAAA,EAAA,MAuCL;CAvCqB,EAAA,GAQrB,mBAAA,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,4 +1,4 @@
1
- import * as react_jsx_runtime14 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime10 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_runtime14.JSX.Element | null;
10
+ }) => react_jsx_runtime10.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_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime7 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_runtime15.JSX.Element | undefined;
13
+ }): react_jsx_runtime7.JSX.Element | undefined;
14
14
  //#endregion
15
15
  export { ShippingPriceNudge };
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/free-shipping-price-nudge/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAqES,kBAAA;;;;;;QAMD;EANC,eAAA,EAOU,cAPQ,EAAA;CACzB,CAAA,EAOD,mBAAA,CAAA,GAAA,CAAA,OAAA,GAPC,SAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/free-shipping-price-nudge/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAqES,kBAAA;;;;;;QAMD;EANC,eAAA,EAOU,cAPQ,EAAA;CACzB,CAAA,EAOD,kBAAA,CAAA,GAAA,CAAA,OAAA,GAPC,SAAA"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime7 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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_runtime7.JSX.Element;
14
+ }: InteractiveLinkProps) => react_jsx_runtime0.JSX.Element;
15
15
  //#endregion
16
16
  export { InteractiveLink };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Maybe, ProductVariant } from "../../types/graphql.js";
2
- import * as react_jsx_runtime6 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 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_runtime6.JSX.Element;
14
+ }: LineItemOptionsProps) => react_jsx_runtime0.JSX.Element;
15
15
  //#endregion
16
16
  export { LineItemOptions };
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { LineItem } from "../../types/graphql.js";
2
- import * as react_jsx_runtime8 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 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_runtime8.JSX.Element;
14
+ }: LineItemPriceProps) => react_jsx_runtime11.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,kBAAA,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,mBAAA,CAAA,GAAA,CAAA,OAJE"}
@@ -1,5 +1,5 @@
1
1
  import { AnchorHTMLAttributes, DetailedHTMLProps } from "react";
2
- import * as react_jsx_runtime9 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 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> & {
@@ -10,7 +10,7 @@ declare const LocalizedClientLink: ({
10
10
  href,
11
11
  locale,
12
12
  ...props
13
- }: LocalizedClientLinkProps) => react_jsx_runtime9.JSX.Element;
13
+ }: LocalizedClientLinkProps) => react_jsx_runtime1.JSX.Element;
14
14
  //#endregion
15
15
  export { LocalizedClientLink };
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime10 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 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_runtime10.JSX.Element;
23
+ }: ModalProps): react_jsx_runtime3.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_runtime5 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 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_runtime5.JSX.Element | null;
9
+ }): react_jsx_runtime6.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_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime12 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_runtime0.JSX.Element;
62
+ }: ProductCardProps): react_jsx_runtime12.JSX.Element;
63
63
  //#endregion
64
64
  export { ProductCard };
65
65
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":[],"mappings":";;;;;cAYM;;;IAoBL,+BAAA,CAAA;AA5BiE,UA8BxD,KAAA,CAtBJ;EAsBI,OAAA,EAAK,MAAA;EAKL,GAAA,CAAA,EAAA,MAAO;AAYH;UAZJ,OAAA,CAe6C;EAC5C,EAAA,EAAA,MAAA;EADwB,KAAA,EAAA;IAAY,GAAA,EAAA,MAAA;IAuC/B,GAAA,CAAA,EAAA,MAAW;EACzB,CAAA;EACA,QAAA,CAAA,EAAA;IACA,QAAA,EAAA,MAAA;IACA,MAAA,EAAA,MAAA;EACA,CAAA;EACA,KAAA,EAAA,MAAA;EACA,IAAA,CAAA,EAAA,MAAA;EACC,KAAA,EAlDM,KAkDN;;UA/CO,gBAAA,SAAyB,YA+ChB,CAAA,OA/CoC,mBA+CpC,CAAA,CAAA;WA9CR;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCK,WAAA;;;;;;;;GAQb,mBAAgB,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":[],"mappings":";;;;;cAYM;;;IAoBL,+BAAA,CAAA;AA5BiE,UA8BxD,KAAA,CAtBJ;EAsBI,OAAA,EAAK,MAAA;EAKL,GAAA,CAAA,EAAA,MAAO;AAYH;UAZJ,OAAA,CAe6C;EAC5C,EAAA,EAAA,MAAA;EADwB,KAAA,EAAA;IAAY,GAAA,EAAA,MAAA;IAuC/B,GAAA,CAAA,EAAA,MAAW;EACzB,CAAA;EACA,QAAA,CAAA,EAAA;IACA,QAAA,EAAA,MAAA;IACA,MAAA,EAAA,MAAA;EACA,CAAA;EACA,KAAA,EAAA,MAAA;EACA,IAAA,CAAA,EAAA,MAAA;EACC,KAAA,EAlDM,KAkDN;;UA/CO,gBAAA,SAAyB,YA+ChB,CAAA,OA/CoC,mBA+CpC,CAAA,CAAA;WA9CR;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCK,WAAA;;;;;;;;GAQb,mBAAgB,mBAAA,CAAA,GAAA,CAAA"}
@@ -47,11 +47,14 @@ function ProductCard({ product, rating, badge, variants, variant, size, classNam
47
47
  size
48
48
  }), "w-60 overflow-hidden rounded-2xl border p-0 shadow-sm"),
49
49
  children: [/* @__PURE__ */ jsx("div", {
50
- className: "h-72 w-full overflow-hidden",
51
- children: /* @__PURE__ */ jsx("img", {
50
+ className: "relative h-72 w-full overflow-hidden",
51
+ children: /* @__PURE__ */ jsx(Image, {
52
52
  src: product.image.src,
53
53
  alt: product.image.alt ?? product.title,
54
- className: "h-full w-full object-cover"
54
+ fill: true,
55
+ className: "object-cover",
56
+ sizes: "240px",
57
+ quality: 60
55
58
  })
56
59
  }), /* @__PURE__ */ jsxs("div", {
57
60
  className: "flex flex-col gap-1 p-3",
@@ -80,15 +83,17 @@ function ProductCard({ product, rating, badge, variants, variant, size, classNam
80
83
  size
81
84
  }), className),
82
85
  children: [/* @__PURE__ */ jsxs("div", {
83
- className: "relative",
86
+ className: "relative aspect-[1/1]",
84
87
  children: [/* @__PURE__ */ jsx(Image, {
85
- src: product.image.src || "/assets/images/missing-img.webp",
88
+ src: product.image.src,
86
89
  alt: product.image.alt ?? product.title,
87
- width: 500,
88
- height: 500,
89
- className: cn("w-full object-cover")
90
+ fill: true,
91
+ className: cn("object-cover"),
92
+ priority: true,
93
+ quality: 60,
94
+ sizes: "(max-width: 576px) 280px, (max-width: 768px) 360px, (max-width: 992px) 240px, 200px"
90
95
  }), badge && /* @__PURE__ */ jsx("div", {
91
- className: "absolute left-2 top-2",
96
+ className: "absolute top-2 left-2",
92
97
  children: /* @__PURE__ */ jsx(Badge, {
93
98
  variant: "default",
94
99
  children: badge.label
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":["'use client';\n\nimport Image from 'next/image';\n\nimport { type VariantProps, cva } from 'class-variance-authority';\n\nimport { Badge } from '@gfed-medusa/sf-lib-ui/components/badge';\nimport { Button } from '@gfed-medusa/sf-lib-ui/components/button';\nimport { RatingCount } from '@gfed-medusa/sf-lib-ui/components/rating-count';\nimport { VariantSelector } from '@gfed-medusa/sf-lib-ui/components/variant-selector';\nimport { cn } from '@gfed-medusa/sf-lib-ui/lib/utils';\n\nconst productCardVariants = cva(\n 'rounded-2xl border overflow-hidden transition',\n {\n variants: {\n variant: {\n default: 'flex flex-col shadow-sm hover:shadow-md',\n withAddToCart: 'flex flex-col shadow-sm hover:shadow-md',\n minimal: 'flex flex-col hover:shadow hover:border-muted-foreground/30',\n },\n size: {\n sm: 'w-48',\n md: 'w-64',\n lg: 'w-80',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n);\n\ninterface Price {\n current: string;\n old?: string;\n}\n\ninterface Product {\n id: string;\n image: {\n src: string;\n alt?: string;\n };\n localize?: {\n currency: string;\n locale: string;\n };\n title: string;\n href?: string;\n price: Price;\n}\n\ninterface ProductCardProps extends VariantProps<typeof productCardVariants> {\n product: Product;\n rating?: {\n average: number;\n count?: number;\n };\n badge?: {\n label: string;\n variant?: 'default' | 'sale' | 'new' | 'limited';\n };\n variants?: {\n options: {\n value: string;\n label?: string;\n imageSrc?: string;\n color?: string;\n }[];\n value: string;\n onChange: (value: string) => void;\n };\n quantity?: {\n value: number;\n onChange: (value: number) => void;\n };\n className?: string;\n}\n\nconst formatPrice = (price: Price, locale = 'en-GB', currency = 'GBP') => {\n const formatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n });\n\n return {\n currentPrice: formatter.format(Number(price.current)),\n oldPrice: price.old ? formatter.format(Number(price.old)) : undefined,\n };\n};\n\nexport function ProductCard({\n product,\n rating,\n badge,\n variants,\n variant,\n size,\n className,\n}: ProductCardProps) {\n const { currentPrice, oldPrice } = formatPrice(\n product.price,\n product.localize?.locale,\n product.localize?.currency\n );\n\n switch (variant) {\n case 'minimal':\n return (\n <div\n className={cn(\n productCardVariants({ variant, size }),\n 'w-60 overflow-hidden rounded-2xl border p-0 shadow-sm'\n )}\n >\n <div className=\"h-72 w-full overflow-hidden\">\n {/* eslint-disable-next-line @next/next/no-img-element -- needed for minimal variant */}\n <img\n src={product.image.src}\n alt={product.image.alt ?? product.title}\n className=\"h-full w-full object-cover\"\n />\n </div>\n\n <div className=\"flex flex-col gap-1 p-3\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"truncate text-base font-medium\">\n {product.href ? (\n <a href={product.href} className=\"hover:underline\">\n {product.title}\n </a>\n ) : (\n product.title\n )}\n </h3>\n <p className=\"mt-0 text-lg font-semibold text-gray-900\">\n {currentPrice}\n </p>\n </div>\n <p className=\"text-xs text-gray-500\">7 colors</p>\n </div>\n </div>\n );\n default:\n return (\n <div className={cn(productCardVariants({ variant, size }), className)}>\n {/* Image */}\n <div className=\"relative\">\n <Image\n src={product.image.src || '/assets/images/missing-img.webp'}\n alt={product.image.alt ?? product.title}\n width={500}\n height={500}\n className={cn('w-full object-cover')}\n />\n {badge && (\n <div className=\"absolute left-2 top-2\">\n <Badge variant=\"default\">{badge.label}</Badge>\n </div>\n )}\n </div>\n\n {/* Content */}\n <div className=\"flex flex-col gap-2 p-3\">\n <h3 className=\"truncate text-base font-medium\">\n {product.href ? (\n <a href={product.href} className=\"hover:underline\">\n {product.title}\n </a>\n ) : (\n product.title\n )}\n </h3>\n\n {/* Price */}\n <div className=\"flex items-center gap-2\">\n <p className=\"text-lg font-semibold\">{currentPrice}</p>\n {oldPrice && (\n <p className=\"text-muted-foreground text-sm line-through\">\n {oldPrice}\n </p>\n )}\n </div>\n\n {/* Rating */}\n {rating !== undefined && (\n <div\n data-testid=\"product-card-rating\"\n className=\"flex items-center gap-2\"\n >\n <RatingCount\n average={rating.average}\n ratingCount={rating.count}\n />\n </div>\n )}\n\n {/* Variant Selector */}\n {variants && (\n <VariantSelector\n options={variants.options}\n value={variants.value ?? ''}\n onChange={variants.onChange}\n type=\"color\"\n />\n )}\n\n {/* Add to Cart button */}\n {variant === 'withAddToCart' && (\n <Button variant=\"default\" className=\"w-full cursor-pointer\">\n Add to Cart\n </Button>\n )}\n </div>\n </div>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,sBAAsB,IAC1B,iDACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,eAAe;GACf,SAAS;GACV;EACD,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAiDD,MAAM,eAAe,OAAc,SAAS,SAAS,WAAW,UAAU;CACxE,MAAM,YAAY,IAAI,KAAK,aAAa,QAAQ;EAC9C,OAAO;EACP;EACD,CAAC;AAEF,QAAO;EACL,cAAc,UAAU,OAAO,OAAO,MAAM,QAAQ,CAAC;EACrD,UAAU,MAAM,MAAM,UAAU,OAAO,OAAO,MAAM,IAAI,CAAC,GAAG;EAC7D;;AAGH,SAAgB,YAAY,EAC1B,SACA,QACA,OACA,UACA,SACA,MACA,aACmB;CACnB,MAAM,EAAE,cAAc,aAAa,YACjC,QAAQ,OACR,QAAQ,UAAU,QAClB,QAAQ,UAAU,SACnB;AAED,SAAQ,SAAR;EACE,KAAK,UACH,QACE,qBAAC;GACC,WAAW,GACT,oBAAoB;IAAE;IAAS;IAAM,CAAC,EACtC,wDACD;cAED,oBAAC;IAAI,WAAU;cAEb,oBAAC;KACC,KAAK,QAAQ,MAAM;KACnB,KAAK,QAAQ,MAAM,OAAO,QAAQ;KAClC,WAAU;MACV;KACE,EAEN,qBAAC;IAAI,WAAU;eACb,qBAAC;KAAI,WAAU;gBACb,oBAAC;MAAG,WAAU;gBACX,QAAQ,OACP,oBAAC;OAAE,MAAM,QAAQ;OAAM,WAAU;iBAC9B,QAAQ;QACP,GAEJ,QAAQ;OAEP,EACL,oBAAC;MAAE,WAAU;gBACV;OACC;MACA,EACN,oBAAC;KAAE,WAAU;eAAwB;MAAY;KAC7C;IACF;EAEV,QACE,QACE,qBAAC;GAAI,WAAW,GAAG,oBAAoB;IAAE;IAAS;IAAM,CAAC,EAAE,UAAU;cAEnE,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,KAAK,QAAQ,MAAM,OAAO;KAC1B,KAAK,QAAQ,MAAM,OAAO,QAAQ;KAClC,OAAO;KACP,QAAQ;KACR,WAAW,GAAG,sBAAsB;MACpC,EACD,SACC,oBAAC;KAAI,WAAU;eACb,oBAAC;MAAM,SAAQ;gBAAW,MAAM;OAAc;MAC1C;KAEJ,EAGN,qBAAC;IAAI,WAAU;;KACb,oBAAC;MAAG,WAAU;gBACX,QAAQ,OACP,oBAAC;OAAE,MAAM,QAAQ;OAAM,WAAU;iBAC9B,QAAQ;QACP,GAEJ,QAAQ;OAEP;KAGL,qBAAC;MAAI,WAAU;iBACb,oBAAC;OAAE,WAAU;iBAAyB;QAAiB,EACtD,YACC,oBAAC;OAAE,WAAU;iBACV;QACC;OAEF;KAGL,WAAW,UACV,oBAAC;MACC,eAAY;MACZ,WAAU;gBAEV,oBAAC;OACC,SAAS,OAAO;OAChB,aAAa,OAAO;QACpB;OACE;KAIP,YACC,oBAAC;MACC,SAAS,SAAS;MAClB,OAAO,SAAS,SAAS;MACzB,UAAU,SAAS;MACnB,MAAK;OACL;KAIH,YAAY,mBACX,oBAAC;MAAO,SAAQ;MAAU,WAAU;gBAAwB;OAEnD;;KAEP;IACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":["'use client';\n\nimport Image from 'next/image';\n\nimport { type VariantProps, cva } from 'class-variance-authority';\n\nimport { Badge } from '@gfed-medusa/sf-lib-ui/components/badge';\nimport { Button } from '@gfed-medusa/sf-lib-ui/components/button';\nimport { RatingCount } from '@gfed-medusa/sf-lib-ui/components/rating-count';\nimport { VariantSelector } from '@gfed-medusa/sf-lib-ui/components/variant-selector';\nimport { cn } from '@gfed-medusa/sf-lib-ui/lib/utils';\n\nconst productCardVariants = cva(\n 'rounded-2xl border overflow-hidden transition',\n {\n variants: {\n variant: {\n default: 'flex flex-col shadow-sm hover:shadow-md',\n withAddToCart: 'flex flex-col shadow-sm hover:shadow-md',\n minimal: 'flex flex-col hover:shadow hover:border-muted-foreground/30',\n },\n size: {\n sm: 'w-48',\n md: 'w-64',\n lg: 'w-80',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n);\n\ninterface Price {\n current: string;\n old?: string;\n}\n\ninterface Product {\n id: string;\n image: {\n src: string;\n alt?: string;\n };\n localize?: {\n currency: string;\n locale: string;\n };\n title: string;\n href?: string;\n price: Price;\n}\n\ninterface ProductCardProps extends VariantProps<typeof productCardVariants> {\n product: Product;\n rating?: {\n average: number;\n count?: number;\n };\n badge?: {\n label: string;\n variant?: 'default' | 'sale' | 'new' | 'limited';\n };\n variants?: {\n options: {\n value: string;\n label?: string;\n imageSrc?: string;\n color?: string;\n }[];\n value: string;\n onChange: (value: string) => void;\n };\n quantity?: {\n value: number;\n onChange: (value: number) => void;\n };\n className?: string;\n}\n\nconst formatPrice = (price: Price, locale = 'en-GB', currency = 'GBP') => {\n const formatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n });\n\n return {\n currentPrice: formatter.format(Number(price.current)),\n oldPrice: price.old ? formatter.format(Number(price.old)) : undefined,\n };\n};\n\nexport function ProductCard({\n product,\n rating,\n badge,\n variants,\n variant,\n size,\n className,\n}: ProductCardProps) {\n const { currentPrice, oldPrice } = formatPrice(\n product.price,\n product.localize?.locale,\n product.localize?.currency\n );\n\n switch (variant) {\n case 'minimal':\n return (\n <div\n className={cn(\n productCardVariants({ variant, size }),\n 'w-60 overflow-hidden rounded-2xl border p-0 shadow-sm'\n )}\n >\n <div className=\"relative h-72 w-full overflow-hidden\">\n <Image\n src={product.image.src}\n alt={product.image.alt ?? product.title}\n fill\n className=\"object-cover\"\n sizes=\"240px\"\n quality={60}\n />\n </div>\n\n <div className=\"flex flex-col gap-1 p-3\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"truncate text-base font-medium\">\n {product.href ? (\n <a href={product.href} className=\"hover:underline\">\n {product.title}\n </a>\n ) : (\n product.title\n )}\n </h3>\n <p className=\"mt-0 text-lg font-semibold text-gray-900\">\n {currentPrice}\n </p>\n </div>\n <p className=\"text-xs text-gray-500\">7 colors</p>\n </div>\n </div>\n );\n default:\n return (\n <div className={cn(productCardVariants({ variant, size }), className)}>\n {/* Image */}\n <div className=\"relative aspect-[1/1]\">\n <Image\n src={product.image.src}\n alt={product.image.alt ?? product.title}\n fill\n className={cn('object-cover')}\n priority\n quality={60}\n sizes=\"(max-width: 576px) 280px, (max-width: 768px) 360px, (max-width: 992px) 240px, 200px\"\n />\n {badge && (\n <div className=\"absolute top-2 left-2\">\n <Badge variant=\"default\">{badge.label}</Badge>\n </div>\n )}\n </div>\n\n {/* Content */}\n <div className=\"flex flex-col gap-2 p-3\">\n <h3 className=\"truncate text-base font-medium\">\n {product.href ? (\n <a href={product.href} className=\"hover:underline\">\n {product.title}\n </a>\n ) : (\n product.title\n )}\n </h3>\n\n {/* Price */}\n <div className=\"flex items-center gap-2\">\n <p className=\"text-lg font-semibold\">{currentPrice}</p>\n {oldPrice && (\n <p className=\"text-muted-foreground text-sm line-through\">\n {oldPrice}\n </p>\n )}\n </div>\n\n {/* Rating */}\n {rating !== undefined && (\n <div\n data-testid=\"product-card-rating\"\n className=\"flex items-center gap-2\"\n >\n <RatingCount\n average={rating.average}\n ratingCount={rating.count}\n />\n </div>\n )}\n\n {/* Variant Selector */}\n {variants && (\n <VariantSelector\n options={variants.options}\n value={variants.value ?? ''}\n onChange={variants.onChange}\n type=\"color\"\n />\n )}\n\n {/* Add to Cart button */}\n {variant === 'withAddToCart' && (\n <Button variant=\"default\" className=\"w-full cursor-pointer\">\n Add to Cart\n </Button>\n )}\n </div>\n </div>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,sBAAsB,IAC1B,iDACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,eAAe;GACf,SAAS;GACV;EACD,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAiDD,MAAM,eAAe,OAAc,SAAS,SAAS,WAAW,UAAU;CACxE,MAAM,YAAY,IAAI,KAAK,aAAa,QAAQ;EAC9C,OAAO;EACP;EACD,CAAC;AAEF,QAAO;EACL,cAAc,UAAU,OAAO,OAAO,MAAM,QAAQ,CAAC;EACrD,UAAU,MAAM,MAAM,UAAU,OAAO,OAAO,MAAM,IAAI,CAAC,GAAG;EAC7D;;AAGH,SAAgB,YAAY,EAC1B,SACA,QACA,OACA,UACA,SACA,MACA,aACmB;CACnB,MAAM,EAAE,cAAc,aAAa,YACjC,QAAQ,OACR,QAAQ,UAAU,QAClB,QAAQ,UAAU,SACnB;AAED,SAAQ,SAAR;EACE,KAAK,UACH,QACE,qBAAC;GACC,WAAW,GACT,oBAAoB;IAAE;IAAS;IAAM,CAAC,EACtC,wDACD;cAED,oBAAC;IAAI,WAAU;cACb,oBAAC;KACC,KAAK,QAAQ,MAAM;KACnB,KAAK,QAAQ,MAAM,OAAO,QAAQ;KAClC;KACA,WAAU;KACV,OAAM;KACN,SAAS;MACT;KACE,EAEN,qBAAC;IAAI,WAAU;eACb,qBAAC;KAAI,WAAU;gBACb,oBAAC;MAAG,WAAU;gBACX,QAAQ,OACP,oBAAC;OAAE,MAAM,QAAQ;OAAM,WAAU;iBAC9B,QAAQ;QACP,GAEJ,QAAQ;OAEP,EACL,oBAAC;MAAE,WAAU;gBACV;OACC;MACA,EACN,oBAAC;KAAE,WAAU;eAAwB;MAAY;KAC7C;IACF;EAEV,QACE,QACE,qBAAC;GAAI,WAAW,GAAG,oBAAoB;IAAE;IAAS;IAAM,CAAC,EAAE,UAAU;cAEnE,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,KAAK,QAAQ,MAAM;KACnB,KAAK,QAAQ,MAAM,OAAO,QAAQ;KAClC;KACA,WAAW,GAAG,eAAe;KAC7B;KACA,SAAS;KACT,OAAM;MACN,EACD,SACC,oBAAC;KAAI,WAAU;eACb,oBAAC;MAAM,SAAQ;gBAAW,MAAM;OAAc;MAC1C;KAEJ,EAGN,qBAAC;IAAI,WAAU;;KACb,oBAAC;MAAG,WAAU;gBACX,QAAQ,OACP,oBAAC;OAAE,MAAM,QAAQ;OAAM,WAAU;iBAC9B,QAAQ;QACP,GAEJ,QAAQ;OAEP;KAGL,qBAAC;MAAI,WAAU;iBACb,oBAAC;OAAE,WAAU;iBAAyB;QAAiB,EACtD,YACC,oBAAC;OAAE,WAAU;iBACV;QACC;OAEF;KAGL,WAAW,UACV,oBAAC;MACC,eAAY;MACZ,WAAU;gBAEV,oBAAC;OACC,SAAS,OAAO;OAChB,aAAa,OAAO;QACpB;OACE;KAIP,YACC,oBAAC;MACC,SAAS,SAAS;MAClB,OAAO,SAAS,SAAS;MACzB,UAAU,SAAS;MACnB,MAAK;OACL;KAIH,YAAY,mBACX,oBAAC;MAAO,SAAQ;MAAU,WAAU;gBAAwB;OAEnD;;KAEP;IACF"}
@@ -1,5 +1,5 @@
1
1
  import { Product } from "../../types/graphql.js";
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/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_runtime0.JSX.Element;
12
+ }: ProductPreviewProps): react_jsx_runtime13.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_runtime1 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime14 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_runtime1.JSX.Element;
17
+ }): react_jsx_runtime14.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"}
@@ -30,7 +30,7 @@ const ImageOrPlaceholder = ({ image, size }) => {
30
30
  alt: "Thumbnail",
31
31
  className: "absolute inset-0 object-cover object-center",
32
32
  draggable: false,
33
- quality: 50,
33
+ quality: 40,
34
34
  sizes: "(max-width: 576px) 280px, (max-width: 768px) 360px, (max-width: 992px) 480px, 800px",
35
35
  fill: true
36
36
  }) : /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Thumbnail: React.FC<ThumbnailProps>"],"sources":["../../../src/components/thumbnail/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport Image from 'next/image';\n\nimport { PlaceholderImage } from '@gfed-medusa/sf-lib-ui/icons/placeholder-image';\nimport { Container, clx } from '@medusajs/ui';\n\ntype ThumbnailProps = {\n thumbnail?: string | null;\n // TODO: Fix image typings\n images?: any[] | null;\n size?: 'small' | 'medium' | 'large' | 'full' | 'square';\n isFeatured?: boolean;\n className?: string;\n 'data-testid'?: string;\n};\n\nconst Thumbnail: React.FC<ThumbnailProps> = ({\n thumbnail,\n images,\n size = 'small',\n isFeatured,\n className,\n 'data-testid': dataTestid,\n}) => {\n const initialImage = thumbnail || images?.[0]?.url;\n\n return (\n <Container\n className={clx(\n 'rounded-large bg-ui-bg-subtle shadow-elevation-card-rest group-hover:shadow-elevation-card-hover relative w-full overflow-hidden p-4 transition-shadow duration-150 ease-in-out',\n className,\n {\n 'aspect-[11/14]': isFeatured,\n 'aspect-[9/16]': !isFeatured && size !== 'square',\n 'aspect-[1/1]': size === 'square',\n 'w-[180px]': size === 'small',\n 'w-[290px]': size === 'medium',\n 'w-[440px]': size === 'large',\n 'w-full': size === 'full',\n }\n )}\n data-testid={dataTestid}\n >\n <ImageOrPlaceholder image={initialImage} size={size} />\n </Container>\n );\n};\n\nconst ImageOrPlaceholder = ({\n image,\n size,\n}: Pick<ThumbnailProps, 'size'> & { image?: string }) => {\n return image ? (\n <Image\n src={image}\n alt=\"Thumbnail\"\n className=\"absolute inset-0 object-cover object-center\"\n draggable={false}\n quality={50}\n sizes=\"(max-width: 576px) 280px, (max-width: 768px) 360px, (max-width: 992px) 480px, 800px\"\n fill\n />\n ) : (\n <div className=\"absolute inset-0 flex h-full w-full items-center justify-center\">\n <PlaceholderImage size={size === 'small' ? 16 : 24} />\n </div>\n );\n};\n\nexport { Thumbnail };\n"],"mappings":";;;;;;;AAiBA,MAAMA,aAAuC,EAC3C,WACA,QACA,OAAO,SACP,YACA,WACA,eAAe,iBACX;CACJ,MAAM,eAAe,aAAa,SAAS,IAAI;AAE/C,QACE,oBAAC;EACC,WAAW,IACT,mLACA,WACA;GACE,kBAAkB;GAClB,iBAAiB,CAAC,cAAc,SAAS;GACzC,gBAAgB,SAAS;GACzB,aAAa,SAAS;GACtB,aAAa,SAAS;GACtB,aAAa,SAAS;GACtB,UAAU,SAAS;GACpB,CACF;EACD,eAAa;YAEb,oBAAC;GAAmB,OAAO;GAAoB;IAAQ;GAC7C;;AAIhB,MAAM,sBAAsB,EAC1B,OACA,WACuD;AACvD,QAAO,QACL,oBAAC;EACC,KAAK;EACL,KAAI;EACJ,WAAU;EACV,WAAW;EACX,SAAS;EACT,OAAM;EACN;GACA,GAEF,oBAAC;EAAI,WAAU;YACb,oBAAC,oBAAiB,MAAM,SAAS,UAAU,KAAK,KAAM;GAClD"}
1
+ {"version":3,"file":"index.js","names":["Thumbnail: React.FC<ThumbnailProps>"],"sources":["../../../src/components/thumbnail/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport Image from 'next/image';\n\nimport { PlaceholderImage } from '@gfed-medusa/sf-lib-ui/icons/placeholder-image';\nimport { Container, clx } from '@medusajs/ui';\n\ntype ThumbnailProps = {\n thumbnail?: string | null;\n // TODO: Fix image typings\n images?: any[] | null;\n size?: 'small' | 'medium' | 'large' | 'full' | 'square';\n isFeatured?: boolean;\n className?: string;\n 'data-testid'?: string;\n};\n\nconst Thumbnail: React.FC<ThumbnailProps> = ({\n thumbnail,\n images,\n size = 'small',\n isFeatured,\n className,\n 'data-testid': dataTestid,\n}) => {\n const initialImage = thumbnail || images?.[0]?.url;\n\n return (\n <Container\n className={clx(\n 'rounded-large bg-ui-bg-subtle shadow-elevation-card-rest group-hover:shadow-elevation-card-hover relative w-full overflow-hidden p-4 transition-shadow duration-150 ease-in-out',\n className,\n {\n 'aspect-[11/14]': isFeatured,\n 'aspect-[9/16]': !isFeatured && size !== 'square',\n 'aspect-[1/1]': size === 'square',\n 'w-[180px]': size === 'small',\n 'w-[290px]': size === 'medium',\n 'w-[440px]': size === 'large',\n 'w-full': size === 'full',\n }\n )}\n data-testid={dataTestid}\n >\n <ImageOrPlaceholder image={initialImage} size={size} />\n </Container>\n );\n};\n\nconst ImageOrPlaceholder = ({\n image,\n size,\n}: Pick<ThumbnailProps, 'size'> & { image?: string }) => {\n return image ? (\n <Image\n src={image}\n alt=\"Thumbnail\"\n className=\"absolute inset-0 object-cover object-center\"\n draggable={false}\n quality={40}\n sizes=\"(max-width: 576px) 280px, (max-width: 768px) 360px, (max-width: 992px) 480px, 800px\"\n fill\n />\n ) : (\n <div className=\"absolute inset-0 flex h-full w-full items-center justify-center\">\n <PlaceholderImage size={size === 'small' ? 16 : 24} />\n </div>\n );\n};\n\nexport { Thumbnail };\n"],"mappings":";;;;;;;AAiBA,MAAMA,aAAuC,EAC3C,WACA,QACA,OAAO,SACP,YACA,WACA,eAAe,iBACX;CACJ,MAAM,eAAe,aAAa,SAAS,IAAI;AAE/C,QACE,oBAAC;EACC,WAAW,IACT,mLACA,WACA;GACE,kBAAkB;GAClB,iBAAiB,CAAC,cAAc,SAAS;GACzC,gBAAgB,SAAS;GACzB,aAAa,SAAS;GACtB,aAAa,SAAS;GACtB,aAAa,SAAS;GACtB,UAAU,SAAS;GACpB,CACF;EACD,eAAa;YAEb,oBAAC;GAAmB,OAAO;GAAoB;IAAQ;GAC7C;;AAIhB,MAAM,sBAAsB,EAC1B,OACA,WACuD;AACvD,QAAO,QACL,oBAAC;EACC,KAAK;EACL,KAAI;EACJ,WAAU;EACV,WAAW;EACX,SAAS;EACT,OAAM;EACN;GACA,GAEF,oBAAC;EAAI,WAAU;YACb,oBAAC,oBAAiB,MAAM,SAAS,UAAU,KAAK,KAAM;GAClD"}
@@ -1,10 +1,10 @@
1
1
  import { PropsWithChildren } from "react";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 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_runtime2.JSX.Element;
7
+ }: PropsWithChildren): react_jsx_runtime15.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_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime8 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_runtime3.JSX.Element;
16
+ }: ModalProviderProps) => react_jsx_runtime8.JSX.Element;
17
17
  declare const useModal: () => ModalContext;
18
18
  //#endregion
19
19
  export { ModalProvider, useModal };
@@ -1,15 +1,15 @@
1
1
  'use server';
2
2
 
3
3
  import { graphqlFetch } from "../gql/apollo-client.js";
4
- import { GET_COLLECTIONS_QUERY } from "../gql/queries/collections.js";
4
+ import { GET_COLLECTIONS_HOME_QUERY } from "../gql/queries/collections.js";
5
5
 
6
6
  //#region src/lib/data/collections.ts
7
7
  const listCollections = async (queryParams = {}) => {
8
8
  try {
9
9
  return { collections: (await graphqlFetch({
10
- query: GET_COLLECTIONS_QUERY,
10
+ query: GET_COLLECTIONS_HOME_QUERY,
11
11
  variables: {
12
- limit: parseInt(queryParams.limit || "100"),
12
+ limit: parseInt(queryParams.limit || "50"),
13
13
  offset: parseInt(queryParams.offset || "0")
14
14
  }
15
15
  }))?.collections };
@@ -1 +1 @@
1
- {"version":3,"file":"collections.js","names":[],"sources":["../../../src/lib/data/collections.ts"],"sourcesContent":["'use server';\n\nimport { graphqlFetch } from '@/lib/gql/apollo-client';\nimport { GET_COLLECTIONS_QUERY } from '@/lib/gql/queries/collections';\nimport {\n GetCollectionsQuery,\n GetCollectionsQueryVariables,\n} from '@/types/graphql';\n\nexport const listCollections = async (\n queryParams: Record<string, string> = {}\n) => {\n try {\n const limit = parseInt(queryParams.limit || '100');\n const offset = parseInt(queryParams.offset || '0');\n\n const data = await graphqlFetch<\n GetCollectionsQuery,\n GetCollectionsQueryVariables\n >({\n query: GET_COLLECTIONS_QUERY,\n variables: { limit, offset },\n });\n\n return {\n collections: data?.collections,\n };\n } catch (error) {\n console.error('Error fetching collections from BFF:', error);\n return { collections: [] };\n }\n};\n"],"mappings":";;;;;;AASA,MAAa,kBAAkB,OAC7B,cAAsC,EAAE,KACrC;AACH,KAAI;AAYF,SAAO,EACL,cATW,MAAM,aAGjB;GACA,OAAO;GACP,WAAW;IAAE,OARD,SAAS,YAAY,SAAS,MAAM;IAQ5B,QAPP,SAAS,YAAY,UAAU,IAAI;IAOpB;GAC7B,CAAC,GAGmB,aACpB;UACM,OAAO;AACd,UAAQ,MAAM,wCAAwC,MAAM;AAC5D,SAAO,EAAE,aAAa,EAAE,EAAE"}
1
+ {"version":3,"file":"collections.js","names":[],"sources":["../../../src/lib/data/collections.ts"],"sourcesContent":["'use server';\n\nimport { graphqlFetch } from '@/lib/gql/apollo-client';\nimport { GET_COLLECTIONS_HOME_QUERY } from '@/lib/gql/queries/collections';\nimport {\n GetCollectionsQuery,\n GetCollectionsQueryVariables,\n} from '@/types/graphql';\n\nexport const listCollections = async (\n queryParams: Record<string, string> = {}\n) => {\n try {\n const limit = parseInt(queryParams.limit || '50');\n const offset = parseInt(queryParams.offset || '0');\n\n const data = await graphqlFetch<\n GetCollectionsQuery,\n GetCollectionsQueryVariables\n >({\n query: GET_COLLECTIONS_HOME_QUERY,\n variables: { limit, offset },\n });\n\n return {\n collections: data?.collections,\n };\n } catch (error) {\n console.error('Error fetching collections from BFF:', error);\n return { collections: [] };\n }\n};\n"],"mappings":";;;;;;AASA,MAAa,kBAAkB,OAC7B,cAAsC,EAAE,KACrC;AACH,KAAI;AAYF,SAAO,EACL,cATW,MAAM,aAGjB;GACA,OAAO;GACP,WAAW;IAAE,OARD,SAAS,YAAY,SAAS,KAAK;IAQ3B,QAPP,SAAS,YAAY,UAAU,IAAI;IAOpB;GAC7B,CAAC,GAGmB,aACpB;UACM,OAAO;AACd,UAAQ,MAAM,wCAAwC,MAAM;AAC5D,SAAO,EAAE,aAAa,EAAE,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import { useStorefrontActions } from "./client-actions.js";
2
2
  import { ReactNode } from "react";
3
- import * as react_jsx_runtime4 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime2 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_runtime4.JSX.Element;
18
+ }: StorefrontProviderProps) => react_jsx_runtime2.JSX.Element;
19
19
  declare const useStorefrontContext: () => StorefrontContext;
20
20
  //#endregion
21
21
  export { StorefrontContext, StorefrontProvider, useStorefrontActions, useStorefrontContext };
@@ -11,7 +11,7 @@ const StorefrontReactContext = createContext({
11
11
  cacheId: ""
12
12
  });
13
13
  const fetchContext = async () => {
14
- const response = await fetch("/api/context", { credentials: "include" });
14
+ const response = await fetch("/api/horz/context", { credentials: "include" });
15
15
  if (!response.ok) throw new Error("Failed to fetch context");
16
16
  return response.json();
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["contextValue: StorefrontContext"],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nimport useSWR from 'swr';\n\nexport interface StorefrontContext {\n cartId: string;\n cacheId: string;\n cookieHeader?: string;\n}\n\ninterface ClientContext {\n cartId: string;\n cacheId: string;\n}\n\nconst StorefrontReactContext = createContext<StorefrontContext>({\n cartId: '',\n cacheId: '',\n});\n\nconst fetchContext = async (): Promise<ClientContext> => {\n const response = await fetch('/api/context', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch context');\n }\n\n return response.json();\n};\n\ninterface StorefrontProviderProps {\n children: ReactNode;\n value?: StorefrontContext;\n}\n\nexport const StorefrontProvider = ({\n children,\n value,\n}: StorefrontProviderProps) => {\n // If value is provided (host apps), use it directly\n // If no value (horizontal components), fetch from API\n const { data: fetchedContext } = useSWR<ClientContext>(\n value ? null : 'storefront-context',\n fetchContext,\n {\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n }\n );\n\n const contextValue: StorefrontContext = value ?? {\n cartId: fetchedContext?.cartId ?? '',\n cacheId: fetchedContext?.cacheId ?? '',\n };\n\n return (\n <StorefrontReactContext.Provider value={contextValue}>\n {children}\n </StorefrontReactContext.Provider>\n );\n};\n\nexport const useStorefrontContext = () => useContext(StorefrontReactContext);\nexport { useStorefrontActions } from './client-actions';\n"],"mappings":";;;;;;;;AAiBA,MAAM,yBAAyB,cAAiC;CAC9D,QAAQ;CACR,SAAS;CACV,CAAC;AAEF,MAAM,eAAe,YAAoC;CACvD,MAAM,WAAW,MAAM,MAAM,gBAAgB,EAC3C,aAAa,WACd,CAAC;AAEF,KAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,0BAA0B;AAG5C,QAAO,SAAS,MAAM;;AAQxB,MAAa,sBAAsB,EACjC,UACA,YAC6B;CAG7B,MAAM,EAAE,MAAM,mBAAmB,OAC/B,QAAQ,OAAO,sBACf,cACA;EACE,mBAAmB;EACnB,uBAAuB;EACxB,CACF;CAED,MAAMA,eAAkC,SAAS;EAC/C,QAAQ,gBAAgB,UAAU;EAClC,SAAS,gBAAgB,WAAW;EACrC;AAED,QACE,oBAAC,uBAAuB;EAAS,OAAO;EACrC;GAC+B;;AAItC,MAAa,6BAA6B,WAAW,uBAAuB"}
1
+ {"version":3,"file":"context.js","names":["contextValue: StorefrontContext"],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nimport useSWR from 'swr';\n\nexport interface StorefrontContext {\n cartId: string;\n cacheId: string;\n cookieHeader?: string;\n}\n\ninterface ClientContext {\n cartId: string;\n cacheId: string;\n}\n\nconst StorefrontReactContext = createContext<StorefrontContext>({\n cartId: '',\n cacheId: '',\n});\n\nconst fetchContext = async (): Promise<ClientContext> => {\n const response = await fetch('/api/horz/context', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch context');\n }\n\n return response.json();\n};\n\ninterface StorefrontProviderProps {\n children: ReactNode;\n value?: StorefrontContext;\n}\n\nexport const StorefrontProvider = ({\n children,\n value,\n}: StorefrontProviderProps) => {\n // If value is provided (host apps), use it directly\n // If no value (horizontal components), fetch from API\n const { data: fetchedContext } = useSWR<ClientContext>(\n value ? null : 'storefront-context',\n fetchContext,\n {\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n }\n );\n\n const contextValue: StorefrontContext = value ?? {\n cartId: fetchedContext?.cartId ?? '',\n cacheId: fetchedContext?.cacheId ?? '',\n };\n\n return (\n <StorefrontReactContext.Provider value={contextValue}>\n {children}\n </StorefrontReactContext.Provider>\n );\n};\n\nexport const useStorefrontContext = () => useContext(StorefrontReactContext);\nexport { useStorefrontActions } from './client-actions';\n"],"mappings":";;;;;;;;AAiBA,MAAM,yBAAyB,cAAiC;CAC9D,QAAQ;CACR,SAAS;CACV,CAAC;AAEF,MAAM,eAAe,YAAoC;CACvD,MAAM,WAAW,MAAM,MAAM,qBAAqB,EAChD,aAAa,WACd,CAAC;AAEF,KAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,0BAA0B;AAG5C,QAAO,SAAS,MAAM;;AAQxB,MAAa,sBAAsB,EACjC,UACA,YAC6B;CAG7B,MAAM,EAAE,MAAM,mBAAmB,OAC/B,QAAQ,OAAO,sBACf,cACA;EACE,mBAAmB;EACnB,uBAAuB;EACxB,CACF;CAED,MAAMA,eAAkC,SAAS;EAC/C,QAAQ,gBAAgB,UAAU;EAClC,SAAS,gBAAgB,WAAW;EACrC;AAED,QACE,oBAAC,uBAAuB;EAAS,OAAO;EACrC;GAC+B;;AAItC,MAAa,6BAA6B,WAAW,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-client.d.ts","names":[],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":[],"mappings":";;;;cAmBM,cAAY;;AAXM;AA2BxB;AA2BA;AASA;;AAIqC,iBAxCrB,wBAAA,CAwCqB,YAAA,CAAA,EAAA,MAAA,CAAA,EAxCyB,YAwCzB;AAAS,iBAb9B,gBAAA,CAa8B,GAAA,CAAA,EAbR,eAaQ,GAAA,IAAA,CAAA,EAbqB,YAarB;AAAnC,iBAJW,YAIE,CAAA,OAAA,EAAA,mBAFH,kBAEG,CAAA,CAAA,OAAA,EAAb,YAAA,CAAa,YAAA,CAAa,OAAb,EAAsB,UAAtB,CAAA,EAAA,oBAAA,CAAA,EACC,YADD,CAAA,EAErB,OAFqB,CAEb,OAFa,GAAA,SAAA,CAAA;AACC,iBAiBH,eAjBG,CAAA,OAAA,EAAA,mBAmBJ,kBAnBI,CAAA,CAAA,OAAA,EAqBd,YAAA,CAAa,aArBC,CAqBa,OArBb,EAqBsB,UArBtB,CAAA,EAAA,oBAAA,CAAA,EAsBA,YAtBA,CAAA,EAuBtB,OAvBsB,CAuBd,OAvBc,GAAA,SAAA,CAAA"}
1
+ {"version":3,"file":"apollo-client.d.ts","names":[],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":[],"mappings":";;;;cA2BM,cAAY;;AAnBM;AAmCxB;AA2BA;AASA;;AAIqC,iBAxCrB,wBAAA,CAwCqB,YAAA,CAAA,EAAA,MAAA,CAAA,EAxCyB,YAwCzB;AAAS,iBAb9B,gBAAA,CAa8B,GAAA,CAAA,EAbR,eAaQ,GAAA,IAAA,CAAA,EAbqB,YAarB;AAAnC,iBAJW,YAIE,CAAA,OAAA,EAAA,mBAFH,kBAEG,CAAA,CAAA,OAAA,EAAb,YAAA,CAAa,YAAA,CAAa,OAAb,EAAsB,UAAtB,CAAA,EAAA,oBAAA,CAAA,EACC,YADD,CAAA,EAErB,OAFqB,CAEb,OAFa,GAAA,SAAA,CAAA;AACC,iBAiBH,eAjBG,CAAA,OAAA,EAAA,mBAmBJ,kBAnBI,CAAA,CAAA,OAAA,EAqBd,YAAA,CAAa,aArBC,CAqBa,OArBb,EAqBsB,UArBtB,CAAA,EAAA,oBAAA,CAAA,EAsBA,YAtBA,CAAA,EAuBtB,OAvBsB,CAuBd,OAvBc,GAAA,SAAA,CAAA"}
@@ -3,8 +3,13 @@ import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from "@apollo/clien
3
3
 
4
4
  //#region src/lib/gql/apollo-client.ts
5
5
  const isServer = () => typeof window === "undefined";
6
+ const getGraphQLEndpoint = () => {
7
+ const endpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;
8
+ if (endpoint) return isServer() ? `${getBaseURL()}${endpoint}` : endpoint;
9
+ return isServer() ? `${getBaseURL()}/api/graphql` : "/api/graphql";
10
+ };
6
11
  const httpLink = new HttpLink({
7
- uri: isServer() ? `${getBaseURL()}/api/graphql` : "/api/graphql",
12
+ uri: getGraphQLEndpoint(),
8
13
  credentials: "include"
9
14
  });
10
15
  const apolloClient = new ApolloClient({
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-client.js","names":["error: any"],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":["import { IncomingMessage } from 'http';\n\nimport { ApolloLink } from '@apollo/client';\nimport {\n ApolloClient,\n HttpLink,\n InMemoryCache,\n OperationVariables,\n} from '@apollo/client';\n\nimport { getBaseURL } from '../utils/env';\n\nconst isServer = () => typeof window === 'undefined';\n\nconst httpLink = new HttpLink({\n uri: isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql',\n credentials: 'include',\n});\n\nconst apolloClient = new ApolloClient({\n link: httpLink,\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n});\n\n/**\n * When requests are sent from the server, cookies need to be manually attached.\n *\n * @param cookieHeader Cookies string to forward\n * @returns Server-side Apollo client\n */\nexport function createServerApolloClient(cookieHeader?: string) {\n const authLink = new ApolloLink((operation, forward) => {\n if (cookieHeader) {\n operation.setContext({\n http: {\n includeCredentials: true,\n },\n headers: {\n Cookie: cookieHeader,\n },\n });\n }\n\n return forward(operation);\n });\n\n return new ApolloClient({\n link: authLink.concat(httpLink),\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n });\n}\n\nexport function initializeApollo(req: IncomingMessage | null = null) {\n if (isServer()) {\n const cookieHeader = req?.headers.cookie;\n return createServerApolloClient(cookieHeader);\n }\n\n return apolloClient;\n}\n\nexport async function graphqlFetch<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.QueryOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.query<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\n\nexport async function graphqlMutation<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.MutateOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.mutate<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\nexport default apolloClient;\n"],"mappings":";;;;AAYA,MAAM,iBAAiB,OAAO,WAAW;AAEzC,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;CAClD,aAAa;CACd,CAAC;AAEF,MAAM,eAAe,IAAI,aAAa;CACpC,MAAM;CACN,OAAO,IAAI,cAAc,EAAE,CAAC;CAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;CACF,CAAC;;;;;;;AAQF,SAAgB,yBAAyB,cAAuB;AAgB9D,QAAO,IAAI,aAAa;EACtB,MAhBe,IAAI,YAAY,WAAW,YAAY;AACtD,OAAI,aACF,WAAU,WAAW;IACnB,MAAM,EACJ,oBAAoB,MACrB;IACD,SAAS,EACP,QAAQ,cACT;IACF,CAAC;AAGJ,UAAO,QAAQ,UAAU;IACzB,CAGe,OAAO,SAAS;EAC/B,OAAO,IAAI,cAAc,EAAE,CAAC;EAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;EACF,CAAC;;AAGJ,SAAgB,iBAAiB,MAA8B,MAAM;AACnE,KAAI,UAAU,EAAE;EACd,MAAM,eAAe,KAAK,QAAQ;AAClC,SAAO,yBAAyB,aAAa;;AAG/C,QAAO;;AAGT,eAAsB,aAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,MAA2B;GACvD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAIrD,eAAsB,gBAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,OAA4B;GACxD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAGrD,4BAAe"}
1
+ {"version":3,"file":"apollo-client.js","names":["error: any"],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":["import { IncomingMessage } from 'http';\n\nimport { ApolloLink } from '@apollo/client';\nimport {\n ApolloClient,\n HttpLink,\n InMemoryCache,\n OperationVariables,\n} from '@apollo/client';\n\nimport { getBaseURL } from '../utils/env';\n\nconst isServer = () => typeof window === 'undefined';\n\nconst getGraphQLEndpoint = () => {\n const endpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;\n if (endpoint) return isServer() ? `${getBaseURL()}${endpoint}` : endpoint;\n\n // Defaults to home's graphql endpoint\n return isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql';\n};\n\nconst httpLink = new HttpLink({\n uri: getGraphQLEndpoint(),\n credentials: 'include',\n});\n\nconst apolloClient = new ApolloClient({\n link: httpLink,\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n});\n\n/**\n * When requests are sent from the server, cookies need to be manually attached.\n *\n * @param cookieHeader Cookies string to forward\n * @returns Server-side Apollo client\n */\nexport function createServerApolloClient(cookieHeader?: string) {\n const authLink = new ApolloLink((operation, forward) => {\n if (cookieHeader) {\n operation.setContext({\n http: {\n includeCredentials: true,\n },\n headers: {\n Cookie: cookieHeader,\n },\n });\n }\n\n return forward(operation);\n });\n\n return new ApolloClient({\n link: authLink.concat(httpLink),\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n });\n}\n\nexport function initializeApollo(req: IncomingMessage | null = null) {\n if (isServer()) {\n const cookieHeader = req?.headers.cookie;\n return createServerApolloClient(cookieHeader);\n }\n\n return apolloClient;\n}\n\nexport async function graphqlFetch<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.QueryOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.query<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\n\nexport async function graphqlMutation<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.MutateOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.mutate<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\nexport default apolloClient;\n"],"mappings":";;;;AAYA,MAAM,iBAAiB,OAAO,WAAW;AAEzC,MAAM,2BAA2B;CAC/B,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,SAAU,QAAO,UAAU,GAAG,GAAG,YAAY,GAAG,aAAa;AAGjE,QAAO,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;;AAGtD,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,oBAAoB;CACzB,aAAa;CACd,CAAC;AAEF,MAAM,eAAe,IAAI,aAAa;CACpC,MAAM;CACN,OAAO,IAAI,cAAc,EAAE,CAAC;CAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;CACF,CAAC;;;;;;;AAQF,SAAgB,yBAAyB,cAAuB;AAgB9D,QAAO,IAAI,aAAa;EACtB,MAhBe,IAAI,YAAY,WAAW,YAAY;AACtD,OAAI,aACF,WAAU,WAAW;IACnB,MAAM,EACJ,oBAAoB,MACrB;IACD,SAAS,EACP,QAAQ,cACT;IACF,CAAC;AAGJ,UAAO,QAAQ,UAAU;IACzB,CAGe,OAAO,SAAS;EAC/B,OAAO,IAAI,cAAc,EAAE,CAAC;EAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;EACF,CAAC;;AAGJ,SAAgB,iBAAiB,MAA8B,MAAM;AACnE,KAAI,UAAU,EAAE;EACd,MAAM,eAAe,KAAK,QAAQ;AAClC,SAAO,yBAAyB,aAAa;;AAG/C,QAAO;;AAGT,eAAsB,aAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,MAA2B;GACvD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAIrD,eAAsB,gBAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,OAA4B;GACxD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAGrD,4BAAe"}
@@ -1,14 +1,14 @@
1
- import * as _apollo_client1 from "@apollo/client";
1
+ import * as _apollo_client2 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/cart.d.ts
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;
4
+ declare const LINE_ITEM_FRAGMENT: _apollo_client2.DocumentNode;
5
+ declare const COUNTRY_FRAGMENT: _apollo_client2.DocumentNode;
6
+ declare const REGION_FRAGMENT: _apollo_client2.DocumentNode;
7
+ declare const SHIPPING_METHODS_FRAGMENT: _apollo_client2.DocumentNode;
8
+ declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client2.DocumentNode;
9
+ declare const ADDRESS_FRAGMENT: _apollo_client2.DocumentNode;
10
+ declare const PROMOTION_FRAGMENT: _apollo_client2.DocumentNode;
11
+ declare const CART_FRAGMENT: _apollo_client2.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_client0 from "@apollo/client";
1
+ import * as _apollo_client31 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/customer.d.ts
4
- declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client0.DocumentNode;
5
- declare const CUSTOMER_FRAGMENT: _apollo_client0.DocumentNode;
4
+ declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client31.DocumentNode;
5
+ declare const CUSTOMER_FRAGMENT: _apollo_client31.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"}