@shopify/shop-minis-react 0.0.26 → 0.0.28

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 (44) hide show
  1. package/dist/_virtual/index2.js +4 -4
  2. package/dist/_virtual/index3.js +4 -4
  3. package/dist/components/atoms/content-monitor.js +22 -0
  4. package/dist/components/atoms/content-monitor.js.map +1 -0
  5. package/dist/components/atoms/content-wrapper.js +18 -0
  6. package/dist/components/atoms/content-wrapper.js.map +1 -0
  7. package/dist/components/atoms/long-press-detector.js +33 -0
  8. package/dist/components/atoms/long-press-detector.js.map +1 -0
  9. package/dist/components/commerce/product-link-skeleton.js +30 -0
  10. package/dist/components/commerce/product-link-skeleton.js.map +1 -0
  11. package/dist/components/commerce/product-link.js +68 -68
  12. package/dist/components/commerce/product-link.js.map +1 -1
  13. package/dist/components/commerce/search.js +144 -0
  14. package/dist/components/commerce/search.js.map +1 -0
  15. package/dist/components/content/image-content-wrapper.js +27 -0
  16. package/dist/components/content/image-content-wrapper.js.map +1 -0
  17. package/dist/components/ui/input.js +3 -3
  18. package/dist/components/ui/input.js.map +1 -1
  19. package/dist/hooks/product/useProductSearch.js +24 -23
  20. package/dist/hooks/product/useProductSearch.js.map +1 -1
  21. package/dist/index.js +232 -225
  22. package/dist/index.js.map +1 -1
  23. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/search.js +16 -0
  24. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/search.js.map +1 -0
  25. package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +1 -1
  26. package/dist/shop-minis-react.css +1 -1
  27. package/dist/utils/colors.js +1 -1
  28. package/package.json +1 -1
  29. package/src/components/atoms/content-monitor.tsx +25 -0
  30. package/src/components/{content → atoms}/content-wrapper.tsx +1 -0
  31. package/src/components/atoms/long-press-detector.tsx +52 -0
  32. package/src/components/commerce/product-link-skeleton.tsx +30 -0
  33. package/src/components/commerce/product-link.tsx +8 -5
  34. package/src/components/commerce/search.tsx +264 -0
  35. package/src/components/content/image-content-wrapper.tsx +42 -0
  36. package/src/components/index.ts +3 -1
  37. package/src/components/ui/input.tsx +1 -1
  38. package/src/hooks/product/useProductSearch.ts +10 -1
  39. package/src/styles/utilities.css +9 -0
  40. package/dist/components/content/content-monitor.js +0 -17
  41. package/dist/components/content/content-monitor.js.map +0 -1
  42. package/dist/components/content/content-wrapper.js +0 -17
  43. package/dist/components/content/content-wrapper.js.map +0 -1
  44. package/src/components/content/content-monitor.tsx +0 -23
@@ -1,8 +1,8 @@
1
1
  import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js";
3
- var t = /* @__PURE__ */ o();
4
- const l = /* @__PURE__ */ r(t);
2
+ import { __require as o } from "../shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js";
3
+ var t = o();
4
+ const a = /* @__PURE__ */ r(t);
5
5
  export {
6
- l as default
6
+ a as default
7
7
  };
8
8
  //# sourceMappingURL=index2.js.map
@@ -1,8 +1,8 @@
1
1
  import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js";
3
- var t = o();
4
- const a = /* @__PURE__ */ r(t);
2
+ import { __require as o } from "../shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js";
3
+ var t = /* @__PURE__ */ o();
4
+ const l = /* @__PURE__ */ r(t);
5
5
  export {
6
- a as default
6
+ l as default
7
7
  };
8
8
  //# sourceMappingURL=index3.js.map
