@shopify/shop-minis-react 0.4.6 → 0.4.8
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/index4.js +2 -2
- 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/index.js +146 -143
- package/dist/index.js.map +1 -1
- package/dist/mocks.js +3 -4
- package/dist/mocks.js.map +1 -1
- package/dist/shop-minis-platform/src/constants.js +6 -0
- package/dist/shop-minis-platform/src/constants.js.map +1 -0
- 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/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/eslint/config.cjs +2 -1
- package/eslint/rules/no-secrets.cjs +111 -5
- package/package.json +8 -3
- package/src/mocks.ts +0 -1
- package/stylelint/config.mjs +41 -0
- package/stylelint/index.mjs +11 -0
- package/stylelint/plugin-no-font-imports.mjs +60 -0
package/dist/_virtual/index4.js
CHANGED
package/dist/_virtual/index5.js
CHANGED
|
@@ -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/index.js
CHANGED
|
@@ -2,19 +2,19 @@ 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 c, ProductCardImage as d, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardReviewStars as
|
|
6
|
-
import { ProductLink as
|
|
7
|
-
import { MerchantCard as I, MerchantCardContainer as
|
|
8
|
-
import { ProductCardSkeleton as
|
|
9
|
-
import { MerchantCardSkeleton as
|
|
10
|
-
import { QuantitySelector as
|
|
11
|
-
import { Search as
|
|
12
|
-
import { FavoriteButton as
|
|
5
|
+
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as c, ProductCardImage as d, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardReviewStars as A, ProductCardTitle as D } from "./components/commerce/product-card.js";
|
|
6
|
+
import { ProductLink as T } from "./components/commerce/product-link.js";
|
|
7
|
+
import { MerchantCard as I, MerchantCardContainer as E, MerchantCardHeader as R, MerchantCardInfo as w, MerchantCardName as F, MerchantCardRating as M } from "./components/commerce/merchant-card.js";
|
|
8
|
+
import { ProductCardSkeleton as B } from "./components/commerce/product-card-skeleton.js";
|
|
9
|
+
import { MerchantCardSkeleton as L } from "./components/commerce/merchant-card-skeleton.js";
|
|
10
|
+
import { QuantitySelector as b } from "./components/commerce/quantity-selector.js";
|
|
11
|
+
import { Search as _, SearchInput as G, SearchProvider as O, SearchResultsList as y } from "./components/commerce/search.js";
|
|
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";
|
|
15
15
|
import { TransitionLink as Q } from "./components/navigation/transition-link.js";
|
|
16
|
-
import { Button as
|
|
17
|
-
import { IconButton as
|
|
16
|
+
import { Button as j } from "./components/atoms/button.js";
|
|
17
|
+
import { IconButton as X } from "./components/atoms/icon-button.js";
|
|
18
18
|
import { Image as rr } from "./components/atoms/image.js";
|
|
19
19
|
import { Touchable as or } from "./components/atoms/touchable.js";
|
|
20
20
|
import { LongPressDetector as ar } from "./components/atoms/long-press-detector.js";
|
|
@@ -24,44 +24,44 @@ import { VideoPlayer as lr } from "./components/atoms/video-player.js";
|
|
|
24
24
|
import { TextInput as fr } from "./components/atoms/text-input.js";
|
|
25
25
|
import { ContentWrapper as cr } from "./components/atoms/content-wrapper.js";
|
|
26
26
|
import { ProductVariantPrice as Cr } from "./components/atoms/product-variant-price.js";
|
|
27
|
-
import { Accordion as Sr, AccordionContent as
|
|
28
|
-
import { Alert as
|
|
29
|
-
import { AlertDialog as
|
|
30
|
-
import { Avatar as
|
|
31
|
-
import { Badge as
|
|
32
|
-
import { Card as qr, CardAction as Kr, CardContent as Qr, CardDescription as
|
|
27
|
+
import { Accordion as Sr, AccordionContent as Ar, AccordionItem as Dr, AccordionTrigger as Pr } from "./components/ui/accordion.js";
|
|
28
|
+
import { Alert as hr, AlertDescription as Ir, AlertTitle as Er } from "./components/ui/alert.js";
|
|
29
|
+
import { AlertDialog as wr, AlertDialogAction as Fr, AlertDialogCancel as Mr, AlertDialogContent as vr, AlertDialogDescription as Br, AlertDialogFooter as Ur, AlertDialogHeader as Lr, AlertDialogOverlay as Nr, AlertDialogPortal as br, AlertDialogTitle as kr, AlertDialogTrigger as _r } from "./components/ui/alert-dialog.js";
|
|
30
|
+
import { Avatar as Or, AvatarFallback as yr, AvatarImage as Hr } from "./components/ui/avatar.js";
|
|
31
|
+
import { Badge as zr, badgeVariants as Wr } from "./components/ui/badge.js";
|
|
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
35
|
import { Dialog as me, DialogClose as se, DialogContent as le, DialogDescription as ue, DialogFooter as fe, DialogHeader as xe, DialogOverlay as ce, DialogPortal as de, DialogTitle as Ce, DialogTrigger as ge } from "./components/ui/dialog.js";
|
|
36
|
-
import { Drawer as
|
|
37
|
-
import { Input as
|
|
38
|
-
import { Label as
|
|
39
|
-
import { Progress as
|
|
40
|
-
import { RadioGroup as
|
|
41
|
-
import { ResizableHandle as
|
|
42
|
-
import { ScrollArea as
|
|
43
|
-
import { Select as qe, SelectContent as Ke, SelectGroup as Qe, SelectItem as
|
|
36
|
+
import { Drawer as Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Ee, DrawerPortal as Re, DrawerTitle as we, DrawerTrigger as Fe } from "./components/ui/drawer.js";
|
|
37
|
+
import { Input as ve } from "./components/ui/input.js";
|
|
38
|
+
import { Label as Ue } from "./components/ui/label.js";
|
|
39
|
+
import { Progress as Ne } from "./components/ui/progress.js";
|
|
40
|
+
import { RadioGroup as ke, RadioGroupItem as _e } from "./components/ui/radio-group.js";
|
|
41
|
+
import { ResizableHandle as Oe, ResizablePanel as ye, ResizablePanelGroup as He } from "./components/ui/resizable.js";
|
|
42
|
+
import { ScrollArea as ze, ScrollBar as We } from "./components/ui/scroll-area.js";
|
|
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";
|
|
45
45
|
import { Sheet as io, SheetClose as po, SheetContent as no, SheetDescription as mo, SheetFooter as so, SheetHeader as lo, SheetTitle as uo, SheetTrigger as fo } from "./components/ui/sheet.js";
|
|
46
46
|
import { Toaster as co } from "./components/ui/sonner.js";
|
|
47
47
|
import { toast as go } from "./shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js";
|
|
48
|
-
import { Skeleton as
|
|
49
|
-
import { useRecentProducts as
|
|
50
|
-
import { useRecentShops as
|
|
51
|
-
import { useSavedProducts as
|
|
52
|
-
import { useSavedProductsActions as
|
|
53
|
-
import { useFollowedShops as
|
|
54
|
-
import { useFollowedShopsActions as
|
|
55
|
-
import { useCurrentUser as
|
|
56
|
-
import { useOrders as
|
|
57
|
-
import { useBuyerAttributes as
|
|
58
|
-
import { useGenerateUserToken as
|
|
48
|
+
import { Skeleton as Ao } from "./components/ui/skeleton.js";
|
|
49
|
+
import { useRecentProducts as Po } from "./hooks/user/useRecentProducts.js";
|
|
50
|
+
import { useRecentShops as ho } from "./hooks/user/useRecentShops.js";
|
|
51
|
+
import { useSavedProducts as Eo } from "./hooks/user/useSavedProducts.js";
|
|
52
|
+
import { useSavedProductsActions as wo } from "./hooks/user/useSavedProductsActions.js";
|
|
53
|
+
import { useFollowedShops as Mo } from "./hooks/user/useFollowedShops.js";
|
|
54
|
+
import { useFollowedShopsActions as Bo } from "./hooks/user/useFollowedShopsActions.js";
|
|
55
|
+
import { useCurrentUser as Lo } from "./hooks/user/useCurrentUser.js";
|
|
56
|
+
import { useOrders as bo } from "./hooks/user/useOrders.js";
|
|
57
|
+
import { useBuyerAttributes as _o } from "./hooks/user/useBuyerAttributes.js";
|
|
58
|
+
import { useGenerateUserToken as Oo } from "./hooks/user/useGenerateUserToken.js";
|
|
59
59
|
import { useProductListActions as Ho } from "./hooks/product/useProductListActions.js";
|
|
60
|
-
import { useProductLists as
|
|
60
|
+
import { useProductLists as zo } from "./hooks/product/useProductLists.js";
|
|
61
61
|
import { useProductList as Yo } from "./hooks/product/useProductList.js";
|
|
62
62
|
import { useProduct as Ko } from "./hooks/product/useProduct.js";
|
|
63
|
-
import { useProducts as
|
|
64
|
-
import { useProductVariants as
|
|
63
|
+
import { useProducts as Zo } from "./hooks/product/useProducts.js";
|
|
64
|
+
import { useProductVariants as Jo } from "./hooks/product/useProductVariants.js";
|
|
65
65
|
import { useProductMedia as $o } from "./hooks/product/useProductMedia.js";
|
|
66
66
|
import { useProductSearch as et } from "./hooks/product/useProductSearch.js";
|
|
67
67
|
import { useRecommendedProducts as tt } from "./hooks/product/useRecommendedProducts.js";
|
|
@@ -72,62 +72,63 @@ import { useSecureStorage as ut } from "./hooks/storage/useSecureStorage.js";
|
|
|
72
72
|
import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
|
|
73
73
|
import { useShopNavigation as dt } from "./hooks/navigation/useShopNavigation.js";
|
|
74
74
|
import { useCloseMini as gt } from "./hooks/navigation/useCloseMini.js";
|
|
75
|
-
import { useDeeplink as
|
|
76
|
-
import { useNavigateWithTransition as
|
|
77
|
-
import { useShop as
|
|
78
|
-
import { useRecommendedShops as
|
|
79
|
-
import { useCreateImageContent as
|
|
80
|
-
import { useErrorToast as
|
|
81
|
-
import { useErrorScreen as
|
|
82
|
-
import { useShare as
|
|
83
|
-
import { useImagePicker as
|
|
84
|
-
import { useKeyboardAvoidingView as
|
|
85
|
-
import { useRequestPermissions as
|
|
75
|
+
import { useDeeplink as At } from "./hooks/navigation/useDeeplink.js";
|
|
76
|
+
import { useNavigateWithTransition as Pt } from "./hooks/navigation/useNavigateWithTransition.js";
|
|
77
|
+
import { useShop as ht } from "./hooks/shop/useShop.js";
|
|
78
|
+
import { useRecommendedShops as Et } from "./hooks/shop/useRecommendedShops.js";
|
|
79
|
+
import { useCreateImageContent as wt } from "./hooks/content/useCreateImageContent.js";
|
|
80
|
+
import { useErrorToast as Mt } from "./hooks/util/useErrorToast.js";
|
|
81
|
+
import { useErrorScreen as Bt } from "./hooks/util/useErrorScreen.js";
|
|
82
|
+
import { useShare as Lt } from "./hooks/util/useShare.js";
|
|
83
|
+
import { useImagePicker as bt } from "./hooks/util/useImagePicker.js";
|
|
84
|
+
import { useKeyboardAvoidingView as _t } from "./hooks/util/useKeyboardAvoidingView.js";
|
|
85
|
+
import { useRequestPermissions as Ot } from "./hooks/util/useRequestPermissions.js";
|
|
86
86
|
import { useOnMiniFocus as Ht } from "./hooks/events/useOnMiniFocus.js";
|
|
87
|
-
import { useOnMiniBlur as
|
|
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 { MiniEntityNotFoundError as
|
|
90
|
+
import { MiniEntityNotFoundError as Zt, MiniError as jt, MiniNetworkError as Jt, formatError as Xt } from "./utils/errors.js";
|
|
91
91
|
import { extractBrandTheme as ra, formatReviewCount as ea, getFeaturedImages as oa, normalizeRating as ta } from "./utils/merchant-card.js";
|
|
92
92
|
import { parseUrl as ia } from "./utils/parseUrl.js";
|
|
93
93
|
import { fileToDataUri as na, getResizedImageUrl as ma, getThumbhashDataURL as sa } from "./utils/image.js";
|
|
94
94
|
import { UserState as ua, UserTokenGenerateUserErrorCode as fa } from "./shop-minis-platform/src/types/user.js";
|
|
95
95
|
import { ContentCreateUserErrorCode as ca, MinisContentStatus as da } from "./shop-minis-platform/src/types/content.js";
|
|
96
96
|
import { Social as ga } from "./shop-minis-platform/src/types/share.js";
|
|
97
|
+
import { DATA_FETCHING_DEFAULT_FETCH_POLICY as Aa, DATA_FETCHING_DEFAULT_PAGE_SIZE as Da } from "./shop-minis-platform/src/constants.js";
|
|
97
98
|
export {
|
|
98
99
|
Sr as Accordion,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
Ar as AccordionContent,
|
|
101
|
+
Dr as AccordionItem,
|
|
102
|
+
Pr as AccordionTrigger,
|
|
102
103
|
n as AddToCartButton,
|
|
103
|
-
|
|
104
|
+
hr as Alert,
|
|
104
105
|
Ir as AlertDescription,
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
wr as AlertDialog,
|
|
107
|
+
Fr as AlertDialogAction,
|
|
107
108
|
pr as AlertDialogAtom,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
Mr as AlertDialogCancel,
|
|
110
|
+
vr as AlertDialogContent,
|
|
111
|
+
Br as AlertDialogDescription,
|
|
112
|
+
Ur as AlertDialogFooter,
|
|
113
|
+
Lr as AlertDialogHeader,
|
|
114
|
+
Nr as AlertDialogOverlay,
|
|
115
|
+
br as AlertDialogPortal,
|
|
116
|
+
kr as AlertDialogTitle,
|
|
117
|
+
_r as AlertDialogTrigger,
|
|
118
|
+
Er as AlertTitle,
|
|
119
|
+
Or as Avatar,
|
|
120
|
+
yr as AvatarFallback,
|
|
120
121
|
Hr as AvatarImage,
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
zr as Badge,
|
|
123
|
+
j as Button,
|
|
123
124
|
s as BuyNowButton,
|
|
124
125
|
qr as Card,
|
|
125
126
|
Kr as CardAction,
|
|
126
127
|
Qr as CardContent,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
Zr as CardDescription,
|
|
129
|
+
jr as CardFooter,
|
|
130
|
+
Jr as CardHeader,
|
|
131
|
+
Xr as CardTitle,
|
|
131
132
|
re as Carousel,
|
|
132
133
|
ee as CarouselContent,
|
|
133
134
|
oe as CarouselItem,
|
|
@@ -136,6 +137,8 @@ export {
|
|
|
136
137
|
pe as Checkbox,
|
|
137
138
|
ca as ContentCreateUserErrorCode,
|
|
138
139
|
cr as ContentWrapper,
|
|
140
|
+
Aa as DATA_FETCHING_DEFAULT_FETCH_POLICY,
|
|
141
|
+
Da as DATA_FETCHING_DEFAULT_PAGE_SIZE,
|
|
139
142
|
o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
|
|
140
143
|
me as Dialog,
|
|
141
144
|
se as DialogClose,
|
|
@@ -147,34 +150,34 @@ export {
|
|
|
147
150
|
de as DialogPortal,
|
|
148
151
|
Ce as DialogTitle,
|
|
149
152
|
ge as DialogTrigger,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
Ae as Drawer,
|
|
154
|
+
De as DrawerClose,
|
|
155
|
+
Pe as DrawerContent,
|
|
156
|
+
Te as DrawerDescription,
|
|
157
|
+
he as DrawerFooter,
|
|
155
158
|
Ie as DrawerHeader,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
Ee as DrawerOverlay,
|
|
160
|
+
Re as DrawerPortal,
|
|
161
|
+
we as DrawerTitle,
|
|
162
|
+
Fe as DrawerTrigger,
|
|
163
|
+
V as FavoriteButton,
|
|
164
|
+
X as IconButton,
|
|
162
165
|
rr as Image,
|
|
163
166
|
W as ImageContentWrapper,
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
ve as Input,
|
|
168
|
+
Ue as Label,
|
|
166
169
|
mr as List,
|
|
167
170
|
ar as LongPressDetector,
|
|
168
171
|
I as MerchantCard,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
E as MerchantCardContainer,
|
|
173
|
+
R as MerchantCardHeader,
|
|
174
|
+
w as MerchantCardInfo,
|
|
175
|
+
F as MerchantCardName,
|
|
176
|
+
M as MerchantCardRating,
|
|
177
|
+
L as MerchantCardSkeleton,
|
|
178
|
+
Zt as MiniEntityNotFoundError,
|
|
179
|
+
jt as MiniError,
|
|
180
|
+
Jt as MiniNetworkError,
|
|
178
181
|
i as MinisContainer,
|
|
179
182
|
da as MinisContentStatus,
|
|
180
183
|
q as MinisRouter,
|
|
@@ -187,31 +190,31 @@ export {
|
|
|
187
190
|
C as ProductCardImageContainer,
|
|
188
191
|
g as ProductCardInfo,
|
|
189
192
|
S as ProductCardPrice,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
A as ProductCardReviewStars,
|
|
194
|
+
B as ProductCardSkeleton,
|
|
195
|
+
D as ProductCardTitle,
|
|
196
|
+
T as ProductLink,
|
|
194
197
|
Cr as ProductVariantPrice,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
Ne as Progress,
|
|
199
|
+
b as QuantitySelector,
|
|
200
|
+
ke as RadioGroup,
|
|
201
|
+
_e as RadioGroupItem,
|
|
202
|
+
Oe as ResizableHandle,
|
|
203
|
+
ye as ResizablePanel,
|
|
201
204
|
He as ResizablePanelGroup,
|
|
202
|
-
|
|
205
|
+
ze as ScrollArea,
|
|
203
206
|
We as ScrollBar,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
_ as Search,
|
|
208
|
+
G as SearchInput,
|
|
209
|
+
O as SearchProvider,
|
|
210
|
+
y as SearchResultsList,
|
|
208
211
|
qe as Select,
|
|
209
212
|
Ke as SelectContent,
|
|
210
213
|
Qe as SelectGroup,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
Ze as SelectItem,
|
|
215
|
+
je as SelectLabel,
|
|
216
|
+
Je as SelectScrollDownButton,
|
|
217
|
+
Xe as SelectScrollUpButton,
|
|
215
218
|
$e as SelectSeparator,
|
|
216
219
|
ro as SelectTrigger,
|
|
217
220
|
eo as SelectValue,
|
|
@@ -224,7 +227,7 @@ export {
|
|
|
224
227
|
lo as SheetHeader,
|
|
225
228
|
uo as SheetTitle,
|
|
226
229
|
fo as SheetTrigger,
|
|
227
|
-
|
|
230
|
+
Ao as Skeleton,
|
|
228
231
|
ga as Social,
|
|
229
232
|
fr as TextInput,
|
|
230
233
|
co as Toaster,
|
|
@@ -236,7 +239,7 @@ export {
|
|
|
236
239
|
Wr as badgeVariants,
|
|
237
240
|
ra as extractBrandTheme,
|
|
238
241
|
na as fileToDataUri,
|
|
239
|
-
|
|
242
|
+
Xt as formatError,
|
|
240
243
|
ea as formatReviewCount,
|
|
241
244
|
oa as getFeaturedImages,
|
|
242
245
|
ma as getResizedImageUrl,
|
|
@@ -245,45 +248,45 @@ export {
|
|
|
245
248
|
ia as parseUrl,
|
|
246
249
|
go as toast,
|
|
247
250
|
st as useAsyncStorage,
|
|
248
|
-
|
|
251
|
+
_o as useBuyerAttributes,
|
|
249
252
|
gt as useCloseMini,
|
|
250
|
-
|
|
253
|
+
wt as useCreateImageContent,
|
|
251
254
|
nt as useCuratedProducts,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
Lo as useCurrentUser,
|
|
256
|
+
At as useDeeplink,
|
|
257
|
+
Bt as useErrorScreen,
|
|
258
|
+
Mt as useErrorToast,
|
|
259
|
+
Mo as useFollowedShops,
|
|
260
|
+
Bo as useFollowedShopsActions,
|
|
261
|
+
Oo as useGenerateUserToken,
|
|
262
|
+
bt as useImagePicker,
|
|
260
263
|
xt as useImageUpload,
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
_t as useKeyboardAvoidingView,
|
|
265
|
+
Pt as useNavigateWithTransition,
|
|
263
266
|
Kt as useOnAppStateChange,
|
|
264
|
-
|
|
267
|
+
zt as useOnMiniBlur,
|
|
265
268
|
Yt as useOnMiniClose,
|
|
266
269
|
Ht as useOnMiniFocus,
|
|
267
|
-
|
|
270
|
+
bo as useOrders,
|
|
268
271
|
it as usePopularProducts,
|
|
269
272
|
Ko as useProduct,
|
|
270
273
|
Yo as useProductList,
|
|
271
274
|
Ho as useProductListActions,
|
|
272
|
-
|
|
275
|
+
zo as useProductLists,
|
|
273
276
|
$o as useProductMedia,
|
|
274
277
|
et as useProductSearch,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
Jo as useProductVariants,
|
|
279
|
+
Zo as useProducts,
|
|
280
|
+
Po as useRecentProducts,
|
|
281
|
+
ho as useRecentShops,
|
|
279
282
|
tt as useRecommendedProducts,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
Et as useRecommendedShops,
|
|
284
|
+
Ot as useRequestPermissions,
|
|
285
|
+
Eo as useSavedProducts,
|
|
286
|
+
wo as useSavedProductsActions,
|
|
284
287
|
ut as useSecureStorage,
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
Lt as useShare,
|
|
289
|
+
ht as useShop,
|
|
287
290
|
dt as useShopNavigation
|
|
288
291
|
};
|
|
289
292
|
//# 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
|
@@ -16,7 +16,7 @@ const t = (o, r, e = "99.99", i) => ({
|
|
|
16
16
|
altText: r
|
|
17
17
|
}
|
|
18
18
|
}), n = (o, r, e) => {
|
|
19
|
-
const i = e?.themeType || "none", c = e?.withBrandSettings || i !== "none", l = e?.featuredImagesLimit || 3, m = Array.from({ length: l }, (
|
|
19
|
+
const i = e?.themeType || "none", c = e?.withBrandSettings || i !== "none", l = e?.featuredImagesLimit || 3, m = Array.from({ length: l }, (P, s) => ({
|
|
20
20
|
url: `https://picsum.photos/400/400?random=${o}-${s}`,
|
|
21
21
|
sensitive: !1,
|
|
22
22
|
altText: `${r} featured image ${s + 1}`
|
|
@@ -128,7 +128,6 @@ function I() {
|
|
|
128
128
|
},
|
|
129
129
|
productRecommendationImpression: void 0,
|
|
130
130
|
productRecommendationClick: void 0,
|
|
131
|
-
hideEntryPoint: void 0,
|
|
132
131
|
closeMini: void 0,
|
|
133
132
|
getAccountInformation: {
|
|
134
133
|
status: "available",
|
|
@@ -402,11 +401,11 @@ function I() {
|
|
|
402
401
|
));
|
|
403
402
|
return r;
|
|
404
403
|
}
|
|
405
|
-
const
|
|
404
|
+
const f = () => {
|
|
406
405
|
const o = navigator.userAgent.toLowerCase(), r = /iphone|ipad|ipod/.test(o), e = /android/.test(o);
|
|
407
406
|
return r || e;
|
|
408
407
|
}, y = ({ force: o } = {}) => {
|
|
409
|
-
|
|
408
|
+
f() && !o || window.minisSDK || (window.minisSDK = I(), window.minisParams = {
|
|
410
409
|
handle: "mock-handle",
|
|
411
410
|
initialUrl: "/mock-initial-url",
|
|
412
411
|
platform: "web"
|
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\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 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/teapot.jpg`,\n altText: title,\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\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 console.log(`[Mock Action] ${String(key)}`, params)\n return Promise.resolve({ok: true as const, data: result})\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 hideEntryPoint: 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 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: {url: 'https://example.com/image.jpg'},\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 ],\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 ],\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: [createProduct('saved-1', 'Saved Product 1', '49.99')],\n pageInfo: createPagination(),\n },\n getRecentProducts: {\n data: [createProduct('recent-1', 'Recent Product 1', '59.99')],\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: {data: [createProduct('prod-2', 'Product 2', '19.99')]},\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: [createShop('recent-shop-1', 'Recent Shop 1')],\n pageInfo: createPagination(),\n },\n getFollowedShops: {\n data: [createShop('followed-shop-1', 'Followed Shop 1')],\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: '/mock-initial-url',\n platform: 'web',\n }\n }\n}\n"],"names":["createProduct","id","title","price","compareAtPrice","createShop","name","options","themeType","shouldHaveBrandSettings","featuredImagesCount","featuredImages","_","i","getThemeColors","createHeaderTheme","createPagination","hasNext","createProductList","products","makeMockMethod","key","result","params","makeMockActions","results","MinisContentStatus","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks","force"],"mappings":";;AASO,MAAMA,IAAgB,CAC3BC,GACAC,GACAC,IAAQ,SACRC,OACa;AAAA,EACb,IAAAH;AAAA,EACA,OAAAC;AAAA,EACA,OAAO,EAAC,QAAQC,GAAO,cAAc,MAAK;AAAA,EAC1C,GAAIC,KAAkB;AAAA,IACpB,gBAAgB,EAAC,QAAQA,GAAgB,cAAc,MAAK;AAAA,EAC9D;AAAA,EACA,iBAAiB,EAAC,eAAe,KAAK,aAAa,GAAE;AAAA,EACrD,MAAMC,EAAW,SAAS,WAAW;AAAA,EACrC,kBAAkB,WAAWJ,CAAE;AAAA,EAC/B,aAAa;AAAA,EACb,eAAe;AAAA,IACb,KAAK;AAAA,IACL,SAASC;AAAA,EAAA;AAEb,IAEaG,IAAa,CACxBJ,GACAK,GACAC,MAWG;AAEG,QAAAC,IAAYD,GAAS,aAAa,QAClCE,IACJF,GAAS,qBAAqBC,MAAc,QAGxCE,IAAsBH,GAAS,uBAAuB,GACtDI,IAAiB,MAAM,KAAK,EAAC,QAAQD,EAAmB,GAAG,CAACE,GAAGC,OAAO;AAAA,IAC1E,KAAK,wCAAwCZ,CAAE,IAAIY,CAAC;AAAA,IACpD,WAAW;AAAA,IACX,SAAS,GAAGP,CAAI,mBAAmBO,IAAI,CAAC;AAAA,EAAA,EACxC,GAGIC,IAAiB,MAAM;AAC3B,YAAQN,GAAW;AAAA,MACjB,KAAK;AACI,eAAA;AAAA,UACL,SAASD,GAAS;AAAA,UAClB,cAAcA,GAAS;AAAA,UACvB,aAAaA,GAAS;AAAA,UACtB,eAAeA,GAAS,sBAAsB;AAAA,QAChD;AAAA,MACF,KAAK;AACI,eAAA;AAAA,UACL,SAASA,GAAS,gBAAgB;AAAA,UAClC,cAAcA,GAAS;AAAA,UACvB,aAAaA,GAAS;AAAA,UACtB,eAAeA,GAAS;A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WV,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\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 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/teapot.jpg`,\n altText: title,\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\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 console.log(`[Mock Action] ${String(key)}`, params)\n return Promise.resolve({ok: true as const, data: result})\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 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: {url: 'https://example.com/image.jpg'},\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 ],\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 ],\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: [createProduct('saved-1', 'Saved Product 1', '49.99')],\n pageInfo: createPagination(),\n },\n getRecentProducts: {\n data: [createProduct('recent-1', 'Recent Product 1', '59.99')],\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: {data: [createProduct('prod-2', 'Product 2', '19.99')]},\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: [createShop('recent-shop-1', 'Recent Shop 1')],\n pageInfo: createPagination(),\n },\n getFollowedShops: {\n data: [createShop('followed-shop-1', 'Followed Shop 1')],\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: '/mock-initial-url',\n platform: 'web',\n }\n }\n}\n"],"names":["createProduct","id","title","price","compareAtPrice","createShop","name","options","themeType","shouldHaveBrandSettings","featuredImagesCount","featuredImages","_","i","getThemeColors","createHeaderTheme","createPagination","hasNext","createProductList","products","makeMockMethod","key","result","params","makeMockActions","results","MinisContentStatus","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks","force"],"mappings":";;AASO,MAAMA,IAAgB,CAC3BC,GACAC,GACAC,IAAQ,SACRC,OACa;AAAA,EACb,IAAAH;AAAA,EACA,OAAAC;AAAA,EACA,OAAO,EAAC,QAAQC,GAAO,cAAc,MAAK;AAAA,EAC1C,GAAIC,KAAkB;AAAA,IACpB,gBAAgB,EAAC,QAAQA,GAAgB,cAAc,MAAK;AAAA,EAC9D;AAAA,EACA,iBAAiB,EAAC,eAAe,KAAK,aAAa,GAAE;AAAA,EACrD,MAAMC,EAAW,SAAS,WAAW;AAAA,EACrC,kBAAkB,WAAWJ,CAAE;AAAA,EAC/B,aAAa;AAAA,EACb,eAAe;AAAA,IACb,KAAK;AAAA,IACL,SAASC;AAAA,EAAA;AAEb,IAEaG,IAAa,CACxBJ,GACAK,GACAC,MAWG;AAEG,QAAAC,IAAYD,GAAS,aAAa,QAClCE,IACJF,GAAS,qBAAqBC,MAAc,QAGxCE,IAAsB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AAAA,MACjB,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,EACf,GAEMC,IAA6B,CAAC;AACpC,aAAWP,KAAOI;AAChB,IAAI,OAAO,UAAU,eAAe,KAAKA,GAASJ,CAAG,MAEnDO,EAAKP,CAAG,IAAID;AAAA,MACVC;AAAA,MACAI,EAAQJ,CAA2B;AAAA,IACrC;AAGG,SAAAO;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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../shop-minis-platform/src/constants.ts"],"sourcesContent":["import {DataHookFetchPolicy} from './types'\n\nexport const DATA_FETCHING_DEFAULT_PAGE_SIZE = 20\nexport const DATA_FETCHING_DEFAULT_FETCH_POLICY: DataHookFetchPolicy =\n 'cache-first'\n"],"names":["DATA_FETCHING_DEFAULT_PAGE_SIZE","DATA_FETCHING_DEFAULT_FETCH_POLICY"],"mappings":"AAEO,MAAMA,IAAkC,IAClCC,IACX;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as q } from "../../../../../../../../_virtual/
|
|
1
|
+
import { __module as q } from "../../../../../../../../_virtual/index4.js";
|
|
2
2
|
import { __require as F } from "../../../../../global@4.4.0/node_modules/global/window.js";
|
|
3
3
|
import { __require as N } from "../../../../../@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js";
|
|
4
4
|
import { __require as J } from "../../../../../is-function@1.0.2/node_modules/is-function/index.js";
|
|
@@ -2,7 +2,7 @@ import L from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-ut
|
|
|
2
2
|
import T from "../../../../../../../_virtual/window.js";
|
|
3
3
|
import { forEachMediaGroup as Z } from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js";
|
|
4
4
|
import J from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js";
|
|
5
|
-
import { l as Q } from "../../../../../../../_virtual/
|
|
5
|
+
import { l as Q } from "../../../../../../../_virtual/index5.js";
|
|
6
6
|
/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */
|
|
7
7
|
const w = (e) => !!e && typeof e == "object", E = (...e) => e.reduce((n, t) => (typeof t != "object" || Object.keys(t).forEach((r) => {
|
|
8
8
|
Array.isArray(n[r]) && Array.isArray(t[r]) ? n[r] = n[r].concat(t[r]) : w(n[r]) && w(t[r]) ? n[r] = E(n[r], t[r]) : n[r] = t[r];
|
package/eslint/config.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const shopMinisPlugin = require('./index.cjs')
|
|
|
14
14
|
|
|
15
15
|
module.exports = {
|
|
16
16
|
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
|
|
17
|
+
ignores: ['.minis-cache/**/*', 'node_modules/**/*'],
|
|
17
18
|
languageOptions: {
|
|
18
19
|
parser: require('@typescript-eslint/parser'),
|
|
19
20
|
ecmaVersion: 'latest',
|
|
@@ -39,7 +40,7 @@ module.exports = {
|
|
|
39
40
|
// Shop Minis custom rules
|
|
40
41
|
'shop-minis/no-env-without-fallback': 'error',
|
|
41
42
|
'shop-minis/no-internal-imports': 'error',
|
|
42
|
-
'shop-minis/no-secrets': 'error',
|
|
43
|
+
'shop-minis/no-secrets': ['error'],
|
|
43
44
|
'shop-minis/prefer-sdk-components': 'warn',
|
|
44
45
|
'shop-minis/prefer-sdk-hooks': 'warn',
|
|
45
46
|
'shop-minis/validate-manifest': 'error',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/* eslint-disable import/extensions */
|
|
2
1
|
/**
|
|
3
2
|
* ESLint rule wrapper for eslint-plugin-no-secrets with custom messages
|
|
4
|
-
*
|
|
3
|
+
* and URL-aware delimiter handling
|
|
5
4
|
*/
|
|
6
5
|
|
|
7
6
|
const noSecretsPlugin = require('eslint-plugin-no-secrets')
|
|
@@ -9,6 +8,77 @@ const noSecretsPlugin = require('eslint-plugin-no-secrets')
|
|
|
9
8
|
// Get the original rule
|
|
10
9
|
const originalRule = noSecretsPlugin.rules['no-secrets']
|
|
11
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Create a context-like object that overrides options while delegating
|
|
13
|
+
* all other property access to the original context
|
|
14
|
+
*/
|
|
15
|
+
function createContextWithOptions(context, newOptions) {
|
|
16
|
+
const wrapper = Object.create(context)
|
|
17
|
+
Object.defineProperty(wrapper, 'options', {
|
|
18
|
+
value: newOptions,
|
|
19
|
+
writable: false,
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
})
|
|
23
|
+
return wrapper
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const sharedIgnoreList = [
|
|
27
|
+
'^data:', // Data URLs (base64 images, fonts, etc.)
|
|
28
|
+
'^gid://', // Shopify GraphQL IDs
|
|
29
|
+
'gid%3A%2F%2F', // Shopify GraphQL IDs (URL encoded)
|
|
30
|
+
'^blob:', // Blob URLs from URL.createObjectURL()
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const urlIgnoreList = [
|
|
34
|
+
// Video platforms
|
|
35
|
+
'youtube\\.com',
|
|
36
|
+
'youtu\\.be',
|
|
37
|
+
'vimeo\\.com',
|
|
38
|
+
'player\\.vimeo\\.com',
|
|
39
|
+
'tiktok\\.com',
|
|
40
|
+
'twitch\\.tv',
|
|
41
|
+
'dailymotion\\.com',
|
|
42
|
+
'wistia\\.com',
|
|
43
|
+
|
|
44
|
+
// Image CDNs
|
|
45
|
+
'imagedelivery\\.net',
|
|
46
|
+
'cloudinary\\.com',
|
|
47
|
+
'res\\.cloudinary\\.com',
|
|
48
|
+
'imgix\\.net',
|
|
49
|
+
'unsplash\\.com',
|
|
50
|
+
'images\\.unsplash\\.com',
|
|
51
|
+
'pexels\\.com',
|
|
52
|
+
'images\\.pexels\\.com',
|
|
53
|
+
|
|
54
|
+
// Placeholder services
|
|
55
|
+
'placehold\\.co',
|
|
56
|
+
'placeholder\\.com',
|
|
57
|
+
'via\\.placeholder\\.com',
|
|
58
|
+
'placekitten\\.com',
|
|
59
|
+
'picsum\\.photos',
|
|
60
|
+
'loremflickr\\.com',
|
|
61
|
+
'dummyimage\\.com',
|
|
62
|
+
|
|
63
|
+
// Cloud storage
|
|
64
|
+
'storage\\.googleapis\\.com',
|
|
65
|
+
'commondatastorage\\.googleapis\\.com',
|
|
66
|
+
's3\\.amazonaws\\.com',
|
|
67
|
+
's3\\.[a-z0-9-]+\\.amazonaws\\.com',
|
|
68
|
+
'blob\\.core\\.windows\\.net',
|
|
69
|
+
|
|
70
|
+
// E-commerce CDNs
|
|
71
|
+
'cdn\\.shopify\\.com',
|
|
72
|
+
'shopifycdn\\.com',
|
|
73
|
+
|
|
74
|
+
// Social media embeds
|
|
75
|
+
'instagram\\.com',
|
|
76
|
+
'twitter\\.com',
|
|
77
|
+
'x\\.com',
|
|
78
|
+
'facebook\\.com',
|
|
79
|
+
'pinterest\\.com',
|
|
80
|
+
]
|
|
81
|
+
|
|
12
82
|
module.exports = {
|
|
13
83
|
meta: {
|
|
14
84
|
...originalRule.meta,
|
|
@@ -19,9 +89,45 @@ module.exports = {
|
|
|
19
89
|
'Potential {{ name }} detected. Hardcoded credentials should never be committed. Please check the Shop Minis documentation learn how to handle these cases. You can disable this rule if it is not a credential.',
|
|
20
90
|
},
|
|
21
91
|
},
|
|
92
|
+
|
|
22
93
|
create(context) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
94
|
+
const baseOptions = context.options[0] || {}
|
|
95
|
+
|
|
96
|
+
// Visitor for NON-URLs: shared patterns only, skip URLs
|
|
97
|
+
const nonUrlContext = createContextWithOptions(context, [
|
|
98
|
+
{
|
|
99
|
+
...baseOptions,
|
|
100
|
+
ignoreContent: [
|
|
101
|
+
...(baseOptions.ignoreContent || []),
|
|
102
|
+
...sharedIgnoreList,
|
|
103
|
+
'^https?://',
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
])
|
|
107
|
+
const nonUrlVisitor = originalRule.create(nonUrlContext)
|
|
108
|
+
|
|
109
|
+
// Visitor for URLs ONLY: shared + URL patterns, with URL delimiters
|
|
110
|
+
const urlContext = createContextWithOptions(context, [
|
|
111
|
+
{
|
|
112
|
+
...baseOptions,
|
|
113
|
+
ignoreContent: [
|
|
114
|
+
...(baseOptions.ignoreContent || []),
|
|
115
|
+
...sharedIgnoreList,
|
|
116
|
+
...urlIgnoreList,
|
|
117
|
+
'^(?!https?://)',
|
|
118
|
+
],
|
|
119
|
+
additionalDelimiters: ['/', '\\?', '=', '&', '\\+'],
|
|
120
|
+
},
|
|
121
|
+
])
|
|
122
|
+
const urlVisitor = originalRule.create(urlContext)
|
|
123
|
+
|
|
124
|
+
// Only process Literal nodes - skip TemplateElement to avoid false positives
|
|
125
|
+
// on template expressions like `${variable}` which get split incorrectly
|
|
126
|
+
return {
|
|
127
|
+
Literal(node) {
|
|
128
|
+
nonUrlVisitor.Literal?.(node)
|
|
129
|
+
urlVisitor.Literal?.(node)
|
|
130
|
+
},
|
|
131
|
+
}
|
|
26
132
|
},
|
|
27
133
|
}
|
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.4.
|
|
4
|
+
"version": "0.4.8",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dist/**/*",
|
|
21
21
|
"eslint/**/*.cjs",
|
|
22
22
|
"eslint/**/*.md",
|
|
23
|
+
"stylelint/**/*.mjs",
|
|
23
24
|
"generated-hook-maps/**/*.json",
|
|
24
25
|
"README.md",
|
|
25
26
|
"LICENSE.txt"
|
|
@@ -34,7 +35,9 @@
|
|
|
34
35
|
"./mocks": "./src/mocks.ts",
|
|
35
36
|
"./src/*": "./src/*",
|
|
36
37
|
"./eslint": "./eslint/index.cjs",
|
|
37
|
-
"./eslint/config": "./eslint/config.cjs"
|
|
38
|
+
"./eslint/config": "./eslint/config.cjs",
|
|
39
|
+
"./stylelint": "./stylelint/index.mjs",
|
|
40
|
+
"./stylelint/config": "./stylelint/config.mjs"
|
|
38
41
|
},
|
|
39
42
|
"peerDependencies": {
|
|
40
43
|
"react": ">=18.2.0",
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
"typescript": ">=5.0.0"
|
|
44
47
|
},
|
|
45
48
|
"dependencies": {
|
|
46
|
-
"@shopify/shop-minis-platform": "0.8.
|
|
49
|
+
"@shopify/shop-minis-platform": "0.8.2",
|
|
47
50
|
"@tailwindcss/vite": "4.1.8",
|
|
48
51
|
"@tanstack/react-query": "5.86.0",
|
|
49
52
|
"@types/color": "3.0.6",
|
|
@@ -72,6 +75,8 @@
|
|
|
72
75
|
"react-virtuoso": "4.14.0",
|
|
73
76
|
"react-window": "1.8.11",
|
|
74
77
|
"sonner": "2.0.5",
|
|
78
|
+
"stylelint": "^16.26.1",
|
|
79
|
+
"stylelint-config-standard": "^39.0.1",
|
|
75
80
|
"tailwind-merge": "2.6.0",
|
|
76
81
|
"tailwindcss": "4.1.8",
|
|
77
82
|
"thumbhash": "0.1.1",
|
package/src/mocks.ts
CHANGED
|
@@ -205,7 +205,6 @@ export function makeMockActions(): ShopActions {
|
|
|
205
205
|
},
|
|
206
206
|
productRecommendationImpression: undefined,
|
|
207
207
|
productRecommendationClick: undefined,
|
|
208
|
-
hideEntryPoint: undefined,
|
|
209
208
|
closeMini: undefined,
|
|
210
209
|
getAccountInformation: {
|
|
211
210
|
status: 'available',
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {dirname, join} from 'node:path'
|
|
2
|
+
import {fileURLToPath} from 'node:url'
|
|
3
|
+
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
5
|
+
|
|
6
|
+
/** @type {import('stylelint').Config} */
|
|
7
|
+
const config = {
|
|
8
|
+
extends: ['stylelint-config-standard'],
|
|
9
|
+
plugins: [join(__dirname, 'plugin-no-font-imports.mjs')],
|
|
10
|
+
rules: {
|
|
11
|
+
// Tailwind CSS v4 at-rules
|
|
12
|
+
'at-rule-no-unknown': [
|
|
13
|
+
true,
|
|
14
|
+
{
|
|
15
|
+
ignoreAtRules: [
|
|
16
|
+
'theme',
|
|
17
|
+
'source',
|
|
18
|
+
'custom-variant',
|
|
19
|
+
'apply',
|
|
20
|
+
'config',
|
|
21
|
+
'plugin',
|
|
22
|
+
'utility',
|
|
23
|
+
'variant',
|
|
24
|
+
'tailwind',
|
|
25
|
+
'reference',
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
// Tailwind theme() function
|
|
30
|
+
'function-no-unknown': [
|
|
31
|
+
true,
|
|
32
|
+
{
|
|
33
|
+
ignoreFunctions: ['theme'],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
'import-notation': 'string',
|
|
37
|
+
'plugin/no-font-imports': true,
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default config
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable import/extensions */
|
|
2
|
+
/**
|
|
3
|
+
* Stylelint plugin for @shopify/shop-minis-react
|
|
4
|
+
* @fileoverview Custom stylelint rules for Shop Minis apps
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import noFontImports from './plugin-no-font-imports.mjs'
|
|
8
|
+
|
|
9
|
+
const plugins = [noFontImports]
|
|
10
|
+
|
|
11
|
+
export default plugins
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rule wrapper for stylelint to prevent font imports in Shop Minis
|
|
3
|
+
*/
|
|
4
|
+
import stylelint from 'stylelint'
|
|
5
|
+
|
|
6
|
+
const ruleName = 'plugin/no-font-imports'
|
|
7
|
+
const messages = stylelint.utils.ruleMessages(ruleName, {
|
|
8
|
+
rejected: 'Custom font imports are not allowed in Shop Minis',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
url: '',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @type {import('stylelint').Rule} */
|
|
16
|
+
const ruleFunction = primary => {
|
|
17
|
+
return (root, result) => {
|
|
18
|
+
const validOptions = stylelint.utils.validateOptions(result, ruleName, {
|
|
19
|
+
actual: primary,
|
|
20
|
+
possible: [true],
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
if (!validOptions) return
|
|
24
|
+
|
|
25
|
+
root.walkAtRules('import', atRule => {
|
|
26
|
+
const importPath = atRule.params
|
|
27
|
+
|
|
28
|
+
// Check for common font-related URLs
|
|
29
|
+
if (
|
|
30
|
+
importPath.includes('fonts.googleapis.com') ||
|
|
31
|
+
importPath.includes('fonts.gstatic.com') ||
|
|
32
|
+
importPath.includes('use.typekit.net') ||
|
|
33
|
+
importPath.includes('fast.fonts.net') ||
|
|
34
|
+
/font/i.test(importPath)
|
|
35
|
+
) {
|
|
36
|
+
stylelint.utils.report({
|
|
37
|
+
message: messages.rejected,
|
|
38
|
+
node: atRule,
|
|
39
|
+
result,
|
|
40
|
+
ruleName,
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
root.walkAtRules('font-face', atRule => {
|
|
46
|
+
stylelint.utils.report({
|
|
47
|
+
message: messages.rejected,
|
|
48
|
+
node: atRule,
|
|
49
|
+
result,
|
|
50
|
+
ruleName,
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ruleFunction.ruleName = ruleName
|
|
57
|
+
ruleFunction.messages = messages
|
|
58
|
+
ruleFunction.meta = meta
|
|
59
|
+
|
|
60
|
+
export default stylelint.createPlugin(ruleName, ruleFunction)
|