@shopify/shop-minis-react 0.0.28 → 0.0.30

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 (57) hide show
  1. package/dist/_virtual/index10.js +2 -2
  2. package/dist/_virtual/index2.js +4 -4
  3. package/dist/_virtual/index3.js +4 -4
  4. package/dist/_virtual/index5.js +3 -2
  5. package/dist/_virtual/index5.js.map +1 -1
  6. package/dist/_virtual/index6.js +2 -3
  7. package/dist/_virtual/index6.js.map +1 -1
  8. package/dist/_virtual/index7.js +2 -2
  9. package/dist/_virtual/index9.js +2 -2
  10. package/dist/components/atoms/list.js +37 -31
  11. package/dist/components/atoms/list.js.map +1 -1
  12. package/dist/components/commerce/product-link.js +117 -113
  13. package/dist/components/commerce/product-link.js.map +1 -1
  14. package/dist/components/commerce/search.js +26 -17
  15. package/dist/components/commerce/search.js.map +1 -1
  16. package/dist/components/navigation/minis-router.js +14 -0
  17. package/dist/components/navigation/minis-router.js.map +1 -0
  18. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
  19. package/dist/hooks/navigation/useShopNavigation.js.map +1 -1
  20. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  21. package/dist/hooks/user/useFollowedShopsActions.js.map +1 -1
  22. package/dist/hooks/util/useImagePicker.js.map +1 -1
  23. package/dist/index.js +2 -2
  24. package/dist/mocks.js +9 -9
  25. package/dist/mocks.js.map +1 -1
  26. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  27. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
  28. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +1 -1
  29. package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
  30. package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js +764 -567
  31. package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js.map +1 -1
  32. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +1 -1
  33. package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +1 -1
  34. package/dist/utils/colors.js +1 -1
  35. package/package.json +1 -1
  36. package/src/components/atoms/list.tsx +24 -4
  37. package/src/components/commerce/product-link.tsx +10 -4
  38. package/src/components/commerce/search.tsx +9 -2
  39. package/src/components/index.ts +1 -1
  40. package/src/components/navigation/minis-router.tsx +23 -0
  41. package/src/hooks/navigation/useNavigateWithTransition.ts +6 -1
  42. package/src/hooks/navigation/useShopNavigation.ts +3 -1
  43. package/src/hooks/user/useCurrentUser.ts +3 -0
  44. package/src/hooks/user/useFollowedShopsActions.ts +2 -2
  45. package/src/hooks/util/{useImagePicker.tsx → useImagePicker.ts} +8 -2
  46. package/src/index.css +1 -0
  47. package/src/mocks.ts +3 -3
  48. package/src/stories/ImageContentWrapper.stories.tsx +68 -0
  49. package/src/stories/MerchantCard.stories.tsx +21 -0
  50. package/src/stories/ProductCard.stories.tsx +10 -3
  51. package/src/stories/ProductLink.stories.tsx +3 -3
  52. package/src/stories/QuantitySelector.stories.tsx +78 -0
  53. package/src/stories/Search.stories.tsx +37 -0
  54. package/src/stories/VideoPlayer.stories.tsx +129 -0
  55. package/src/styles/fonts.css +26 -0
  56. package/src/styles/theme.css +26 -0
  57. package/src/hooks/util/useImagePicker.doc.tsx +0 -41
@@ -1,5 +1,5 @@
1
- var e = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- e as __module
3
+ r as __exports
4
4
  };
5
5
  //# sourceMappingURL=index10.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=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/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=index3.js.map
@@ -1,5 +1,6 @@
1
- var e = { exports: {} };
1
+ import { __require as r } from "../shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js";
2
+ var i = r();
2
3
  export {
3
- e as __module
4
+ i as s
4
5
  };
5
6
  //# sourceMappingURL=index5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,6 +1,5 @@
1
- import { __require as r } from "../shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js";
2
- var i = r();
1
+ var e = { exports: {} };
3
2
  export {
4
- i as l
3
+ e as __module
5
4
  };
6
5
  //# sourceMappingURL=index6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,6 +1,6 @@
1
- import { __require as r } from "../shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js";
1
+ import { __require as r } from "../shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js";
2
2
  var i = r();
3
3
  export {
4
- i as s
4
+ i as l
5
5
  };