@@ -0,0 +1,22 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useShopActions as n } from "../../internal/useShopActions.js";
3
+ import { LongPressDetector as s } from "./long-press-detector.js";
4
+ function c({
5
+ publicId: o,
6
+ children: r
7
+ }) {
8
+ const { showFeedbackSheet: t } = n();
9
+ return /* @__PURE__ */ e(
10
+ s,
11
+ {
12
+ onLongPress: () => {
13
+ o && t({ publicId: o });
14
+ },
15
+ children: r
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ c as ContentMonitor
21
+ };
22
+ //# sourceMappingURL=content-monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-monitor.js","sources":["../../../src/components/atoms/content-monitor.tsx"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\n\nimport {LongPressDetector} from './long-press-detector'\n\nexport function ContentMonitor({\n publicId,\n children,\n}: {\n publicId?: string\n children: React.ReactNode\n}) {\n const {showFeedbackSheet} = useShopActions()\n\n return (\n <LongPressDetector\n onLongPress={() => {\n if (!publicId) return\n\n showFeedbackSheet({publicId})\n }}\n >\n {children}\n </LongPressDetector>\n )\n}\n"],"names":["ContentMonitor","publicId","children","showFeedbackSheet","useShopActions","jsx","LongPressDetector"],"mappings":";;;AAIO,SAASA,EAAe;AAAA,EAC7B,UAAAC;AAAA,EACA,UAAAC;AACF,GAGG;AACK,QAAA,EAAC,mBAAAC,EAAiB,IAAIC,EAAe;AAGzC,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,aAAa,MAAM;AACjB,QAAKL,KAEaE,EAAA,EAAC,UAAAF,GAAS;AAAA,MAC9B;AAAA,MAEC,UAAAC;AAAA,IAAA;AAAA,EACH;AAEJ;"}
@@ -0,0 +1,18 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useContent as c } from "../../hooks/content/useContent.js";
3
+ import { ContentMonitor as m } from "./content-monitor.js";
4
+ function C({
5
+ publicId: o,
6
+ externalId: r,
7
+ children: e
8
+ }) {
9
+ const { content: i, loading: t } = c({
10
+ identifiers: [{ publicId: o, externalId: r }],
11
+ skip: !o && !r
12
+ }), n = i?.[0];
13
+ return t || !n ? e({ loading: t }) : /* @__PURE__ */ p(m, { publicId: n.publicId, children: e({ content: n, loading: t }) });
14
+ }
15
+ export {
16
+ C as ContentWrapper
17
+ };
18
+ //# sourceMappingURL=content-wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-wrapper.js","sources":["../../../src/components/atoms/content-wrapper.tsx"],"sourcesContent":["import {useContent} from '../../hooks/content/useContent'\nimport {Content} from '../../types'\n\nimport {ContentMonitor} from './content-monitor'\n\ninterface BaseContentWrapperProps {\n children: ({\n content,\n loading,\n }: {\n content?: Content\n loading: boolean\n }) => JSX.Element | null\n}\n\ninterface PublicIdContentWrapperProps extends BaseContentWrapperProps {\n publicId: string\n externalId?: never\n}\n\ninterface ExternalIdContentWrapperProps extends BaseContentWrapperProps {\n externalId: string\n publicId?: never\n}\n\ntype ContentWrapperProps =\n | PublicIdContentWrapperProps\n | ExternalIdContentWrapperProps\n\n// It's too messy in the docs to show the complete types here so we show a simplified version\nexport interface ContentWrapperPropsForDocs extends BaseContentWrapperProps {\n publicId?: string\n externalId?: string\n}\n\nexport function ContentWrapper({\n publicId,\n externalId,\n children,\n}: ContentWrapperProps) {\n const {content, loading} = useContent({\n identifiers: [{publicId, externalId}],\n skip: !publicId && !externalId,\n })\n\n const contentItem = content?.[0]\n\n if (loading || !contentItem) {\n return children({loading})\n }\n\n return (\n <ContentMonitor publicId={contentItem.publicId}>\n {children({content: contentItem, loading})}\n </ContentMonitor>\n )\n}\n"],"names":["ContentWrapper","publicId","externalId","children","content","loading","useContent","contentItem","jsx","ContentMonitor"],"mappings":";;;AAmCO,SAASA,EAAe;AAAA,EAC7B,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AACF,GAAwB;AACtB,QAAM,EAAC,SAAAC,GAAS,SAAAC,EAAO,IAAIC,EAAW;AAAA,IACpC,aAAa,CAAC,EAAC,UAAAL,GAAU,YAAAC,GAAW;AAAA,IACpC,MAAM,CAACD,KAAY,CAACC;AAAA,EAAA,CACrB,GAEKK,IAAcH,IAAU,CAAC;AAE3B,SAAAC,KAAW,CAACE,IACPJ,EAAS,EAAC,SAAAE,GAAQ,IAIzB,gBAAAG,EAACC,GAAe,EAAA,UAAUF,EAAY,UACnC,UAASJ,EAAA,EAAC,SAASI,GAAa,SAAAF,EAAO,CAAC,EAC3C,CAAA;AAEJ;"}
@@ -0,0 +1,33 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { motion as s } from "../../shop-minis-react/node_modules/.pnpm/motion@12.17.3_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/motion/dist/es/framer-motion/dist/es/render/components/motion/proxy.js";
4
+ const l = ({
5
+ onLongPress: e,
6
+ delay: o = 500,
7
+ children: c,
8
+ ...a
9
+ }) => {
10
+ const r = t.useRef(void 0), u = t.useCallback(() => {
11
+ r.current = window.setTimeout(() => {
12
+ e(), r.current = void 0;
13
+ }, o);
14
+ }, [e, o]), n = t.useCallback(() => {
15
+ r.current && (clearTimeout(r.current), r.current = void 0);
16
+ }, []);
17
+ return t.useEffect(() => () => {
18
+ r.current && clearTimeout(r.current);
19
+ }, []), /* @__PURE__ */ i(
20
+ s.div,
21
+ {
22
+ onTapStart: u,
23
+ onTap: n,
24
+ onTapCancel: n,
25
+ ...a,
26
+ children: c
27
+ }
28
+ );
29
+ };
30
+ export {
31
+ l as LongPressDetector
32
+ };
33
+ //# sourceMappingURL=long-press-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"long-press-detector.js","sources":["../../../src/components/atoms/long-press-detector.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {motion, HTMLMotionProps} from 'motion/react'\n\ninterface LongPressDetectorProps extends HTMLMotionProps<'div'> {\n onLongPress: () => void\n delay?: number\n children: React.ReactNode\n}\n\nexport const LongPressDetector = ({\n onLongPress,\n delay = 500,\n children,\n ...motionProps\n}: LongPressDetectorProps) => {\n const longPressTimeoutRef = React.useRef<number | undefined>(undefined)\n\n const handleTapStart = React.useCallback(() => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n onLongPress()\n longPressTimeoutRef.current = undefined\n }, delay)\n }, [onLongPress, delay])\n\n const handleTapEnd = React.useCallback(() => {\n if (longPressTimeoutRef.current) {\n clearTimeout(longPressTimeoutRef.current)\n longPressTimeoutRef.current = undefined\n }\n }, [])\n\n // Cleanup timer on unmount\n React.useEffect(() => {\n return () => {\n if (longPressTimeoutRef.current) {\n clearTimeout(longPressTimeoutRef.current)\n }\n }\n }, [])\n\n return (\n <motion.div\n onTapStart={handleTapStart}\n onTap={handleTapEnd}\n onTapCancel={handleTapEnd}\n {...motionProps}\n >\n {children}\n </motion.div>\n )\n}\n"],"names":["LongPressDetector","onLongPress","delay","children","motionProps","longPressTimeoutRef","React","handleTapStart","handleTapEnd","jsx","motion"],"mappings":";;;AAUO,MAAMA,IAAoB,CAAC;AAAA,EAChC,aAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,GAAGC;AACL,MAA8B;AACtB,QAAAC,IAAsBC,EAAM,OAA2B,MAAS,GAEhEC,IAAiBD,EAAM,YAAY,MAAM;AACzB,IAAAD,EAAA,UAAU,OAAO,WAAW,MAAM;AACxC,MAAAJ,EAAA,GACZI,EAAoB,UAAU;AAAA,OAC7BH,CAAK;AAAA,EAAA,GACP,CAACD,GAAaC,CAAK,CAAC,GAEjBM,IAAeF,EAAM,YAAY,MAAM;AAC3C,IAAID,EAAoB,YACtB,aAAaA,EAAoB,OAAO,GACxCA,EAAoB,UAAU;AAAA,EAElC,GAAG,EAAE;AAGL,SAAAC,EAAM,UAAU,MACP,MAAM;AACX,IAAID,EAAoB,WACtB,aAAaA,EAAoB,OAAO;AAAA,EAE5C,GACC,EAAE,GAGH,gBAAAI;AAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MACC,YAAYH;AAAA,MACZ,OAAOC;AAAA,MACP,aAAaA;AAAA,MACZ,GAAGJ;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EACH;AAEJ;"}
@@ -0,0 +1,30 @@
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import { cn as m } from "../../lib/utils.js";
3
+ import { Skeleton as s } from "../ui/skeleton.js";
4
+ function n({
5
+ className: t,
6
+ ...r
7
+ }) {
8
+ return /* @__PURE__ */ e(
9
+ "div",
10
+ {
11
+ className: m(
12
+ "relative w-full shadow-sm rounded-lg p-4 items-center",
13
+ t
14
+ ),
15
+ ...r,
16
+ children: /* @__PURE__ */ l("div", { className: "flex flex-row items-center justify-center w-full", children: [
17
+ /* @__PURE__ */ e(s, { className: "aspect-square w-15 h-15" }),
18
+ /* @__PURE__ */ l("div", { className: "flex flex-col justify-center items-start ml-2 w-full pt-2", children: [
19
+ /* @__PURE__ */ e(s, { className: "mb-3 h-3 w-3/4" }),
20
+ /* @__PURE__ */ e(s, { className: "mb-2 h-3 w-1/4" }),
21
+ /* @__PURE__ */ e(s, { className: "mb-2 h-3 w-1/3" })
22
+ ] })
23
+ ] })
24
+ }
25
+ );
26
+ }
27
+ export {
28
+ n as ProductLinkSkeleton
29
+ };
30
+ //# sourceMappingURL=product-link-skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-link-skeleton.js","sources":["../../../src/components/commerce/product-link-skeleton.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cn} from '../../lib/utils'\nimport {Skeleton} from '../ui/skeleton'\n\nfunction ProductLinkSkeleton({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n className={cn(\n 'relative w-full shadow-sm rounded-lg p-4 items-center',\n className\n )}\n {...props}\n >\n <div className=\"flex flex-row items-center justify-center w-full\">\n <Skeleton className=\"aspect-square w-15 h-15\" />\n <div className=\"flex flex-col justify-center items-start ml-2 w-full pt-2\">\n <Skeleton className=\"mb-3 h-3 w-3/4\" />\n <Skeleton className=\"mb-2 h-3 w-1/4\" />\n <Skeleton className=\"mb-2 h-3 w-1/3\" />\n </div>\n </div>\n </div>\n )\n}\n\nexport {ProductLinkSkeleton}\n"],"names":["ProductLinkSkeleton","className","props","jsx","cn","jsxs","Skeleton"],"mappings":";;;AAKA,SAASA,EAAoB;AAAA,EAC3B,WAAAC;AAAA,EACA,GAAGC;AACL,GAAgC;AAE5B,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAH;AAAA,MACF;AAAA,MACC,GAAGC;AAAA,MAEJ,UAAA,gBAAAG,EAAC,OAAI,EAAA,WAAU,oDACb,UAAA;AAAA,QAAC,gBAAAF,EAAAG,GAAA,EAAS,WAAU,0BAA0B,CAAA;AAAA,QAC9C,gBAAAD,EAAC,OAAI,EAAA,WAAU,6DACb,UAAA;AAAA,UAAC,gBAAAF,EAAAG,GAAA,EAAS,WAAU,iBAAiB,CAAA;AAAA,UACrC,gBAAAH,EAACG,GAAS,EAAA,WAAU,iBAAiB,CAAA;AAAA,UACrC,gBAAAH,EAACG,GAAS,EAAA,WAAU,iBAAiB,CAAA;AAAA,QAAA,EACvC,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,16 +1,16 @@
1
- import { jsxs as c, jsx as t, Fragment as V } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as t, Fragment as F } from "react/jsx-runtime";
2
2
  import * as w from "react";
