@shopify/shop-minis-react 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index2.js +4 -4
- package/dist/_virtual/index3.js +4 -4
- package/dist/_virtual/index5.js +2 -3
- package/dist/_virtual/index5.js.map +1 -1
- package/dist/_virtual/index6.js +3 -2
- package/dist/_virtual/index6.js.map +1 -1
- package/dist/_virtual/index7.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/hooks/user/useGenerateUserToken.js +12 -0
- package/dist/hooks/user/useGenerateUserToken.js.map +1 -0
- package/dist/index.js +111 -106
- package/dist/index.js.map +1 -1
- package/dist/mocks.js +16 -8
- package/dist/mocks.js.map +1 -1
- package/dist/shop-minis-platform/src/types/user.js +6 -0
- package/dist/shop-minis-platform/src/types/user.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/package.json +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/user/useGenerateUserToken.ts +25 -0
- package/src/mocks.ts +8 -1
package/dist/_virtual/index10.js
CHANGED
package/dist/_virtual/index2.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
-
import { __require as o } from "../shop-minis-react/node_modules/.pnpm
|
|
3
|
-
var t =
|
|
4
|
-
const
|
|
2
|
+
import { __require as o } from "../shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js";
|
|
3
|
+
var t = o();
|
|
4
|
+
const a = /* @__PURE__ */ r(t);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=index2.js.map
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
-
import { __require as o } from "../shop-minis-react/node_modules/.pnpm
|
|
3
|
-
var t = o();
|
|
4
|
-
const
|
|
2
|
+
import { __require as o } from "../shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js";
|
|
3
|
+
var t = /* @__PURE__ */ o();
|
|
4
|
+
const l = /* @__PURE__ */ r(t);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
l as default
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=index3.js.map
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var i = r();
|
|
1
|
+
var e = { exports: {} };
|
|
3
2
|
export {
|
|
4
|
-
|
|
3
|
+
e as __module
|
|
5
4
|
};
|
|
6
5
|
//# sourceMappingURL=index5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/_virtual/index6.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __require as r } from "../shop-minis-react/node_modules/.pnpm
|
|
1
|
+
import { __require as r } from "../shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js";
|
|
2
2
|
var i = r();
|
|
3
3
|
export {
|
|
4
|
-
i as
|
|
4
|
+
i as s
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=index7.js.map
|
package/dist/_virtual/index9.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useHandleAction as n } from "../../internal/useHandleAction.js";
|
|
2
|
+
import { useShopActions as o } from "../../internal/useShopActions.js";
|
|
3
|
+
function s() {
|
|
4
|
+
const { generateUserToken: e } = o();
|
|
5
|
+
return {
|
|
6
|
+
generateUserToken: n(e)
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
s as useGenerateUserToken
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useGenerateUserToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGenerateUserToken.js","sources":["../../../src/hooks/user/useGenerateUserToken.ts"],"sourcesContent":["import {\n GeneratedTokenData,\n UserTokenGenerateUserErrors,\n} from '@shopify/shop-minis-platform'\n\nimport {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\n\ninterface UseGenerateUserTokenReturns {\n /**\n * Generates a temporary token for the user.\n */\n generateUserToken: () => Promise<{\n data: GeneratedTokenData\n userErrors?: UserTokenGenerateUserErrors[]\n }>\n}\n\nexport function useGenerateUserToken(): UseGenerateUserTokenReturns {\n const {generateUserToken} = useShopActions()\n\n return {\n generateUserToken: useHandleAction(generateUserToken),\n }\n}\n"],"names":["useGenerateUserToken","generateUserToken","useShopActions","useHandleAction"],"mappings":";;AAkBO,SAASA,IAAoD;AAC5D,QAAA,EAAC,mBAAAC,EAAiB,IAAIC,EAAe;AAEpC,SAAA;AAAA,IACL,mBAAmBC,EAAgBF,CAAiB;AAAA,EACtD;AACF;"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./types/index.js";
|
|
2
2
|
import { MinisContainer as p } from "./components/MinisContainer.js";
|
|
3
|
-
import { ProductCard as
|
|
3
|
+
import { ProductCard as m } from "./components/commerce/product-card.js";
|
|
4
4
|
import { ProductLink as s } from "./components/commerce/product-link.js";
|
|
5
5
|
import { MerchantCard as f, MerchantCardPrimitive as x } from "./components/commerce/merchant-card.js";
|
|
6
6
|
import { ProductCardSkeleton as c } from "./components/commerce/product-card-skeleton.js";
|
|
@@ -10,10 +10,10 @@ import { Search as A, SearchInput as P, SearchProvider as h, SearchResultsList a
|
|
|
10
10
|
import { ImageContentWrapper as v } from "./components/content/image-content-wrapper.js";
|
|
11
11
|
import { MinisRouter as R } from "./components/navigation/minis-router.js";
|
|
12
12
|
import { TransitionLink as E } from "./components/navigation/transition-link.js";
|
|
13
|
-
import { Button as
|
|
14
|
-
import { FavoriteButton as
|
|
15
|
-
import { IconButton as
|
|
16
|
-
import { ThumbhashImage as
|
|
13
|
+
import { Button as F } from "./components/atoms/button.js";
|
|
14
|
+
import { FavoriteButton as B } from "./components/atoms/favorite-button.js";
|
|
15
|
+
import { IconButton as M } from "./components/atoms/icon-button.js";
|
|
16
|
+
import { ThumbhashImage as y } from "./components/atoms/thumbhash-image.js";
|
|
17
17
|
import { Touchable as H } from "./components/atoms/touchable.js";
|
|
18
18
|
import { LongPressDetector as V } from "./components/atoms/long-press-detector.js";
|
|
19
19
|
import { AlertDialogAtom as _ } from "./components/atoms/alert-dialog.js";
|
|
@@ -21,23 +21,23 @@ import { List as Y } from "./components/atoms/list.js";
|
|
|
21
21
|
import { VideoPlayer as j } from "./components/atoms/video-player.js";
|
|
22
22
|
import { Accordion as J, AccordionContent as K, AccordionItem as X, AccordionTrigger as Z } from "./components/ui/accordion.js";
|
|
23
23
|
import { Alert as rr, AlertDescription as er, AlertTitle as or } from "./components/ui/alert.js";
|
|
24
|
-
import { AlertDialog as ar, AlertDialogAction as pr, AlertDialogCancel as ir, AlertDialogContent as
|
|
24
|
+
import { AlertDialog as ar, AlertDialogAction as pr, AlertDialogCancel as ir, AlertDialogContent as mr, AlertDialogDescription as lr, AlertDialogFooter as sr, AlertDialogHeader as nr, AlertDialogOverlay as fr, AlertDialogPortal as xr, AlertDialogTitle as ur, AlertDialogTrigger as cr } from "./components/ui/alert-dialog.js";
|
|
25
25
|
import { Avatar as gr, AvatarFallback as Sr, AvatarImage as Cr } from "./components/ui/avatar.js";
|
|
26
26
|
import { Badge as Ar, badgeVariants as Pr } from "./components/ui/badge.js";
|
|
27
|
-
import { Card as Tr, CardAction as Ir, CardContent as vr, CardDescription as wr, CardFooter as Rr, CardHeader as
|
|
28
|
-
import { Carousel as
|
|
29
|
-
import { Checkbox as
|
|
27
|
+
import { Card as Tr, CardAction as Ir, CardContent as vr, CardDescription as wr, CardFooter as Rr, CardHeader as kr, CardTitle as Er } from "./components/ui/card.js";
|
|
28
|
+
import { Carousel as Fr, CarouselContent as Ur, CarouselItem as Br, CarouselNext as Lr, CarouselPrevious as Mr } from "./components/ui/carousel.js";
|
|
29
|
+
import { Checkbox as yr } from "./components/ui/checkbox.js";
|
|
30
30
|
import { Dialog as Hr, DialogClose as Or, DialogContent as Vr, DialogDescription as zr, DialogFooter as _r, DialogHeader as Wr, DialogOverlay as Yr, DialogPortal as Qr, DialogTitle as jr, DialogTrigger as qr } from "./components/ui/dialog.js";
|
|
31
31
|
import { Drawer as Kr, DrawerClose as Xr, DrawerContent as Zr, DrawerDescription as $r, DrawerFooter as re, DrawerHeader as ee, DrawerOverlay as oe, DrawerPortal as te, DrawerTitle as ae, DrawerTrigger as pe } from "./components/ui/drawer.js";
|
|
32
|
-
import { Input as
|
|
32
|
+
import { Input as me } from "./components/ui/input.js";
|
|
33
33
|
import { Label as se } from "./components/ui/label.js";
|
|
34
34
|
import { Progress as fe } from "./components/ui/progress.js";
|
|
35
35
|
import { RadioGroup as ue, RadioGroupItem as ce } from "./components/ui/radio-group.js";
|
|
36
36
|
import { ResizableHandle as ge, ResizablePanel as Se, ResizablePanelGroup as Ce } from "./components/ui/resizable.js";
|
|
37
37
|
import { ScrollArea as Ae, ScrollBar as Pe } from "./components/ui/scroll-area.js";
|
|
38
|
-
import { Select as Te, SelectContent as Ie, SelectGroup as ve, SelectItem as we, SelectLabel as Re, SelectScrollDownButton as
|
|
39
|
-
import { Separator as
|
|
40
|
-
import { Sheet as
|
|
38
|
+
import { Select as Te, SelectContent as Ie, SelectGroup as ve, SelectItem as we, SelectLabel as Re, SelectScrollDownButton as ke, SelectScrollUpButton as Ee, SelectSeparator as be, SelectTrigger as Fe, SelectValue as Ue } from "./components/ui/select.js";
|
|
39
|
+
import { Separator as Le } from "./components/ui/separator.js";
|
|
40
|
+
import { Sheet as Ne, SheetClose as ye, SheetContent as Ge, SheetDescription as He, SheetFooter as Oe, SheetHeader as Ve, SheetTitle as ze, SheetTrigger as _e } from "./components/ui/sheet.js";
|
|
41
41
|
import { Toaster as Ye } from "./components/ui/sonner.js";
|
|
42
42
|
import { Skeleton as je } from "./components/ui/skeleton.js";
|
|
43
43
|
import { useRecentProducts as Je } from "./hooks/user/useRecentProducts.js";
|
|
@@ -46,41 +46,43 @@ import { useSavedProducts as $e } from "./hooks/user/useSavedProducts.js";
|
|
|
46
46
|
import { useSavedProductsActions as eo } from "./hooks/user/useSavedProductsActions.js";
|
|
47
47
|
import { useFollowedShops as to } from "./hooks/user/useFollowedShops.js";
|
|
48
48
|
import { useFollowedShopsActions as po } from "./hooks/user/useFollowedShopsActions.js";
|
|
49
|
-
import { useCurrentUser as
|
|
49
|
+
import { useCurrentUser as mo } from "./hooks/user/useCurrentUser.js";
|
|
50
50
|
import { useOrders as so } from "./hooks/user/useOrders.js";
|
|
51
51
|
import { useBuyerAttributes as fo } from "./hooks/user/useBuyerAttributes.js";
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
52
|
+
import { useGenerateUserToken as uo } from "./hooks/user/useGenerateUserToken.js";
|
|
53
|
+
import { useProductListActions as go } from "./hooks/product/useProductListActions.js";
|
|
54
|
+
import { useProductLists as Co } from "./hooks/product/useProductLists.js";
|
|
55
|
+
import { useProductList as Ao } from "./hooks/product/useProductList.js";
|
|
56
|
+
import { useProduct as ho } from "./hooks/product/useProduct.js";
|
|
57
|
+
import { useProducts as Io } from "./hooks/product/useProducts.js";
|
|
58
|
+
import { useProductVariants as wo } from "./hooks/product/useProductVariants.js";
|
|
59
|
+
import { useProductMedia as ko } from "./hooks/product/useProductMedia.js";
|
|
59
60
|
import { useProductSearch as bo } from "./hooks/product/useProductSearch.js";
|
|
60
|
-
import { useRecommendedProducts as
|
|
61
|
-
import { usePopularProducts as
|
|
62
|
-
import { useCuratedProducts as
|
|
63
|
-
import { useAsyncStorage as
|
|
64
|
-
import { useSecureStorage as
|
|
65
|
-
import { useImageUpload as
|
|
66
|
-
import { useShopNavigation as
|
|
67
|
-
import { useCloseMini as
|
|
68
|
-
import { useDeeplink as
|
|
69
|
-
import { useNavigateWithTransition as
|
|
70
|
-
import { useShop as
|
|
71
|
-
import { useShopCartActions as
|
|
72
|
-
import { useRecommendedShops as
|
|
73
|
-
import { useCreateImageContent as
|
|
74
|
-
import { useErrorToast as
|
|
75
|
-
import { useErrorScreen as
|
|
76
|
-
import { useShare as
|
|
77
|
-
import { useImagePicker as
|
|
78
|
-
import { MiniEntityNotFoundError as
|
|
79
|
-
import { extractBrandTheme as
|
|
80
|
-
import { parseUrl as
|
|
81
|
-
import { fileToDataUri as
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
61
|
+
import { useRecommendedProducts as Uo } from "./hooks/product/useRecommendedProducts.js";
|
|
62
|
+
import { usePopularProducts as Lo } from "./hooks/product/usePopularProducts.js";
|
|
63
|
+
import { useCuratedProducts as No } from "./hooks/product/useCuratedProducts.js";
|
|
64
|
+
import { useAsyncStorage as Go } from "./hooks/storage/useAsyncStorage.js";
|
|
65
|
+
import { useSecureStorage as Oo } from "./hooks/storage/useSecureStorage.js";
|
|
66
|
+
import { useImageUpload as zo } from "./hooks/storage/useImageUpload.js";
|
|
67
|
+
import { useShopNavigation as Wo } from "./hooks/navigation/useShopNavigation.js";
|
|
68
|
+
import { useCloseMini as Qo } from "./hooks/navigation/useCloseMini.js";
|
|
69
|
+
import { useDeeplink as qo } from "./hooks/navigation/useDeeplink.js";
|
|
70
|
+
import { useNavigateWithTransition as Ko } from "./hooks/navigation/useNavigateWithTransition.js";
|
|
71
|
+
import { useShop as Zo } from "./hooks/shop/useShop.js";
|
|
72
|
+
import { useShopCartActions as rt } from "./hooks/shop/useShopCartActions.js";
|
|
73
|
+
import { useRecommendedShops as ot } from "./hooks/shop/useRecommendedShops.js";
|
|
74
|
+
import { useCreateImageContent as at } from "./hooks/content/useCreateImageContent.js";
|
|
75
|
+
import { useErrorToast as it } from "./hooks/util/useErrorToast.js";
|
|
76
|
+
import { useErrorScreen as lt } from "./hooks/util/useErrorScreen.js";
|
|
77
|
+
import { useShare as nt } from "./hooks/util/useShare.js";
|
|
78
|
+
import { useImagePicker as xt } from "./hooks/util/useImagePicker.js";
|
|
79
|
+
import { MiniEntityNotFoundError as ct, MiniError as dt, MiniNetworkError as gt, formatError as St } from "./utils/errors.js";
|
|
80
|
+
import { extractBrandTheme as Dt, formatReviewCount as At, getFeaturedImages as Pt, normalizeRating as ht } from "./utils/merchant-card.js";
|
|
81
|
+
import { parseUrl as It } from "./utils/parseUrl.js";
|
|
82
|
+
import { fileToDataUri as wt } from "./utils/imageToDataUri.js";
|
|
83
|
+
import { UserState as kt, UserTokenGenerateUserErrorCode as Et } from "./shop-minis-platform/src/types/user.js";
|
|
84
|
+
import { ContentCreateUserErrorCode as Ft } from "./shop-minis-platform/src/types/content.js";
|
|
85
|
+
import { Consent as Bt, ConsentStatus as Lt } from "./shop-minis-platform/src/types/permissions.js";
|
|
84
86
|
export {
|
|
85
87
|
J as Accordion,
|
|
86
88
|
K as AccordionContent,
|
|
@@ -92,8 +94,8 @@ export {
|
|
|
92
94
|
pr as AlertDialogAction,
|
|
93
95
|
_ as AlertDialogAtom,
|
|
94
96
|
ir as AlertDialogCancel,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
mr as AlertDialogContent,
|
|
98
|
+
lr as AlertDialogDescription,
|
|
97
99
|
sr as AlertDialogFooter,
|
|
98
100
|
nr as AlertDialogHeader,
|
|
99
101
|
fr as AlertDialogOverlay,
|
|
@@ -105,23 +107,23 @@ export {
|
|
|
105
107
|
Sr as AvatarFallback,
|
|
106
108
|
Cr as AvatarImage,
|
|
107
109
|
Ar as Badge,
|
|
108
|
-
|
|
110
|
+
F as Button,
|
|
109
111
|
Tr as Card,
|
|
110
112
|
Ir as CardAction,
|
|
111
113
|
vr as CardContent,
|
|
112
114
|
wr as CardDescription,
|
|
113
115
|
Rr as CardFooter,
|
|
114
|
-
|
|
116
|
+
kr as CardHeader,
|
|
115
117
|
Er as CardTitle,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
Fr as Carousel,
|
|
119
|
+
Ur as CarouselContent,
|
|
120
|
+
Br as CarouselItem,
|
|
121
|
+
Lr as CarouselNext,
|
|
122
|
+
Mr as CarouselPrevious,
|
|
123
|
+
yr as Checkbox,
|
|
124
|
+
Bt as Consent,
|
|
125
|
+
Lt as ConsentStatus,
|
|
126
|
+
Ft as ContentCreateUserErrorCode,
|
|
125
127
|
o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
|
|
126
128
|
Hr as Dialog,
|
|
127
129
|
Or as DialogClose,
|
|
@@ -143,23 +145,23 @@ export {
|
|
|
143
145
|
te as DrawerPortal,
|
|
144
146
|
ae as DrawerTitle,
|
|
145
147
|
pe as DrawerTrigger,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
B as FavoriteButton,
|
|
149
|
+
M as IconButton,
|
|
148
150
|
v as ImageContentWrapper,
|
|
149
|
-
|
|
151
|
+
me as Input,
|
|
150
152
|
se as Label,
|
|
151
153
|
Y as List,
|
|
152
154
|
V as LongPressDetector,
|
|
153
155
|
f as MerchantCard,
|
|
154
156
|
x as MerchantCardPrimitive,
|
|
155
157
|
g as MerchantCardSkeleton,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
ct as MiniEntityNotFoundError,
|
|
159
|
+
dt as MiniError,
|
|
160
|
+
gt as MiniNetworkError,
|
|
159
161
|
p as MinisContainer,
|
|
160
162
|
R as MinisRouter,
|
|
161
163
|
t as NAVIGATION_TYPES,
|
|
162
|
-
|
|
164
|
+
m as ProductCard,
|
|
163
165
|
c as ProductCardSkeleton,
|
|
164
166
|
s as ProductLink,
|
|
165
167
|
fe as Progress,
|
|
@@ -180,14 +182,14 @@ export {
|
|
|
180
182
|
ve as SelectGroup,
|
|
181
183
|
we as SelectItem,
|
|
182
184
|
Re as SelectLabel,
|
|
183
|
-
|
|
185
|
+
ke as SelectScrollDownButton,
|
|
184
186
|
Ee as SelectScrollUpButton,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
be as SelectSeparator,
|
|
188
|
+
Fe as SelectTrigger,
|
|
189
|
+
Ue as SelectValue,
|
|
190
|
+
Le as Separator,
|
|
191
|
+
Ne as Sheet,
|
|
192
|
+
ye as SheetClose,
|
|
191
193
|
Ge as SheetContent,
|
|
192
194
|
He as SheetDescription,
|
|
193
195
|
Oe as SheetFooter,
|
|
@@ -195,53 +197,56 @@ export {
|
|
|
195
197
|
ze as SheetTitle,
|
|
196
198
|
_e as SheetTrigger,
|
|
197
199
|
je as Skeleton,
|
|
198
|
-
|
|
200
|
+
y as ThumbhashImage,
|
|
199
201
|
Ye as Toaster,
|
|
200
202
|
H as Touchable,
|
|
201
203
|
E as TransitionLink,
|
|
204
|
+
kt as UserState,
|
|
205
|
+
Et as UserTokenGenerateUserErrorCode,
|
|
202
206
|
j as VideoPlayer,
|
|
203
207
|
Pr as badgeVariants,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
Dt as extractBrandTheme,
|
|
209
|
+
wt as fileToDataUri,
|
|
210
|
+
St as formatError,
|
|
211
|
+
At as formatReviewCount,
|
|
212
|
+
Pt as getFeaturedImages,
|
|
213
|
+
ht as normalizeRating,
|
|
214
|
+
It as parseUrl,
|
|
215
|
+
Go as useAsyncStorage,
|
|
212
216
|
fo as useBuyerAttributes,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
Qo as useCloseMini,
|
|
218
|
+
at as useCreateImageContent,
|
|
219
|
+
No as useCuratedProducts,
|
|
220
|
+
mo as useCurrentUser,
|
|
221
|
+
qo as useDeeplink,
|
|
222
|
+
lt as useErrorScreen,
|
|
223
|
+
it as useErrorToast,
|
|
220
224
|
to as useFollowedShops,
|
|
221
225
|
po as useFollowedShopsActions,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
uo as useGenerateUserToken,
|
|
227
|
+
xt as useImagePicker,
|
|
228
|
+
zo as useImageUpload,
|
|
229
|
+
Ko as useNavigateWithTransition,
|
|
225
230
|
so as useOrders,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
Lo as usePopularProducts,
|
|
232
|
+
ho as useProduct,
|
|
233
|
+
Ao as useProductList,
|
|
234
|
+
go as useProductListActions,
|
|
235
|
+
Co as useProductLists,
|
|
236
|
+
ko as useProductMedia,
|
|
232
237
|
bo as useProductSearch,
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
wo as useProductVariants,
|
|
239
|
+
Io as useProducts,
|
|
235
240
|
Je as useRecentProducts,
|
|
236
241
|
Xe as useRecentShops,
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
Uo as useRecommendedProducts,
|
|
243
|
+
ot as useRecommendedShops,
|
|
239
244
|
$e as useSavedProducts,
|
|
240
245
|
eo as useSavedProductsActions,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
+
Oo as useSecureStorage,
|
|
247
|
+
nt as useShare,
|
|
248
|
+
Zo as useShop,
|
|
249
|
+
rt as useShopCartActions,
|
|
250
|
+
Wo as useShopNavigation
|
|
246
251
|
};
|
|
247
252
|
//# 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserState as p } from "./shop-minis-platform/src/types/user.js";
|
|
1
2
|
const e = (t, o, r = "99.99", s) => ({
|
|
2
3
|
id: t,
|
|
3
4
|
title: o,
|
|
@@ -14,7 +15,7 @@ const e = (t, o, r = "99.99", s) => ({
|
|
|
14
15
|
altText: o
|
|
15
16
|
}
|
|
16
17
|
}), i = (t, o, r) => {
|
|
17
|
-
const c = Array.from({ length: 3 }, (
|
|
18
|
+
const c = Array.from({ length: 3 }, (g, n) => ({
|
|
18
19
|
url: `https://picsum.photos/400/400?random=${t}-${n}`,
|
|
19
20
|
sensitive: !1,
|
|
20
21
|
altText: `${o} featured image ${n + 1}`
|
|
@@ -45,10 +46,10 @@ const e = (t, o, r = "99.99", s) => ({
|
|
|
45
46
|
name: o,
|
|
46
47
|
products: r
|
|
47
48
|
});
|
|
48
|
-
function
|
|
49
|
+
function l(t, o) {
|
|
49
50
|
return (r) => (console.log(`[Mock Action] ${String(t)}`, r), Promise.resolve({ ok: !0, data: o }));
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function u() {
|
|
52
53
|
const t = {
|
|
53
54
|
followShop: !0,
|
|
54
55
|
unfollowShop: !1,
|
|
@@ -299,20 +300,27 @@ function l() {
|
|
|
299
300
|
visibility: ["DISCOVERABLE"]
|
|
300
301
|
}
|
|
301
302
|
]
|
|
303
|
+
},
|
|
304
|
+
generateUserToken: {
|
|
305
|
+
data: {
|
|
306
|
+
token: "user-token-123",
|
|
307
|
+
expiresAt: "2025-01-01",
|
|
308
|
+
userState: p.VERIFIED
|
|
309
|
+
}
|
|
302
310
|
}
|
|
303
311
|
}, o = {};
|
|
304
312
|
for (const r in t)
|
|
305
|
-
Object.prototype.hasOwnProperty.call(t, r) && (o[r] =
|
|
313
|
+
Object.prototype.hasOwnProperty.call(t, r) && (o[r] = l(
|
|
306
314
|
r,
|
|
307
315
|
t[r]
|
|
308
316
|
));
|
|
309
317
|
return o;
|
|
310
318
|
}
|
|
311
|
-
const
|
|
319
|
+
const m = () => {
|
|
312
320
|
const t = navigator.userAgent.toLowerCase(), o = /iphone|ipad|ipod/.test(t), r = /android/.test(t);
|
|
313
321
|
return o || r;
|
|
314
|
-
},
|
|
315
|
-
|
|
322
|
+
}, h = () => {
|
|
323
|
+
m() || window.minisSDK || (window.minisSDK = u(), window.minisParams = {
|
|
316
324
|
handle: "mock-handle",
|
|
317
325
|
initialUrl: "/mock-initial-url",
|
|
318
326
|
platform: "web"
|
|
@@ -321,6 +329,6 @@ const u = () => {
|
|
|
321
329
|
export {
|
|
322
330
|
e as createProduct,
|
|
323
331
|
i as createShop,
|
|
324
|
-
|
|
332
|
+
h as injectMocks
|
|
325
333
|
};
|
|
326
334
|
//# sourceMappingURL=mocks.js.map
|
package/dist/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sources":["../src/mocks.ts"],"sourcesContent":["import {Product, Gender} 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\nfunction makeMockActions(): ShopActions {\n const results: {\n [K in keyof ShopActions]: ShopActionDataType<ShopActions[K]>\n } = {\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: 'stored-value',\n setPersistedItem: undefined,\n removePersistedItem: undefined,\n getAllPersistedKeys: ['key1', 'key2', 'key3'],\n clearPersistedItems: undefined,\n getInternalPersistedItem: 'internal-value',\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 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: [createProduct('search-3', 'Search Product 3', '39.99')],\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 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: {data: createShop('shop-1', 'Sample Shop')},\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 },\n ],\n },\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 = () => {\n // Only inject mocks if we aren't on a mobile device\n if (isMobile()) {\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","featuredImages","_","i","createPagination","hasNext","createProductList","products","makeMockMethod","key","result","params","makeMockActions","results","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks"],"mappings":"AAIO,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;AAQG,QAAAC,IAAiB,MAAM,KAAK,EAAC,QAAQ,EAAmB,GAAG,CAACC,GAAGC,OAAO;AAAA,IAC1E,KAAK,wCAAwCT,CAAE,IAAIS,CAAC;AAAA,IACpD,WAAW;AAAA,IACX,SAAS,GAAGJ,CAAI,mBAAmBI,IAAI,CAAC;AAAA,EAAA,EACxC;AA4EK,SAAA;AAAA,IACL,IAAAT;AAAA,IACA,MAAAK;AAAA,IACA,eAAe;AAAA,MACb,KAAK,WAAWA,EAAK,cAAc,QAAQ,QAAQ,GAAG,CAAC;AAAA,IACzD;AAAA,I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;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,QAAA;AAAA,MAC7B;AAAA,IACF;AAAA,EAEJ,GAEMU,IAA6B,CAAC;AACpC,aAAWL,KAAOI;AAChB,IAAI,OAAO,UAAU,eAAe,KAAKA,GAASJ,CAAG,MAEnDK,EAAKL,CAAG,IAAID;AAAA,MACVC;AAAA,MACAI,EAAQJ,CAA2B;AAAA,IACrC;AAGG,SAAAK;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,MAAM;AAE/B,EAAIJ,OAIC,OAAO,aACV,OAAO,WAAWH,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 {Product, Gender, UserState} 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\nfunction makeMockActions(): ShopActions {\n const results: {\n [K in keyof ShopActions]: ShopActionDataType<ShopActions[K]>\n } = {\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: 'stored-value',\n setPersistedItem: undefined,\n removePersistedItem: undefined,\n getAllPersistedKeys: ['key1', 'key2', 'key3'],\n clearPersistedItems: undefined,\n getInternalPersistedItem: 'internal-value',\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 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: [createProduct('search-3', 'Search Product 3', '39.99')],\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 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: {data: createShop('shop-1', 'Sample Shop')},\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 },\n ],\n },\n generateUserToken: {\n data: {\n token: 'user-token-123',\n expiresAt: '2025-01-01',\n userState: UserState.VERIFIED,\n },\n },\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 = () => {\n // Only inject mocks if we aren't on a mobile device\n if (isMobile()) {\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","featuredImages","_","i","createPagination","hasNext","createProductList","products","makeMockMethod","key","result","params","makeMockActions","results","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks"],"mappings":";AAIO,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,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AAO,WAAWJ,EAAgB,GAClC,OAAO,cAAc;AAAA,IACnB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAEJ;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var I = /* @__PURE__ */ ((N) => (N.MINI_NOT_FOUND = "MINI_NOT_FOUND", N.USER_NOT_FOUND = "USER_NOT_FOUND", N))(I || {}), O = /* @__PURE__ */ ((N) => (N.GUEST = "GUEST", N.VERIFIED = "VERIFIED", N))(O || {});
|
|
2
|
+
export {
|
|
3
|
+
O as UserState,
|
|
4
|
+
I as UserTokenGenerateUserErrorCode
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sources":["../../../../../shop-minis-platform/src/types/user.ts"],"sourcesContent":["/* eslint-disable @shopify/typescript/prefer-pascal-case-enums */ export interface UserProfile {\n displayName?: string | null\n avatarImage?: {\n url: string\n } | null\n}\n\nexport interface BuyerAttributes {\n genderAffinity?: Gender\n categoryAffinities: TaxonomyCategory[]\n}\n\nexport type Gender = 'MALE' | 'FEMALE' | 'NEUTRAL'\n\nexport interface TaxonomyCategory {\n id: string\n name: string\n ancestors?: TaxonomyCategory[]\n}\n\nexport enum UserTokenGenerateUserErrorCode {\n MINI_NOT_FOUND = 'MINI_NOT_FOUND',\n USER_NOT_FOUND = 'USER_NOT_FOUND',\n}\n\nexport enum UserState {\n GUEST = 'GUEST',\n VERIFIED = 'VERIFIED',\n}\n\nexport type ISO8601DateTime = string\n\nexport interface UserTokenGenerateUserErrors {\n code: UserTokenGenerateUserErrorCode\n message: string\n field?: string[] | null\n}\n\nexport interface GeneratedTokenData {\n /**\n * A temporary token for the user.\n */\n token?: string | null\n /**\n * The expiration time of the token.\n */\n expiresAt?: ISO8601DateTime | null\n /**\n * Whether the user is verified or a guest.\n */\n userState?: UserState | null\n}\n"],"names":["UserTokenGenerateUserErrorCode","UserState"],"mappings":"AAoBY,IAAAA,sBAAAA,OACVA,EAAA,iBAAiB,kBACjBA,EAAA,iBAAiB,kBAFPA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,WAAW,YAFDA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as q } from "../../../../../../../../_virtual/
|
|
1
|
+
import { __module as q } from "../../../../../../../../_virtual/index5.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/index6.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];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../../../../_virtual/
|
|
1
|
+
import { __module as r } from "../../../../../../../_virtual/index10.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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import S from "../../../../../../../_virtual/window.js";
|
|
2
2
|
import B from "../../../../../../../_virtual/document.js";
|
|
3
|
-
import il from "../../../../../../../_virtual/
|
|
3
|
+
import il from "../../../../../../../_virtual/index2.js";
|
|
4
4
|
import ao from "../../../../../../../_virtual/browser-index.js";
|
|
5
5
|
import xe from "../../../../@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js";
|
|
6
6
|
import Kc from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/resolve-url.js";
|
package/dist/utils/colors.js
CHANGED
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.
|
|
4
|
+
"version": "0.0.31",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript": ">=5.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@shopify/shop-minis-platform": "0.0.
|
|
41
|
+
"@shopify/shop-minis-platform": "0.0.10",
|
|
42
42
|
"@tailwindcss/vite": "4.1.8",
|
|
43
43
|
"@types/color": "3.0.6",
|
|
44
44
|
"@types/lodash": "4.17.20",
|
package/src/hooks/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './user/useFollowedShopsActions'
|
|
|
8
8
|
export * from './user/useCurrentUser'
|
|
9
9
|
export * from './user/useOrders'
|
|
10
10
|
export * from './user/useBuyerAttributes'
|
|
11
|
+
export * from './user/useGenerateUserToken'
|
|
11
12
|
|
|
12
13
|
// - Product Hooks
|
|
13
14
|
export * from './product/useProductListActions'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GeneratedTokenData,
|
|
3
|
+
UserTokenGenerateUserErrors,
|
|
4
|
+
} from '@shopify/shop-minis-platform'
|
|
5
|
+
|
|
6
|
+
import {useHandleAction} from '../../internal/useHandleAction'
|
|
7
|
+
import {useShopActions} from '../../internal/useShopActions'
|
|
8
|
+
|
|
9
|
+
interface UseGenerateUserTokenReturns {
|
|
10
|
+
/**
|
|
11
|
+
* Generates a temporary token for the user.
|
|
12
|
+
*/
|
|
13
|
+
generateUserToken: () => Promise<{
|
|
14
|
+
data: GeneratedTokenData
|
|
15
|
+
userErrors?: UserTokenGenerateUserErrors[]
|
|
16
|
+
}>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useGenerateUserToken(): UseGenerateUserTokenReturns {
|
|
20
|
+
const {generateUserToken} = useShopActions()
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
generateUserToken: useHandleAction(generateUserToken),
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/mocks.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Product, Gender} from '@shopify/shop-minis-platform'
|
|
1
|
+
import {Product, Gender, UserState} from '@shopify/shop-minis-platform'
|
|
2
2
|
import {ShopActions} from '@shopify/shop-minis-platform/actions'
|
|
3
3
|
|
|
4
4
|
// Helper functions for common data structures
|
|
@@ -437,6 +437,13 @@ function makeMockActions(): ShopActions {
|
|
|
437
437
|
},
|
|
438
438
|
],
|
|
439
439
|
},
|
|
440
|
+
generateUserToken: {
|
|
441
|
+
data: {
|
|
442
|
+
token: 'user-token-123',
|
|
443
|
+
expiresAt: '2025-01-01',
|
|
444
|
+
userState: UserState.VERIFIED,
|
|
445
|
+
},
|
|
446
|
+
},
|
|
440
447
|
} as const
|
|
441
448
|
|
|
442
449
|
const mock: Partial<ShopActions> = {}
|