@shopify/shop-minis-react 0.0.0-snapshot.20260109162751 → 0.0.0-snapshot.20260112135741
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/components/navigation/minis-router.js +8 -15
- package/dist/components/navigation/minis-router.js.map +1 -1
- package/dist/hooks/navigation/useNavigateWithTransition.js +6 -6
- package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
- package/dist/index.js +94 -96
- package/dist/index.js.map +1 -1
- package/dist/mocks.js +10 -11
- package/dist/mocks.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js +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/package.json +2 -2
- package/src/components/navigation/minis-router.tsx +1 -9
- package/src/hooks/index.ts +0 -1
- package/src/hooks/navigation/useNavigateWithTransition.test.ts +3 -17
- package/src/hooks/navigation/useNavigateWithTransition.ts +4 -9
- package/src/mocks.ts +0 -1
- package/dist/hooks/events/useOnNavigateBack.js +0 -14
- package/dist/hooks/events/useOnNavigateBack.js.map +0 -1
- package/dist/internal/navigation-manager.js +0 -12
- package/dist/internal/navigation-manager.js.map +0 -1
- package/src/hooks/events/useOnNavigateBack.ts +0 -16
- package/src/internal/navigation-manager.tsx +0 -13
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BrowserRouter as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
function x({
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { BrowserRouter as i } from "../../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";
|
|
3
|
+
import { TransitionContainer as e } from "./transition-container.js";
|
|
4
|
+
function s({
|
|
6
5
|
children: o,
|
|
7
|
-
viewTransitions:
|
|
8
|
-
...
|
|
6
|
+
viewTransitions: n = !1,
|
|
7
|
+
...t
|
|
9
8
|
}) {
|
|
10
|
-
return
|
|
11
|
-
/* @__PURE__ */ r(e, {}),
|
|
12
|
-
/* @__PURE__ */ r(a, { children: o })
|
|
13
|
-
] }) : /* @__PURE__ */ t(n, { ...i, children: [
|
|
14
|
-
/* @__PURE__ */ r(e, {}),
|
|
15
|
-
o
|
|
16
|
-
] });
|
|
9
|
+
return n ? /* @__PURE__ */ r(i, { ...t, children: /* @__PURE__ */ r(e, { children: o }) }) : /* @__PURE__ */ r(i, { ...t, children: o });
|
|
17
10
|
}
|
|
18
11
|
export {
|
|
19
|
-
|
|
12
|
+
s as MinisRouter
|
|
20
13
|
};
|
|
21
14
|
//# sourceMappingURL=minis-router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minis-router.js","sources":["../../../src/components/navigation/minis-router.tsx"],"sourcesContent":["import {BrowserRouter, BrowserRouterProps} from 'react-router'\n\nimport {
|
|
1
|
+
{"version":3,"file":"minis-router.js","sources":["../../../src/components/navigation/minis-router.tsx"],"sourcesContent":["import {BrowserRouter, BrowserRouterProps} from 'react-router'\n\nimport {TransitionContainer} from './transition-container'\n\nexport interface MinisRouterProps extends BrowserRouterProps {\n viewTransitions?: boolean\n}\n\nexport function MinisRouter({\n children,\n viewTransitions = false,\n ...props\n}: MinisRouterProps) {\n if (viewTransitions) {\n return (\n <BrowserRouter {...props}>\n <TransitionContainer>{children}</TransitionContainer>\n </BrowserRouter>\n )\n }\n\n return <BrowserRouter {...props}>{children}</BrowserRouter>\n}\n"],"names":["MinisRouter","children","viewTransitions","props","BrowserRouter","jsx","TransitionContainer"],"mappings":";;;AAQO,SAASA,EAAY;AAAA,EAC1B,UAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,GAAGC;AACL,GAAqB;AACnB,SAAID,sBAECE,GAAe,EAAA,GAAGD,GACjB,UAAC,gBAAAE,EAAAC,GAAA,EAAqB,UAAAL,EAAS,CAAA,GACjC,IAII,gBAAAI,EAAAD,GAAA,EAAe,GAAGD,GAAQ,UAAAF,EAAS,CAAA;AAC7C;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useNavigate as
|
|
1
|
+
import { useNavigate as c, useLocation as u } from "../../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";
|
|
2
2
|
import { DATA_NAVIGATION_TYPE_ATTRIBUTE as r } from "../../types/index.js";
|
|
3
|
-
function
|
|
4
|
-
const e =
|
|
3
|
+
function d() {
|
|
4
|
+
const e = c(), o = u();
|
|
5
5
|
return (t, n) => {
|
|
6
6
|
if (typeof t == "number") {
|
|
7
7
|
if (document.startViewTransition)
|
|
@@ -18,10 +18,10 @@ function f() {
|
|
|
18
18
|
return e(t);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
const a = t === o.pathname
|
|
21
|
+
const a = t === o.pathname;
|
|
22
22
|
if (document.startViewTransition)
|
|
23
23
|
document.startViewTransition(() => {
|
|
24
|
-
|
|
24
|
+
e(t, {
|
|
25
25
|
replace: a,
|
|
26
26
|
...n
|
|
27
27
|
}), n?.preventScrollReset !== !0 && window.scrollTo(0, 0);
|
|
@@ -37,6 +37,6 @@ function f() {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
|
-
|
|
40
|
+
d as useNavigateWithTransition
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=useNavigateWithTransition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigateWithTransition.js","sources":["../../../src/hooks/navigation/useNavigateWithTransition.ts"],"sourcesContent":["import {useLocation, useNavigate, NavigateOptions} from 'react-router'\n\nimport {DATA_NAVIGATION_TYPE_ATTRIBUTE} from '../../types'\n\ntype UseNavigateWithTransitionReturns = (\n to: string | number,\n options?: NavigateOptions\n) => void | Promise<void>\n\nexport function useNavigateWithTransition(): UseNavigateWithTransitionReturns {\n const navigate = useNavigate()\n const location = useLocation()\n\n const transitionNavigate = (\n to: string | number,\n options?: NavigateOptions\n ) => {\n if (typeof to === 'number') {\n // Delta navigation - no options parameter\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to)\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to)\n }\n return\n }\n\n const isSameRoute = to === location.pathname\n
|
|
1
|
+
{"version":3,"file":"useNavigateWithTransition.js","sources":["../../../src/hooks/navigation/useNavigateWithTransition.ts"],"sourcesContent":["import {useLocation, useNavigate, NavigateOptions} from 'react-router'\n\nimport {DATA_NAVIGATION_TYPE_ATTRIBUTE} from '../../types'\n\ntype UseNavigateWithTransitionReturns = (\n to: string | number,\n options?: NavigateOptions\n) => void | Promise<void>\n\nexport function useNavigateWithTransition(): UseNavigateWithTransitionReturns {\n const navigate = useNavigate()\n const location = useLocation()\n\n const transitionNavigate = (\n to: string | number,\n options?: NavigateOptions\n ) => {\n if (typeof to === 'number') {\n // Delta navigation - no options parameter\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to)\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to)\n }\n return\n }\n\n const isSameRoute = to === location.pathname\n\n // Path navigation - with options\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to, {\n replace: isSameRoute,\n ...options,\n })\n\n if (options?.preventScrollReset !== true) {\n window.scrollTo(0, 0)\n }\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to, options)\n }\n }\n\n return transitionNavigate\n}\n"],"names":["useNavigateWithTransition","navigate","useNavigate","location","useLocation","to","options","DATA_NAVIGATION_TYPE_ATTRIBUTE","error","isSameRoute"],"mappings":";;AASO,SAASA,IAA8D;AAC5E,QAAMC,IAAWC,EAAY,GACvBC,IAAWC,EAAY;AAyDtB,SAvDoB,CACzBC,GACAC,MACG;AACC,QAAA,OAAOD,KAAO,UAAU;AAE1B,UAAI,SAAS;AAKA,QAJQ,SAAS,oBAAoB,MAAM;AACpD,UAAAJ,EAASI,CAAE;AAAA,QAAA,CACZ,EAEU,SACR,KAAK,MAAM;AACV,mBAAS,gBAAgB;AAAA,YACvBE;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,CAASC,MAAA;AACN,kBAAA,MAAM,0BAA0BA,CAAK;AAAA,QAAA,CAC9C;AAAA;AAEH,eAAOP,EAASI,CAAE;AAEpB;AAAA,IAAA;AAGI,UAAAI,IAAcJ,MAAOF,EAAS;AAGpC,QAAI,SAAS;AAYA,MAXQ,SAAS,oBAAoB,MAAM;AACpD,QAAAF,EAASI,GAAI;AAAA,UACX,SAASI;AAAA,UACT,GAAGH;AAAA,QAAA,CACJ,GAEGA,GAAS,uBAAuB,MAC3B,OAAA,SAAS,GAAG,CAAC;AAAA,MACtB,CACD,EAEU,SACR,KAAK,MAAM;AACV,iBAAS,gBAAgB;AAAA,UACvBC;AAAA,QACF;AAAA,MAAA,CACD,EACA,MAAM,CAASC,MAAA;AACN,gBAAA,MAAM,0BAA0BA,CAAK;AAAA,MAAA,CAC9C;AAAA;AAEI,aAAAP,EAASI,GAAIC,CAAO;AAAA,EAE/B;AAGF;"}
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./ty
|
|
|
2
2
|
import { MinisContainer as i } from "./components/MinisContainer.js";
|
|
3
3
|
import { AddToCartButton as n } from "./components/commerce/add-to-cart.js";
|
|
4
4
|
import { BuyNowButton as s } from "./components/commerce/buy-now.js";
|
|
5
|
-
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as
|
|
5
|
+
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as d, ProductCardImage as c, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardReviewStars as A, ProductCardTitle as D } from "./components/commerce/product-card.js";
|
|
6
6
|
import { ProductLink as T } from "./components/commerce/product-link.js";
|
|
7
|
-
import { MerchantCard as I, MerchantCardContainer as R, MerchantCardHeader as
|
|
8
|
-
import { ProductCardSkeleton as
|
|
7
|
+
import { MerchantCard as I, MerchantCardContainer as R, MerchantCardHeader as E, MerchantCardInfo as M, MerchantCardName as w, MerchantCardRating as B } from "./components/commerce/merchant-card.js";
|
|
8
|
+
import { ProductCardSkeleton as v } from "./components/commerce/product-card-skeleton.js";
|
|
9
9
|
import { MerchantCardSkeleton as L } from "./components/commerce/merchant-card-skeleton.js";
|
|
10
10
|
import { QuantitySelector as N } from "./components/commerce/quantity-selector.js";
|
|
11
|
-
import { Search as
|
|
11
|
+
import { Search as _, SearchInput as y, SearchProvider as G, SearchResultsList as O } from "./components/commerce/search.js";
|
|
12
12
|
import { FavoriteButton as V } from "./components/commerce/favorite-button.js";
|
|
13
13
|
import { ImageContentWrapper as W } from "./components/content/image-content-wrapper.js";
|
|
14
14
|
import { MinisRouter as q } from "./components/navigation/minis-router.js";
|
|
@@ -22,23 +22,23 @@ import { AlertDialogAtom as pr } from "./components/atoms/alert-dialog.js";
|
|
|
22
22
|
import { List as mr } from "./components/atoms/list.js";
|
|
23
23
|
import { VideoPlayer as lr } from "./components/atoms/video-player.js";
|
|
24
24
|
import { TextInput as fr } from "./components/atoms/text-input.js";
|
|
25
|
-
import { ContentWrapper as
|
|
25
|
+
import { ContentWrapper as dr } from "./components/atoms/content-wrapper.js";
|
|
26
26
|
import { ProductVariantPrice as Cr } from "./components/atoms/product-variant-price.js";
|
|
27
27
|
import { Accordion as Sr, AccordionContent as Ar, AccordionItem as Dr, AccordionTrigger as Pr } from "./components/ui/accordion.js";
|
|
28
28
|
import { Alert as hr, AlertDescription as Ir, AlertTitle as Rr } from "./components/ui/alert.js";
|
|
29
|
-
import { AlertDialog as
|
|
30
|
-
import { Avatar as
|
|
29
|
+
import { AlertDialog as Mr, AlertDialogAction as wr, AlertDialogCancel as Br, AlertDialogContent as Fr, AlertDialogDescription as vr, AlertDialogFooter as Ur, AlertDialogHeader as Lr, AlertDialogOverlay as br, AlertDialogPortal as Nr, AlertDialogTitle as kr, AlertDialogTrigger as _r } from "./components/ui/alert-dialog.js";
|
|
30
|
+
import { Avatar as Gr, AvatarFallback as Or, AvatarImage as Hr } from "./components/ui/avatar.js";
|
|
31
31
|
import { Badge as zr, badgeVariants as Wr } from "./components/ui/badge.js";
|
|
32
32
|
import { Card as qr, CardAction as Kr, CardContent as Qr, CardDescription as Zr, CardFooter as jr, CardHeader as Jr, CardTitle as Xr } from "./components/ui/card.js";
|
|
33
33
|
import { Carousel as re, CarouselContent as ee, CarouselItem as oe, CarouselNext as te, CarouselPrevious as ae } from "./components/ui/carousel.js";
|
|
34
34
|
import { Checkbox as pe } from "./components/ui/checkbox.js";
|
|
35
|
-
import { Dialog as me, DialogClose as se, DialogContent as le, DialogDescription as ue, DialogFooter as fe, DialogHeader as xe, DialogOverlay as
|
|
36
|
-
import { Drawer as Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Re, DrawerPortal as
|
|
37
|
-
import { Input as
|
|
35
|
+
import { Dialog as me, DialogClose as se, DialogContent as le, DialogDescription as ue, DialogFooter as fe, DialogHeader as xe, DialogOverlay as de, DialogPortal as ce, DialogTitle as Ce, DialogTrigger as ge } from "./components/ui/dialog.js";
|
|
36
|
+
import { Drawer as Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Re, DrawerPortal as Ee, DrawerTitle as Me, DrawerTrigger as we } from "./components/ui/drawer.js";
|
|
37
|
+
import { Input as Fe } from "./components/ui/input.js";
|
|
38
38
|
import { Label as Ue } from "./components/ui/label.js";
|
|
39
39
|
import { Progress as be } from "./components/ui/progress.js";
|
|
40
|
-
import { RadioGroup as ke, RadioGroupItem as
|
|
41
|
-
import { ResizableHandle as
|
|
40
|
+
import { RadioGroup as ke, RadioGroupItem as _e } from "./components/ui/radio-group.js";
|
|
41
|
+
import { ResizableHandle as Ge, ResizablePanel as Oe, ResizablePanelGroup as He } from "./components/ui/resizable.js";
|
|
42
42
|
import { ScrollArea as ze, ScrollBar as We } from "./components/ui/scroll-area.js";
|
|
43
43
|
import { Select as qe, SelectContent as Ke, SelectGroup as Qe, SelectItem as Ze, SelectLabel as je, SelectScrollDownButton as Je, SelectScrollUpButton as Xe, SelectSeparator as $e, SelectTrigger as ro, SelectValue as eo } from "./components/ui/select.js";
|
|
44
44
|
import { Separator as to } from "./components/ui/separator.js";
|
|
@@ -49,13 +49,13 @@ import { Skeleton as Ao } from "./components/ui/skeleton.js";
|
|
|
49
49
|
import { useRecentProducts as Po } from "./hooks/user/useRecentProducts.js";
|
|
50
50
|
import { useRecentShops as ho } from "./hooks/user/useRecentShops.js";
|
|
51
51
|
import { useSavedProducts as Ro } from "./hooks/user/useSavedProducts.js";
|
|
52
|
-
import { useSavedProductsActions as
|
|
53
|
-
import { useFollowedShops as
|
|
54
|
-
import { useFollowedShopsActions as
|
|
52
|
+
import { useSavedProductsActions as Mo } from "./hooks/user/useSavedProductsActions.js";
|
|
53
|
+
import { useFollowedShops as Bo } from "./hooks/user/useFollowedShops.js";
|
|
54
|
+
import { useFollowedShopsActions as vo } from "./hooks/user/useFollowedShopsActions.js";
|
|
55
55
|
import { useCurrentUser as Lo } from "./hooks/user/useCurrentUser.js";
|
|
56
56
|
import { useOrders as No } from "./hooks/user/useOrders.js";
|
|
57
|
-
import { useBuyerAttributes as
|
|
58
|
-
import { useGenerateUserToken as
|
|
57
|
+
import { useBuyerAttributes as _o } from "./hooks/user/useBuyerAttributes.js";
|
|
58
|
+
import { useGenerateUserToken as Go } from "./hooks/user/useGenerateUserToken.js";
|
|
59
59
|
import { useProductListActions as Ho } from "./hooks/product/useProductListActions.js";
|
|
60
60
|
import { useProductLists as zo } from "./hooks/product/useProductLists.js";
|
|
61
61
|
import { useProductList as Yo } from "./hooks/product/useProductList.js";
|
|
@@ -70,33 +70,32 @@ import { useCuratedProducts as nt } from "./hooks/product/useCuratedProducts.js"
|
|
|
70
70
|
import { useAsyncStorage as st } from "./hooks/storage/useAsyncStorage.js";
|
|
71
71
|
import { useSecureStorage as ut } from "./hooks/storage/useSecureStorage.js";
|
|
72
72
|
import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
|
|
73
|
-
import { useShopNavigation as
|
|
73
|
+
import { useShopNavigation as ct } from "./hooks/navigation/useShopNavigation.js";
|
|
74
74
|
import { useCloseMini as gt } from "./hooks/navigation/useCloseMini.js";
|
|
75
75
|
import { useDeeplink as At } from "./hooks/navigation/useDeeplink.js";
|
|
76
76
|
import { useNavigateWithTransition as Pt } from "./hooks/navigation/useNavigateWithTransition.js";
|
|
77
77
|
import { useShop as ht } from "./hooks/shop/useShop.js";
|
|
78
78
|
import { useRecommendedShops as Rt } from "./hooks/shop/useRecommendedShops.js";
|
|
79
|
-
import { useCreateImageContent as
|
|
80
|
-
import { useErrorToast as
|
|
81
|
-
import { useErrorScreen as
|
|
79
|
+
import { useCreateImageContent as Mt } from "./hooks/content/useCreateImageContent.js";
|
|
80
|
+
import { useErrorToast as Bt } from "./hooks/util/useErrorToast.js";
|
|
81
|
+
import { useErrorScreen as vt } from "./hooks/util/useErrorScreen.js";
|
|
82
82
|
import { useShare as Lt } from "./hooks/util/useShare.js";
|
|
83
83
|
import { useImagePicker as Nt } from "./hooks/util/useImagePicker.js";
|
|
84
|
-
import { useKeyboardAvoidingView as
|
|
85
|
-
import { useRequestPermissions as
|
|
84
|
+
import { useKeyboardAvoidingView as _t } from "./hooks/util/useKeyboardAvoidingView.js";
|
|
85
|
+
import { useRequestPermissions as Gt } from "./hooks/util/useRequestPermissions.js";
|
|
86
86
|
import { useOnMiniFocus as Ht } from "./hooks/events/useOnMiniFocus.js";
|
|
87
87
|
import { useOnMiniBlur as zt } from "./hooks/events/useOnMiniBlur.js";
|
|
88
88
|
import { useOnMiniClose as Yt } from "./hooks/events/useOnMiniClose.js";
|
|
89
89
|
import { useOnAppStateChange as Kt } from "./hooks/events/useOnAppStateChange.js";
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import { DATA_FETCHING_DEFAULT_FETCH_POLICY as Ra, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ba } from "./shop-minis-platform/src/constants.js";
|
|
90
|
+
import { MiniEntityNotFoundError as Zt, MiniError as jt, MiniNetworkError as Jt, formatError as Xt } from "./utils/errors.js";
|
|
91
|
+
import { extractBrandTheme as ra, formatReviewCount as ea, getFeaturedImages as oa, normalizeRating as ta } from "./utils/merchant-card.js";
|
|
92
|
+
import { parseUrl as ia } from "./utils/parseUrl.js";
|
|
93
|
+
import { dataURLToBlob as na, fileToDataUri as ma, getResizedImageUrl as sa, getThumbhashBlobURL as la, getThumbhashDataURL as ua } from "./utils/image.js";
|
|
94
|
+
import { formatMoney as xa } from "./utils/formatMoney.js";
|
|
95
|
+
import { UserState as ca, UserTokenGenerateUserErrorCode as Ca } from "./shop-minis-platform/src/types/user.js";
|
|
96
|
+
import { ContentCreateUserErrorCode as Sa, MinisContentStatus as Aa } from "./shop-minis-platform/src/types/content.js";
|
|
97
|
+
import { Social as Pa } from "./shop-minis-platform/src/types/share.js";
|
|
98
|
+
import { DATA_FETCHING_DEFAULT_FETCH_POLICY as ha, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ia } from "./shop-minis-platform/src/constants.js";
|
|
100
99
|
export {
|
|
101
100
|
Sr as Accordion,
|
|
102
101
|
Ar as AccordionContent,
|
|
@@ -105,21 +104,21 @@ export {
|
|
|
105
104
|
n as AddToCartButton,
|
|
106
105
|
hr as Alert,
|
|
107
106
|
Ir as AlertDescription,
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
Mr as AlertDialog,
|
|
108
|
+
wr as AlertDialogAction,
|
|
110
109
|
pr as AlertDialogAtom,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
Br as AlertDialogCancel,
|
|
111
|
+
Fr as AlertDialogContent,
|
|
112
|
+
vr as AlertDialogDescription,
|
|
114
113
|
Ur as AlertDialogFooter,
|
|
115
114
|
Lr as AlertDialogHeader,
|
|
116
115
|
br as AlertDialogOverlay,
|
|
117
116
|
Nr as AlertDialogPortal,
|
|
118
117
|
kr as AlertDialogTitle,
|
|
119
|
-
|
|
118
|
+
_r as AlertDialogTrigger,
|
|
120
119
|
Rr as AlertTitle,
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
Gr as Avatar,
|
|
121
|
+
Or as AvatarFallback,
|
|
123
122
|
Hr as AvatarImage,
|
|
124
123
|
zr as Badge,
|
|
125
124
|
j as Button,
|
|
@@ -137,10 +136,10 @@ export {
|
|
|
137
136
|
te as CarouselNext,
|
|
138
137
|
ae as CarouselPrevious,
|
|
139
138
|
pe as Checkbox,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
Sa as ContentCreateUserErrorCode,
|
|
140
|
+
dr as ContentWrapper,
|
|
141
|
+
ha as DATA_FETCHING_DEFAULT_FETCH_POLICY,
|
|
142
|
+
Ia as DATA_FETCHING_DEFAULT_PAGE_SIZE,
|
|
144
143
|
o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
|
|
145
144
|
me as Dialog,
|
|
146
145
|
se as DialogClose,
|
|
@@ -148,8 +147,8 @@ export {
|
|
|
148
147
|
ue as DialogDescription,
|
|
149
148
|
fe as DialogFooter,
|
|
150
149
|
xe as DialogHeader,
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
de as DialogOverlay,
|
|
151
|
+
ce as DialogPortal,
|
|
153
152
|
Ce as DialogTitle,
|
|
154
153
|
ge as DialogTrigger,
|
|
155
154
|
Ae as Drawer,
|
|
@@ -159,57 +158,57 @@ export {
|
|
|
159
158
|
he as DrawerFooter,
|
|
160
159
|
Ie as DrawerHeader,
|
|
161
160
|
Re as DrawerOverlay,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
Ee as DrawerPortal,
|
|
162
|
+
Me as DrawerTitle,
|
|
163
|
+
we as DrawerTrigger,
|
|
165
164
|
V as FavoriteButton,
|
|
166
165
|
X as IconButton,
|
|
167
166
|
rr as Image,
|
|
168
167
|
W as ImageContentWrapper,
|
|
169
|
-
|
|
168
|
+
Fe as Input,
|
|
170
169
|
Ue as Label,
|
|
171
170
|
mr as List,
|
|
172
171
|
ar as LongPressDetector,
|
|
173
172
|
I as MerchantCard,
|
|
174
173
|
R as MerchantCardContainer,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
E as MerchantCardHeader,
|
|
175
|
+
M as MerchantCardInfo,
|
|
176
|
+
w as MerchantCardName,
|
|
177
|
+
B as MerchantCardRating,
|
|
179
178
|
L as MerchantCardSkeleton,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
Zt as MiniEntityNotFoundError,
|
|
180
|
+
jt as MiniError,
|
|
181
|
+
Jt as MiniNetworkError,
|
|
183
182
|
i as MinisContainer,
|
|
184
|
-
|
|
183
|
+
Aa as MinisContentStatus,
|
|
185
184
|
q as MinisRouter,
|
|
186
185
|
t as NAVIGATION_TYPES,
|
|
187
186
|
u as ProductCard,
|
|
188
187
|
f as ProductCardBadge,
|
|
189
188
|
x as ProductCardContainer,
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
d as ProductCardFavoriteButton,
|
|
190
|
+
c as ProductCardImage,
|
|
192
191
|
C as ProductCardImageContainer,
|
|
193
192
|
g as ProductCardInfo,
|
|
194
193
|
S as ProductCardPrice,
|
|
195
194
|
A as ProductCardReviewStars,
|
|
196
|
-
|
|
195
|
+
v as ProductCardSkeleton,
|
|
197
196
|
D as ProductCardTitle,
|
|
198
197
|
T as ProductLink,
|
|
199
198
|
Cr as ProductVariantPrice,
|
|
200
199
|
be as Progress,
|
|
201
200
|
N as QuantitySelector,
|
|
202
201
|
ke as RadioGroup,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
_e as RadioGroupItem,
|
|
203
|
+
Ge as ResizableHandle,
|
|
204
|
+
Oe as ResizablePanel,
|
|
206
205
|
He as ResizablePanelGroup,
|
|
207
206
|
ze as ScrollArea,
|
|
208
207
|
We as ScrollBar,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
_ as Search,
|
|
209
|
+
y as SearchInput,
|
|
210
|
+
G as SearchProvider,
|
|
211
|
+
O as SearchResultsList,
|
|
213
212
|
qe as Select,
|
|
214
213
|
Ke as SelectContent,
|
|
215
214
|
Qe as SelectGroup,
|
|
@@ -230,49 +229,48 @@ export {
|
|
|
230
229
|
uo as SheetTitle,
|
|
231
230
|
fo as SheetTrigger,
|
|
232
231
|
Ao as Skeleton,
|
|
233
|
-
|
|
232
|
+
Pa as Social,
|
|
234
233
|
fr as TextInput,
|
|
235
234
|
co as Toaster,
|
|
236
235
|
or as Touchable,
|
|
237
236
|
Q as TransitionLink,
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
ca as UserState,
|
|
238
|
+
Ca as UserTokenGenerateUserErrorCode,
|
|
240
239
|
lr as VideoPlayer,
|
|
241
240
|
Wr as badgeVariants,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
na as dataURLToBlob,
|
|
242
|
+
ra as extractBrandTheme,
|
|
243
|
+
ma as fileToDataUri,
|
|
244
|
+
Xt as formatError,
|
|
245
|
+
xa as formatMoney,
|
|
246
|
+
ea as formatReviewCount,
|
|
247
|
+
oa as getFeaturedImages,
|
|
248
|
+
sa as getResizedImageUrl,
|
|
249
|
+
la as getThumbhashBlobURL,
|
|
250
|
+
ua as getThumbhashDataURL,
|
|
251
|
+
ta as normalizeRating,
|
|
252
|
+
ia as parseUrl,
|
|
254
253
|
go as toast,
|
|
255
254
|
st as useAsyncStorage,
|
|
256
|
-
|
|
255
|
+
_o as useBuyerAttributes,
|
|
257
256
|
gt as useCloseMini,
|
|
258
|
-
|
|
257
|
+
Mt as useCreateImageContent,
|
|
259
258
|
nt as useCuratedProducts,
|
|
260
259
|
Lo as useCurrentUser,
|
|
261
260
|
At as useDeeplink,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
261
|
+
vt as useErrorScreen,
|
|
262
|
+
Bt as useErrorToast,
|
|
263
|
+
Bo as useFollowedShops,
|
|
264
|
+
vo as useFollowedShopsActions,
|
|
265
|
+
Go as useGenerateUserToken,
|
|
267
266
|
Nt as useImagePicker,
|
|
268
267
|
xt as useImageUpload,
|
|
269
|
-
|
|
268
|
+
_t as useKeyboardAvoidingView,
|
|
270
269
|
Pt as useNavigateWithTransition,
|
|
271
270
|
Kt as useOnAppStateChange,
|
|
272
271
|
zt as useOnMiniBlur,
|
|
273
272
|
Yt as useOnMiniClose,
|
|
274
273
|
Ht as useOnMiniFocus,
|
|
275
|
-
Zt as useOnNavigateBack,
|
|
276
274
|
No as useOrders,
|
|
277
275
|
it as usePopularProducts,
|
|
278
276
|
Ko as useProduct,
|
|
@@ -287,12 +285,12 @@ export {
|
|
|
287
285
|
ho as useRecentShops,
|
|
288
286
|
tt as useRecommendedProducts,
|
|
289
287
|
Rt as useRecommendedShops,
|
|
290
|
-
|
|
288
|
+
Gt as useRequestPermissions,
|
|
291
289
|
Ro as useSavedProducts,
|
|
292
|
-
|
|
290
|
+
Mo as useSavedProductsActions,
|
|
293
291
|
ut as useSecureStorage,
|
|
294
292
|
Lt as useShare,
|
|
295
293
|
ht as useShop,
|
|
296
|
-
|
|
294
|
+
ct as useShopNavigation
|
|
297
295
|
};
|
|
298
296
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/mocks.js
CHANGED
|
@@ -11,7 +11,7 @@ const m = [
|
|
|
11
11
|
r = (r << 5) - r + o.charCodeAt(t), r |= 0;
|
|
12
12
|
return Math.abs(r);
|
|
13
13
|
}, e = (o, r, t = "99.99", n) => {
|
|
14
|
-
const
|
|
14
|
+
const i = P(o) % m.length, c = m[i];
|
|
15
15
|
return {
|
|
16
16
|
id: o,
|
|
17
17
|
title: r,
|
|
@@ -29,7 +29,7 @@ const m = [
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}, d = (o, r, t) => {
|
|
32
|
-
const n = t?.themeType || "none",
|
|
32
|
+
const n = t?.themeType || "none", i = t?.withBrandSettings || n !== "none", c = t?.featuredImagesLimit || 3, u = Array.from({ length: c }, (C, l) => ({
|
|
33
33
|
url: `https://picsum.photos/400/400?random=${o}-${l}`,
|
|
34
34
|
sensitive: !1,
|
|
35
35
|
altText: `${r} featured image ${l + 1}`
|
|
@@ -104,7 +104,7 @@ const m = [
|
|
|
104
104
|
url: `https://picsum.photos/100/100?random=${o}`,
|
|
105
105
|
sensitive: !1
|
|
106
106
|
},
|
|
107
|
-
brandSettings:
|
|
107
|
+
brandSettings: i ? {
|
|
108
108
|
id: `brand-settings-${o}`,
|
|
109
109
|
colors: {
|
|
110
110
|
id: `colors-${o}`,
|
|
@@ -117,7 +117,7 @@ const m = [
|
|
|
117
117
|
}, a = (o = !1) => ({
|
|
118
118
|
hasNextPage: o,
|
|
119
119
|
endCursor: o ? "cursor123" : null
|
|
120
|
-
}),
|
|
120
|
+
}), s = (o, r, t = []) => ({
|
|
121
121
|
id: o,
|
|
122
122
|
publicId: `public-${o}`,
|
|
123
123
|
name: r,
|
|
@@ -212,20 +212,20 @@ function I() {
|
|
|
212
212
|
reportContentImpression: void 0,
|
|
213
213
|
getProductLists: {
|
|
214
214
|
data: [
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
s("list-1", "Wishlist"),
|
|
216
|
+
s("list-2", "Favorites")
|
|
217
217
|
],
|
|
218
218
|
pageInfo: a()
|
|
219
219
|
},
|
|
220
220
|
getProductList: {
|
|
221
|
-
data:
|
|
221
|
+
data: s("list-1", "Wishlist", [
|
|
222
222
|
e("prod-1", "Sample Product")
|
|
223
223
|
]),
|
|
224
224
|
pageInfo: a()
|
|
225
225
|
},
|
|
226
|
-
addProductList:
|
|
226
|
+
addProductList: s("list-3", "New List"),
|
|
227
227
|
removeProductList: void 0,
|
|
228
|
-
renameProductList:
|
|
228
|
+
renameProductList: s("list-1", "Updated Wishlist"),
|
|
229
229
|
addProductListItem: void 0,
|
|
230
230
|
removeProductListItem: void 0,
|
|
231
231
|
getRecommendedProducts: {
|
|
@@ -449,8 +449,7 @@ function I() {
|
|
|
449
449
|
granted: !0
|
|
450
450
|
},
|
|
451
451
|
reportError: void 0,
|
|
452
|
-
reportFetch: void 0
|
|
453
|
-
reportNavigationState: void 0
|
|
452
|
+
reportFetch: void 0
|
|
454
453
|
}, r = {};
|
|
455
454
|
for (const t in o)
|
|
456
455
|
Object.prototype.hasOwnProperty.call(o, t) && (r[t] = f(
|
package/dist/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sources":["../src/mocks.ts"],"sourcesContent":["import {\n Product,\n Gender,\n UserState,\n MinisContentStatus,\n} from '@shopify/shop-minis-platform'\nimport {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nconst SAMPLE_IMAGE_NAMES = [\n 'garnished.jpeg',\n 'bath.jpeg',\n 'teapot.jpg',\n 'shoes.jpeg',\n]\n\n// Simple hash function to get a deterministic index from a string\nconst hashString = (str: string): number => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i)\n hash |= 0\n }\n return Math.abs(hash)\n}\n\n// Helper functions for common data structures\nexport const createProduct = (\n id: string,\n title: string,\n price = '99.99',\n compareAtPrice?: string\n): Product => {\n const imageIndex = hashString(id) % SAMPLE_IMAGE_NAMES.length\n const imageName = SAMPLE_IMAGE_NAMES[imageIndex]\n\n return {\n id,\n title,\n price: {amount: price, currencyCode: 'USD'},\n ...(compareAtPrice && {\n compareAtPrice: {amount: compareAtPrice, currencyCode: 'USD'},\n }),\n reviewAnalytics: {averageRating: 4.5, reviewCount: 10},\n shop: createShop('shop1', 'Mock Shop'),\n defaultVariantId: `variant-${id}`,\n isFavorited: false,\n featuredImage: {\n url: `https://cdn.shopify.com/static/sample-images/${imageName}`,\n altText: title,\n },\n }\n}\n\nexport const createShop = (\n id: string,\n name: string,\n options?: {\n themeType?: 'coverImage' | 'brandColor' | 'logoColor' | 'none'\n withBrandSettings?: boolean\n primaryColor?: string\n logoDominantColor?: string\n logoAverageColor?: string\n coverDominantColor?: string\n wordmarkUrl?: string\n coverImageUrl?: string\n featuredImagesLimit?: number\n }\n) => {\n // Determine theme configuration\n const themeType = options?.themeType || 'none'\n const shouldHaveBrandSettings =\n options?.withBrandSettings || themeType !== 'none'\n\n // Generate featured images\n const featuredImagesCount = options?.featuredImagesLimit || 3\n const featuredImages = Array.from({length: featuredImagesCount}, (_, i) => ({\n url: `https://picsum.photos/400/400?random=${id}-${i}`,\n sensitive: false,\n altText: `${name} featured image ${i + 1}`,\n }))\n\n // Configure colors based on theme type\n const getThemeColors = () => {\n switch (themeType) {\n case 'coverImage':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor || '#FF6B35',\n }\n case 'brandColor':\n return {\n primary: options?.primaryColor || '#27AE60',\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n case 'logoColor':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor || '#E74C3C',\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n default:\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n }\n }\n\n // Configure header theme\n const createHeaderTheme = () => {\n if (themeType === 'coverImage' || options?.coverImageUrl) {\n return {\n id: `header-theme-${id}`,\n coverImage: {\n url:\n options?.coverImageUrl ||\n 'https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=800&h=400&fit=crop',\n altText: `${name} cover image`,\n sensitive: false,\n thumbhash: 'k9oGHQRnh493V4dIeHeXh4h3iIeI',\n },\n wordmark:\n options?.wordmarkUrl || themeType === 'coverImage'\n ? {\n url:\n options?.wordmarkUrl ||\n 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',\n altText: `${name} wordmark`,\n sensitive: false,\n }\n : undefined,\n }\n }\n\n if (options?.wordmarkUrl) {\n return {\n id: `header-theme-${id}`,\n wordmark: {\n url: options.wordmarkUrl,\n altText: `${name} wordmark`,\n sensitive: false,\n },\n }\n }\n\n return undefined\n }\n\n return {\n id,\n name,\n primaryDomain: {\n url: `https://${name.toLowerCase().replace(/\\s+/g, '-')}.com`,\n },\n reviewAnalytics: {averageRating: 4.3, reviewCount: 50},\n visualTheme: {\n id: `visual-theme-${id}`,\n featuredImages,\n logoImage: {\n url: `https://picsum.photos/100/100?random=${id}`,\n sensitive: false,\n },\n brandSettings: shouldHaveBrandSettings\n ? {\n id: `brand-settings-${id}`,\n colors: {\n id: `colors-${id}`,\n ...getThemeColors(),\n },\n headerTheme: createHeaderTheme(),\n }\n : undefined,\n },\n }\n}\n\nconst createPagination = (hasNext = false) => ({\n hasNextPage: hasNext,\n endCursor: hasNext ? 'cursor123' : null,\n})\n\nconst createProductList = (id: string, name: string, products: any[] = []) => ({\n id,\n publicId: `public-${id}`,\n name,\n products,\n})\n\n// Helper type to extract the data type from a ShopAction\ntype ShopActionDataType<T> = T extends (\n ...args: any[]\n) => Promise<{ok: true; data: infer R} | {ok: false; error: any}>\n ? R\n : never\n\n// Use window._mockLogs instead of console.log so logs aren't stripped in production builds\n// This allows e2e tests to verify mock actions are being called\nexport interface MockLog {\n action: string\n params?: unknown\n}\n\ndeclare global {\n interface Window {\n _mockLogs?: MockLog[]\n }\n}\n\nfunction logMockAction(action: string, params?: unknown) {\n window._mockLogs = window._mockLogs || []\n window._mockLogs.push({action, params})\n}\n\nfunction makeMockMethod<K extends keyof ShopActions>(\n key: K,\n result: ShopActionDataType<ShopActions[K]>\n): ShopActions[K] {\n return ((params: Parameters<ShopActions[K]>[0]) => {\n logMockAction(String(key), params)\n return Promise.resolve({\n ok: true as const,\n data: result,\n mocked: true,\n })\n }) as ShopActions[K]\n}\n\nexport function makeMockActions(): ShopActions {\n const results: {\n [K in keyof ShopActions]: ShopActionDataType<ShopActions[K]>\n } = {\n translateContentUp: undefined,\n translateContentDown: undefined,\n followShop: true,\n unfollowShop: false,\n favorite: undefined,\n unfavorite: undefined,\n getShopAppInformation: {\n appVersion: '1.0.0',\n buildNumber: '12345',\n buildId: 'dev-build-123',\n },\n productRecommendationImpression: undefined,\n productRecommendationClick: undefined,\n closeMini: undefined,\n getAccountInformation: {\n status: 'available',\n value: 'user@example.com',\n },\n getCurrentUser: {\n data: {\n displayName: 'John Doe',\n avatarImage: {url: 'https://example.com/avatar.jpg'},\n },\n },\n createOrderAttribution: undefined,\n addToCart: undefined,\n buyProduct: undefined,\n buyProducts: undefined,\n showErrorScreen: undefined,\n showErrorToast: undefined,\n getDeeplinkPaths: {\n matchers: ['/products', '/collections', '/cart'],\n },\n navigateToDeeplink: undefined,\n navigateToShop: undefined,\n navigateToProduct: undefined,\n navigateToOrder: undefined,\n navigateToCheckout: undefined,\n createImageUploadLink: {\n // This action is mocked in the actual hook. See `useImageUpload` for more details.\n targets: [\n {\n url: 'https://example.com/upload',\n resourceUrl: 'https://example.com/resource',\n parameters: [{name: 'key', value: 'upload-123'}],\n },\n ],\n },\n completeImageUpload: {\n files: [\n {\n id: 'file-123',\n fileStatus: 'READY',\n image: {\n url: 'https://example.com/image.jpg',\n },\n },\n ],\n },\n getPersistedItem: null,\n setPersistedItem: undefined,\n removePersistedItem: undefined,\n getAllPersistedKeys: ['key1', 'key2', 'key3'],\n clearPersistedItems: undefined,\n getInternalPersistedItem: null,\n setInternalPersistedItem: undefined,\n removeInternalPersistedItem: undefined,\n getAllInternalPersistedKeys: ['internal-key1', 'internal-key2'],\n clearInternalPersistedItems: undefined,\n getSecret: 'secret-value',\n setSecret: undefined,\n removeSecret: undefined,\n reportInteraction: undefined,\n reportImpression: undefined,\n reportContentImpression: undefined,\n getProductLists: {\n data: [\n createProductList('list-1', 'Wishlist'),\n createProductList('list-2', 'Favorites'),\n ],\n pageInfo: createPagination(),\n },\n getProductList: {\n data: createProductList('list-1', 'Wishlist', [\n createProduct('prod-1', 'Sample Product'),\n ]),\n pageInfo: createPagination(),\n },\n addProductList: createProductList('list-3', 'New List'),\n removeProductList: undefined,\n renameProductList: createProductList('list-1', 'Updated Wishlist'),\n addProductListItem: undefined,\n removeProductListItem: undefined,\n getRecommendedProducts: {\n data: [\n createProduct('rec-1', 'Recommended Product 1', '79.99'),\n createProduct('rec-2', 'Recommended Product 2', '129.99'),\n createProduct('rec-3', 'Recommended Product 3', '129.99'),\n createProduct('rec-4', 'Recommended Product 4', '29.99'),\n createProduct('rec-5', 'Recommended Product 5', '39.99'),\n createProduct('rec-6', 'Recommended Product 6', '49.99'),\n createProduct('rec-7', 'Recommended Product 7', '59.99'),\n createProduct('rec-8', 'Recommended Product 8', '69.99'),\n createProduct('rec-9', 'Recommended Product 9', '129.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecommendedShops: {\n data: [\n createShop('shop-1', 'Amazing Store'),\n createShop('shop-2', 'Best Deals Shop'),\n createShop('shop-3', 'Great Products'),\n createShop('shop-4', 'Top Brands'),\n createShop('shop-5', 'Exclusive Offers'),\n ],\n pageInfo: createPagination(),\n },\n searchProductsByShop: {\n data: [\n createProduct('search-1', 'Search Result 1', '59.99'),\n createProduct('search-2', 'Search Result 2', '89.99'),\n createProduct('search-3', 'Search Result 3', '119.99'),\n createProduct('search-4', 'Search Result 4', '149.99'),\n createProduct('search-5', 'Search Result 5', '179.99'),\n ],\n pageInfo: createPagination(),\n },\n getOrders: {\n data: [\n {\n id: 'order-1',\n name: '#1001',\n lineItems: [\n {\n productTitle: 'Sample Product',\n variantTitle: 'Medium',\n quantity: 2,\n product: null,\n },\n ],\n shop: createShop('shop-1', 'Sample Shop'),\n },\n ],\n pageInfo: createPagination(),\n },\n getBuyerAttributes: {\n data: {\n genderAffinity: 'NEUTRAL' as Gender,\n categoryAffinities: [\n {id: 'cat1', name: 'Electronics'},\n {id: 'cat2', name: 'Clothing'},\n ],\n },\n },\n showFeedbackSheet: undefined,\n getPopularProducts: {\n data: [\n createProduct('pop-1', 'The Hero Snowboard', '702.95'),\n createProduct('pop-2', 'Snow Jacket', '605.95', '702.00'),\n createProduct('pop-3', 'Winter Gloves', '89.95'),\n createProduct('pop-4', 'Summer Gloves', '89.95'),\n createProduct('pop-5', 'Spring Gloves', '89.95'),\n createProduct('pop-6', 'Playstation 5', '499.95'),\n createProduct('pop-7', 'Xbox Series X', '499.95'),\n createProduct('pop-8', 'Nintendo Switch', '299.95'),\n createProduct('pop-9', 'Playstation 4', '299.95'),\n createProduct('pop-10', 'Nintendo 3DS', '89.95'),\n ],\n pageInfo: createPagination(),\n },\n share: {\n message: 'Shared!',\n success: true,\n },\n shareSingle: {\n message: 'Shared!',\n success: true,\n },\n getCuratedProducts: {\n data: [\n createProduct('cur-1', 'Curated Product 1', '79.99'),\n createProduct('cur-2', 'Curated Product 2', '129.99'),\n ],\n pageInfo: createPagination(),\n },\n getSavedProducts: {\n data: [\n createProduct('saved-1', 'Saved Product 1', '49.99'),\n createProduct('saved-2', 'Saved Product 2', '59.99'),\n createProduct('saved-3', 'Saved Product 3', '69.99'),\n createProduct('saved-4', 'Saved Product 4', '79.99'),\n createProduct('saved-5', 'Saved Product 5', '89.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecentProducts: {\n data: [\n createProduct('recent-1', 'Recent Product 1', '59.99'),\n createProduct('recent-2', 'Recent Product 2', '69.99'),\n createProduct('recent-3', 'Recent Product 3', '79.99'),\n createProduct('recent-4', 'Recent Product 4', '89.99'),\n createProduct('recent-5', 'Recent Product 5', '99.99'),\n ],\n pageInfo: createPagination(),\n },\n getProductSearch: {\n data: [\n createProduct('search-1', 'Search Product 1', '39.99'),\n createProduct('search-2', 'Search Product 2', '19.99'),\n createProduct('search-3', 'Search Product 3', '29.99'),\n createProduct('search-4', 'Search Product 4', '49.99'),\n createProduct('search-5', 'Search Product 5', '9.99'),\n ],\n pageInfo: createPagination(),\n },\n getProducts: {\n data: [\n createProduct('prod-1', 'Product 1', '9.99'),\n createProduct('prod-2', 'Product 2', '19.99'),\n createProduct('prod-3', 'Product 3', '29.99'),\n createProduct('prod-4', 'Product 4', '39.99'),\n createProduct('prod-5', 'Product 5', '49.99'),\n ],\n },\n getProduct: {data: createProduct('prod-1', 'Sample Product')},\n getProductVariants: {\n data: [\n {\n id: 'variant-1',\n title: 'Variant 1',\n isFavorited: false,\n image: {url: 'https://example.com/variant-1.jpg'},\n price: {amount: '19.99', currencyCode: 'USD'},\n compareAtPrice: {amount: '29.99', currencyCode: 'USD'},\n },\n ],\n pageInfo: createPagination(),\n },\n getProductMedia: {\n data: [\n {\n id: 'media-1',\n image: {url: 'https://example.com/media-1.jpg'},\n mediaContentType: 'IMAGE',\n alt: 'Sample product image',\n },\n ],\n pageInfo: createPagination(),\n },\n getShop: {\n data: createShop('shop-1', 'Sample Shop', {featuredImagesLimit: 4}),\n },\n getRecentShops: {\n data: [\n createShop('recent-shop-1', 'Recent Shop 1'),\n createShop('recent-shop-2', 'Recent Shop 2'),\n createShop('recent-shop-3', 'Recent Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n getFollowedShops: {\n data: [\n createShop('followed-shop-1', 'Followed Shop 1'),\n createShop('followed-shop-2', 'Followed Shop 2'),\n createShop('followed-shop-3', 'Followed Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n previewProductInAr: undefined,\n createContent: {\n data: {\n publicId: 'content-123',\n externalId: null,\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n description: 'This is a mock content item',\n visibility: ['DISCOVERABLE'],\n shareableUrl: 'https://example.com/content/123',\n products: null,\n },\n },\n getContent: {\n data: [\n {\n publicId: 'content-123',\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n visibility: ['DISCOVERABLE'],\n status: MinisContentStatus.READY,\n },\n ],\n },\n generateUserToken: {\n data: {\n token: 'user-token-123',\n expiresAt: '2025-01-01',\n userState: UserState.VERIFIED,\n },\n },\n navigateToCart: undefined,\n requestPermission: {\n granted: true,\n },\n reportError: undefined,\n reportFetch: undefined,\n reportNavigationState: undefined,\n } as const\n\n const mock: Partial<ShopActions> = {}\n for (const key in results) {\n if (Object.prototype.hasOwnProperty.call(results, key)) {\n // @ts-expect-error: dynamic assignment is safe due to exhaustive mapping\n mock[key] = makeMockMethod(\n key as keyof ShopActions,\n results[key as keyof typeof results]\n )\n }\n }\n return mock as ShopActions\n}\n\n// Detect if running on a mobile device\nconst isMobile = (): boolean => {\n const userAgent = navigator.userAgent.toLowerCase()\n const isIOS = /iphone|ipad|ipod/.test(userAgent)\n const isAndroid = /android/.test(userAgent)\n\n return isIOS || isAndroid\n}\n\nexport const injectMocks = ({force}: {force?: boolean} = {}) => {\n // Only inject mocks if we aren't on a mobile device or we force it\n if (isMobile() && !force) {\n return\n }\n\n if (!window.minisSDK) {\n window.minisSDK = makeMockActions()\n window.minisParams = {\n handle: 'mock-handle',\n initialUrl: '/',\n platform: 'web',\n }\n }\n}\n"],"names":["SAMPLE_IMAGE_NAMES","hashString","str","hash","i","createProduct","id","title","price","compareAtPrice","imageIndex","imageName","createShop","name","options","themeType","shouldHaveBrandSettings","featuredImagesCount","featuredImages","_","getThemeColors","createHeaderTheme","createPagination","hasNext","createProductList","products","logMockAction","action","params","makeMockMethod","key","result","makeMockActions","results","MinisContentStatus","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks","force"],"mappings":";;AAQA,MAAMA,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGMC,IAAa,CAACC,MAAwB;AAC1C,MAAIC,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIF,EAAI,QAAQE;AAC9B,IAAAD,KAAQA,KAAQ,KAAKA,IAAOD,EAAI,WAAWE,CAAC,GACpCD,KAAA;AAEH,SAAA,KAAK,IAAIA,CAAI;AACtB,GAGaE,IAAgB,CAC3BC,GACAC,GACAC,IAAQ,SACRC,MACY;AACZ,QAAMC,IAAaT,EAAWK,CAAE,IAAIN,EAAmB,QACjDW,IAAYX,E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AM;AAAA,QACJ;AAAA,UACE,UAAU;AAAA,UACV,OAAO;AAAA,YACL,IAAI;AAAA,YACJ,KAAK;AAAA,YACL,OAAO;AAAA,YACP,QAAQ;AAAA,UACV;AAAA,UACA,OAAO;AAAA,UACP,YAAY,CAAC,cAAc;AAAA,UAC3B,QAAQY,EAAmB;AAAA,QAAA;AAAA,MAC7B;AAAA,IAEJ;AAAA,IACA,mBAAmB;AAAA,MACjB,MAAM;AAAA,QACJ,OAAO;AAAA,QACP,WAAW;AAAA,QACX,WAAWC,EAAU;AAAA,MAAA;AAAA,IAEzB;AAAA,IACA,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,MACjB,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,IACb,uBAAuB;AAAA,EACzB,GAEMC,IAA6B,CAAC;AACpC,aAAWN,KAAOG;AAChB,IAAI,OAAO,UAAU,eAAe,KAAKA,GAASH,CAAG,MAEnDM,EAAKN,CAAG,IAAID;AAAA,MACVC;AAAA,MACAG,EAAQH,CAA2B;AAAA,IACrC;AAGG,SAAAM;AACT;AAGA,MAAMC,IAAW,MAAe;AACxB,QAAAC,IAAY,UAAU,UAAU,YAAY,GAC5CC,IAAQ,mBAAmB,KAAKD,CAAS,GACzCE,IAAY,UAAU,KAAKF,CAAS;AAE1C,SAAOC,KAASC;AAClB,GAEaC,IAAc,CAAC,EAAC,OAAAC,EAAK,IAAuB,OAAO;AAE1D,EAAAL,EAAA,KAAc,CAACK,KAId,OAAO,aACV,OAAO,WAAWV,EAAgB,GAClC,OAAO,cAAc;AAAA,IACnB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"mocks.js","sources":["../src/mocks.ts"],"sourcesContent":["import {\n Product,\n Gender,\n UserState,\n MinisContentStatus,\n} from '@shopify/shop-minis-platform'\nimport {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nconst SAMPLE_IMAGE_NAMES = [\n 'garnished.jpeg',\n 'bath.jpeg',\n 'teapot.jpg',\n 'shoes.jpeg',\n]\n\n// Simple hash function to get a deterministic index from a string\nconst hashString = (str: string): number => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i)\n hash |= 0\n }\n return Math.abs(hash)\n}\n\n// Helper functions for common data structures\nexport const createProduct = (\n id: string,\n title: string,\n price = '99.99',\n compareAtPrice?: string\n): Product => {\n const imageIndex = hashString(id) % SAMPLE_IMAGE_NAMES.length\n const imageName = SAMPLE_IMAGE_NAMES[imageIndex]\n\n return {\n id,\n title,\n price: {amount: price, currencyCode: 'USD'},\n ...(compareAtPrice && {\n compareAtPrice: {amount: compareAtPrice, currencyCode: 'USD'},\n }),\n reviewAnalytics: {averageRating: 4.5, reviewCount: 10},\n shop: createShop('shop1', 'Mock Shop'),\n defaultVariantId: `variant-${id}`,\n isFavorited: false,\n featuredImage: {\n url: `https://cdn.shopify.com/static/sample-images/${imageName}`,\n altText: title,\n },\n }\n}\n\nexport const createShop = (\n id: string,\n name: string,\n options?: {\n themeType?: 'coverImage' | 'brandColor' | 'logoColor' | 'none'\n withBrandSettings?: boolean\n primaryColor?: string\n logoDominantColor?: string\n logoAverageColor?: string\n coverDominantColor?: string\n wordmarkUrl?: string\n coverImageUrl?: string\n featuredImagesLimit?: number\n }\n) => {\n // Determine theme configuration\n const themeType = options?.themeType || 'none'\n const shouldHaveBrandSettings =\n options?.withBrandSettings || themeType !== 'none'\n\n // Generate featured images\n const featuredImagesCount = options?.featuredImagesLimit || 3\n const featuredImages = Array.from({length: featuredImagesCount}, (_, i) => ({\n url: `https://picsum.photos/400/400?random=${id}-${i}`,\n sensitive: false,\n altText: `${name} featured image ${i + 1}`,\n }))\n\n // Configure colors based on theme type\n const getThemeColors = () => {\n switch (themeType) {\n case 'coverImage':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor || '#FF6B35',\n }\n case 'brandColor':\n return {\n primary: options?.primaryColor || '#27AE60',\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n case 'logoColor':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor || '#E74C3C',\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n default:\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n }\n }\n\n // Configure header theme\n const createHeaderTheme = () => {\n if (themeType === 'coverImage' || options?.coverImageUrl) {\n return {\n id: `header-theme-${id}`,\n coverImage: {\n url:\n options?.coverImageUrl ||\n 'https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=800&h=400&fit=crop',\n altText: `${name} cover image`,\n sensitive: false,\n thumbhash: 'k9oGHQRnh493V4dIeHeXh4h3iIeI',\n },\n wordmark:\n options?.wordmarkUrl || themeType === 'coverImage'\n ? {\n url:\n options?.wordmarkUrl ||\n 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',\n altText: `${name} wordmark`,\n sensitive: false,\n }\n : undefined,\n }\n }\n\n if (options?.wordmarkUrl) {\n return {\n id: `header-theme-${id}`,\n wordmark: {\n url: options.wordmarkUrl,\n altText: `${name} wordmark`,\n sensitive: false,\n },\n }\n }\n\n return undefined\n }\n\n return {\n id,\n name,\n primaryDomain: {\n url: `https://${name.toLowerCase().replace(/\\s+/g, '-')}.com`,\n },\n reviewAnalytics: {averageRating: 4.3, reviewCount: 50},\n visualTheme: {\n id: `visual-theme-${id}`,\n featuredImages,\n logoImage: {\n url: `https://picsum.photos/100/100?random=${id}`,\n sensitive: false,\n },\n brandSettings: shouldHaveBrandSettings\n ? {\n id: `brand-settings-${id}`,\n colors: {\n id: `colors-${id}`,\n ...getThemeColors(),\n },\n headerTheme: createHeaderTheme(),\n }\n : undefined,\n },\n }\n}\n\nconst createPagination = (hasNext = false) => ({\n hasNextPage: hasNext,\n endCursor: hasNext ? 'cursor123' : null,\n})\n\nconst createProductList = (id: string, name: string, products: any[] = []) => ({\n id,\n publicId: `public-${id}`,\n name,\n products,\n})\n\n// Helper type to extract the data type from a ShopAction\ntype ShopActionDataType<T> = T extends (\n ...args: any[]\n) => Promise<{ok: true; data: infer R} | {ok: false; error: any}>\n ? R\n : never\n\n// Use window._mockLogs instead of console.log so logs aren't stripped in production builds\n// This allows e2e tests to verify mock actions are being called\nexport interface MockLog {\n action: string\n params?: unknown\n}\n\ndeclare global {\n interface Window {\n _mockLogs?: MockLog[]\n }\n}\n\nfunction logMockAction(action: string, params?: unknown) {\n window._mockLogs = window._mockLogs || []\n window._mockLogs.push({action, params})\n}\n\nfunction makeMockMethod<K extends keyof ShopActions>(\n key: K,\n result: ShopActionDataType<ShopActions[K]>\n): ShopActions[K] {\n return ((params: Parameters<ShopActions[K]>[0]) => {\n logMockAction(String(key), params)\n return Promise.resolve({\n ok: true as const,\n data: result,\n mocked: true,\n })\n }) as ShopActions[K]\n}\n\nexport function makeMockActions(): ShopActions {\n const results: {\n [K in keyof ShopActions]: ShopActionDataType<ShopActions[K]>\n } = {\n translateContentUp: undefined,\n translateContentDown: undefined,\n followShop: true,\n unfollowShop: false,\n favorite: undefined,\n unfavorite: undefined,\n getShopAppInformation: {\n appVersion: '1.0.0',\n buildNumber: '12345',\n buildId: 'dev-build-123',\n },\n productRecommendationImpression: undefined,\n productRecommendationClick: undefined,\n closeMini: undefined,\n getAccountInformation: {\n status: 'available',\n value: 'user@example.com',\n },\n getCurrentUser: {\n data: {\n displayName: 'John Doe',\n avatarImage: {url: 'https://example.com/avatar.jpg'},\n },\n },\n createOrderAttribution: undefined,\n addToCart: undefined,\n buyProduct: undefined,\n buyProducts: undefined,\n showErrorScreen: undefined,\n showErrorToast: undefined,\n getDeeplinkPaths: {\n matchers: ['/products', '/collections', '/cart'],\n },\n navigateToDeeplink: undefined,\n navigateToShop: undefined,\n navigateToProduct: undefined,\n navigateToOrder: undefined,\n navigateToCheckout: undefined,\n createImageUploadLink: {\n // This action is mocked in the actual hook. See `useImageUpload` for more details.\n targets: [\n {\n url: 'https://example.com/upload',\n resourceUrl: 'https://example.com/resource',\n parameters: [{name: 'key', value: 'upload-123'}],\n },\n ],\n },\n completeImageUpload: {\n files: [\n {\n id: 'file-123',\n fileStatus: 'READY',\n image: {\n url: 'https://example.com/image.jpg',\n },\n },\n ],\n },\n getPersistedItem: null,\n setPersistedItem: undefined,\n removePersistedItem: undefined,\n getAllPersistedKeys: ['key1', 'key2', 'key3'],\n clearPersistedItems: undefined,\n getInternalPersistedItem: null,\n setInternalPersistedItem: undefined,\n removeInternalPersistedItem: undefined,\n getAllInternalPersistedKeys: ['internal-key1', 'internal-key2'],\n clearInternalPersistedItems: undefined,\n getSecret: 'secret-value',\n setSecret: undefined,\n removeSecret: undefined,\n reportInteraction: undefined,\n reportImpression: undefined,\n reportContentImpression: undefined,\n getProductLists: {\n data: [\n createProductList('list-1', 'Wishlist'),\n createProductList('list-2', 'Favorites'),\n ],\n pageInfo: createPagination(),\n },\n getProductList: {\n data: createProductList('list-1', 'Wishlist', [\n createProduct('prod-1', 'Sample Product'),\n ]),\n pageInfo: createPagination(),\n },\n addProductList: createProductList('list-3', 'New List'),\n removeProductList: undefined,\n renameProductList: createProductList('list-1', 'Updated Wishlist'),\n addProductListItem: undefined,\n removeProductListItem: undefined,\n getRecommendedProducts: {\n data: [\n createProduct('rec-1', 'Recommended Product 1', '79.99'),\n createProduct('rec-2', 'Recommended Product 2', '129.99'),\n createProduct('rec-3', 'Recommended Product 3', '129.99'),\n createProduct('rec-4', 'Recommended Product 4', '29.99'),\n createProduct('rec-5', 'Recommended Product 5', '39.99'),\n createProduct('rec-6', 'Recommended Product 6', '49.99'),\n createProduct('rec-7', 'Recommended Product 7', '59.99'),\n createProduct('rec-8', 'Recommended Product 8', '69.99'),\n createProduct('rec-9', 'Recommended Product 9', '129.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecommendedShops: {\n data: [\n createShop('shop-1', 'Amazing Store'),\n createShop('shop-2', 'Best Deals Shop'),\n createShop('shop-3', 'Great Products'),\n createShop('shop-4', 'Top Brands'),\n createShop('shop-5', 'Exclusive Offers'),\n ],\n pageInfo: createPagination(),\n },\n searchProductsByShop: {\n data: [\n createProduct('search-1', 'Search Result 1', '59.99'),\n createProduct('search-2', 'Search Result 2', '89.99'),\n createProduct('search-3', 'Search Result 3', '119.99'),\n createProduct('search-4', 'Search Result 4', '149.99'),\n createProduct('search-5', 'Search Result 5', '179.99'),\n ],\n pageInfo: createPagination(),\n },\n getOrders: {\n data: [\n {\n id: 'order-1',\n name: '#1001',\n lineItems: [\n {\n productTitle: 'Sample Product',\n variantTitle: 'Medium',\n quantity: 2,\n product: null,\n },\n ],\n shop: createShop('shop-1', 'Sample Shop'),\n },\n ],\n pageInfo: createPagination(),\n },\n getBuyerAttributes: {\n data: {\n genderAffinity: 'NEUTRAL' as Gender,\n categoryAffinities: [\n {id: 'cat1', name: 'Electronics'},\n {id: 'cat2', name: 'Clothing'},\n ],\n },\n },\n showFeedbackSheet: undefined,\n getPopularProducts: {\n data: [\n createProduct('pop-1', 'The Hero Snowboard', '702.95'),\n createProduct('pop-2', 'Snow Jacket', '605.95', '702.00'),\n createProduct('pop-3', 'Winter Gloves', '89.95'),\n createProduct('pop-4', 'Summer Gloves', '89.95'),\n createProduct('pop-5', 'Spring Gloves', '89.95'),\n createProduct('pop-6', 'Playstation 5', '499.95'),\n createProduct('pop-7', 'Xbox Series X', '499.95'),\n createProduct('pop-8', 'Nintendo Switch', '299.95'),\n createProduct('pop-9', 'Playstation 4', '299.95'),\n createProduct('pop-10', 'Nintendo 3DS', '89.95'),\n ],\n pageInfo: createPagination(),\n },\n share: {\n message: 'Shared!',\n success: true,\n },\n shareSingle: {\n message: 'Shared!',\n success: true,\n },\n getCuratedProducts: {\n data: [\n createProduct('cur-1', 'Curated Product 1', '79.99'),\n createProduct('cur-2', 'Curated Product 2', '129.99'),\n ],\n pageInfo: createPagination(),\n },\n getSavedProducts: {\n data: [\n createProduct('saved-1', 'Saved Product 1', '49.99'),\n createProduct('saved-2', 'Saved Product 2', '59.99'),\n createProduct('saved-3', 'Saved Product 3', '69.99'),\n createProduct('saved-4', 'Saved Product 4', '79.99'),\n createProduct('saved-5', 'Saved Product 5', '89.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecentProducts: {\n data: [\n createProduct('recent-1', 'Recent Product 1', '59.99'),\n createProduct('recent-2', 'Recent Product 2', '69.99'),\n createProduct('recent-3', 'Recent Product 3', '79.99'),\n createProduct('recent-4', 'Recent Product 4', '89.99'),\n createProduct('recent-5', 'Recent Product 5', '99.99'),\n ],\n pageInfo: createPagination(),\n },\n getProductSearch: {\n data: [\n createProduct('search-1', 'Search Product 1', '39.99'),\n createProduct('search-2', 'Search Product 2', '19.99'),\n createProduct('search-3', 'Search Product 3', '29.99'),\n createProduct('search-4', 'Search Product 4', '49.99'),\n createProduct('search-5', 'Search Product 5', '9.99'),\n ],\n pageInfo: createPagination(),\n },\n getProducts: {\n data: [\n createProduct('prod-1', 'Product 1', '9.99'),\n createProduct('prod-2', 'Product 2', '19.99'),\n createProduct('prod-3', 'Product 3', '29.99'),\n createProduct('prod-4', 'Product 4', '39.99'),\n createProduct('prod-5', 'Product 5', '49.99'),\n ],\n },\n getProduct: {data: createProduct('prod-1', 'Sample Product')},\n getProductVariants: {\n data: [\n {\n id: 'variant-1',\n title: 'Variant 1',\n isFavorited: false,\n image: {url: 'https://example.com/variant-1.jpg'},\n price: {amount: '19.99', currencyCode: 'USD'},\n compareAtPrice: {amount: '29.99', currencyCode: 'USD'},\n },\n ],\n pageInfo: createPagination(),\n },\n getProductMedia: {\n data: [\n {\n id: 'media-1',\n image: {url: 'https://example.com/media-1.jpg'},\n mediaContentType: 'IMAGE',\n alt: 'Sample product image',\n },\n ],\n pageInfo: createPagination(),\n },\n getShop: {\n data: createShop('shop-1', 'Sample Shop', {featuredImagesLimit: 4}),\n },\n getRecentShops: {\n data: [\n createShop('recent-shop-1', 'Recent Shop 1'),\n createShop('recent-shop-2', 'Recent Shop 2'),\n createShop('recent-shop-3', 'Recent Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n getFollowedShops: {\n data: [\n createShop('followed-shop-1', 'Followed Shop 1'),\n createShop('followed-shop-2', 'Followed Shop 2'),\n createShop('followed-shop-3', 'Followed Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n previewProductInAr: undefined,\n createContent: {\n data: {\n publicId: 'content-123',\n externalId: null,\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n description: 'This is a mock content item',\n visibility: ['DISCOVERABLE'],\n shareableUrl: 'https://example.com/content/123',\n products: null,\n },\n },\n getContent: {\n data: [\n {\n publicId: 'content-123',\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n visibility: ['DISCOVERABLE'],\n status: MinisContentStatus.READY,\n },\n ],\n },\n generateUserToken: {\n data: {\n token: 'user-token-123',\n expiresAt: '2025-01-01',\n userState: UserState.VERIFIED,\n },\n },\n navigateToCart: undefined,\n requestPermission: {\n granted: true,\n },\n reportError: undefined,\n reportFetch: undefined,\n } as const\n\n const mock: Partial<ShopActions> = {}\n for (const key in results) {\n if (Object.prototype.hasOwnProperty.call(results, key)) {\n // @ts-expect-error: dynamic assignment is safe due to exhaustive mapping\n mock[key] = makeMockMethod(\n key as keyof ShopActions,\n results[key as keyof typeof results]\n )\n }\n }\n return mock as ShopActions\n}\n\n// Detect if running on a mobile device\nconst isMobile = (): boolean => {\n const userAgent = navigator.userAgent.toLowerCase()\n const isIOS = /iphone|ipad|ipod/.test(userAgent)\n const isAndroid = /android/.test(userAgent)\n\n return isIOS || isAndroid\n}\n\nexport const injectMocks = ({force}: {force?: boolean} = {}) => {\n // Only inject mocks if we aren't on a mobile device or we force it\n if (isMobile() && !force) {\n return\n }\n\n if (!window.minisSDK) {\n window.minisSDK = makeMockActions()\n window.minisParams = {\n handle: 'mock-handle',\n initialUrl: '/',\n platform: 'web',\n }\n }\n}\n"],"names":["SAMPLE_IMAGE_NAMES","hashString","str","hash","i","createProduct","id","title","price","compareAtPrice","imageIndex","imageName","createShop","name","options","themeType","shouldHaveBrandSettings","featuredImagesCount","featuredImages","_","getThemeColors","createHeaderTheme","createPagination","hasNext","createProductList","products","logMockAction","action","params","makeMockMethod","key","result","makeMockActions","results","MinisContentStatus","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks","force"],"mappings":";;AAQA,MAAMA,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGMC,IAAa,CAACC,MAAwB;AAC1C,MAAIC,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIF,EAAI,QAAQE;AAC9B,IAAAD,KAAQA,KAAQ,KAAKA,IAAOD,EAAI,WAAWE,CAAC,GACpCD,KAAA;AAEH,SAAA,KAAK,IAAIA,CAAI;AACtB,GAGaE,IAAgB,CAC3BC,GACAC,GACAC,IAAQ,SACRC,MACY;AACZ,QAAMC,IAAaT,EAAWK,CAAE,IAAIN,EAAmB,QACjDW,IAAYX,EAAmBU,CAAU;AAExC,SAAA;AAAA,IACL,IAAAJ;AAAA,IACA,OAAAC;AAAA,IACA,OAAO,EAAC,QAAQC,GAAO,cAAc,MAAK;AAAA,IAC1C,GAAIC,KAAkB;AAAA,MACpB,gBAAgB,EAAC,QAAQA,GAAgB,cAAc,MAAK;AAAA,IAC9D;AAAA,IACA,iBAAiB,EAAC,eAAe,KAAK,aAAa,GAAE;AAAA,IACrD,MAAMG,EAAW,SAAS,WAAW;AAAA,IACrC,kBAAkB,WAAWN,CAAE;AAAA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C,EAAU;AAAA,MAAA;AAAA,IAEzB;AAAA,IACA,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,MACjB,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,EACf,GAEMC,IAA6B,CAAC;AACpC,aAAWN,KAAOG;AAChB,IAAI,OAAO,UAAU,eAAe,KAAKA,GAASH,CAAG,MAEnDM,EAAKN,CAAG,IAAID;AAAA,MACVC;AAAA,MACAG,EAAQH,CAA2B;AAAA,IACrC;AAGG,SAAAM;AACT;AAGA,MAAMC,IAAW,MAAe;AACxB,QAAAC,IAAY,UAAU,UAAU,YAAY,GAC5CC,IAAQ,mBAAmB,KAAKD,CAAS,GACzCE,IAAY,UAAU,KAAKF,CAAS;AAE1C,SAAOC,KAASC;AAClB,GAEaC,IAAc,CAAC,EAAC,OAAAC,EAAK,IAAuB,OAAO;AAE1D,EAAAL,EAAA,KAAc,CAACK,KAId,OAAO,aACV,OAAO,WAAWV,EAAgB,GAClC,OAAO,cAAc;AAAA,IACnB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAEJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../../../../_virtual/
|
|
1
|
+
import { __module as r } from "../../../../../../../_virtual/index11.js";
|
|
2
2
|
import { __require as o } from "../cjs/use-sync-external-store-shim.production.js";
|
|
3
3
|
import { __require as i } from "../cjs/use-sync-external-store-shim.development.js";
|
|
4
4
|
var e;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/shop-minis-react",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "0.0.0-snapshot.
|
|
4
|
+
"version": "0.0.0-snapshot.20260112135741",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": ">=5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@shopify/shop-minis-platform": "0.0.0-snapshot.
|
|
49
|
+
"@shopify/shop-minis-platform": "0.0.0-snapshot.20260112135741",
|
|
50
50
|
"@tailwindcss/vite": "4.1.8",
|
|
51
51
|
"@tanstack/react-query": "5.86.0",
|
|
52
52
|
"@types/color": "3.0.6",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {BrowserRouter, BrowserRouterProps} from 'react-router'
|
|
2
2
|
|
|
3
|
-
import {NavigationManager} from '../../internal/navigation-manager'
|
|
4
|
-
|
|
5
3
|
import {TransitionContainer} from './transition-container'
|
|
6
4
|
|
|
7
5
|
export interface MinisRouterProps extends BrowserRouterProps {
|
|
@@ -16,16 +14,10 @@ export function MinisRouter({
|
|
|
16
14
|
if (viewTransitions) {
|
|
17
15
|
return (
|
|
18
16
|
<BrowserRouter {...props}>
|
|
19
|
-
<NavigationManager />
|
|
20
17
|
<TransitionContainer>{children}</TransitionContainer>
|
|
21
18
|
</BrowserRouter>
|
|
22
19
|
)
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
return
|
|
26
|
-
<BrowserRouter {...props}>
|
|
27
|
-
<NavigationManager />
|
|
28
|
-
{children}
|
|
29
|
-
</BrowserRouter>
|
|
30
|
-
)
|
|
22
|
+
return <BrowserRouter {...props}>{children}</BrowserRouter>
|
|
31
23
|
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -290,29 +290,15 @@ describe('useNavigateWithTransition', () => {
|
|
|
290
290
|
})
|
|
291
291
|
})
|
|
292
292
|
|
|
293
|
-
it('handles navigation to root path
|
|
294
|
-
// Mock history state with idx
|
|
295
|
-
const originalHistoryState = window.history.state
|
|
296
|
-
Object.defineProperty(window.history, 'state', {
|
|
297
|
-
value: {idx: 3},
|
|
298
|
-
writable: true,
|
|
299
|
-
configurable: true,
|
|
300
|
-
})
|
|
301
|
-
|
|
293
|
+
it('handles navigation to root path', async () => {
|
|
302
294
|
const {result} = renderHook(() => useNavigateWithTransition())
|
|
303
295
|
|
|
304
296
|
await act(async () => {
|
|
305
297
|
result.current('/')
|
|
306
298
|
})
|
|
307
299
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
// Restore original state
|
|
312
|
-
Object.defineProperty(window.history, 'state', {
|
|
313
|
-
value: originalHistoryState,
|
|
314
|
-
writable: true,
|
|
315
|
-
configurable: true,
|
|
300
|
+
expect(mockNavigate).toHaveBeenCalledWith('/', {
|
|
301
|
+
replace: false,
|
|
316
302
|
})
|
|
317
303
|
})
|
|
318
304
|
|
|
@@ -38,19 +38,14 @@ export function useNavigateWithTransition(): UseNavigateWithTransitionReturns {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const isSameRoute = to === location.pathname
|
|
41
|
-
const isNavigatingToHomeRoute = to === '/'
|
|
42
41
|
|
|
43
42
|
// Path navigation - with options
|
|
44
43
|
if (document.startViewTransition) {
|
|
45
44
|
const transition = document.startViewTransition(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
replace: isSameRoute,
|
|
51
|
-
...options,
|
|
52
|
-
})
|
|
53
|
-
}
|
|
45
|
+
navigate(to, {
|
|
46
|
+
replace: isSameRoute,
|
|
47
|
+
...options,
|
|
48
|
+
})
|
|
54
49
|
|
|
55
50
|
if (options?.preventScrollReset !== true) {
|
|
56
51
|
window.scrollTo(0, 0)
|
package/src/mocks.ts
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useRef as i, useEffect as o } from "react";
|
|
2
|
-
function s(n) {
|
|
3
|
-
const e = i(n);
|
|
4
|
-
e.current = n, o(() => {
|
|
5
|
-
const t = window.minisEvents.on("NAVIGATE_BACK", () => {
|
|
6
|
-
e.current();
|
|
7
|
-
});
|
|
8
|
-
return () => window.minisEvents.off(t);
|
|
9
|
-
}, []);
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
s as useOnNavigateBack
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=useOnNavigateBack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnNavigateBack.js","sources":["../../../src/hooks/events/useOnNavigateBack.ts"],"sourcesContent":["import {useEffect, useRef} from 'react'\n\nexport function useOnNavigateBack(callback: () => void) {\n // Using a ref allows the callback to be updated without triggering a re-render\n // This makes the hook nicer to use because developers don't need useCallback\n const callbackRef = useRef(callback)\n callbackRef.current = callback\n\n useEffect(() => {\n const listenerId = window.minisEvents.on('NAVIGATE_BACK', () => {\n callbackRef.current()\n })\n\n return () => window.minisEvents.off(listenerId)\n }, [])\n}\n"],"names":["useOnNavigateBack","callback","callbackRef","useRef","useEffect","listenerId"],"mappings":";AAEO,SAASA,EAAkBC,GAAsB;AAGhD,QAAAC,IAAcC,EAAOF,CAAQ;AACnC,EAAAC,EAAY,UAAUD,GAEtBG,EAAU,MAAM;AACd,UAAMC,IAAa,OAAO,YAAY,GAAG,iBAAiB,MAAM;AAC9D,MAAAH,EAAY,QAAQ;AAAA,IAAA,CACrB;AAED,WAAO,MAAM,OAAO,YAAY,IAAIG,CAAU;AAAA,EAChD,GAAG,EAAE;AACP;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useOnNavigateBack as t } from "../hooks/events/useOnNavigateBack.js";
|
|
2
|
-
import { useNavigateWithTransition as i } from "../hooks/navigation/useNavigateWithTransition.js";
|
|
3
|
-
function r() {
|
|
4
|
-
const a = i();
|
|
5
|
-
return t(() => {
|
|
6
|
-
a(-1);
|
|
7
|
-
}), null;
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
r as NavigationManager
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=navigation-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-manager.js","sources":["../../src/internal/navigation-manager.tsx"],"sourcesContent":["import {useOnNavigateBack} from '../hooks/events/useOnNavigateBack'\nimport {useNavigateWithTransition} from '../hooks/navigation/useNavigateWithTransition'\n\nexport function NavigationManager() {\n const navigate = useNavigateWithTransition()\n\n // Handle native back button press\n useOnNavigateBack(() => {\n navigate(-1)\n })\n\n return null\n}\n"],"names":["NavigationManager","navigate","useNavigateWithTransition","useOnNavigateBack"],"mappings":";;AAGO,SAASA,IAAoB;AAClC,QAAMC,IAAWC,EAA0B;AAG3C,SAAAC,EAAkB,MAAM;AACtB,IAAAF,EAAS,EAAE;AAAA,EAAA,CACZ,GAEM;AACT;"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {useEffect, useRef} from 'react'
|
|
2
|
-
|
|
3
|
-
export function useOnNavigateBack(callback: () => void) {
|
|
4
|
-
// Using a ref allows the callback to be updated without triggering a re-render
|
|
5
|
-
// This makes the hook nicer to use because developers don't need useCallback
|
|
6
|
-
const callbackRef = useRef(callback)
|
|
7
|
-
callbackRef.current = callback
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const listenerId = window.minisEvents.on('NAVIGATE_BACK', () => {
|
|
11
|
-
callbackRef.current()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
return () => window.minisEvents.off(listenerId)
|
|
15
|
-
}, [])
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {useOnNavigateBack} from '../hooks/events/useOnNavigateBack'
|
|
2
|
-
import {useNavigateWithTransition} from '../hooks/navigation/useNavigateWithTransition'
|
|
3
|
-
|
|
4
|
-
export function NavigationManager() {
|
|
5
|
-
const navigate = useNavigateWithTransition()
|
|
6
|
-
|
|
7
|
-
// Handle native back button press
|
|
8
|
-
useOnNavigateBack(() => {
|
|
9
|
-
navigate(-1)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
return null
|
|
13
|
-
}
|