@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.
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index2.js +4 -4
- package/dist/_virtual/index3.js +4 -4
- package/dist/_virtual/index5.js +3 -2
- package/dist/_virtual/index5.js.map +1 -1
- package/dist/_virtual/index6.js +2 -3
- package/dist/_virtual/index6.js.map +1 -1
- package/dist/_virtual/index7.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/components/atoms/list.js +37 -31
- package/dist/components/atoms/list.js.map +1 -1
- package/dist/components/commerce/product-link.js +117 -113
- package/dist/components/commerce/product-link.js.map +1 -1
- package/dist/components/commerce/search.js +26 -17
- package/dist/components/commerce/search.js.map +1 -1
- package/dist/components/navigation/minis-router.js +14 -0
- package/dist/components/navigation/minis-router.js.map +1 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
- package/dist/hooks/navigation/useShopNavigation.js.map +1 -1
- package/dist/hooks/user/useCurrentUser.js.map +1 -1
- package/dist/hooks/user/useFollowedShopsActions.js.map +1 -1
- package/dist/hooks/util/useImagePicker.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/mocks.js +9 -9
- package/dist/mocks.js.map +1 -1
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
- 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
- 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
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/package.json +1 -1
- package/src/components/atoms/list.tsx +24 -4
- package/src/components/commerce/product-link.tsx +10 -4
- package/src/components/commerce/search.tsx +9 -2
- package/src/components/index.ts +1 -1
- package/src/components/navigation/minis-router.tsx +23 -0
- package/src/hooks/navigation/useNavigateWithTransition.ts +6 -1
- package/src/hooks/navigation/useShopNavigation.ts +3 -1
- package/src/hooks/user/useCurrentUser.ts +3 -0
- package/src/hooks/user/useFollowedShopsActions.ts +2 -2
- package/src/hooks/util/{useImagePicker.tsx → useImagePicker.ts} +8 -2
- package/src/index.css +1 -0
- package/src/mocks.ts +3 -3
- package/src/stories/ImageContentWrapper.stories.tsx +68 -0
- package/src/stories/MerchantCard.stories.tsx +21 -0
- package/src/stories/ProductCard.stories.tsx +10 -3
- package/src/stories/ProductLink.stories.tsx +3 -3
- package/src/stories/QuantitySelector.stories.tsx +78 -0
- package/src/stories/Search.stories.tsx +37 -0
- package/src/stories/VideoPlayer.stories.tsx +129 -0
- package/src/styles/fonts.css +26 -0
- package/src/styles/theme.css +26 -0
- package/src/hooks/util/useImagePicker.doc.tsx +0 -41
package/dist/_virtual/index10.js
CHANGED
package/dist/_virtual/index2.js
CHANGED
|
@@ -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
|
|
3
|
-
var t = o();
|
|
4
|
-
const
|
|
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
|
-
|
|
6
|
+
l as default
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=index2.js.map
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -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
|
|
3
|
-
var t =
|
|
4
|
-
const
|
|
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
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=index3.js.map
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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":";;"}
|
package/dist/_virtual/index6.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __require as r } from "../shop-minis-react/node_modules/.pnpm
|
|
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
|
|
4
|
+
i as l
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=index7.js.map
|
package/dist/_virtual/index9.js
CHANGED
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useCallback as f } from "react";
|
|
3
|
-
import { VariableSizeList as
|
|
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 =
|
|
7
|
+
const N = _;
|
|
8
8
|
function q({
|
|
9
|
-
items:
|
|
9
|
+
items: t,
|
|
10
10
|
height: p,
|
|
11
|
-
renderItem:
|
|
12
|
-
className:
|
|
13
|
-
showScrollbar:
|
|
14
|
-
header:
|
|
15
|
-
headerHeight:
|
|
16
|
-
itemSizeForRow:
|
|
17
|
-
fetchMore:
|
|
18
|
-
overscanCount:
|
|
19
|
-
...
|
|
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
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
(
|
|
32
|
-
[
|
|
33
|
-
), S = j(
|
|
34
|
-
return /* @__PURE__ */
|
|
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:
|
|
42
|
-
overscanCount:
|
|
47
|
+
itemCount: t.length,
|
|
48
|
+
overscanCount: g,
|
|
43
49
|
itemSize: z,
|
|
44
|
-
...
|
|
45
|
-
children:
|
|
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
|
|
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
|
|
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
|
|
4
|
-
import { useShopNavigation as
|
|
5
|
-
import { useSavedProductsActions as
|
|
6
|
-
import { formatMoney as
|
|
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
|
|
9
|
-
import { Touchable as
|
|
10
|
-
import { Card as
|
|
11
|
-
import
|
|
12
|
-
import { Root as
|
|
13
|
-
const
|
|
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
|
|
31
|
-
className:
|
|
32
|
-
layout:
|
|
30
|
+
function J({
|
|
31
|
+
className: e,
|
|
32
|
+
layout: o,
|
|
33
33
|
discount: r,
|
|
34
|
-
asChild:
|
|
34
|
+
asChild: a = !1,
|
|
35
35
|
onPress: l,
|
|
36
|
-
...
|
|
36
|
+
...s
|
|
37
37
|
}) {
|
|
38
38
|
return /* @__PURE__ */ t(
|
|
39
|
-
|
|
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
|
-
|
|
47
|
+
a ? G : B,
|
|
48
48
|
{
|
|
49
49
|
className: n(
|
|
50
|
-
|
|
50
|
+
H({ layout: o, discount: r }),
|
|
51
51
|
"border-0 bg-white rounded-xl shadow-lg shadow-black/10",
|
|
52
|
-
|
|
52
|
+
e
|
|
53
53
|
),
|
|
54
|
-
...
|
|
54
|
+
...s
|
|
55
55
|
}
|
|
56
56
|
)
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
className:
|
|
62
|
-
layout:
|
|
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
|
-
|
|
72
|
-
|
|
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
|
|
79
|
-
className:
|
|
80
|
-
layout:
|
|
78
|
+
function Q({
|
|
79
|
+
className: e,
|
|
80
|
+
layout: o = "horizontal",
|
|
81
81
|
...r
|
|
82
82
|
}) {
|
|
83
83
|
return /* @__PURE__ */ t(
|
|
84
|
-
|
|
84
|
+
U,
|
|
85
85
|
{
|
|
86
86
|
className: n(
|
|
87
|
-
|
|
88
|
-
|
|
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
|
|
95
|
-
className:
|
|
96
|
-
children:
|
|
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
|
-
|
|
105
|
+
e
|
|
106
106
|
),
|
|
107
107
|
...r,
|
|
108
|
-
children:
|
|
108
|
+
children: o
|
|
109
109
|
}
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
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",
|
|
118
|
-
...
|
|
117
|
+
className: n("flex items-center gap-2", e),
|
|
118
|
+
...o
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
className:
|
|
124
|
-
...
|
|
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",
|
|
131
|
-
...
|
|
130
|
+
className: n("text-sm font-semibold text-gray-900", e),
|
|
131
|
+
...o
|
|
132
132
|
}
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
className:
|
|
137
|
-
...
|
|
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",
|
|
144
|
-
...
|
|
143
|
+
className: n("text-sm text-gray-500 line-through", e),
|
|
144
|
+
...o
|
|
145
145
|
}
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
className:
|
|
150
|
-
...
|
|
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",
|
|
157
|
-
...
|
|
156
|
+
className: n("text-sm font-semibold text-red-600", e),
|
|
157
|
+
...o
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
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
|
-
|
|
168
|
+
e
|
|
169
169
|
),
|
|
170
|
-
...
|
|
170
|
+
...o
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
className:
|
|
176
|
-
onPress:
|
|
174
|
+
function et({
|
|
175
|
+
className: e,
|
|
176
|
+
onPress: o,
|
|
177
177
|
filled: r = !1,
|
|
178
|
-
...
|
|
178
|
+
...a
|
|
179
179
|
}) {
|
|
180
180
|
return /* @__PURE__ */ t(
|
|
181
|
-
|
|
181
|
+
_,
|
|
182
182
|
{
|
|
183
|
-
className: n("flex-shrink-0 self-center px-0 py-0",
|
|
184
|
-
...
|
|
183
|
+
className: n("flex-shrink-0 self-center px-0 py-0", e),
|
|
184
|
+
...a,
|
|
185
185
|
children: /* @__PURE__ */ t(
|
|
186
|
-
|
|
186
|
+
T,
|
|
187
187
|
{
|
|
188
188
|
stopPropagation: !0,
|
|
189
|
-
onClick:
|
|
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(
|
|
195
|
+
children: /* @__PURE__ */ t(q, { filled: r, onClick: o })
|
|
196
196
|
}
|
|
197
197
|
)
|
|
198
198
|
}
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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:
|
|
213
|
+
isFavorited: R,
|
|
210
214
|
selectedVariant: f,
|
|
211
215
|
defaultVariantId: h,
|
|
212
216
|
shop: g
|
|
213
|
-
} =
|
|
214
|
-
|
|
215
|
-
productId:
|
|
216
|
-
});
|
|
217
|
-
}, [r,
|
|
218
|
-
const
|
|
219
|
-
|
|
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
|
-
|
|
222
|
-
productId:
|
|
225
|
+
d ? await s({
|
|
226
|
+
productId: i,
|
|
223
227
|
shopId: g.id,
|
|
224
228
|
productVariantId: f?.id || h
|
|
225
|
-
}) : await
|
|
226
|
-
productId:
|
|
229
|
+
}) : await l({
|
|
230
|
+
productId: i,
|
|
227
231
|
shopId: g.id,
|
|
228
232
|
productVariantId: f?.id || h
|
|
229
233
|
});
|
|
230
234
|
} catch {
|
|
231
|
-
|
|
235
|
+
I(d);
|
|
232
236
|
}
|
|
233
237
|
}, [
|
|
234
238
|
x,
|
|
235
|
-
|
|
239
|
+
i,
|
|
236
240
|
g.id,
|
|
237
241
|
f?.id,
|
|
238
242
|
h,
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
l,
|
|
244
|
+
s
|
|
241
245
|
]);
|
|
242
246
|
return /* @__PURE__ */ c(
|
|
243
|
-
|
|
247
|
+
J,
|
|
244
248
|
{
|
|
245
249
|
layout: "horizontal",
|
|
246
|
-
discount:
|
|
247
|
-
onPress:
|
|
250
|
+
discount: A ? "small" : "none",
|
|
251
|
+
onPress: V,
|
|
248
252
|
children: [
|
|
249
|
-
/* @__PURE__ */ t(
|
|
253
|
+
/* @__PURE__ */ t(K, { layout: "horizontal", children: b ? /* @__PURE__ */ t(
|
|
250
254
|
"img",
|
|
251
255
|
{
|
|
252
|
-
src:
|
|
253
|
-
alt:
|
|
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(
|
|
258
|
-
/* @__PURE__ */ t(
|
|
259
|
-
|
|
260
|
-
Array.from({ length: 5 }, (
|
|
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:
|
|
267
|
+
fill: u < Math.floor(y) ? "currentColor" : "none",
|
|
264
268
|
className: n(
|
|
265
269
|
"h-3 w-3",
|
|
266
|
-
|
|
270
|
+
u < Math.floor(y) ? "text-primary" : "text-gray-300"
|
|
267
271
|
)
|
|
268
272
|
},
|
|
269
|
-
|
|
273
|
+
u
|
|
270
274
|
)),
|
|
271
275
|
/* @__PURE__ */ c("span", { className: "text-xs text-gray-600 ml-1", children: [
|
|
272
276
|
"(",
|
|
273
|
-
|
|
277
|
+
L,
|
|
274
278
|
")"
|
|
275
279
|
] })
|
|
276
|
-
] }) }),
|
|
277
|
-
/* @__PURE__ */ t(
|
|
278
|
-
/* @__PURE__ */ t(
|
|
279
|
-
/* @__PURE__ */ t(
|
|
280
|
-
] }) : /* @__PURE__ */ t(
|
|
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
|
-
|
|
283
|
-
|
|
286
|
+
o ? null : /* @__PURE__ */ t(
|
|
287
|
+
et,
|
|
284
288
|
{
|
|
285
289
|
filled: x,
|
|
286
|
-
onPress:
|
|
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
|
-
|
|
298
|
+
pt as ProductLink
|
|
295
299
|
};
|
|
296
300
|
//# sourceMappingURL=product-link.js.map
|