6
6
  //# sourceMappingURL=index7.js.map
@@ -1,5 +1,5 @@
1
- var r = {};
1
+ var e = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ e as __module
4
4
  };
5
5
  //# sourceMappingURL=index9.js.map
@@ -1,48 +1,54 @@
1
- import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
- import { useCallback as f } from "react";
3
- import { VariableSizeList as V } from "../../shop-minis-react/node_modules/.pnpm/react-window@1.8.11_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-window/dist/index.esm.js";
1
+ import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
+ import { useRef as V, useCallback as f } from "react";
3
+ import { VariableSizeList as _ } from "../../shop-minis-react/node_modules/.pnpm/react-window@1.8.11_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-window/dist/index.esm.js";
4
4
  import { cn as j } from "../../lib/utils.js";
5
5
  /* empty css */
6
6
  import { Pagination as C } from "./pagination.js";
7
- const N = V;
7
+ const N = _;
8
8
  function q({
9
- items: r,
9
+ items: t,
10
10
  height: p,
11
- renderItem: l,
12
- className: m,
13
- showScrollbar: v = !1,
14
- header: t,
15
- headerHeight: n,
16
- itemSizeForRow: s,
17
- fetchMore: a,
18
- overscanCount: b,
19
- ...L
11
+ renderItem: o,
12
+ className: v,
13
+ showScrollbar: b = !1,
14
+ header: i,
15
+ headerHeight: c,
16
+ itemSizeForRow: a,
17
+ fetchMore: l,
18
+ overscanCount: g,
19
+ ...h
20
20
  }) {
21
- const g = f(
22
- ({ index: i, style: c }) => t && i === 0 ? /* @__PURE__ */ u("div", { style: c, children: [
23
- t,
24
- /* @__PURE__ */ o("div", { style: { top: n }, children: l(r[0], 0) })
25
- ] }) : a && i === r.length - 1 ? /* @__PURE__ */ u("div", { style: c, children: [
26
- l(r[i], i),
27
- /* @__PURE__ */ o("div", { style: { bottom: 0 }, children: /* @__PURE__ */ o(C, { fetchMore: a }) })
28
- ] }) : /* @__PURE__ */ o("div", { style: c, children: l(r[i], i) }),
29
- [r, l, t, a, n]
21
+ const s = V(null), e = f(() => {
22
+ if (s.current) return;
23
+ const r = Promise.resolve(l?.()).finally(() => {
24
+ s.current === r && (s.current = null);
25
+ });
26
+ s.current = r;
27
+ }, [l]), L = f(
28
+ ({ index: r, style: u }) => i && r === 0 ? /* @__PURE__ */ m("div", { style: u, children: [
29
+ i,
30
+ /* @__PURE__ */ n("div", { style: { top: c }, children: o(t[0], 0) })
31
+ ] }) : l && r === t.length - 1 ? /* @__PURE__ */ m("div", { style: u, children: [
32
+ o(t[r], r),
33
+ /* @__PURE__ */ n("div", { style: { bottom: 0 }, children: /* @__PURE__ */ n(C, { fetchMore: e }) })
34
+ ] }) : /* @__PURE__ */ n("div", { style: u, children: o(t[r], r) }),
35
+ [t, o, i, c, e, l]
30
36
  ), z = f(
31
- (i) => t && i === 0 ? (n || 0) + s(i) : s(i),
32
- [s, t, n]
33
- ), S = j(v ? void 0 : "no-scrollbars", m);
34
- return /* @__PURE__ */ o(
37
+ (r) => i && r === 0 ? (c || 0) + a(r) : a(r),
38
+ [a, i, c]
39
+ ), S = j(b ? void 0 : "no-scrollbars", v);
40
+ return /* @__PURE__ */ n(
35
41
  N,
36
42
  {
37
43
  className: S,
38
44
  height: p,
39
45
  direction: "vertical",
40
46
  width: "100%",
41
- itemCount: r.length,
42
- overscanCount: b,
47
+ itemCount: t.length,
48
+ overscanCount: g,
43
49
  itemSize: z,
44
- ...L,
45
- children: g
50
+ ...h,
51
+ children: L
46
52
  }
47
53
  );
48
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sources":["../../../src/components/atoms/list.tsx"],"sourcesContent":["import {ComponentType, useCallback} from 'react'\n\nimport {\n VariableSizeList as _VariableSizeList,\n VariableSizeListProps,\n} from 'react-window'\n\nimport {cn} from '../../lib/utils'\nimport '../../styles/utilities.css'\n\nimport {Pagination} from './pagination'\n\nconst VariableSizeList =\n _VariableSizeList as unknown as ComponentType<VariableSizeListProps>\n\ninterface Props<T = any>\n extends Omit<\n VariableSizeListProps<T>,\n 'children' | 'itemCount' | 'width' | 'itemSize' | 'direction'\n > {\n items: T[]\n renderItem: (item: T, index: number) => React.ReactNode\n itemSizeForRow: (index: number) => number\n showScrollbar?: boolean\n header?: React.ReactNode\n headerHeight?: number\n fetchMore?: () => void\n}\n\nexport function List<T = any>({\n items,\n height,\n renderItem,\n className,\n showScrollbar = false,\n header,\n headerHeight,\n itemSizeForRow,\n fetchMore,\n overscanCount,\n ...listProps\n}: Props<T>) {\n const rowRenderer = useCallback(\n ({index, style}: {index: number; style: React.CSSProperties}) => {\n // prepend the header to the first row if it exists\n if (header && index === 0) {\n return (\n <div style={style}>\n {header}\n <div style={{top: headerHeight}}>{renderItem(items[0], 0)}</div>\n </div>\n )\n }\n\n // append the pagination spinner to the last row if fetchMore exists\n if (fetchMore && index === items.length - 1) {\n return (\n <div style={style}>\n {renderItem(items[index], index)}\n <div style={{bottom: 0}}>\n <Pagination fetchMore={fetchMore} />\n </div>\n </div>\n )\n }\n\n return <div style={style}>{renderItem(items[index], index)}</div>\n },\n [items, renderItem, header, fetchMore, headerHeight]\n )\n\n const getItemSize = useCallback(\n (index: number) => {\n // include the header height in the first row height\n if (header && index === 0) {\n const _headerHeight = headerHeight || 0\n return _headerHeight + itemSizeForRow(index)\n }\n\n return itemSizeForRow(index)\n },\n [itemSizeForRow, header, headerHeight]\n )\n\n const classNames = cn(showScrollbar ? undefined : 'no-scrollbars', className)\n\n return (\n <VariableSizeList\n className={classNames}\n height={height}\n direction=\"vertical\"\n width=\"100%\"\n itemCount={items.length}\n overscanCount={overscanCount}\n itemSize={getItemSize}\n {...listProps}\n >\n {rowRenderer}\n </VariableSizeList>\n )\n}\n"],"names":["VariableSizeList","_VariableSizeList","List","items","height","renderItem","className","showScrollbar","header","headerHeight","itemSizeForRow","fetchMore","overscanCount","listProps","rowRenderer","useCallback","index","style","jsxs","jsx","Pagination","getItemSize","classNames","cn"],"mappings":";;;;;;AAYA,MAAMA,IACJC;AAgBK,SAASC,EAAc;AAAA,EAC5B,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACL,GAAa;AACX,QAAMC,IAAcC;AAAA,IAClB,CAAC,EAAC,OAAAC,GAAO,OAAAC,QAEHT,KAAUQ,MAAU,IAEpB,gBAAAE,EAAC,SAAI,OAAAD,GACF,UAAA;AAAA,MAAAT;AAAA,MACA,gBAAAW,EAAA,OAAA,EAAI,OAAO,EAAC,KAAKV,EAAA,GAAgB,UAAAJ,EAAWF,EAAM,CAAC,GAAG,CAAC,EAAE,CAAA;AAAA,IAAA,GAC5D,IAKAQ,KAAaK,MAAUb,EAAM,SAAS,IAEtC,gBAAAe,EAAC,SAAI,OAAAD,GACF,UAAA;AAAA,MAAWZ,EAAAF,EAAMa,CAAK,GAAGA,CAAK;AAAA,MAC/B,gBAAAG,EAAC,OAAI,EAAA,OAAO,EAAC,QAAQ,KACnB,UAAA,gBAAAA,EAACC,GAAW,EAAA,WAAAT,EAAsB,CAAA,EACpC,CAAA;AAAA,IAAA,GACF,IAIG,gBAAAQ,EAAC,SAAI,OAAAF,GAAe,UAAAZ,EAAWF,EAAMa,CAAK,GAAGA,CAAK,GAAE;AAAA,IAE7D,CAACb,GAAOE,GAAYG,GAAQG,GAAWF,CAAY;AAAA,EACrD,GAEMY,IAAcN;AAAA,IAClB,CAACC,MAEKR,KAAUQ,MAAU,KACAP,KAAgB,KACfC,EAAeM,CAAK,IAGtCN,EAAeM,CAAK;AAAA,IAE7B,CAACN,GAAgBF,GAAQC,CAAY;AAAA,EACvC,GAEMa,IAAaC,EAAGhB,IAAgB,SAAY,iBAAiBD,CAAS;AAG1E,SAAA,gBAAAa;AAAA,IAACnB;AAAA,IAAA;AAAA,MACC,WAAWsB;AAAA,MACX,QAAAlB;AAAA,MACA,WAAU;AAAA,MACV,OAAM;AAAA,MACN,WAAWD,EAAM;AAAA,MACjB,eAAAS;AAAA,MACA,UAAUS;AAAA,MACT,GAAGR;AAAA,MAEH,UAAAC;AAAA,IAAA;AAAA,EACH;AAEJ;"}
1
+ {"version":3,"file":"list.js","sources":["../../../src/components/atoms/list.tsx"],"sourcesContent":["import {ComponentType, useCallback, useRef} from 'react'\n\nimport {\n VariableSizeList as _VariableSizeList,\n VariableSizeListProps,\n} from 'react-window'\n\nimport {cn} from '../../lib/utils'\nimport '../../styles/utilities.css'\n\nimport {Pagination} from './pagination'\n\nconst VariableSizeList =\n _VariableSizeList as unknown as ComponentType<VariableSizeListProps>\n\ninterface Props<T = any>\n extends Omit<\n VariableSizeListProps<T>,\n 'children' | 'itemCount' | 'width' | 'itemSize' | 'direction'\n > {\n items: T[]\n renderItem: (item: T, index: number) => React.ReactNode\n itemSizeForRow: (index: number) => number\n showScrollbar?: boolean\n header?: React.ReactNode\n headerHeight?: number\n fetchMore?: () => Promise<void>\n}\n\nexport function List<T = any>({\n items,\n height,\n renderItem,\n className,\n showScrollbar = false,\n header,\n headerHeight,\n itemSizeForRow,\n fetchMore,\n overscanCount,\n ...listProps\n}: Props<T>) {\n const inFlightFetchMoreRef = useRef<Promise<void> | null>(null)\n\n // This is workaround to prevent multiple calls to fetchMore\n // react-window re-renders the rows while scrolling,\n // and the TrackingPixel could be triggered multiple times\n\n const _fetchMore = useCallback(() => {\n // Dedupe concurrent calls by returning the same in-flight promise\n if (inFlightFetchMoreRef.current) return\n\n const current = Promise.resolve(fetchMore?.()).finally(() => {\n // Only clear if this is still the most recent promise\n if (inFlightFetchMoreRef.current === current) {\n inFlightFetchMoreRef.current = null\n }\n })\n\n inFlightFetchMoreRef.current = current\n }, [fetchMore])\n\n const rowRenderer = useCallback(\n ({index, style}: {index: number; style: React.CSSProperties}) => {\n // prepend the header to the first row if it exists\n if (header && index === 0) {\n return (\n <div style={style}>\n {header}\n <div style={{top: headerHeight}}>{renderItem(items[0], 0)}</div>\n </div>\n )\n }\n\n // append the pagination spinner to the last row if fetchMore exists\n if (fetchMore && index === items.length - 1) {\n return (\n <div style={style}>\n {renderItem(items[index], index)}\n <div style={{bottom: 0}}>\n <Pagination fetchMore={_fetchMore} />\n </div>\n </div>\n )\n }\n\n return <div style={style}>{renderItem(items[index], index)}</div>\n },\n [items, renderItem, header, headerHeight, _fetchMore, fetchMore]\n )\n\n const getItemSize = useCallback(\n (index: number) => {\n // include the header height in the first row height\n if (header && index === 0) {\n const _headerHeight = headerHeight || 0\n return _headerHeight + itemSizeForRow(index)\n }\n\n return itemSizeForRow(index)\n },\n [itemSizeForRow, header, headerHeight]\n )\n\n const classNames = cn(showScrollbar ? undefined : 'no-scrollbars', className)\n\n return (\n <VariableSizeList\n className={classNames}\n height={height}\n direction=\"vertical\"\n width=\"100%\"\n itemCount={items.length}\n overscanCount={overscanCount}\n itemSize={getItemSize}\n {...listProps}\n >\n {rowRenderer}\n </VariableSizeList>\n )\n}\n"],"names":["VariableSizeList","_VariableSizeList","List","items","height","renderItem","className","showScrollbar","header","headerHeight","itemSizeForRow","fetchMore","overscanCount","listProps","inFlightFetchMoreRef","useRef","_fetchMore","useCallback","current","rowRenderer","index","style","jsxs","jsx","Pagination","getItemSize","classNames","cn"],"mappings":";;;;;;AAYA,MAAMA,IACJC;AAgBK,SAASC,EAAc;AAAA,EAC5B,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACL,GAAa;AACL,QAAAC,IAAuBC,EAA6B,IAAI,GAMxDC,IAAaC,EAAY,MAAM;AAEnC,QAAIH,EAAqB,QAAS;AAElC,UAAMI,IAAU,QAAQ,QAAQP,IAAa,CAAA,EAAE,QAAQ,MAAM;AAEvD,MAAAG,EAAqB,YAAYI,MACnCJ,EAAqB,UAAU;AAAA,IACjC,CACD;AAED,IAAAA,EAAqB,UAAUI;AAAA,EAAA,GAC9B,CAACP,CAAS,CAAC,GAERQ,IAAcF;AAAA,IAClB,CAAC,EAAC,OAAAG,GAAO,OAAAC,QAEHb,KAAUY,MAAU,IAEpB,gBAAAE,EAAC,SAAI,OAAAD,GACF,UAAA;AAAA,MAAAb;AAAA,MACA,gBAAAe,EAAA,OAAA,EAAI,OAAO,EAAC,KAAKd,EAAA,GAAgB,UAAAJ,EAAWF,EAAM,CAAC,GAAG,CAAC,EAAE,CAAA;AAAA,IAAA,GAC5D,IAKAQ,KAAaS,MAAUjB,EAAM,SAAS,IAEtC,gBAAAmB,EAAC,SAAI,OAAAD,GACF,UAAA;AAAA,MAAWhB,EAAAF,EAAMiB,CAAK,GAAGA,CAAK;AAAA,MAC/B,gBAAAG,EAAC,OAAI,EAAA,OAAO,EAAC,QAAQ,EAAC,GACpB,UAAC,gBAAAA,EAAAC,GAAA,EAAW,WAAWR,EAAY,CAAA,EACrC,CAAA;AAAA,IAAA,GACF,IAIG,gBAAAO,EAAC,SAAI,OAAAF,GAAe,UAAAhB,EAAWF,EAAMiB,CAAK,GAAGA,CAAK,GAAE;AAAA,IAE7D,CAACjB,GAAOE,GAAYG,GAAQC,GAAcO,GAAYL,CAAS;AAAA,EACjE,GAEMc,IAAcR;AAAA,IAClB,CAACG,MAEKZ,KAAUY,MAAU,KACAX,KAAgB,KACfC,EAAeU,CAAK,IAGtCV,EAAeU,CAAK;AAAA,IAE7B,CAACV,GAAgBF,GAAQC,CAAY;AAAA,EACvC,GAEMiB,IAAaC,EAAGpB,IAAgB,SAAY,iBAAiBD,CAAS;AAG1E,SAAA,gBAAAiB;AAAA,IAACvB;AAAA,IAAA;AAAA,MACC,WAAW0B;AAAA,MACX,QAAAtB;AAAA,MACA,WAAU;AAAA,MACV,OAAM;AAAA,MACN,WAAWD,EAAM;AAAA,MACjB,eAAAS;AAAA,MACA,UAAUa;AAAA,MACT,GAAGZ;AAAA,MAEH,UAAAM;AAAA,IAAA;AAAA,EACH;AAEJ;"}
@@ -1,16 +1,16 @@
1
- import { jsxs as c, jsx as t, Fragment as F } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as t, Fragment as j } from "react/jsx-runtime";
2
2
  import * as w from "react";
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";
3
+ import { cva as O } 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 M } from "../../hooks/navigation/useShopNavigation.js";
5
+ import { useSavedProductsActions as D } from "../../hooks/user/useSavedProductsActions.js";
6
+ import { formatMoney as z } from "../../lib/formatMoney.js";
7
7
  import { cn as n } from "../../lib/utils.js";
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("", {
8
+ import { FavoriteButton as q } from "../atoms/favorite-button.js";
9
+ import { Touchable as T } from "../atoms/touchable.js";
10
+ import { Card as B, CardContent as U, CardAction as _ } from "../ui/card.js";
11
+ import E 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 G } 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 H = O("", {
14
14
  variants: {
15
15
  layout: {
16
16
  horizontal: "w-full !flex-row items-center gap-3 px-4 py-3",
@@ -27,16 +27,16 @@ const G = j("", {
27
27
  discount: "none"
28
28
  }
29
29
  });
30
- function H({
31
- className: o,
32
- layout: e,
30
+ function J({
31
+ className: e,
32
+ layout: o,
33
33
  discount: r,
34
- asChild: i = !1,
34
+ asChild: a = !1,
35
35
  onPress: l,
36
- ...a
36
+ ...s
37
37
  }) {
38
38
  return /* @__PURE__ */ t(
39
- z,
39
+ T,
40
40
  {
41
41
  onClick: l,
42
42
  whileTap: { opacity: 0.7 },
@@ -44,22 +44,22 @@ function H({
44
44
  opacity: { type: "tween", duration: 0.08, ease: "easeInOut" }
45
45
  },
46
46
  children: /* @__PURE__ */ t(
47
- i ? E : q,
47
+ a ? G : B,
48
48
  {
49
49
  className: n(
50
- G({ layout: e, discount: r }),
50
+ H({ layout: o, discount: r }),
51
51
  "border-0 bg-white rounded-xl shadow-lg shadow-black/10",
52
- o
52
+ e
53
53
  ),
54
- ...a
54
+ ...s
55
55
  }
56
56
  )
57
57
  }
58
58
  );
59
59
  }
60
- function J({
61
- className: o,
62
- layout: e = "horizontal",
60
+ function K({
61
+ className: e,
62
+ layout: o = "horizontal",
63
63
  ...r
64
64
  }) {
65
65
  return /* @__PURE__ */ t(
@@ -68,32 +68,32 @@ function J({
68
68
  "data-slot": "product-link-image",
69
69
  className: n(
70
70
  "overflow-hidden rounded-md bg-muted",
71
- e === "horizontal" ? "h-16 w-16 flex-shrink-0" : "aspect-square w-full",
72
- o
71
+ o === "horizontal" ? "h-16 w-16 flex-shrink-0" : "aspect-square w-full",
72
+ e
73
73
  ),
74
74
  ...r
75
75
  }
76
76
  );
77
77
  }
78
- function K({
79
- className: o,
80
- layout: e = "horizontal",
78
+ function Q({
79
+ className: e,
80
+ layout: o = "horizontal",
81
81
  ...r
82
82
  }) {
83
83
  return /* @__PURE__ */ t(
84
- B,
84
+ U,
85
85
  {
86
86
  className: n(
87
- e === "horizontal" ? "flex-1 min-w-0 space-y-1 px-0 py-0" : "space-y-2",
88
- o
87
+ o === "horizontal" ? "flex-1 min-w-0 space-y-1 px-0 py-0" : "space-y-2",
88
+ e
89
89
  ),
90
90
  ...r
91
91
  }
92
92
  );
93
93
  }
94
- function Q({
95
- className: o,
96
- children: e,
94
+ function W({
95
+ className: e,
96
+ children: o,
97
97
  ...r
98
98
  }) {
99
99
  return /* @__PURE__ */ t(
@@ -102,188 +102,192 @@ function Q({
102
102
  "data-slot": "product-link-title",
103
103
  className: n(
104
104
  "text-sm font-medium leading-tight text-gray-900 truncate overflow-hidden whitespace-nowrap text-ellipsis",
105
- o
105
+ e
106
106
  ),
107
107
  ...r,
108
- children: e
108
+ children: o
109
109
  }
110
110
  );
111
111
  }
112
- function W({ className: o, ...e }) {
112
+ function X({ className: e, ...o }) {
113
113
  return /* @__PURE__ */ t(
114
114
  "div",
115
115
  {
116
116
  "data-slot": "product-link-price",
117
- className: n("flex items-center gap-2", o),
118
- ...e
117
+ className: n("flex items-center gap-2", e),
118
+ ...o
119
119
  }
120
120
  );
121
121
  }
122
- function X({
123
- className: o,
124
- ...e
122
+ function Y({
123
+ className: e,
124
+ ...o
125
125
  }) {
126
126
  return /* @__PURE__ */ t(
127
127
  "span",
128
128
  {
129
129
  "data-slot": "product-link-current-price",
130
- className: n("text-sm font-semibold text-gray-900", o),
131
- ...e
130
+ className: n("text-sm font-semibold text-gray-900", e),
131
+ ...o
132
132
  }
133
133
  );
134
134
  }
135
- function Y({
136
- className: o,
137
- ...e
135
+ function Z({
136
+ className: e,
137
+ ...o
138
138
  }) {
139
139
  return /* @__PURE__ */ t(
140
140
  "span",
141
141
  {
142
142
  "data-slot": "product-link-original-price",
143
- className: n("text-sm text-gray-500 line-through", o),
144
- ...e
143
+ className: n("text-sm text-gray-500 line-through", e),
144
+ ...o
145
145
  }
146
146
  );
147
147
  }
148
- function Z({
149
- className: o,
150
- ...e
148
+ function $({
149
+ className: e,
150
+ ...o
151
151
  }) {
152
152
  return /* @__PURE__ */ t(
153
153
  "span",
154
154
  {
155
155
  "data-slot": "product-link-discount-price",
156
- className: n("text-sm font-semibold text-red-600", o),
157
- ...e
156
+ className: n("text-sm font-semibold text-red-600", e),
157
+ ...o
158
158
  }
159
159
  );
160
160
  }
161
- function $({ className: o, ...e }) {
161
+ function tt({ className: e, ...o }) {
162
162
  return /* @__PURE__ */ t(
163
163
  "div",
164
164
  {
165
165
  "data-slot": "product-link-rating",
166
166
  className: n(
167
167
  "flex items-center gap-1 text-xs text-muted-foreground",
168
- o
168
+ e
169
169
  ),
170
- ...e
170
+ ...o
171
171
  }
172
172
  );
173
173
  }
174
- function tt({
175
- className: o,
176
- onPress: e,
174
+ function et({
175
+ className: e,
176
+ onPress: o,
177
177
  filled: r = !1,
178
- ...i
178
+ ...a
179
179
  }) {
180
180
  return /* @__PURE__ */ t(
181
- U,
181
+ _,
182
182
  {
183
- className: n("flex-shrink-0 self-center px-0 py-0", o),
184
- ...i,
183
+ className: n("flex-shrink-0 self-center px-0 py-0", e),
184
+ ...a,
185
185
  children: /* @__PURE__ */ t(
186
- z,
186
+ T,
187
187
  {
188
188
  stopPropagation: !0,
189
- onClick: e,
189
+ onClick: o,
190
190
  whileTap: { opacity: 0.7, scale: 0.95 },
191
191
  transition: {
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(D, { filled: r, onClick: e })
195
+ children: /* @__PURE__ */ t(q, { filled: r, onClick: o })
196
196
  }
197
197
  )
198
198
  }
199
199
  );
200
200
  }
201
- function mt({ product: o, hideFavoriteAction: e = !1 }) {
202
- const { navigateToProduct: r } = O(), { saveProduct: i, unsaveProduct: l } = M(), {
203
- id: a,
204
- title: u,
205
- featuredImage: P,
201
+ function pt({
202
+ product: e,
203
+ hideFavoriteAction: o = !1,
204
+ onClick: r
205
+ }) {
206
+ const { navigateToProduct: a } = M(), { saveProduct: l, unsaveProduct: s } = D(), {
207
+ id: i,
208
+ title: P,
209
+ featuredImage: N,
206
210
  reviewAnalytics: C,
207
211
  price: m,
208
212
  compareAtPrice: p,
209
- isFavorited: T,
213
+ isFavorited: R,
210
214
  selectedVariant: f,
211
215
  defaultVariantId: h,
212
216
  shop: g
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
- productId: a
216
- });
217
- }, [r, a]), V = w.useCallback(async () => {
218
- const s = x;
219
- N(!s);
217
+ } = e, [x, I] = w.useState(R), y = C?.averageRating, L = C?.reviewCount, v = m?.amount ? z(m?.amount, m?.currencyCode) : void 0, b = N?.url, S = N?.altText || P, k = p?.amount ? z(p?.amount, p?.currencyCode) : void 0, A = k && k !== v, V = w.useCallback(() => {
218
+ a({
219
+ productId: i
220
+ }), r?.(e);
221
+ }, [a, i, r, e]), F = w.useCallback(async () => {
222
+ const d = x;
223
+ I(!d);
220
224
  try {
221
- s ? await l({
222
- productId: a,
225
+ d ? await s({
226
+ productId: i,
223
227
  shopId: g.id,
224
228
  productVariantId: f?.id || h
225
- }) : await i({
226
- productId: a,
229
+ }) : await l({
230
+ productId: i,
227
231
  shopId: g.id,
228
232
  productVariantId: f?.id || h
229
233
  });
230
234
  } catch {
231
- N(s);
235
+ I(d);
232
236
  }
233
237
  }, [
234
238
  x,
235
- a,
239
+ i,
236
240
  g.id,
237
241
  f?.id,
238
242
  h,
239
- i,
240
- l
243
+ l,
244
+ s
241
245
  ]);
242
246
  return /* @__PURE__ */ c(
243
- H,
247
+ J,
244
248
  {
245
249
  layout: "horizontal",
246
- discount: b ? "small" : "none",
247
- onPress: S,
250
+ discount: A ? "small" : "none",
251
+ onPress: V,
248
252
  children: [
249
- /* @__PURE__ */ t(J, { layout: "horizontal", children: L ? /* @__PURE__ */ t(
253
+ /* @__PURE__ */ t(K, { layout: "horizontal", children: b ? /* @__PURE__ */ t(
250
254
  "img",
251
255
  {
252
- src: L,
253
- alt: R,
256
+ src: b,
257
+ alt: S,
254
258
  className: "h-full w-full object-cover"
255
259
  }
256
260
  ) : /* @__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(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
- _,
261
+ /* @__PURE__ */ c(Q, { layout: "horizontal", children: [
262
+ /* @__PURE__ */ t(W, { children: P }),
263
+ L && y ? /* @__PURE__ */ t(tt, { children: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
264
+ Array.from({ length: 5 }, (d, u) => /* @__PURE__ */ t(
265
+ E,
262
266
  {
263
- fill: d < Math.floor(y) ? "currentColor" : "none",
267
+ fill: u < Math.floor(y) ? "currentColor" : "none",
264
268
  className: n(
265
269
  "h-3 w-3",
266
- d < Math.floor(y) ? "text-primary" : "text-gray-300"
270
+ u < Math.floor(y) ? "text-primary" : "text-gray-300"
267
271
  )
268
272
  },
269
- d
273
+ u
270
274
  )),
271
275
  /* @__PURE__ */ c("span", { className: "text-xs text-gray-600 ml-1", children: [
272
276
  "(",
273
- I,
277
+ L,
274
278
  ")"
275
279
  ] })
276
- ] }) }),
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 }) })
280
+ ] }) }) : null,
281
+ /* @__PURE__ */ t(X, { children: A ? /* @__PURE__ */ c(j, { children: [
282
+ /* @__PURE__ */ t($, { children: v }),
283
+ /* @__PURE__ */ t(Z, { children: k })
284
+ ] }) : /* @__PURE__ */ t(Y, { children: v }) })
281
285
  ] }),
282
- e ? null : /* @__PURE__ */ t(
283
- tt,
286
+ o ? null : /* @__PURE__ */ t(
287
+ et,
284
288
  {
285
289
  filled: x,
286
- onPress: V
290
+ onPress: F
287
291
  }
288
292
  )
289
293
  ]
@@ -291,6 +295,6 @@ function mt({ product: o, hideFavoriteAction: e = !1 }) {
291
295
  );
292
296
  }
293
297
  export {
294
- mt as ProductLink
298
+ pt as ProductLink
295
299
  };
296
300
  //# sourceMappingURL=product-link.js.map