3
- import { cva as F } from "../../shop-minis-react/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
- import { useShopNavigation as j } from "../../hooks/navigation/useShopNavigation.js";
5
- import { useSavedProductsActions as O } from "../../hooks/user/useSavedProductsActions.js";
6
- import { formatMoney as b } from "../../lib/formatMoney.js";
3
+ import { cva as j } from "../../shop-minis-react/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
+ import { useShopNavigation as O } from "../../hooks/navigation/useShopNavigation.js";
5
+ import { useSavedProductsActions as M } from "../../hooks/user/useSavedProductsActions.js";
6
+ import { formatMoney as A } from "../../lib/formatMoney.js";
7
7
  import { cn as n } from "../../lib/utils.js";
8
- import { FavoriteButton as M } from "../atoms/favorite-button.js";
9
- import { Touchable as A } from "../atoms/touchable.js";
10
- import { Card as D, CardContent as q, CardAction as B } from "../ui/card.js";
11
- import U from "../../shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star.js";
12
- import { Root as _ } from "../../shop-minis-react/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-slot/dist/index.js";
13
- const E = F("", {
8
+ import { FavoriteButton as D } from "../atoms/favorite-button.js";
9
+ import { Touchable as z } from "../atoms/touchable.js";
10
+ import { Card as q, CardContent as B, CardAction as U } from "../ui/card.js";
11
+ import _ from "../../shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star.js";
12
+ import { Root as E } from "../../shop-minis-react/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-slot/dist/index.js";
13
+ const G = j("", {
14
14
  variants: {
15
15
  layout: {
16
16
  horizontal: "w-full !flex-row items-center gap-3 px-4 py-3",
@@ -27,37 +27,37 @@ const E = F("", {
27
27
  discount: "none"
28
28
  }
29
29
  });
30
- function G({
30
+ function H({
31
31
  className: o,
32
32
  layout: e,
33
33
  discount: r,
34
34
  asChild: i = !1,
35
- onPress: a,
36
- ...s
35
+ onPress: l,
36
+ ...a
37
37
  }) {
38
38
  return /* @__PURE__ */ t(
39
- A,
39
+ z,
40
40
  {
41
- onClick: a,
41
+ onClick: l,
42
42
  whileTap: { opacity: 0.7 },
43
43
  transition: {
44
44
  opacity: { type: "tween", duration: 0.08, ease: "easeInOut" }
45
45
  },
46
46
  children: /* @__PURE__ */ t(
47
- i ? _ : D,
47
+ i ? E : q,
48
48
  {
49
49
  className: n(
50
- E({ layout: e, discount: r }),
50
+ G({ layout: e, discount: r }),
51
51
  "border-0 bg-white rounded-xl shadow-lg shadow-black/10",
52
52
  o
53
53
  ),
54
- ...s
54
+ ...a
55
55
  }
56
56
  )
57
57
  }
58
58
  );
59
59
  }
60
- function H({
60
+ function J({
61
61
  className: o,
62
62
  layout: e = "horizontal",
63
63
  ...r
@@ -75,13 +75,13 @@ function H({
75
75
  }
76
76
  );
77
77
  }
78
- function J({
78
+ function K({
79
79
  className: o,
80
80
  layout: e = "horizontal",
81
81
  ...r
82
82
  }) {
83
83
  return /* @__PURE__ */ t(
84
- q,
84
+ B,
85
85
  {
86
86
  className: n(
87
87
  e === "horizontal" ? "flex-1 min-w-0 space-y-1 px-0 py-0" : "space-y-2",
@@ -91,7 +91,7 @@ function J({
91
91
  }
92
92
  );
93
93
  }
94
- function K({
94
+ function Q({
95
95
  className: o,
96
96
  children: e,
97
97
  ...r
@@ -109,7 +109,7 @@ function K({
109
109
  }
110
110
  );
111
111
  }
112
- function Q({ className: o, ...e }) {
112
+ function W({ className: o, ...e }) {
113
113
  return /* @__PURE__ */ t(
114
114
  "div",
115
115
  {
@@ -119,7 +119,7 @@ function Q({ className: o, ...e }) {
119
119
  }
120
120
  );
121
121
  }
122
- function W({
122
+ function X({
123
123
  className: o,
124
124
  ...e
125
125
  }) {
@@ -132,7 +132,7 @@ function W({
132
132
  }
133
133
  );
134
134
  }
135
- function X({
135
+ function Y({
136
136
  className: o,
137
137
  ...e
138
138
  }) {
@@ -145,7 +145,7 @@ function X({
145
145
  }
146
146
  );
147
147
  }
148
- function Y({
148
+ function Z({
149
149
  className: o,
150
150
  ...e
151
151
  }) {
@@ -158,7 +158,7 @@ function Y({
158
158
  }
159
159
  );
160
160
  }
161
- function Z({ className: o, ...e }) {
161
+ function $({ className: o, ...e }) {
162
162
  return /* @__PURE__ */ t(
163
163
  "div",
164
164
  {
@@ -171,19 +171,19 @@ function Z({ className: o, ...e }) {
171
171
  }
172
172
  );
173
173
  }
174
- function $({
174
+ function tt({
175
175
  className: o,
176
176
  onPress: e,
177
177
  filled: r = !1,
178
178
  ...i
179
179
  }) {
180
180
  return /* @__PURE__ */ t(
181
- B,
181
+ U,
182
182
  {
183
183
  className: n("flex-shrink-0 self-center px-0 py-0", o),
184
184
  ...i,
185
185
  children: /* @__PURE__ */ t(
186
- A,
186
+ z,
187
187
  {
188
188
  stopPropagation: !0,
189
189
  onClick: e,
@@ -192,43 +192,43 @@ function $({
192
192
  opacity: { type: "tween", duration: 0.08, ease: "easeInOut" },
193
193
  scale: { type: "tween", duration: 0.08, ease: "easeInOut" }
194
194
  },
195
- children: /* @__PURE__ */ t(M, { filled: r, onClick: e })
195
+ children: /* @__PURE__ */ t(D, { filled: r, onClick: e })
196
196
  }
197
197
  )
198
198
  }
199
199
  );
200
200
  }
201
- function ut({ product: o }) {
202
- const { navigateToProduct: e } = j(), { saveProduct: r, unsaveProduct: i } = O(), {
201
+ function mt({ product: o, hideFavoriteAction: e = !1 }) {
202
+ const { navigateToProduct: r } = O(), { saveProduct: i, unsaveProduct: l } = M(), {
203
203
  id: a,
204
- title: s,
205
- featuredImage: u,
206
- reviewAnalytics: P,
204
+ title: u,
205
+ featuredImage: P,
206
+ reviewAnalytics: C,
207
207
  price: m,
208
208
  compareAtPrice: p,
209
- isFavorited: z,
209
+ isFavorited: T,
210
210
  selectedVariant: f,
211
211
  defaultVariantId: h,
212
212
  shop: g
213
- } = o, [x, C] = w.useState(z), y = P?.averageRating, N = P?.reviewCount, v = m?.amount ? b(m?.amount, m?.currencyCode) : void 0, I = u?.url, T = u?.altText || s, k = p?.amount ? b(p?.amount, p?.currencyCode) : void 0, L = k && k !== v, R = w.useCallback(() => {
214
- e({
213
+ } = o, [x, N] = w.useState(T), y = C?.averageRating, I = C?.reviewCount, v = m?.amount ? A(m?.amount, m?.currencyCode) : void 0, L = P?.url, R = P?.altText || u, k = p?.amount ? A(p?.amount, p?.currencyCode) : void 0, b = k && k !== v, S = w.useCallback(() => {
214
+ r({
215
215
  productId: a
216
216
  });
217
- }, [e, a]), S = w.useCallback(async () => {
218
- const l = x;
219
- C(!l);
217
+ }, [r, a]), V = w.useCallback(async () => {
218
+ const s = x;
219
+ N(!s);
220
220
  try {
221
- l ? await i({
221
+ s ? await l({
222
222
  productId: a,
223
223
  shopId: g.id,
224
224
  productVariantId: f?.id || h
225
- }) : await r({
225
+ }) : await i({
226
226
  productId: a,
227
227
  shopId: g.id,
228
228
  productVariantId: f?.id || h
229
229
  });
230
230
  } catch {
231
- C(l);
231
+ N(s);
232
232
  }
233
233
  }, [
234
234
  x,
@@ -236,29 +236,29 @@ function ut({ product: o }) {
236
236
  g.id,
237
237
  f?.id,
238
238
  h,
239
- r,
240
- i
239
+ i,
240
+ l
241
241
  ]);
242
242
  return /* @__PURE__ */ c(
243
- G,
243
+ H,
244
244
  {
245
245
  layout: "horizontal",
246
- discount: L ? "small" : "none",
247
- onPress: R,
246
+ discount: b ? "small" : "none",
247
+ onPress: S,
248
248
  children: [
249
- /* @__PURE__ */ t(H, { layout: "horizontal", children: I ? /* @__PURE__ */ t(
249
+ /* @__PURE__ */ t(J, { layout: "horizontal", children: L ? /* @__PURE__ */ t(
250
250
  "img",
251
251
  {
252
- src: I,
253
- alt: T,
252
+ src: L,
253
+ alt: R,
254
254
  className: "h-full w-full object-cover"
255
255
  }
256
256
  ) : /* @__PURE__ */ t("div", { className: "h-full w-full bg-muted flex items-center justify-center text-muted-foreground text-xs", children: "No Image" }) }),
257
- /* @__PURE__ */ c(J, { layout: "horizontal", children: [
258
- /* @__PURE__ */ t(K, { children: s }),
259
- N && y && /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
260
- Array.from({ length: 5 }, (l, d) => /* @__PURE__ */ t(
261
- U,
257
+ /* @__PURE__ */ c(K, { layout: "horizontal", children: [
258
+ /* @__PURE__ */ t(Q, { children: u }),
259
+ I && y && /* @__PURE__ */ t($, { children: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
260
+ Array.from({ length: 5 }, (s, d) => /* @__PURE__ */ t(
261
+ _,
262
262
  {
263
263
  fill: d < Math.floor(y) ? "currentColor" : "none",
264
264
  className: n(
@@ -270,20 +270,20 @@ function ut({ product: o }) {
270
270
  )),
271
271
  /* @__PURE__ */ c("span", { className: "text-xs text-gray-600 ml-1", children: [
272
272
  "(",
273
- N,
273
+ I,
274
274
  ")"
275
275
  ] })
276
276
  ] }) }),
277
- /* @__PURE__ */ t(Q, { children: L ? /* @__PURE__ */ c(V, { children: [
278
- /* @__PURE__ */ t(Y, { children: v }),
279
- /* @__PURE__ */ t(X, { children: k })
280
- ] }) : /* @__PURE__ */ t(W, { children: v }) })
277
+ /* @__PURE__ */ t(W, { children: b ? /* @__PURE__ */ c(F, { children: [
278
+ /* @__PURE__ */ t(Z, { children: v }),
279
+ /* @__PURE__ */ t(Y, { children: k })
280
+ ] }) : /* @__PURE__ */ t(X, { children: v }) })
281
281
  ] }),
282
- /* @__PURE__ */ t(
283
- $,
282
+ e ? null : /* @__PURE__ */ t(
283
+ tt,
284
284
  {
285
285
  filled: x,
286
- onPress: S
286
+ onPress: V
287
287
  }
288
288
  )
289
289
  ]
@@ -291,6 +291,6 @@ function ut({ product: o }) {
291
291
  );
292
292
  }
293
293
  export {
294
- ut as ProductLink
294
+ mt as ProductLink
295
295
  };
296
296
  //# sourceMappingURL=product-link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-link.js","sources":["../../../src/components/commerce/product-link.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {type Product} from '@shopify/shop-minis-platform'\nimport {cva, type VariantProps} from 'class-variance-authority'\nimport {Star} from 'lucide-react'\nimport {Slot as SlotPrimitive} from 'radix-ui'\n\nimport {useShopNavigation} from '../../hooks/navigation/useShopNavigation'\nimport {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'\nimport {formatMoney} from '../../lib/formatMoney'\nimport {cn} from '../../lib/utils'\nimport {FavoriteButton} from '../atoms/favorite-button'\nimport {Touchable} from '../atoms/touchable'\nimport {Card, CardContent, CardAction} from '../ui/card'\n\nconst productLinkVariants = cva('', {\n variants: {\n layout: {\n horizontal: 'w-full !flex-row items-center gap-3 px-4 py-3',\n vertical: 'flex-col',\n },\n discount: {\n none: '',\n small: '',\n large: '',\n },\n },\n defaultVariants: {\n layout: 'horizontal',\n discount: 'none',\n },\n})\n\n// Primitive components (building blocks)\nexport interface ProductLinkRootProps\n extends React.ComponentProps<typeof Card>,\n VariantProps<typeof productLinkVariants> {\n layout?: 'horizontal' | 'vertical'\n asChild?: boolean\n onPress?: () => void\n}\n\nfunction ProductLinkRoot({\n className,\n layout,\n discount,\n asChild = false,\n onPress,\n ...props\n}: ProductLinkRootProps) {\n const Comp = asChild ? SlotPrimitive.Root : Card\n\n return (\n <Touchable\n onClick={onPress}\n whileTap={{opacity: 0.7}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n <Comp\n className={cn(\n productLinkVariants({layout, discount}),\n 'border-0 bg-white rounded-xl shadow-lg shadow-black/10',\n className\n )}\n {...props}\n />\n </Touchable>\n )\n}\n\nfunction ProductLinkImage({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<'div'> & {layout?: 'horizontal' | 'vertical'}) {\n return (\n <div\n data-slot=\"product-link-image\"\n className={cn(\n 'overflow-hidden rounded-md bg-muted',\n layout === 'horizontal'\n ? 'h-16 w-16 flex-shrink-0'\n : 'aspect-square w-full',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkInfo({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<typeof CardContent> & {\n layout?: 'horizontal' | 'vertical'\n}) {\n return (\n <CardContent\n className={cn(\n layout === 'horizontal'\n ? 'flex-1 min-w-0 space-y-1 px-0 py-0'\n : 'space-y-2',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkTitle({\n className,\n children,\n ...props\n}: React.ComponentProps<'h3'>) {\n return (\n <h3\n data-slot=\"product-link-title\"\n className={cn(\n 'text-sm font-medium leading-tight text-gray-900 truncate overflow-hidden whitespace-nowrap text-ellipsis',\n className\n )}\n {...props}\n >\n {children}\n </h3>\n )\n}\n\nfunction ProductLinkPrice({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-price\"\n className={cn('flex items-center gap-2', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkCurrentPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-current-price\"\n className={cn('text-sm font-semibold text-gray-900', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkOriginalPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-original-price\"\n className={cn('text-sm text-gray-500 line-through', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkDiscountPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-discount-price\"\n className={cn('text-sm font-semibold text-red-600', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkRating({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-rating\"\n className={cn(\n 'flex items-center gap-1 text-xs text-muted-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkActions({\n className,\n onPress,\n filled = false,\n ...props\n}: React.ComponentProps<typeof CardAction> & {\n onPress?: () => void\n filled?: boolean\n}) {\n return (\n <CardAction\n className={cn('flex-shrink-0 self-center px-0 py-0', className)}\n {...props}\n >\n <Touchable\n stopPropagation\n onClick={onPress}\n whileTap={{opacity: 0.7, scale: 0.95}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n scale: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n <FavoriteButton filled={filled} onClick={onPress} />\n </Touchable>\n </CardAction>\n )\n}\n\nexport interface ProductLinkProps {\n product: Product\n}\n\n// Composed ProductLink component\nfunction ProductLink({product}: ProductLinkProps) {\n const {navigateToProduct} = useShopNavigation()\n const {saveProduct, unsaveProduct} = useSavedProductsActions()\n\n const {\n id,\n title,\n featuredImage,\n reviewAnalytics,\n price,\n compareAtPrice,\n isFavorited,\n selectedVariant,\n defaultVariantId,\n shop,\n } = product\n\n // Local state for optimistic UI updates\n const [isFavoritedLocal, setIsFavoritedLocal] = React.useState(isFavorited)\n\n const averageRating = reviewAnalytics?.averageRating\n const reviewCount = reviewAnalytics?.reviewCount\n const amount = price?.amount\n ? formatMoney(price?.amount, price?.currencyCode)\n : undefined\n const imageUrl = featuredImage?.url\n const imageAltText = featuredImage?.altText || title\n const compareAtPriceAmount = compareAtPrice?.amount\n ? formatMoney(compareAtPrice?.amount, compareAtPrice?.currencyCode)\n : undefined\n const hasDiscount = compareAtPriceAmount && compareAtPriceAmount !== amount\n\n const handlePress = React.useCallback(() => {\n navigateToProduct({\n productId: id,\n })\n }, [navigateToProduct, id])\n\n const handleActionPress = React.useCallback(async () => {\n const previousState = isFavoritedLocal\n\n // Optimistic update\n setIsFavoritedLocal(!previousState)\n\n try {\n if (previousState) {\n await unsaveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n } else {\n await saveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n }\n } catch (error) {\n // Revert optimistic update on error\n setIsFavoritedLocal(previousState)\n }\n }, [\n isFavoritedLocal,\n id,\n shop.id,\n selectedVariant?.id,\n defaultVariantId,\n saveProduct,\n unsaveProduct,\n ])\n\n return (\n <ProductLinkRoot\n layout=\"horizontal\"\n discount={hasDiscount ? 'small' : 'none'}\n onPress={handlePress}\n >\n <ProductLinkImage layout=\"horizontal\">\n {imageUrl ? (\n <img\n src={imageUrl}\n alt={imageAltText}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div className=\"h-full w-full bg-muted flex items-center justify-center text-muted-foreground text-xs\">\n No Image\n </div>\n )}\n </ProductLinkImage>\n\n <ProductLinkInfo layout=\"horizontal\">\n <ProductLinkTitle>{title}</ProductLinkTitle>\n\n {reviewCount && averageRating && (\n <ProductLinkRating>\n <div className=\"flex items-center gap-1\">\n {Array.from({length: 5}, (_, i) => (\n <Star\n key={i}\n fill={\n i < Math.floor(averageRating!) ? 'currentColor' : 'none'\n }\n className={cn(\n 'h-3 w-3',\n i < Math.floor(averageRating!)\n ? 'text-primary'\n : 'text-gray-300'\n )}\n />\n ))}\n <span className=\"text-xs text-gray-600 ml-1\">\n ({reviewCount})\n </span>\n </div>\n </ProductLinkRating>\n )}\n\n <ProductLinkPrice>\n {hasDiscount ? (\n <>\n <ProductLinkDiscountPrice>{amount}</ProductLinkDiscountPrice>\n <ProductLinkOriginalPrice>\n {compareAtPriceAmount}\n </ProductLinkOriginalPrice>\n </>\n ) : (\n <ProductLinkCurrentPrice>{amount}</ProductLinkCurrentPrice>\n )}\n </ProductLinkPrice>\n </ProductLinkInfo>\n\n <ProductLinkActions\n filled={isFavoritedLocal}\n onPress={handleActionPress}\n />\n </ProductLinkRoot>\n )\n}\n\nexport {ProductLink}\n"],"names":["productLinkVariants","cva","ProductLinkRoot","className","layout","discount","asChild","onPress","props","jsx","Touchable","SlotPrimitive.Root","Card","cn","ProductLinkImage","ProductLinkInfo","CardContent","ProductLinkTitle","children","ProductLinkPrice","ProductLinkCurrentPrice","ProductLinkOriginalPrice","ProductLinkDiscountPrice","ProductLinkRating","ProductLinkActions","filled","CardAction","FavoriteButton","ProductLink","product","navigateToProduct","useShopNavigation","saveProduct","unsaveProduct","useSavedProductsActions","id","title","featuredImage","reviewAnalytics","price","compareAtPrice","isFavorited","selectedVariant","defaultVariantId","shop","isFavoritedLocal","setIsFavoritedLocal","React","averageRating","reviewCount","amount","formatMoney","imageUrl","imageAltText","compareAtPriceAmount","hasDiscount","handlePress","handleActionPress","previousState","jsxs","_","i","Star","Fragment"],"mappings":";;;;;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qB;AAAA,YACR,SAASY;AAAA,UAAA;AAAA,QAAA;AAAA,MACX;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"product-link.js","sources":["../../../src/components/commerce/product-link.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {type Product} from '@shopify/shop-minis-platform'\nimport {cva, type VariantProps} from 'class-variance-authority'\nimport {Star} from 'lucide-react'\nimport {Slot as SlotPrimitive} from 'radix-ui'\n\nimport {useShopNavigation} from '../../hooks/navigation/useShopNavigation'\nimport {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'\nimport {formatMoney} from '../../lib/formatMoney'\nimport {cn} from '../../lib/utils'\nimport {FavoriteButton} from '../atoms/favorite-button'\nimport {Touchable} from '../atoms/touchable'\nimport {Card, CardContent, CardAction} from '../ui/card'\n\nconst productLinkVariants = cva('', {\n variants: {\n layout: {\n horizontal: 'w-full !flex-row items-center gap-3 px-4 py-3',\n vertical: 'flex-col',\n },\n discount: {\n none: '',\n small: '',\n large: '',\n },\n },\n defaultVariants: {\n layout: 'horizontal',\n discount: 'none',\n },\n})\n\n// Primitive components (building blocks)\nexport interface ProductLinkRootProps\n extends React.ComponentProps<typeof Card>,\n VariantProps<typeof productLinkVariants> {\n layout?: 'horizontal' | 'vertical'\n asChild?: boolean\n onPress?: () => void\n}\n\nfunction ProductLinkRoot({\n className,\n layout,\n discount,\n asChild = false,\n onPress,\n ...props\n}: ProductLinkRootProps) {\n const Comp = asChild ? SlotPrimitive.Root : Card\n\n return (\n <Touchable\n onClick={onPress}\n whileTap={{opacity: 0.7}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n <Comp\n className={cn(\n productLinkVariants({layout, discount}),\n 'border-0 bg-white rounded-xl shadow-lg shadow-black/10',\n className\n )}\n {...props}\n />\n </Touchable>\n )\n}\n\nfunction ProductLinkImage({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<'div'> & {layout?: 'horizontal' | 'vertical'}) {\n return (\n <div\n data-slot=\"product-link-image\"\n className={cn(\n 'overflow-hidden rounded-md bg-muted',\n layout === 'horizontal'\n ? 'h-16 w-16 flex-shrink-0'\n : 'aspect-square w-full',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkInfo({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<typeof CardContent> & {\n layout?: 'horizontal' | 'vertical'\n}) {\n return (\n <CardContent\n className={cn(\n layout === 'horizontal'\n ? 'flex-1 min-w-0 space-y-1 px-0 py-0'\n : 'space-y-2',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkTitle({\n className,\n children,\n ...props\n}: React.ComponentProps<'h3'>) {\n return (\n <h3\n data-slot=\"product-link-title\"\n className={cn(\n 'text-sm font-medium leading-tight text-gray-900 truncate overflow-hidden whitespace-nowrap text-ellipsis',\n className\n )}\n {...props}\n >\n {children}\n </h3>\n )\n}\n\nfunction ProductLinkPrice({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-price\"\n className={cn('flex items-center gap-2', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkCurrentPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-current-price\"\n className={cn('text-sm font-semibold text-gray-900', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkOriginalPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-original-price\"\n className={cn('text-sm text-gray-500 line-through', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkDiscountPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-discount-price\"\n className={cn('text-sm font-semibold text-red-600', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkRating({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-rating\"\n className={cn(\n 'flex items-center gap-1 text-xs text-muted-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkActions({\n className,\n onPress,\n filled = false,\n ...props\n}: React.ComponentProps<typeof CardAction> & {\n onPress?: () => void\n filled?: boolean\n}) {\n return (\n <CardAction\n className={cn('flex-shrink-0 self-center px-0 py-0', className)}\n {...props}\n >\n <Touchable\n stopPropagation\n onClick={onPress}\n whileTap={{opacity: 0.7, scale: 0.95}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n scale: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n <FavoriteButton filled={filled} onClick={onPress} />\n </Touchable>\n </CardAction>\n )\n}\n\nexport interface ProductLinkProps {\n product: Product\n hideFavoriteAction?: boolean\n}\n\n// Composed ProductLink component\nfunction ProductLink({product, hideFavoriteAction = false}: ProductLinkProps) {\n const {navigateToProduct} = useShopNavigation()\n const {saveProduct, unsaveProduct} = useSavedProductsActions()\n\n const {\n id,\n title,\n featuredImage,\n reviewAnalytics,\n price,\n compareAtPrice,\n isFavorited,\n selectedVariant,\n defaultVariantId,\n shop,\n } = product\n\n // Local state for optimistic UI updates\n const [isFavoritedLocal, setIsFavoritedLocal] = React.useState(isFavorited)\n\n const averageRating = reviewAnalytics?.averageRating\n const reviewCount = reviewAnalytics?.reviewCount\n const amount = price?.amount\n ? formatMoney(price?.amount, price?.currencyCode)\n : undefined\n const imageUrl = featuredImage?.url\n const imageAltText = featuredImage?.altText || title\n const compareAtPriceAmount = compareAtPrice?.amount\n ? formatMoney(compareAtPrice?.amount, compareAtPrice?.currencyCode)\n : undefined\n const hasDiscount = compareAtPriceAmount && compareAtPriceAmount !== amount\n\n const handlePress = React.useCallback(() => {\n navigateToProduct({\n productId: id,\n })\n }, [navigateToProduct, id])\n\n const handleActionPress = React.useCallback(async () => {\n const previousState = isFavoritedLocal\n\n // Optimistic update\n setIsFavoritedLocal(!previousState)\n\n try {\n if (previousState) {\n await unsaveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n } else {\n await saveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n }\n } catch (error) {\n // Revert optimistic update on error\n setIsFavoritedLocal(previousState)\n }\n }, [\n isFavoritedLocal,\n id,\n shop.id,\n selectedVariant?.id,\n defaultVariantId,\n saveProduct,\n unsaveProduct,\n ])\n\n return (\n <ProductLinkRoot\n layout=\"horizontal\"\n discount={hasDiscount ? 'small' : 'none'}\n onPress={handlePress}\n >\n <ProductLinkImage layout=\"horizontal\">\n {imageUrl ? (\n <img\n src={imageUrl}\n alt={imageAltText}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div className=\"h-full w-full bg-muted flex items-center justify-center text-muted-foreground text-xs\">\n No Image\n </div>\n )}\n </ProductLinkImage>\n\n <ProductLinkInfo layout=\"horizontal\">\n <ProductLinkTitle>{title}</ProductLinkTitle>\n\n {reviewCount && averageRating && (\n <ProductLinkRating>\n <div className=\"flex items-center gap-1\">\n {Array.from({length: 5}, (_, i) => (\n <Star\n key={i}\n fill={\n i < Math.floor(averageRating!) ? 'currentColor' : 'none'\n }\n className={cn(\n 'h-3 w-3',\n i < Math.floor(averageRating!)\n ? 'text-primary'\n : 'text-gray-300'\n )}\n />\n ))}\n <span className=\"text-xs text-gray-600 ml-1\">\n ({reviewCount})\n </span>\n </div>\n </ProductLinkRating>\n )}\n\n <ProductLinkPrice>\n {hasDiscount ? (\n <>\n <ProductLinkDiscountPrice>{amount}</ProductLinkDiscountPrice>\n <ProductLinkOriginalPrice>\n {compareAtPriceAmount}\n </ProductLinkOriginalPrice>\n </>\n ) : (\n <ProductLinkCurrentPrice>{amount}</ProductLinkCurrentPrice>\n )}\n </ProductLinkPrice>\n </ProductLinkInfo>\n\n {hideFavoriteAction ? null : (\n <ProductLinkActions\n filled={isFavoritedLocal}\n onPress={handleActionPress}\n />\n )}\n </ProductLinkRoot>\n )\n}\n\nexport {ProductLink}\n"],"names":["productLinkVariants","cva","ProductLinkRoot","className","layout","discount","asChild","onPress","props","jsx","Touchable","SlotPrimitive.Root","Card","cn","ProductLinkImage","ProductLinkInfo","CardContent","ProductLinkTitle","children","ProductLinkPrice","ProductLinkCurrentPrice","ProductLinkOriginalPrice","ProductLinkDiscountPrice","ProductLinkRating","ProductLinkActions","filled","CardAction","FavoriteButton","ProductLink","product","hideFavoriteAction","navigateToProduct","useShopNavigation","saveProduct","unsaveProduct","useSavedProductsActions","id","title","featuredImage","reviewAnalytics","price","compareAtPrice","isFavorited","selectedVariant","defaultVariantId","shop","isFavoritedLocal","setIsFavoritedLocal","React","averageRating","reviewCount","amount","formatMoney","imageUrl","imageAltText","compareAtPriceAmount","hasDiscount","handlePress","handleActionPress","previousState","jsxs","_","i","Star","Fragment"],"mappings":";;;;;;;;;;;;AAeA,MAAMA,IAAsBC,EAAI,IAAI;AAAA,EAClC,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAAA,EAEX;AAAA,EACA,iBAAiB;AAAA,IACf,QAAQ;AAAA,IACR,UAAU;AAAA,EAAA;AAEd,CAAC;AAWD,SAASC,EAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,SAAAC;AAAA,EACA,GAAGC;AACL,GAAyB;AAIrB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAASH;AAAA,MACT,UAAU,EAAC,SAAS,IAAG;AAAA,MACvB,YAAY;AAAA,QACV,SAAS,EAAC,MAAM,SAAS,UAAU,MAAM,MAAM,YAAW;AAAA,MAC5D;AAAA,MAEA,UAAA,gBAAAE;AAAA,QAVSH,IAAUK,IAAqBC;AAAA,QAUvC;AAAA,UACC,WAAWC;AAAA,YACTb,EAAoB,EAAC,QAAAI,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