@shopify/shop-minis-react 0.0.8 → 0.0.10

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.
@@ -1,14 +1,15 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
2
  import { useState as m, useEffect as l } from "react";
3
- function v({ children: s }) {
4
- const [a, r] = m(!1);
3
+ import { ImagePickerProvider as u } from "../providers/ImagePickerProvider.js";
4
+ function p({ children: s }) {
5
+ const [a, t] = m(!1);
5
6
  return l(() => {
6
- const n = () => window.minisSDK ? (r(!0), !0) : !1;
7
+ const n = () => window.minisSDK ? (t(!0), !0) : !1;
7
8
  if (n())
8
9
  return;
9
- const e = (d) => {
10
- const { type: o } = JSON.parse(d.data);
11
- o === "MINIS_SDK_READY" && r(!0);
10
+ const e = (o) => {
11
+ const { type: d } = JSON.parse(o.data);
12
+ d === "MINIS_SDK_READY" && t(!0);
12
13
  };
13
14
  window.addEventListener("message", e), document.addEventListener("message", e);
14
15
  const i = setInterval(() => {
@@ -17,12 +18,12 @@ function v({ children: s }) {
17
18
  return () => {
18
19
  window.removeEventListener("message", e), document.removeEventListener("message", e);
19
20
  };
20
- }, []), a ? s : /* @__PURE__ */ t("div", { className: "h-screen bg-gray-50 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "text-center", children: [
21
- /* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-4" }),
22
- /* @__PURE__ */ t("p", { className: "text-gray-600", children: "Loading..." })
21
+ }, []), a ? /* @__PURE__ */ r(u, { children: s }) : /* @__PURE__ */ r("div", { className: "h-screen bg-gray-50 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "text-center", children: [
22
+ /* @__PURE__ */ r("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-4" }),
23
+ /* @__PURE__ */ r("p", { className: "text-gray-600", children: "Loading..." })
23
24
  ] }) });
24
25
  }
25
26
  export {
26
- v as MinisContainer
27
+ p as MinisContainer
27
28
  };
28
29
  //# sourceMappingURL=MinisContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MinisContainer.js","sources":["../../src/components/MinisContainer.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react'\n\nexport function MinisContainer({children}: {children: React.ReactNode}) {\n const [isSDKReady, setIsSDKReady] = useState(false)\n\n useEffect(() => {\n // Function to check if SDK is ready\n const checkSDKReady = () => {\n if (window.minisSDK) {\n setIsSDKReady(true)\n return true\n }\n return false\n }\n\n // Check immediately\n if (checkSDKReady()) {\n return\n }\n\n // If not ready, set up a listener for the MINIS_SDK_READY event\n const handleSDKReady = (event: any) => {\n const {type} = JSON.parse(event.data)\n\n if (type === 'MINIS_SDK_READY') {\n setIsSDKReady(true)\n }\n }\n\n // Listen for the MINIS_SDK_READY event\n window.addEventListener('message', handleSDKReady)\n document.addEventListener('message', handleSDKReady)\n\n // Also poll for SDK availability as a fallback\n const pollInterval = setInterval(() => {\n if (checkSDKReady()) {\n clearInterval(pollInterval)\n }\n }, 100)\n\n // Cleanup\n return () => {\n // clearInterval(pollInterval);\n window.removeEventListener('message', handleSDKReady)\n document.removeEventListener('message', handleSDKReady)\n }\n }, [])\n\n // Don't render anything until SDK is ready\n if (!isSDKReady) {\n return (\n <div className=\"h-screen bg-gray-50 flex items-center justify-center\">\n <div className=\"text-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-4\" />\n <p className=\"text-gray-600\">Loading...</p>\n </div>\n </div>\n )\n }\n\n return children\n}\n"],"names":["MinisContainer","children","isSDKReady","setIsSDKReady","useState","useEffect","checkSDKReady","handleSDKReady","event","type","pollInterval","jsxs","jsx"],"mappings":";;AAEgB,SAAAA,EAAe,EAAC,UAAAC,KAAwC;AACtE,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAS,EAAK;AA8ClD,SA5CAC,EAAU,MAAM;AAEd,UAAMC,IAAgB,MAChB,OAAO,YACTH,EAAc,EAAI,GACX,MAEF;AAIT,QAAIG;AACF;AAII,UAAAC,IAAiB,CAACC,MAAe;AACrC,YAAM,EAAC,MAAAC,EAAI,IAAI,KAAK,MAAMD,EAAM,IAAI;AAEpC,MAAIC,MAAS,qBACXN,EAAc,EAAI;AAAA,IAEtB;AAGO,WAAA,iBAAiB,WAAWI,CAAc,GACxC,SAAA,iBAAiB,WAAWA,CAAc;AAG7C,UAAAG,IAAe,YAAY,MAAM;AACrC,MAAIJ,OACF,cAAcI,CAAY;AAAA,OAE3B,GAAG;AAGN,WAAO,MAAM;AAEJ,aAAA,oBAAoB,WAAWH,CAAc,GAC3C,SAAA,oBAAoB,WAAWA,CAAc;AAAA,IACxD;AAAA,EACF,GAAG,EAAE,GAGAL,IAWED,sBATF,OAAI,EAAA,WAAU,wDACb,UAAC,gBAAAU,EAAA,OAAA,EAAI,WAAU,eACb,UAAA;AAAA,IAAC,gBAAAC,EAAA,OAAA,EAAI,WAAU,4EAA4E,CAAA;AAAA,IAC1F,gBAAAA,EAAA,KAAA,EAAE,WAAU,iBAAgB,UAAU,aAAA,CAAA;AAAA,EAAA,EAAA,CACzC,EACF,CAAA;AAKN;"}
1
+ {"version":3,"file":"MinisContainer.js","sources":["../../src/components/MinisContainer.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react'\n\nimport {ImagePickerProvider} from '../providers/ImagePickerProvider'\n\nexport function MinisContainer({children}: {children: React.ReactNode}) {\n const [isSDKReady, setIsSDKReady] = useState(false)\n\n useEffect(() => {\n // Function to check if SDK is ready\n const checkSDKReady = () => {\n if (window.minisSDK) {\n setIsSDKReady(true)\n return true\n }\n return false\n }\n\n // Check immediately\n if (checkSDKReady()) {\n return\n }\n\n // If not ready, set up a listener for the MINIS_SDK_READY event\n const handleSDKReady = (event: any) => {\n const {type} = JSON.parse(event.data)\n\n if (type === 'MINIS_SDK_READY') {\n setIsSDKReady(true)\n }\n }\n\n // Listen for the MINIS_SDK_READY event\n window.addEventListener('message', handleSDKReady)\n document.addEventListener('message', handleSDKReady)\n\n // Also poll for SDK availability as a fallback\n const pollInterval = setInterval(() => {\n if (checkSDKReady()) {\n clearInterval(pollInterval)\n }\n }, 100)\n\n // Cleanup\n return () => {\n // clearInterval(pollInterval);\n window.removeEventListener('message', handleSDKReady)\n document.removeEventListener('message', handleSDKReady)\n }\n }, [])\n\n // Don't render anything until SDK is ready\n if (!isSDKReady) {\n return (\n <div className=\"h-screen bg-gray-50 flex items-center justify-center\">\n <div className=\"text-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-4\" />\n <p className=\"text-gray-600\">Loading...</p>\n </div>\n </div>\n )\n }\n\n return <ImagePickerProvider>{children}</ImagePickerProvider>\n}\n"],"names":["MinisContainer","children","isSDKReady","setIsSDKReady","useState","useEffect","checkSDKReady","handleSDKReady","event","type","pollInterval","jsx","ImagePickerProvider","jsxs"],"mappings":";;;AAIgB,SAAAA,EAAe,EAAC,UAAAC,KAAwC;AACtE,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAS,EAAK;AA8ClD,SA5CAC,EAAU,MAAM;AAEd,UAAMC,IAAgB,MAChB,OAAO,YACTH,EAAc,EAAI,GACX,MAEF;AAIT,QAAIG;AACF;AAII,UAAAC,IAAiB,CAACC,MAAe;AACrC,YAAM,EAAC,MAAAC,EAAI,IAAI,KAAK,MAAMD,EAAM,IAAI;AAEpC,MAAIC,MAAS,qBACXN,EAAc,EAAI;AAAA,IAEtB;AAGO,WAAA,iBAAiB,WAAWI,CAAc,GACxC,SAAA,iBAAiB,WAAWA,CAAc;AAG7C,UAAAG,IAAe,YAAY,MAAM;AACrC,MAAIJ,OACF,cAAcI,CAAY;AAAA,OAE3B,GAAG;AAGN,WAAO,MAAM;AAEJ,aAAA,oBAAoB,WAAWH,CAAc,GAC3C,SAAA,oBAAoB,WAAWA,CAAc;AAAA,IACxD;AAAA,EACF,GAAG,EAAE,GAGAL,IAWE,gBAAAS,EAACC,KAAqB,UAAAX,GAAS,sBATjC,OAAI,EAAA,WAAU,wDACb,UAAC,gBAAAY,EAAA,OAAA,EAAI,WAAU,eACb,UAAA;AAAA,IAAC,gBAAAF,EAAA,OAAA,EAAI,WAAU,4EAA4E,CAAA;AAAA,IAC1F,gBAAAA,EAAA,KAAA,EAAE,WAAU,iBAAgB,UAAU,aAAA,CAAA;AAAA,EAAA,EAAA,CACzC,EACF,CAAA;AAKN;"}
@@ -0,0 +1,23 @@
1
+ import { useMemo as e } from "react";
2
+ import { parseUrl as s } from "../../utils/parseUrl.js";
3
+ const t = () => {
4
+ const { initialUrl: r } = window.minisParams;
5
+ return e(() => {
6
+ if (!r)
7
+ return {
8
+ path: void 0,
9
+ queryParams: void 0,
10
+ hash: void 0
11
+ };
12
+ const a = s(r);
13
+ return {
14
+ path: a.pathname,
15
+ queryParams: a.query,
16
+ hash: a.hash
17
+ };
18
+ }, [r]);
19
+ };
20
+ export {
21
+ t as useDeeplink
22
+ };
23
+ //# sourceMappingURL=useDeeplink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeeplink.js","sources":["../../../src/hooks/navigation/useDeeplink.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {parseUrl} from '../../utils/parseUrl'\n\ninterface UseDeeplinkReturnType {\n /**\n * The path of the deeplink.\n */\n path?: string\n /**\n * The query parameters of the deeplink.\n */\n queryParams?: {[key: string]: string | undefined}\n /**\n * The hash of the deeplink.\n */\n hash?: string\n}\n\nexport const useDeeplink = (): UseDeeplinkReturnType => {\n const {initialUrl} = window.minisParams\n\n return useMemo(() => {\n if (!initialUrl) {\n return {\n path: undefined,\n queryParams: undefined,\n hash: undefined,\n }\n }\n\n const parsedUrl = parseUrl(initialUrl)\n\n return {\n path: parsedUrl.pathname,\n queryParams: parsedUrl.query,\n hash: parsedUrl.hash,\n }\n }, [initialUrl])\n}\n"],"names":["useDeeplink","initialUrl","useMemo","parsedUrl","parseUrl"],"mappings":";;AAmBO,MAAMA,IAAc,MAA6B;AAChD,QAAA,EAAC,YAAAC,MAAc,OAAO;AAE5B,SAAOC,EAAQ,MAAM;AACnB,QAAI,CAACD;AACI,aAAA;AAAA,QACL,MAAM;AAAA,QACN,aAAa;AAAA,QACb,MAAM;AAAA,MACR;AAGI,UAAAE,IAAYC,EAASH,CAAU;AAE9B,WAAA;AAAA,MACL,MAAME,EAAU;AAAA,MAChB,aAAaA,EAAU;AAAA,MACvB,MAAMA,EAAU;AAAA,IAClB;AAAA,EAAA,GACC,CAACF,CAAU,CAAC;AACjB;"}
@@ -0,0 +1,12 @@
1
+ import { useImagePickerContext as o } from "../../providers/ImagePickerProvider.js";
2
+ function t() {
3
+ const { openCamera: e, openGallery: r } = o();
4
+ return {
5
+ openCamera: e,
6
+ openGallery: r
7
+ };
8
+ }
9
+ export {
10
+ t as useImagePicker
11
+ };
12
+ //# sourceMappingURL=useImagePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useImagePicker.js","sources":["../../../src/hooks/util/useImagePicker.tsx"],"sourcesContent":["import {\n CameraFacing,\n useImagePickerContext,\n} from '../../providers/ImagePickerProvider'\n\ninterface UseImagePickerReturn {\n openCamera: (cameraFacing?: CameraFacing) => Promise<File>\n openGallery: () => Promise<File>\n}\n\nexport function useImagePicker(): UseImagePickerReturn {\n const {openCamera, openGallery} = useImagePickerContext()\n\n return {\n openCamera,\n openGallery,\n }\n}\n"],"names":["useImagePicker","openCamera","openGallery","useImagePickerContext"],"mappings":";AAUO,SAASA,IAAuC;AACrD,QAAM,EAAC,YAAAC,GAAY,aAAAC,EAAW,IAAIC,EAAsB;AAEjD,SAAA;AAAA,IACL,YAAAF;AAAA,IACA,aAAAC;AAAA,EACF;AACF;"}
@@ -0,0 +1,12 @@
1
+ import { useHandleAction as r } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as e } from "../../internal/useShopActions.js";
3
+ const n = () => {
4
+ const { share: o } = e();
5
+ return {
6
+ share: r(o)
7
+ };
8
+ };
9
+ export {
10
+ n as useShare
11
+ };
12
+ //# sourceMappingURL=useShare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShare.js","sources":["../../../src/hooks/util/useShare.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {ShareParams} from '../../types'\n\ninterface UseShareReturns {\n /**\n * Closes the Mini viewer.\n */\n share: (params: ShareParams) => void\n}\n\nexport const useShare = (): UseShareReturns => {\n const {share} = useShopActions()\n\n return {\n share: useHandleAction(share),\n }\n}\n"],"names":["useShare","share","useShopActions","useHandleAction"],"mappings":";;AAWO,MAAMA,IAAW,MAAuB;AACvC,QAAA,EAAC,OAAAC,EAAK,IAAIC,EAAe;AAExB,SAAA;AAAA,IACL,OAAOC,EAAgBF,CAAK;AAAA,EAC9B;AACF;"}
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { MinisContainer as o } from "./components/MinisContainer.js";
2
- import { ProductCard as a, ProductCardBadge as i, ProductCardCurrentPrice as l, ProductCardFavoriteButton as n, ProductCardImage as c, ProductCardImageContainer as u, ProductCardInfo as d, ProductCardOriginalPrice as s, ProductCardPrice as p, ProductCardRoot as m, ProductCardTitle as f } from "./components/commerce/product-card.js";
3
- import { ProductLink as x, ProductLinkActions as C, ProductLinkCurrentPrice as P, ProductLinkDiscountPrice as D, ProductLinkImage as S, ProductLinkInfo as A, ProductLinkOriginalPrice as L, ProductLinkPrice as T, ProductLinkRating as k, ProductLinkRoot as h, ProductLinkTitle as w } from "./components/commerce/product-link.js";
2
+ import { ProductCard as a, ProductCardBadge as i, ProductCardCurrentPrice as l, ProductCardFavoriteButton as n, ProductCardImage as c, ProductCardImageContainer as u, ProductCardInfo as d, ProductCardOriginalPrice as p, ProductCardPrice as s, ProductCardRoot as m, ProductCardTitle as f } from "./components/commerce/product-card.js";
3
+ import { ProductLink as g, ProductLinkActions as C, ProductLinkCurrentPrice as P, ProductLinkDiscountPrice as D, ProductLinkImage as S, ProductLinkInfo as A, ProductLinkOriginalPrice as k, ProductLinkPrice as L, ProductLinkRating as T, ProductLinkRoot as h, ProductLinkTitle as w } from "./components/commerce/product-link.js";
4
4
  import { Accordion as b, AccordionContent as v, AccordionItem as R, AccordionTrigger as F } from "./components/atoms/accordion.js";
5
5
  import { Alert as y, AlertDescription as E, AlertTitle as H } from "./components/atoms/alert.js";
6
6
  import { AlertDialog as G, AlertDialogAction as M, AlertDialogCancel as N, AlertDialogContent as U, AlertDialogDescription as z, AlertDialogFooter as V, AlertDialogHeader as j, AlertDialogOverlay as q, AlertDialogPortal as J, AlertDialogTitle as K, AlertDialogTrigger as Q } from "./components/atoms/alert-dialog.js";
7
7
  import { Avatar as X, AvatarFallback as Y, AvatarImage as Z } from "./components/atoms/avatar.js";
8
8
  import { Badge as $, badgeVariants as rr } from "./components/atoms/badge.js";
9
9
  import { Button as or, buttonVariants as tr } from "./components/atoms/button.js";
10
- import { Card as ir, CardAction as lr, CardContent as nr, CardDescription as cr, CardFooter as ur, CardHeader as dr, CardTitle as sr } from "./components/atoms/card.js";
11
- import { Carousel as mr, CarouselContent as fr, CarouselItem as gr, CarouselNext as xr, CarouselPrevious as Cr } from "./components/atoms/carousel.js";
10
+ import { Card as ir, CardAction as lr, CardContent as nr, CardDescription as cr, CardFooter as ur, CardHeader as dr, CardTitle as pr } from "./components/atoms/card.js";
11
+ import { Carousel as mr, CarouselContent as fr, CarouselItem as xr, CarouselNext as gr, CarouselPrevious as Cr } from "./components/atoms/carousel.js";
12
12
  import { Checkbox as Dr } from "./components/atoms/checkbox.js";
13
- import { Dialog as Ar, DialogClose as Lr, DialogContent as Tr, DialogDescription as kr, DialogFooter as hr, DialogHeader as wr, DialogOverlay as Ir, DialogPortal as br, DialogTitle as vr, DialogTrigger as Rr } from "./components/atoms/dialog.js";
13
+ import { Dialog as Ar, DialogClose as kr, DialogContent as Lr, DialogDescription as Tr, DialogFooter as hr, DialogHeader as wr, DialogOverlay as Ir, DialogPortal as br, DialogTitle as vr, DialogTrigger as Rr } from "./components/atoms/dialog.js";
14
14
  import { Drawer as Br, DrawerClose as yr, DrawerContent as Er, DrawerDescription as Hr, DrawerFooter as Or, DrawerHeader as Gr, DrawerOverlay as Mr, DrawerPortal as Nr, DrawerTitle as Ur, DrawerTrigger as zr } from "./components/atoms/drawer.js";
15
15
  import { Input as jr } from "./components/atoms/input.js";
16
16
  import { Label as Jr } from "./components/atoms/label.js";
@@ -18,9 +18,9 @@ import { Progress as Qr } from "./components/atoms/progress.js";
18
18
  import { RadioGroup as Xr, RadioGroupItem as Yr } from "./components/atoms/radio-group.js";
19
19
  import { ResizableHandle as _r, ResizablePanel as $r, ResizablePanelGroup as re } from "./components/atoms/resizable.js";
20
20
  import { ScrollArea as oe, ScrollBar as te } from "./components/atoms/scroll-area.js";
21
- import { Select as ie, SelectContent as le, SelectGroup as ne, SelectItem as ce, SelectLabel as ue, SelectScrollDownButton as de, SelectScrollUpButton as se, SelectSeparator as pe, SelectTrigger as me, SelectValue as fe } from "./components/atoms/select.js";
22
- import { Separator as xe } from "./components/atoms/separator.js";
23
- import { Sheet as Pe, SheetClose as De, SheetContent as Se, SheetDescription as Ae, SheetFooter as Le, SheetHeader as Te, SheetTitle as ke, SheetTrigger as he } from "./components/atoms/sheet.js";
21
+ import { Select as ie, SelectContent as le, SelectGroup as ne, SelectItem as ce, SelectLabel as ue, SelectScrollDownButton as de, SelectScrollUpButton as pe, SelectSeparator as se, SelectTrigger as me, SelectValue as fe } from "./components/atoms/select.js";
22
+ import { Separator as ge } from "./components/atoms/separator.js";
23
+ import { Sheet as Pe, SheetClose as De, SheetContent as Se, SheetDescription as Ae, SheetFooter as ke, SheetHeader as Le, SheetTitle as Te, SheetTrigger as he } from "./components/atoms/sheet.js";
24
24
  import { Toaster as Ie } from "./components/atoms/sonner.js";
25
25
  import { useSavedProductsActions as ve } from "./hooks/user/useSavedProductsActions.js";
26
26
  import { useFollowedShopsActions as Fe } from "./hooks/user/useFollowedShopsActions.js";
@@ -37,13 +37,16 @@ import { useSecureStorage as Ze } from "./hooks/storage/useSecureStorage.js";
37
37
  import { useImageUpload as $e } from "./hooks/storage/useImageUpload.js";
38
38
  import { useShopNavigation as eo } from "./hooks/navigation/useShopNavigation.js";
39
39
  import { useCloseMini as to } from "./hooks/navigation/useCloseMini.js";
40
- import { useShopCartActions as io } from "./hooks/shop/useShopCartActions.js";
41
- import { useRecommendedShops as no } from "./hooks/shop/useRecommendedShops.js";
42
- import { useErrorToast as uo } from "./hooks/util/useErrorToast.js";
43
- import { useErrorScreen as po } from "./hooks/util/useErrorScreen.js";
44
- import { MiniEntityNotFoundError as fo, MiniError as go, MiniNetworkError as xo, formatError as Co } from "./utils/errors.js";
45
- import { parseUrl as Do } from "./utils/parseUrl.js";
46
- import { Consent as Ao, ConsentStatus as Lo, CurrencyCode as To, Gender as ko } from "./types/minisSDK.generated.d.js";
40
+ import { useDeeplink as io } from "./hooks/navigation/useDeeplink.js";
41
+ import { useShopCartActions as no } from "./hooks/shop/useShopCartActions.js";
42
+ import { useRecommendedShops as uo } from "./hooks/shop/useRecommendedShops.js";
43
+ import { useErrorToast as so } from "./hooks/util/useErrorToast.js";
44
+ import { useErrorScreen as fo } from "./hooks/util/useErrorScreen.js";
45
+ import { useShare as go } from "./hooks/util/useShare.js";
46
+ import { useImagePicker as Po } from "./hooks/util/useImagePicker.js";
47
+ import { MiniEntityNotFoundError as So, MiniError as Ao, MiniNetworkError as ko, formatError as Lo } from "./utils/errors.js";
48
+ import { parseUrl as ho } from "./utils/parseUrl.js";
49
+ import { Consent as Io, ConsentStatus as bo, CurrencyCode as vo, Gender as Ro } from "./types/minisSDK.generated.d.js";
47
50
  export {
48
51
  b as Accordion,
49
52
  v as AccordionContent,
@@ -74,20 +77,20 @@ export {
74
77
  cr as CardDescription,
75
78
  ur as CardFooter,
76
79
  dr as CardHeader,
77
- sr as CardTitle,
80
+ pr as CardTitle,
78
81
  mr as Carousel,
79
82
  fr as CarouselContent,
80
- gr as CarouselItem,
81
- xr as CarouselNext,
83
+ xr as CarouselItem,
84
+ gr as CarouselNext,
82
85
  Cr as CarouselPrevious,
83
86
  Dr as Checkbox,
84
- Ao as Consent,
85
- Lo as ConsentStatus,
86
- To as CurrencyCode,
87
+ Io as Consent,
88
+ bo as ConsentStatus,
89
+ vo as CurrencyCode,
87
90
  Ar as Dialog,
88
- Lr as DialogClose,
89
- Tr as DialogContent,
90
- kr as DialogDescription,
91
+ kr as DialogClose,
92
+ Lr as DialogContent,
93
+ Tr as DialogDescription,
91
94
  hr as DialogFooter,
92
95
  wr as DialogHeader,
93
96
  Ir as DialogOverlay,
@@ -104,12 +107,12 @@ export {
104
107
  Nr as DrawerPortal,
105
108
  Ur as DrawerTitle,
106
109
  zr as DrawerTrigger,
107
- ko as Gender,
110
+ Ro as Gender,
108
111
  jr as Input,
109
112
  Jr as Label,
110
- fo as MiniEntityNotFoundError,
111
- go as MiniError,
112
- xo as MiniNetworkError,
113
+ So as MiniEntityNotFoundError,
114
+ Ao as MiniError,
115
+ ko as MiniNetworkError,
113
116
  o as MinisContainer,
114
117
  a as ProductCard,
115
118
  i as ProductCardBadge,
@@ -118,19 +121,19 @@ export {
118
121
  c as ProductCardImage,
119
122
  u as ProductCardImageContainer,
120
123
  d as ProductCardInfo,
121
- s as ProductCardOriginalPrice,
122
- p as ProductCardPrice,
124
+ p as ProductCardOriginalPrice,
125
+ s as ProductCardPrice,
123
126
  m as ProductCardRoot,
124
127
  f as ProductCardTitle,
125
- x as ProductLink,
128
+ g as ProductLink,
126
129
  C as ProductLinkActions,
127
130
  P as ProductLinkCurrentPrice,
128
131
  D as ProductLinkDiscountPrice,
129
132
  S as ProductLinkImage,
130
133
  A as ProductLinkInfo,
131
- L as ProductLinkOriginalPrice,
132
- T as ProductLinkPrice,
133
- k as ProductLinkRating,
134
+ k as ProductLinkOriginalPrice,
135
+ L as ProductLinkPrice,
136
+ T as ProductLinkRating,
134
137
  h as ProductLinkRoot,
135
138
  w as ProductLinkTitle,
136
139
  Qr as Progress,
@@ -147,31 +150,33 @@ export {
147
150
  ce as SelectItem,
148
151
  ue as SelectLabel,
149
152
  de as SelectScrollDownButton,
150
- se as SelectScrollUpButton,
151
- pe as SelectSeparator,
153
+ pe as SelectScrollUpButton,
154
+ se as SelectSeparator,
152
155
  me as SelectTrigger,
153
156
  fe as SelectValue,
154
- xe as Separator,
157
+ ge as Separator,
155
158
  Pe as Sheet,
156
159
  De as SheetClose,
157
160
  Se as SheetContent,
158
161
  Ae as SheetDescription,
159
- Le as SheetFooter,
160
- Te as SheetHeader,
161
- ke as SheetTitle,
162
+ ke as SheetFooter,
163
+ Le as SheetHeader,
164
+ Te as SheetTitle,
162
165
  he as SheetTrigger,
163
166
  Ie as Toaster,
164
167
  rr as badgeVariants,
165
168
  tr as buttonVariants,
166
- Co as formatError,
167
- Do as parseUrl,
169
+ Lo as formatError,
170
+ ho as parseUrl,
168
171
  Xe as useAsyncStorage,
169
172
  Ge as useBuyerAttributes,
170
173
  to as useCloseMini,
171
174
  ye as useCurrentUser,
172
- po as useErrorScreen,
173
- uo as useErrorToast,
175
+ io as useDeeplink,
176
+ fo as useErrorScreen,
177
+ so as useErrorToast,
174
178
  Fe as useFollowedShopsActions,
179
+ Po as useImagePicker,
175
180
  $e as useImageUpload,
176
181
  He as useOrders,
177
182
  Qe as usePopularProducts,
@@ -179,10 +184,11 @@ export {
179
184
  Ne as useProductListActions,
180
185
  ze as useProductLists,
181
186
  Je as useRecommendedProducts,
182
- no as useRecommendedShops,
187
+ uo as useRecommendedShops,
183
188
  ve as useSavedProductsActions,
184
189
  Ze as useSecureStorage,
185
- io as useShopCartActions,
190
+ go as useShare,
191
+ no as useShopCartActions,
186
192
  eo as useShopNavigation
187
193
  };
188
194
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,107 @@
1
+ import { jsxs as w, jsx as p } from "react/jsx-runtime";
2
+ import { useRef as o, useCallback as s, useEffect as x, useMemo as E, createContext as I, useContext as R } from "react";
3
+ const P = I(null);
4
+ function j() {
5
+ const f = R(P);
6
+ if (!f)
7
+ throw new Error(
8
+ "useImagePickerContext must be used within an ImagePickerProvider"
9
+ );
10
+ return f;
11
+ }
12
+ function G({ children: f }) {
13
+ const m = o(null), C = o(null), g = o(null), n = o(null), e = o(null), i = o(null), r = s(() => {
14
+ if (i.current) {
15
+ const { input: c, handler: t } = i.current;
16
+ c.removeEventListener("cancel", t), i.current = null;
17
+ }
18
+ }, []), a = s(() => {
19
+ e.current && (e.current(
20
+ new Error("New file picker opened before previous completed")
21
+ ), n.current = null, e.current = null);
22
+ }, []), d = s(
23
+ (c) => {
24
+ const t = c.target.files?.[0];
25
+ t && n.current && (n.current(t), n.current = null, e.current = null, r()), c.target.value = "";
26
+ },
27
+ [r]
28
+ ), h = s(() => new Promise((c, t) => {
29
+ a(), r(), n.current = c, e.current = t;
30
+ const u = m.current;
31
+ if (!u) {
32
+ t(new Error("Gallery input not found")), n.current = null, e.current = null;
33
+ return;
34
+ }
35
+ const l = () => {
36
+ e.current && (e.current(new Error("User cancelled file selection")), n.current = null, e.current = null), r();
37
+ };
38
+ u.addEventListener("cancel", l), i.current = { input: u, handler: l }, u.click();
39
+ }), [a, r]), v = s(
40
+ (c = "back") => new Promise((t, u) => {
41
+ a(), r(), n.current = t, e.current = u;
42
+ const l = c === "front" ? C.current : g.current;
43
+ if (!l) {
44
+ u(new Error("Camera input not found")), n.current = null, e.current = null;
45
+ return;
46
+ }
47
+ const y = () => {
48
+ e.current && (e.current(new Error("User cancelled camera")), n.current = null, e.current = null), r();
49
+ };
50
+ l.addEventListener("cancel", y), i.current = { input: l, handler: y }, l.click();
51
+ }),
52
+ [a, r]
53
+ );
54
+ x(() => () => {
55
+ a(), r();
56
+ }, [a, r]);
57
+ const k = E(
58
+ () => ({
59
+ openCamera: v,
60
+ openGallery: h
61
+ }),
62
+ [v, h]
63
+ );
64
+ return /* @__PURE__ */ w(P.Provider, { value: k, children: [
65
+ f,
66
+ /* @__PURE__ */ p(
67
+ "input",
68
+ {
69
+ ref: m,
70
+ type: "file",
71
+ accept: "image/*",
72
+ onChange: d,
73
+ style: { display: "none" },
74
+ "aria-hidden": "true"
75
+ }
76
+ ),
77
+ /* @__PURE__ */ p(
78
+ "input",
79
+ {
80
+ ref: C,
81
+ type: "file",
82
+ accept: "image/*",
83
+ capture: "user",
84
+ onChange: d,
85
+ style: { display: "none" },
86
+ "aria-hidden": "true"
87
+ }
88
+ ),
89
+ /* @__PURE__ */ p(
90
+ "input",
91
+ {
92
+ ref: g,
93
+ type: "file",
94
+ accept: "image/*",
95
+ capture: "environment",
96
+ onChange: d,
97
+ style: { display: "none" },
98
+ "aria-hidden": "true"
99
+ }
100
+ )
101
+ ] });
102
+ }
103
+ export {
104
+ G as ImagePickerProvider,
105
+ j as useImagePickerContext
106
+ };
107
+ //# sourceMappingURL=ImagePickerProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImagePickerProvider.js","sources":["../../src/providers/ImagePickerProvider.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useRef,\n useCallback,\n useEffect,\n useMemo,\n} from 'react'\n\nexport type CameraFacing = 'front' | 'back'\n\ninterface ImagePickerContextValue {\n openCamera: (cameraFacing?: CameraFacing) => Promise<File>\n openGallery: () => Promise<File>\n}\n\nconst ImagePickerContext = createContext<ImagePickerContextValue | null>(null)\n\nexport function useImagePickerContext() {\n const context = useContext(ImagePickerContext)\n if (!context) {\n throw new Error(\n 'useImagePickerContext must be used within an ImagePickerProvider'\n )\n }\n return context\n}\n\ninterface ImagePickerProviderProps {\n children: React.ReactNode\n}\n\nexport function ImagePickerProvider({children}: ImagePickerProviderProps) {\n const galleryInputRef = useRef<HTMLInputElement>(null)\n const frontCameraInputRef = useRef<HTMLInputElement>(null)\n const backCameraInputRef = useRef<HTMLInputElement>(null)\n const resolveRef = useRef<((file: File) => void) | null>(null)\n const rejectRef = useRef<((reason: Error) => void) | null>(null)\n const activeCancelHandlerRef = useRef<{\n input: HTMLInputElement\n handler: () => void\n } | null>(null)\n\n const cleanupCancelHandler = useCallback(() => {\n if (activeCancelHandlerRef.current) {\n const {input, handler} = activeCancelHandlerRef.current\n input.removeEventListener('cancel', handler)\n activeCancelHandlerRef.current = null\n }\n }, [])\n\n const rejectPendingPromise = useCallback(() => {\n if (rejectRef.current) {\n rejectRef.current(\n new Error('New file picker opened before previous completed')\n )\n resolveRef.current = null\n rejectRef.current = null\n }\n }, [])\n\n const handleFileChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0]\n\n if (file && resolveRef.current) {\n resolveRef.current(file)\n\n resolveRef.current = null\n rejectRef.current = null\n\n cleanupCancelHandler()\n }\n\n event.target.value = ''\n },\n [cleanupCancelHandler]\n )\n\n const openGallery = useCallback(() => {\n return new Promise<File>((resolve, reject) => {\n rejectPendingPromise()\n cleanupCancelHandler()\n\n resolveRef.current = resolve\n rejectRef.current = reject\n\n const input = galleryInputRef.current\n\n if (!input) {\n reject(new Error('Gallery input not found'))\n resolveRef.current = null\n rejectRef.current = null\n return\n }\n\n const handleCancel = () => {\n if (rejectRef.current) {\n rejectRef.current(new Error('User cancelled file selection'))\n resolveRef.current = null\n rejectRef.current = null\n }\n cleanupCancelHandler()\n }\n\n input.addEventListener('cancel', handleCancel)\n activeCancelHandlerRef.current = {input, handler: handleCancel}\n\n input.click()\n })\n }, [rejectPendingPromise, cleanupCancelHandler])\n\n const openCamera = useCallback(\n (cameraFacing: CameraFacing = 'back') => {\n return new Promise<File>((resolve, reject) => {\n rejectPendingPromise()\n cleanupCancelHandler()\n\n resolveRef.current = resolve\n rejectRef.current = reject\n\n const input =\n cameraFacing === 'front'\n ? frontCameraInputRef.current\n : backCameraInputRef.current\n\n if (!input) {\n reject(new Error('Camera input not found'))\n resolveRef.current = null\n rejectRef.current = null\n return\n }\n\n const handleCancel = () => {\n if (rejectRef.current) {\n rejectRef.current(new Error('User cancelled camera'))\n resolveRef.current = null\n rejectRef.current = null\n }\n cleanupCancelHandler()\n }\n\n input.addEventListener('cancel', handleCancel)\n activeCancelHandlerRef.current = {input, handler: handleCancel}\n\n input.click()\n })\n },\n [rejectPendingPromise, cleanupCancelHandler]\n )\n\n useEffect(() => {\n return () => {\n rejectPendingPromise()\n cleanupCancelHandler()\n }\n }, [rejectPendingPromise, cleanupCancelHandler])\n\n const contextValue: ImagePickerContextValue = useMemo(\n () => ({\n openCamera,\n openGallery,\n }),\n [openCamera, openGallery]\n )\n\n return (\n <ImagePickerContext.Provider value={contextValue}>\n {children}\n <input\n ref={galleryInputRef}\n type=\"file\"\n accept=\"image/*\"\n onChange={handleFileChange}\n style={{display: 'none'}}\n aria-hidden=\"true\"\n />\n <input\n ref={frontCameraInputRef}\n type=\"file\"\n accept=\"image/*\"\n capture=\"user\"\n onChange={handleFileChange}\n style={{display: 'none'}}\n aria-hidden=\"true\"\n />\n <input\n ref={backCameraInputRef}\n type=\"file\"\n accept=\"image/*\"\n capture=\"environment\"\n onChange={handleFileChange}\n style={{display: 'none'}}\n aria-hidden=\"true\"\n />\n </ImagePickerContext.Provider>\n )\n}\n"],"names":["ImagePickerContext","createContext","useImagePickerContext","context","useContext","ImagePickerProvider","children","galleryInputRef","useRef","frontCameraInputRef","backCameraInputRef","resolveRef","rejectRef","activeCancelHandlerRef","cleanupCancelHandler","useCallback","input","handler","rejectPendingPromise","handleFileChange","event","file","openGallery","resolve","reject","handleCancel","openCamera","cameraFacing","useEffect","contextValue","useMemo","jsxs","jsx"],"mappings":";;AAgBA,MAAM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A,MACL,YAAAJ;AAAA,MACA,aAAAJ;AAAA,IAAA;AAAA,IAEF,CAACI,GAAYJ,CAAW;AAAA,EAC1B;AAEA,SACG,gBAAAS,EAAA/B,EAAmB,UAAnB,EAA4B,OAAO6B,GACjC,UAAA;AAAA,IAAAvB;AAAA,IACD,gBAAA0B;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKzB;AAAA,QACL,MAAK;AAAA,QACL,QAAO;AAAA,QACP,UAAUY;AAAA,QACV,OAAO,EAAC,SAAS,OAAM;AAAA,QACvB,eAAY;AAAA,MAAA;AAAA,IACd;AAAA,IACA,gBAAAa;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKvB;AAAA,QACL,MAAK;AAAA,QACL,QAAO;AAAA,QACP,SAAQ;AAAA,QACR,UAAUU;AAAA,QACV,OAAO,EAAC,SAAS,OAAM;AAAA,QACvB,eAAY;AAAA,MAAA;AAAA,IACd;AAAA,IACA,gBAAAa;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKtB;AAAA,QACL,MAAK;AAAA,QACL,QAAO;AAAA,QACP,SAAQ;AAAA,QACR,UAAUS;AAAA,QACV,OAAO,EAAC,SAAS,OAAM;AAAA,QACvB,eAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"minisSDK.generated.d.js","sources":["../../src/types/minisSDK.generated.d.ts"],"sourcesContent":["/* eslint-disable @shopify/typescript/prefer-pascal-case-enums */\n// Auto-generated type definitions for MinisSDK\n// Generated on: 2025-06-16T14:51:57.942Z\n// Do not edit this file manually - run the generation script instead\n// Source: useShopActionsImplementationV3.ts + shopActionsV3Definitions.ts + shopActionsV3Types.ts\n// Generated using TypeScript compiler API for reliable AST parsing\n//\n// This file is self-contained and can be shipped independently\n\n// ============================================================================\n// Base Types (extracted using TypeScript AST parsing)\n// ============================================================================\n\nexport interface ApiKeys {\n refreshToken: string\n accessToken: string\n}\n\nexport interface ShopActionOk<T> {\n ok: true\n data: T\n}\n\nexport interface ShopActionError {\n ok: false\n error: Error & {code?: string}\n}\n\nexport type ShopActionResult<T = void> = ShopActionOk<T> | ShopActionError\n\nexport interface ShopActions {\n getShopAppInformation: () => Promise<\n ShopActionResult<GetShopAppInformationResponse>\n >\n productRecommendationImpression(\n params: ProductRecommendationImpressionParams\n ): Promise<ShopActionResult>\n productRecommendationClick(\n params: ProductRecommendationClickParams\n ): Promise<ShopActionResult>\n hideEntryPoint(): Promise<ShopActionResult>\n closeMini(): Promise<ShopActionResult>\n\n // account actions\n followShop(params: FollowShopParams): Promise<ShopActionResult<boolean>>\n unfollowShop(params: UnfollowShopParams): Promise<ShopActionResult<boolean>>\n favorite(params: FavoriteParams): Promise<ShopActionResult>\n unfavorite(params: UnfavoriteParams): Promise<ShopActionResult>\n getAccountInformation: (\n params: GetAccountInformationParams\n ) => Promise<ShopActionResult<GetAccountInformationResponse>>\n\n // user actions\n getCurrentUser(\n params?: GetCurrentUserParams\n ): Promise<ShopActionResult<GetCurrentUserResponse>>\n\n // product actions\n createOrderAttribution(\n params: CreateOrderAttributionParams\n ): Promise<ShopActionResult>\n addToCart(params: AddToCartParams): Promise<ShopActionResult>\n buyProduct(params: BuyProductParams): Promise<ShopActionResult>\n buyProducts(params: BuyProductsParams): Promise<ShopActionResult>\n\n // error actions\n showErrorScreen: (params: ShowErrorScreenParams) => Promise<ShopActionResult>\n showErrorToast: (message: ShowErrorToastParams) => Promise<ShopActionResult>\n\n // deeplink actions\n getDeeplinkPaths(): Promise<ShopActionResult<GetDeeplinkPathsResponse>>\n navigateToDeeplink(\n params: NavigateToDeeplinkParams\n ): Promise<ShopActionResult>\n\n // navigation actions\n navigateToShop(params: NavigateToShopParams): Promise<ShopActionResult>\n navigateToProduct(params: NavigateToProductParams): Promise<ShopActionResult>\n navigateToOrder(params: NavigateToOrderParams): Promise<ShopActionResult>\n navigateToCheckout(\n params: NavigateToCheckoutParams\n ): Promise<ShopActionResult>\n\n // image upload actions\n createImageUploadLink(\n params: CreateImageUploadLinkParams\n ): Promise<ShopActionResult<CreateImageUploadLinkResponse>>\n completeImageUpload(\n params: CompleteImageUploadParams\n ): Promise<ShopActionResult<CompleteImageUploadResponse>>\n\n // async storage actions\n getPersistedItem(\n params: GetAsyncStorageItemParams\n ): Promise<ShopActionResult<string | null>>\n setPersistedItem(params: SetAsyncStorageItemParams): Promise<ShopActionResult>\n removePersistedItem(\n params: RemoveAsyncStorageItemParams\n ): Promise<ShopActionResult>\n getAllPersistedKeys(): Promise<ShopActionResult<string[]>>\n clearPersistedItems(): Promise<ShopActionResult>\n\n getInternalPersistedItem(\n params: GetAsyncStorageItemParams\n ): Promise<ShopActionResult<string | null>>\n setInternalPersistedItem(\n params: SetAsyncStorageItemParams\n ): Promise<ShopActionResult>\n removeInternalPersistedItem(\n params: RemoveAsyncStorageItemParams\n ): Promise<ShopActionResult>\n getAllInternalPersistedKeys(): Promise<ShopActionResult<string[]>>\n clearInternalPersistedItems(): Promise<ShopActionResult>\n\n // secure storage actions\n getSecret(): Promise<ShopActionResult<string | null>>\n setSecret(params: SetSecretParams): Promise<ShopActionResult>\n removeSecret(): Promise<ShopActionResult>\n\n // event reporting actions\n reportInteraction(params: ReportInteractionParams): Promise<ShopActionResult>\n reportImpression(params: ReportImpressionParams): Promise<ShopActionResult>\n reportContentImpression(\n params: ReportContentImpressionParams\n ): Promise<ShopActionResult>\n\n getProductLists(\n params?: GetProductListsParams\n ): Promise<ShopActionResult<GetProductListsResponse>>\n\n getProductList(\n params?: GetProductListParams\n ): Promise<ShopActionResult<GetProductListResponse>>\n\n // product list actions\n addProductList(\n params: AddProductListParams\n ): Promise<ShopActionResult<ProductList>>\n removeProductList(params: RemoveProductListParams): Promise<ShopActionResult>\n renameProductList: (\n params: RenameProductListParams\n ) => Promise<ShopActionResult<ProductList>>\n addProductListItem(\n params: AddProductListItemParams\n ): Promise<ShopActionResult>\n removeProductListItem(\n params: RemoveProductListItemParams\n ): Promise<ShopActionResult>\n\n // recommendations actions\n getRecommendedProducts(\n params?: GetRecommendedProductsParams\n ): Promise<ShopActionResult<GetRecommendedProductsResponse>>\n getRecommendedShops(\n params?: GetRecommendedShopsParams\n ): Promise<ShopActionResult<GetRecommendedShopsResponse>>\n searchProductsByShop(\n params?: SearchProductsByShopParams\n ): Promise<ShopActionResult<SearchProductsByShopResponse>>\n\n // orders list actions\n getOrders(\n params?: GetOrdersParams\n ): Promise<ShopActionResult<GetOrdersResponse>>\n\n getBuyerAttributes(): Promise<ShopActionResult<GetBuyerAttributesResponse>>\n\n // content actions\n showFeedbackSheet(params: ShowFeedbackSheetParams): Promise<ShopActionResult>\n\n getPopularProducts(\n params?: GetPopularProductsParams\n ): Promise<ShopActionResult<GetPopularProductsResponse>>\n}\n\nexport interface AuthShopActions {\n refreshAccessToken(\n params: RefreshAccessTokenParams\n ): Promise<ShopActionResult<ApiKeys>>\n signOut(): Promise<ShopActionResult>\n}\n\nexport type AllShopActions = ShopActions & AuthShopActions\n\nexport type ShopActionParams<T extends keyof AllShopActions> = Parameters<\n AllShopActions[T]\n>[0]\n\nexport interface FavoriteParams {\n shopId: string\n productId: string\n productVariantId: string\n}\n\nexport interface UnfavoriteParams {\n shopId: string\n productId: string\n productVariantId: string\n}\n\nexport interface LineItemAttribution {\n sourceName: string\n sourceIdentifier: string\n}\n\nexport interface CreateOrderAttributionParams {\n orderId: string\n productVariantId: string\n attribution?: LineItemAttribution\n}\n\nexport interface AddToCartParams extends BuyProductLineItem {\n /**\n * The discount codes to apply to the cart.\n */\n discountCodes?: string[]\n /**\n * Attribution data for the line item.\n * @deprecated\n */\n attribution?: LineItemAttribution\n}\n\nexport interface BuyProductLineItem {\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * The GID of the product variant. E.g. `gid://shopify/ProductVariant/456`.\n */\n productVariantId: string\n /**\n * The quantity of the product to add to the cart.\n */\n quantity?: number\n}\n\nexport interface BuyProductsParams {\n items: [BuyProductLineItem, ...BuyProductLineItem[]] // at least one item\n attribution?: LineItemAttribution\n discountCode?: string\n}\n\nexport interface BuyProductParams extends BuyProductLineItem {\n /**\n * Attribution data for the line item.\n * @deprecated\n */\n attribution?: LineItemAttribution\n /**\n * The discount code to apply to the product.\n */\n discountCode?: string\n}\n\nexport interface UpdateLineItemAttributesParams {\n lineItemAttributes: {key: string; value: string}[]\n attribution?: LineItemAttribution\n}\n\nexport interface NavigateToShopParams {\n shopId: string\n /**\n * @deprecated\n */\n shopName?: string\n}\n\nexport interface NavigateToOrderParams {\n /**\n * The GID of the order. E.g. `gid://shopify/Order/123`.\n */\n orderId: string\n}\n\nexport interface NavigateToCheckoutParams {\n /**\n * The GID of the shop. E.g. `gid://shopify/Shop/123`.\n */\n shopId: string\n}\n\nexport interface NavigateToProductParams {\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * If present, the GID of the variant that should be initially selected\n */\n productVariantId?: string\n /*\n * Variants displayed in the product details screen will be limited to those\n * whose ID is included in this list.\n */\n includedProductVariantGIDs?: string[]\n /**\n * @deprecated use includedProductVariantGIDs instead\n */\n includedProductVariantIds?: string[]\n /**\n * @deprecated do not use\n */\n attribution?: LineItemAttribution\n /**\n * The discount code to apply to the product.\n */\n discountCode?: string\n}\n\nexport interface RefreshAccessTokenParams {\n refreshToken: string\n}\n\nexport interface ProductRecommendationImpressionParams {\n // The product GID string\n productId: string\n // Optional section id, could be useful for tracking which UI sections get impressions\n sectionId?: string\n}\n\nexport interface ProductRecommendationClickParams {\n productId: string\n sectionId?: string\n}\n\nexport interface ShowErrorScreenParams {\n /**\n * The message to display in the error screen.\n */\n message?: string\n /**\n * The title of the error screen.\n */\n title?: string\n}\n\nexport interface ShowErrorToastParams {\n message?: string\n}\n\nexport interface GetAccountInformationParams {\n /**\n * To use user account information, a shopId must be given to track on\n * which shop's behalf user information is being accessed\n */\n shopId: string\n type: 'email' | 'name' | 'phone'\n}\n\nexport interface AccountInformationPhoneInfo {\n phoneNumber: string\n countryCode: string\n prefix: string\n}\n\nexport interface GetAccountInformationResponse {\n status: 'available' | 'not-available'\n value?: string | AccountInformationPhoneInfo\n}\n\nexport interface GetShopAppInformationResponse {\n appVersion: string\n buildNumber: string\n buildId: string\n}\n\nexport interface FollowShopParams {\n shopId: string\n}\n\nexport interface UnfollowShopParams {\n shopId: string\n}\n\nexport interface NavigateToDeeplinkParams {\n deeplink: string\n}\n\nexport interface GetDeeplinkPathsResponse {\n matchers: string[]\n}\n\nexport interface ProductRecommendationClickParams {\n productId: string\n productVariantId?: string\n variantGIDs?: string[]\n discountCode?: string\n attribution?: LineItemAttribution\n sectionId?: string\n}\n\nexport interface CreateImageUploadLinkParams {\n input: {\n mimeType: string\n fileSize: number\n }[]\n}\n\nexport interface UploadTarget {\n url: string\n resourceUrl: string\n parameters: {name: string; value: string}[]\n}\n\nexport interface CreateImageUploadLinkResponse {\n targets?: UploadTarget[]\n error?: string\n}\n\nexport interface CompleteImageUploadParams {\n resourceUrls: string[]\n}\n\nexport interface CompleteImageUploadResponse {\n files?: {\n id: string\n fileStatus: 'FAILED' | 'PENDING' | 'PROCESSING' | 'READY'\n image?: {\n url: string\n } | null\n }[]\n error?: string\n}\n\nexport interface PaginationInfo {\n hasNextPage: boolean\n endCursor: string | null\n}\n\nexport interface GetProductListsResponse {\n data: ProductList[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetProductListResponse {\n data: ProductList | null\n pageInfo: PaginationInfo\n}\n\nexport interface GetRecommendedProductsResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetRecommendedShopsResponse {\n data: Shop[]\n pageInfo: PaginationInfo\n}\n\nexport interface SearchProductsByShopResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetBuyerAttributesResponse {\n data: {\n genderAffinity?: Gender\n categoryAffinities: TaxonomyCategory[]\n }\n}\n\nexport interface GetCurrentUserResponse {\n data: UserProfile\n}\n\nexport interface GetOrdersResponse {\n data: Order[]\n pageInfo: PaginationInfo\n}\n\nexport interface SetSecretParams {\n value: string\n}\n\nexport interface SetAsyncStorageItemParams {\n key: string\n value: string\n}\n\nexport interface GetAsyncStorageItemParams {\n key: string\n}\n\nexport interface RemoveAsyncStorageItemParams {\n key: string\n}\n\nexport interface ReportInteractionParams {\n interactionType: string\n interactionValue?: string\n pageValue?: string\n}\n\nexport interface ReportImpressionParams {\n subjectType?: string\n subjectId?: string\n pageValue?: string\n}\n\nexport interface ReportContentImpressionParams {\n publicId: string\n pageValue?: string\n}\n\nexport interface GetProductListsParams {\n /**\n * The number of lists to fetch.\n */\n first?: number\n /**\n * The cursor to fetch the next page of lists.\n */\n after?: string\n /**\n * The number of items per list to fetch.\n */\n itemsFirst?: number\n /**\n * The fetch policy to use.\n */\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductListParams {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id?: string\n /**\n * The public ID of the product list.\n */\n publicId?: string\n /**\n * The number of items to fetch.\n */\n first?: number\n /**\n * The cursor to fetch the next page of items.\n */\n after?: string\n /**\n * The fetch policy to use.\n */\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface AddProductListParams {\n /**\n * The name of the product list.\n */\n name: string\n /**\n * A description of the product list.\n */\n description?: string\n}\n\nexport interface RemoveProductListParams {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id: string\n}\n\nexport interface RenameProductListParams {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id: string\n /**\n * The new name of the product list.\n */\n name: string\n}\n\nexport interface AddProductListItemParams {\n /**\n * The GID of the shop. E.g. `gid://shopify/Shop/42`.\n */\n shopId: string\n /**\n * The GID of the product variant. E.g. `gid://shopify/ProductVariant/101`.\n */\n productVariantId: string\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n * This will soon be deprecated in favor of just `publicListId`.\n */\n listId: string\n /**\n * The public ID of the product list.\n */\n publicListId: string\n}\n\nexport interface RemoveProductListItemParams {\n /**\n * The GID of the shop. E.g. `gid://shopify/Shop/42`.\n */\n shopId: string\n /**\n * The GID of the product variant. E.g. `gid://shopify/ProductVariant/101`.\n */\n productVariantId: string\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n * This will soon be deprecated in favor of just `publicListId`.\n */\n listId: string\n /**\n * The public ID of the product list.\n */\n publicListId: string\n}\n\nexport interface GetRecommendedProductsParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetRecommendedShopsParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface SearchProductsByShopParams {\n shopId: string\n query?: string\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetBuyerAttributesParams {\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetCurrentUserParams {\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetOrdersParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetPopularProductsParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetPopularProductsResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface PreviewProductInARParams {\n id: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetCuratedProductsParams {\n handle: string\n requiredTags: string[]\n anyOfTags: string[]\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetCuratedProductsResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetProductMediaParams {\n id: string\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductMediaResponse {\n data: ProductMedia[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetProductsParams {\n productIds: string[]\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductsResponse {\n data: Product[]\n}\n\nexport interface GetProductParams {\n id: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductResponse {\n data: Product\n}\n\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby'\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network'\n\nexport enum CurrencyCode {\n AED = 'AED',\n AFN = 'AFN',\n ALL = 'ALL',\n AMD = 'AMD',\n ANG = 'ANG',\n AOA = 'AOA',\n ARS = 'ARS',\n AUD = 'AUD',\n AWG = 'AWG',\n AZN = 'AZN',\n BAM = 'BAM',\n BBD = 'BBD',\n BDT = 'BDT',\n BGN = 'BGN',\n BHD = 'BHD',\n BIF = 'BIF',\n BMD = 'BMD',\n BND = 'BND',\n BOB = 'BOB',\n BRL = 'BRL',\n BSD = 'BSD',\n BTN = 'BTN',\n BWP = 'BWP',\n BYN = 'BYN',\n BYR = 'BYR',\n BZD = 'BZD',\n CAD = 'CAD',\n CDF = 'CDF',\n CHF = 'CHF',\n CLP = 'CLP',\n CNY = 'CNY',\n COP = 'COP',\n CRC = 'CRC',\n CVE = 'CVE',\n CZK = 'CZK',\n DJF = 'DJF',\n DKK = 'DKK',\n DOP = 'DOP',\n DZD = 'DZD',\n EGP = 'EGP',\n ERN = 'ERN',\n ETB = 'ETB',\n EUR = 'EUR',\n FJD = 'FJD',\n FKP = 'FKP',\n GBP = 'GBP',\n GEL = 'GEL',\n GHS = 'GHS',\n GIP = 'GIP',\n GMD = 'GMD',\n GNF = 'GNF',\n GTQ = 'GTQ',\n GYD = 'GYD',\n HKD = 'HKD',\n HNL = 'HNL',\n HRK = 'HRK',\n HTG = 'HTG',\n HUF = 'HUF',\n IDR = 'IDR',\n ILS = 'ILS',\n INR = 'INR',\n IQD = 'IQD',\n IRR = 'IRR',\n ISK = 'ISK',\n JEP = 'JEP',\n JMD = 'JMD',\n JOD = 'JOD',\n JPY = 'JPY',\n KES = 'KES',\n KGS = 'KGS',\n KHR = 'KHR',\n KID = 'KID',\n KMF = 'KMF',\n KRW = 'KRW',\n KWD = 'KWD',\n KYD = 'KYD',\n KZT = 'KZT',\n LAK = 'LAK',\n LBP = 'LBP',\n LKR = 'LKR',\n LRD = 'LRD',\n LSL = 'LSL',\n LTL = 'LTL',\n LVL = 'LVL',\n LYD = 'LYD',\n MAD = 'MAD',\n MDL = 'MDL',\n MGA = 'MGA',\n MKD = 'MKD',\n MMK = 'MMK',\n MNT = 'MNT',\n MOP = 'MOP',\n MRU = 'MRU',\n MUR = 'MUR',\n MVR = 'MVR',\n MWK = 'MWK',\n MXN = 'MXN',\n MYR = 'MYR',\n MZN = 'MZN',\n NAD = 'NAD',\n NGN = 'NGN',\n NIO = 'NIO',\n NOK = 'NOK',\n NPR = 'NPR',\n NZD = 'NZD',\n OMR = 'OMR',\n PAB = 'PAB',\n PEN = 'PEN',\n PGK = 'PGK',\n PHP = 'PHP',\n PKR = 'PKR',\n PLN = 'PLN',\n PYG = 'PYG',\n QAR = 'QAR',\n RON = 'RON',\n RSD = 'RSD',\n RUB = 'RUB',\n RWF = 'RWF',\n SAR = 'SAR',\n SBD = 'SBD',\n SCR = 'SCR',\n SDG = 'SDG',\n SEK = 'SEK',\n SGD = 'SGD',\n SHP = 'SHP',\n SLL = 'SLL',\n SOS = 'SOS',\n SRD = 'SRD',\n SSP = 'SSP',\n STD = 'STD',\n STN = 'STN',\n SYP = 'SYP',\n SZL = 'SZL',\n THB = 'THB',\n TJS = 'TJS',\n TMT = 'TMT',\n TND = 'TND',\n TOP = 'TOP',\n TRY = 'TRY',\n TTD = 'TTD',\n TWD = 'TWD',\n TZS = 'TZS',\n UAH = 'UAH',\n UGX = 'UGX',\n USD = 'USD',\n UYU = 'UYU',\n UZS = 'UZS',\n VED = 'VED',\n VEF = 'VEF',\n VES = 'VES',\n VND = 'VND',\n VUV = 'VUV',\n WST = 'WST',\n XAF = 'XAF',\n XCD = 'XCD',\n XOF = 'XOF',\n XPF = 'XPF',\n XXX = 'XXX',\n YER = 'YER',\n ZAR = 'ZAR',\n ZMW = 'ZMW',\n}\n\nexport type Decimal = string\n\nexport type MiniAppParams = any\n\nexport interface MiniAppConfig<\n _DeprecatedParams extends MiniAppParams = undefined,\n> {\n /**\n * Root component of used inside the Minis Viewer\n */\n ViewerRoot: () => JSX.Element | null\n}\n\nexport interface MiniManifest {\n trusted_domains?: string[]\n permissions?: string[]\n [key: string]: any\n}\n\nexport type Permission = 'CAMERA' | 'GALLERY' | 'MICROPHONE'\n\nexport interface Money {\n amount: Decimal\n currencyCode: CurrencyCode\n}\n\nexport interface ProductImage {\n id?: string | null\n altText?: string | null\n url: string\n sensitive?: boolean | null\n}\n\nexport interface ProductVariant {\n id: string\n isFavorited: boolean\n image?: ProductImage | null\n price: Money\n compareAtPrice?: Money | null\n}\n\nexport interface ProductShop {\n id: string\n name: string\n}\n\nexport type ProductMedia =\n | {\n id: string\n image: ProductImage | null\n mediaContentType: 'IMAGE'\n alt: string | null\n }\n | {\n id: string\n mediaContentType: 'MODEL_3D'\n previewImage: ProductImage | null\n sources: {\n filesize: number\n format: string\n mimeType: string\n url: string\n }[]\n alt: string | null\n }\n | {\n id: string\n mediaContentType: 'VIDEO'\n previewImage: ProductImage | null\n sources: {\n format: string\n mimeType: string\n url: string\n width: number\n height: number\n }[]\n alt: string | null\n }\n | {\n id: string\n mediaContentType: 'EXTERNAL_VIDEO'\n previewImage: ProductImage | null\n embedUrl: string\n alt: string | null\n }\n\nexport interface Product {\n id: string\n title: string\n reviewAnalytics: {\n averageRating?: number | null\n reviewCount?: number | null\n }\n shop: ProductShop\n selectedVariant?: ProductVariant\n defaultVariantId: string\n isFavorited: boolean\n variants?: ProductVariant[]\n featuredImage?: ProductImage | null\n price: Money\n compareAtPrice?: Money | null\n}\n\nexport interface Shop {\n id: string\n name: string\n isFollowing?: boolean | null\n shareUrl?: string | null\n primaryDomain: {\n url: string\n }\n logoImage?: ProductImage | null\n reviewAnalytics: {\n averageRating?: number | null\n reviewCount: number\n }\n}\n\nexport interface QueryOptions {\n fetchPolicy?: WatchQueryFetchPolicy\n skip?: boolean\n}\n\nexport interface ProductList {\n id: string\n publicId: string | null\n name: string | null\n products: Product[]\n}\n\nexport interface Order {\n id: string\n name: string\n lineItems: {\n productTitle: string\n variantTitle: string | null\n quantity: number\n product: Product | null\n }[]\n shop: Shop | null\n}\n\nexport interface BuyerAttributes {\n genderAffinity?: Gender\n categoryAffinities: TaxonomyCategory[]\n}\n\nexport enum Gender {\n Male = 'MALE',\n Female = 'FEMALE',\n Neutral = 'NEUTRAL',\n}\n\nexport interface TaxonomyCategory {\n id: string\n name: string\n ancestors?: TaxonomyCategory[]\n}\n\n/**\n * A user profile.\n */\nexport interface UserProfile {\n /**\n * The display name of the user.\n */\n displayName?: string | null\n /**\n * The avatar image of the user.\n */\n avatarImage?: {\n url: string\n } | null\n}\n\n/**\n * A user metafield.\n */\nexport interface UserMetafield {\n /**\n * The key of the user metafield.\n */\n key: string\n /**\n * The value of the user metafield.\n */\n value: string\n}\n\nexport interface ContentImage {\n id: string | null\n url: string\n width: number | null\n height: number | null\n}\n\nexport interface ContentProduct {\n id: string\n title: string\n featuredImage: ContentImage | null\n}\n\nexport type ContentVisibility = 'DISCOVERABLE' | 'LINKABLE'\n\nexport interface Content {\n publicId: string\n externalId: string | null\n image: ContentImage\n title: string\n description: string | null\n visibility: ContentVisibility[]\n shareableUrl: string | null\n products: ContentProduct[] | null\n}\n\n/**\n * The fetch policy to use. `cache-first` will only fetch from the network if there is no\n * cached data. `network-only` will fetch from the network regardless of whether there\n * is cached data.\n */\nexport type DataHookFetchPolicy = 'cache-first' | 'network-only'\n\nexport interface DataHookOptionsBase {\n /**\n * When true, the data will not be fetched immediately.\n */\n skip?: boolean\n /**\n * The fetch policy to use for the initial data load. Subsequent loads may use different policies.\n */\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface PaginatedDataHookOptionsBase extends DataHookOptionsBase {\n /**\n * The number of products to fetch.\n * @default 20\n */\n first?: number\n}\n\nexport interface DataHookReturnsBase {\n /**\n * Whether data is loading. Represents the initial data load but not `refetch`/`fetchMore` calls.\n */\n loading: boolean\n /**\n * The error that occurred while loading. Represents the initial data load and `refetch` calls but not `fetchMore`\n */\n error: Error | null\n /**\n * Refetch the data. Data is updated in place. The `loading` state will not update but the `error` state will.\n */\n refetch: () => Promise<void>\n}\n\nexport interface PaginatedDataHookReturnsBase extends DataHookReturnsBase {\n /**\n * Whether there is a next page to fetch.\n */\n hasNextPage: boolean\n /**\n * Fetch more data. Data is updated in place. The `loading` and `error` states will not update\n */\n fetchMore: () => Promise<void>\n}\n\nexport const Consent = {\n MiniConsent: 'mini_consent',\n CameraConsent: 'camera_consent',\n PhotoLibraryConsent: 'photo_library_consent',\n MicrophoneConsent: 'microphone_consent',\n} as const\n\nexport const ConsentStatus = {\n Granted: 'granted',\n Dismissed: 'dismissed',\n Idle: 'idle',\n} as const\n\nexport type ConsentType = (typeof Consent)[keyof typeof Consent]\n\nexport type ConsentStatusType =\n (typeof ConsentStatus)[keyof typeof ConsentStatus]\n\nexport interface PaginatedDataHookPageInfo {\n /**\n * Whether there is a next page to fetch.\n */\n hasNextPage: boolean\n /**\n * The cursor to use for the next page of data.\n */\n endCursor: string | null\n}\n\ndeclare global {\n interface Window {\n minisSDK: ShopActions\n }\n}\n\nexport {}\n"],"names":["CurrencyCode","Gender","Consent","ConsentStatus"],"mappings":"AAwtBY,IAAAA,sBAAAA,OACVA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA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NA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OAjKIA,IAAAA,KAAA,CAAA,CAAA,GAuTAC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,UAAU,WAHAA,IAAAA,KAAA,CAAA,CAAA;AAwHL,MAAMC,IAAU;AAAA,EACrB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,mBAAmB;AACrB,GAEaC,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AACR;"}
1
+ {"version":3,"file":"minisSDK.generated.d.js","sources":["../../src/types/minisSDK.generated.d.ts"],"sourcesContent":["/* eslint-disable @shopify/typescript/prefer-pascal-case-enums */\n// Auto-generated type definitions for MinisSDK\n// Generated on: 2025-06-18T10:56:57.588Z\n// Do not edit this file manually - run the generation script instead\n// Source: useShopActionsImplementationV3.ts + shopActionsV3Definitions.ts + shopActionsV3Types.ts\n// Generated using TypeScript compiler API for reliable AST parsing\n//\n// This file is self-contained and can be shipped independently\n\n// ============================================================================\n// Base Types (extracted using TypeScript AST parsing)\n// ============================================================================\n\nexport interface ApiKeys {\n refreshToken: string\n accessToken: string\n}\n\nexport interface ShopActionOk<T> {\n ok: true\n data: T\n}\n\nexport interface ShopActionError {\n ok: false\n error: Error & {code?: string}\n}\n\nexport type ShopActionResult<T = void> = ShopActionOk<T> | ShopActionError\n\nexport interface ShopActions {\n getShopAppInformation: () => Promise<\n ShopActionResult<GetShopAppInformationResponse>\n >\n productRecommendationImpression(\n params: ProductRecommendationImpressionParams\n ): Promise<ShopActionResult>\n productRecommendationClick(\n params: ProductRecommendationClickParams\n ): Promise<ShopActionResult>\n hideEntryPoint(): Promise<ShopActionResult>\n closeMini(): Promise<ShopActionResult>\n\n // account actions\n followShop(params: FollowShopParams): Promise<ShopActionResult<boolean>>\n unfollowShop(params: UnfollowShopParams): Promise<ShopActionResult<boolean>>\n favorite(params: FavoriteParams): Promise<ShopActionResult>\n unfavorite(params: UnfavoriteParams): Promise<ShopActionResult>\n getAccountInformation: (\n params: GetAccountInformationParams\n ) => Promise<ShopActionResult<GetAccountInformationResponse>>\n\n // user actions\n getCurrentUser(\n params?: GetCurrentUserParams\n ): Promise<ShopActionResult<GetCurrentUserResponse>>\n\n // product actions\n createOrderAttribution(\n params: CreateOrderAttributionParams\n ): Promise<ShopActionResult>\n addToCart(params: AddToCartParams): Promise<ShopActionResult>\n buyProduct(params: BuyProductParams): Promise<ShopActionResult>\n buyProducts(params: BuyProductsParams): Promise<ShopActionResult>\n\n // error actions\n showErrorScreen: (params: ShowErrorScreenParams) => Promise<ShopActionResult>\n showErrorToast: (message: ShowErrorToastParams) => Promise<ShopActionResult>\n\n // deeplink actions\n getDeeplinkPaths(): Promise<ShopActionResult<GetDeeplinkPathsResponse>>\n navigateToDeeplink(\n params: NavigateToDeeplinkParams\n ): Promise<ShopActionResult>\n\n // navigation actions\n navigateToShop(params: NavigateToShopParams): Promise<ShopActionResult>\n navigateToProduct(params: NavigateToProductParams): Promise<ShopActionResult>\n navigateToOrder(params: NavigateToOrderParams): Promise<ShopActionResult>\n navigateToCheckout(\n params: NavigateToCheckoutParams\n ): Promise<ShopActionResult>\n\n // image upload actions\n createImageUploadLink(\n params: CreateImageUploadLinkParams\n ): Promise<ShopActionResult<CreateImageUploadLinkResponse>>\n completeImageUpload(\n params: CompleteImageUploadParams\n ): Promise<ShopActionResult<CompleteImageUploadResponse>>\n\n // async storage actions\n getPersistedItem(\n params: GetAsyncStorageItemParams\n ): Promise<ShopActionResult<string | null>>\n setPersistedItem(params: SetAsyncStorageItemParams): Promise<ShopActionResult>\n removePersistedItem(\n params: RemoveAsyncStorageItemParams\n ): Promise<ShopActionResult>\n getAllPersistedKeys(): Promise<ShopActionResult<string[]>>\n clearPersistedItems(): Promise<ShopActionResult>\n\n getInternalPersistedItem(\n params: GetAsyncStorageItemParams\n ): Promise<ShopActionResult<string | null>>\n setInternalPersistedItem(\n params: SetAsyncStorageItemParams\n ): Promise<ShopActionResult>\n removeInternalPersistedItem(\n params: RemoveAsyncStorageItemParams\n ): Promise<ShopActionResult>\n getAllInternalPersistedKeys(): Promise<ShopActionResult<string[]>>\n clearInternalPersistedItems(): Promise<ShopActionResult>\n\n // secure storage actions\n getSecret(): Promise<ShopActionResult<string | null>>\n setSecret(params: SetSecretParams): Promise<ShopActionResult>\n removeSecret(): Promise<ShopActionResult>\n\n // event reporting actions\n reportInteraction(params: ReportInteractionParams): Promise<ShopActionResult>\n reportImpression(params: ReportImpressionParams): Promise<ShopActionResult>\n reportContentImpression(\n params: ReportContentImpressionParams\n ): Promise<ShopActionResult>\n\n getProductLists(\n params?: GetProductListsParams\n ): Promise<ShopActionResult<GetProductListsResponse>>\n\n getProductList(\n params?: GetProductListParams\n ): Promise<ShopActionResult<GetProductListResponse>>\n\n // product list actions\n addProductList(\n params: AddProductListParams\n ): Promise<ShopActionResult<ProductList>>\n removeProductList(params: RemoveProductListParams): Promise<ShopActionResult>\n renameProductList: (\n params: RenameProductListParams\n ) => Promise<ShopActionResult<ProductList>>\n addProductListItem(\n params: AddProductListItemParams\n ): Promise<ShopActionResult>\n removeProductListItem(\n params: RemoveProductListItemParams\n ): Promise<ShopActionResult>\n\n // recommendations actions\n getRecommendedProducts(\n params?: GetRecommendedProductsParams\n ): Promise<ShopActionResult<GetRecommendedProductsResponse>>\n getRecommendedShops(\n params?: GetRecommendedShopsParams\n ): Promise<ShopActionResult<GetRecommendedShopsResponse>>\n searchProductsByShop(\n params?: SearchProductsByShopParams\n ): Promise<ShopActionResult<SearchProductsByShopResponse>>\n\n // orders list actions\n getOrders(\n params?: GetOrdersParams\n ): Promise<ShopActionResult<GetOrdersResponse>>\n\n getBuyerAttributes(): Promise<ShopActionResult<GetBuyerAttributesResponse>>\n\n // content actions\n showFeedbackSheet(params: ShowFeedbackSheetParams): Promise<ShopActionResult>\n\n getPopularProducts(\n params?: GetPopularProductsParams\n ): Promise<ShopActionResult<GetPopularProductsResponse>>\n\n share(params: ShareParams): Promise<ShopActionResult>\n}\n\nexport interface AuthShopActions {\n refreshAccessToken(\n params: RefreshAccessTokenParams\n ): Promise<ShopActionResult<ApiKeys>>\n signOut(): Promise<ShopActionResult>\n}\n\nexport type AllShopActions = ShopActions & AuthShopActions\n\nexport type ShopActionParams<T extends keyof AllShopActions> = Parameters<\n AllShopActions[T]\n>[0]\n\nexport interface FavoriteParams {\n shopId: string\n productId: string\n productVariantId: string\n}\n\nexport interface UnfavoriteParams {\n shopId: string\n productId: string\n productVariantId: string\n}\n\nexport interface LineItemAttribution {\n sourceName: string\n sourceIdentifier: string\n}\n\nexport interface CreateOrderAttributionParams {\n orderId: string\n productVariantId: string\n attribution?: LineItemAttribution\n}\n\nexport interface AddToCartParams extends BuyProductLineItem {\n /**\n * The discount codes to apply to the cart.\n */\n discountCodes?: string[]\n /**\n * Attribution data for the line item.\n * @deprecated\n */\n attribution?: LineItemAttribution\n}\n\nexport interface BuyProductLineItem {\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * The GID of the product variant. E.g. `gid://shopify/ProductVariant/456`.\n */\n productVariantId: string\n /**\n * The quantity of the product to add to the cart.\n */\n quantity?: number\n}\n\nexport interface BuyProductsParams {\n items: [BuyProductLineItem, ...BuyProductLineItem[]] // at least one item\n attribution?: LineItemAttribution\n discountCode?: string\n}\n\nexport interface BuyProductParams extends BuyProductLineItem {\n /**\n * Attribution data for the line item.\n * @deprecated\n */\n attribution?: LineItemAttribution\n /**\n * The discount code to apply to the product.\n */\n discountCode?: string\n}\n\nexport interface UpdateLineItemAttributesParams {\n lineItemAttributes: {key: string; value: string}[]\n attribution?: LineItemAttribution\n}\n\nexport interface NavigateToShopParams {\n shopId: string\n}\n\nexport interface NavigateToOrderParams {\n /**\n * The GID of the order. E.g. `gid://shopify/Order/123`.\n */\n orderId: string\n}\n\nexport interface NavigateToCheckoutParams {\n /**\n * The GID of the shop. E.g. `gid://shopify/Shop/123`.\n */\n shopId: string\n}\n\nexport interface NavigateToProductParams {\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * If present, the GID of the variant that should be initially selected\n */\n productVariantId?: string\n /*\n * Variants displayed in the product details screen will be limited to those\n * whose ID is included in this list.\n */\n includedProductVariantGIDs?: string[]\n /**\n * @deprecated use includedProductVariantGIDs instead\n */\n includedProductVariantIds?: string[]\n /**\n * @deprecated do not use\n */\n attribution?: LineItemAttribution\n /**\n * The discount code to apply to the product.\n */\n discountCode?: string\n}\n\nexport interface RefreshAccessTokenParams {\n refreshToken: string\n}\n\nexport interface ProductRecommendationImpressionParams {\n // The product GID string\n productId: string\n // Optional section id, could be useful for tracking which UI sections get impressions\n sectionId?: string\n}\n\nexport interface ProductRecommendationClickParams {\n productId: string\n sectionId?: string\n}\n\nexport interface ShowErrorScreenParams {\n /**\n * The message to display in the error screen.\n */\n message?: string\n /**\n * The title of the error screen.\n */\n title?: string\n}\n\nexport interface ShowErrorToastParams {\n message?: string\n}\n\nexport interface GetAccountInformationParams {\n /**\n * To use user account information, a shopId must be given to track on\n * which shop's behalf user information is being accessed\n */\n shopId: string\n type: 'email' | 'name' | 'phone'\n}\n\nexport interface AccountInformationPhoneInfo {\n phoneNumber: string\n countryCode: string\n prefix: string\n}\n\nexport interface GetAccountInformationResponse {\n status: 'available' | 'not-available'\n value?: string | AccountInformationPhoneInfo\n}\n\nexport interface GetShopAppInformationResponse {\n appVersion: string\n buildNumber: string\n buildId: string\n}\n\nexport interface FollowShopParams {\n shopId: string\n}\n\nexport interface UnfollowShopParams {\n shopId: string\n}\n\nexport interface NavigateToDeeplinkParams {\n deeplink: string\n}\n\nexport interface GetDeeplinkPathsResponse {\n matchers: string[]\n}\n\nexport interface ProductRecommendationClickParams {\n productId: string\n productVariantId?: string\n variantGIDs?: string[]\n discountCode?: string\n attribution?: LineItemAttribution\n sectionId?: string\n}\n\nexport interface CreateImageUploadLinkParams {\n input: {\n mimeType: string\n fileSize: number\n }[]\n}\n\nexport interface UploadTarget {\n url: string\n resourceUrl: string\n parameters: {name: string; value: string}[]\n}\n\nexport interface CreateImageUploadLinkResponse {\n targets?: UploadTarget[]\n error?: string\n}\n\nexport interface CompleteImageUploadParams {\n resourceUrls: string[]\n}\n\nexport interface CompleteImageUploadResponse {\n files?: {\n id: string\n fileStatus: 'FAILED' | 'PENDING' | 'PROCESSING' | 'READY'\n image?: {\n url: string\n } | null\n }[]\n error?: string\n}\n\nexport interface PaginationInfo {\n hasNextPage: boolean\n endCursor: string | null\n}\n\nexport interface GetProductListsResponse {\n data: ProductList[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetProductListResponse {\n data: ProductList | null\n pageInfo: PaginationInfo\n}\n\nexport interface GetRecommendedProductsResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetRecommendedShopsResponse {\n data: Shop[]\n pageInfo: PaginationInfo\n}\n\nexport interface SearchProductsByShopResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetBuyerAttributesResponse {\n data: {\n genderAffinity?: Gender\n categoryAffinities: TaxonomyCategory[]\n }\n}\n\nexport interface GetCurrentUserResponse {\n data: UserProfile\n}\n\nexport interface GetOrdersResponse {\n data: Order[]\n pageInfo: PaginationInfo\n}\n\nexport interface SetSecretParams {\n value: string\n}\n\nexport interface SetAsyncStorageItemParams {\n key: string\n value: string\n}\n\nexport interface GetAsyncStorageItemParams {\n key: string\n}\n\nexport interface RemoveAsyncStorageItemParams {\n key: string\n}\n\nexport interface ReportInteractionParams {\n interactionType: string\n interactionValue?: string\n pageValue?: string\n}\n\nexport interface ReportImpressionParams {\n subjectType?: string\n subjectId?: string\n pageValue?: string\n}\n\nexport interface ReportContentImpressionParams {\n publicId: string\n pageValue: string\n}\n\nexport interface GetProductListsParams {\n /**\n * The number of lists to fetch.\n */\n first?: number\n /**\n * The cursor to fetch the next page of lists.\n */\n after?: string\n /**\n * The number of items per list to fetch.\n */\n itemsFirst?: number\n /**\n * The fetch policy to use.\n */\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductListParams {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id?: string\n /**\n * The public ID of the product list.\n */\n publicId?: string\n /**\n * The number of items to fetch.\n */\n first?: number\n /**\n * The cursor to fetch the next page of items.\n */\n after?: string\n /**\n * The fetch policy to use.\n */\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface AddProductListParams {\n /**\n * The name of the product list.\n */\n name: string\n /**\n * A description of the product list.\n */\n description?: string\n}\n\nexport interface RemoveProductListParams {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id: string\n}\n\nexport interface RenameProductListParams {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id: string\n /**\n * The new name of the product list.\n */\n name: string\n}\n\nexport interface AddProductListItemParams {\n /**\n * The GID of the shop. E.g. `gid://shopify/Shop/42`.\n */\n shopId: string\n /**\n * The GID of the product variant. E.g. `gid://shopify/ProductVariant/101`.\n */\n productVariantId: string\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n * This will soon be deprecated in favor of just `publicListId`.\n */\n listId: string\n /**\n * The public ID of the product list.\n */\n publicListId: string\n}\n\nexport interface RemoveProductListItemParams {\n /**\n * The GID of the shop. E.g. `gid://shopify/Shop/42`.\n */\n shopId: string\n /**\n * The GID of the product variant. E.g. `gid://shopify/ProductVariant/101`.\n */\n productVariantId: string\n /**\n * The GID of the product. E.g. `gid://shopify/Product/123`.\n */\n productId: string\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n * This will soon be deprecated in favor of just `publicListId`.\n */\n listId: string\n /**\n * The public ID of the product list.\n */\n publicListId: string\n}\n\nexport interface GetRecommendedProductsParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetRecommendedShopsParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface SearchProductsByShopParams {\n shopId: string\n query?: string\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetBuyerAttributesParams {\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetCurrentUserParams {\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetOrdersParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface ShowFeedbackSheetParams {\n publicId: string\n}\n\nexport interface GetPopularProductsParams {\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetPopularProductsResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface PreviewProductInARParams {\n id: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetCuratedProductsParams {\n handle: string\n requiredTags: string[]\n anyOfTags: string[]\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetCuratedProductsResponse {\n data: Product[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetProductMediaParams {\n id: string\n first?: number\n after?: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductMediaResponse {\n data: ProductMedia[]\n pageInfo: PaginationInfo\n}\n\nexport interface GetProductsParams {\n productIds: string[]\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductsResponse {\n data: Product[]\n}\n\nexport interface GetProductParams {\n id: string\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface GetProductResponse {\n data: Product\n}\n\nexport interface ShareParams {\n message?: string\n title?: string\n url?: string\n urls?: string[]\n type?: string\n failOnCancel?: boolean\n}\n\nexport interface MinisParams {\n /** The handle/identifier of the Mini application */\n handle: string\n /** The initial URL that was used to load the Mini (optional) */\n initialUrl?: string\n}\n\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby'\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network'\n\nexport enum CurrencyCode {\n AED = 'AED',\n AFN = 'AFN',\n ALL = 'ALL',\n AMD = 'AMD',\n ANG = 'ANG',\n AOA = 'AOA',\n ARS = 'ARS',\n AUD = 'AUD',\n AWG = 'AWG',\n AZN = 'AZN',\n BAM = 'BAM',\n BBD = 'BBD',\n BDT = 'BDT',\n BGN = 'BGN',\n BHD = 'BHD',\n BIF = 'BIF',\n BMD = 'BMD',\n BND = 'BND',\n BOB = 'BOB',\n BRL = 'BRL',\n BSD = 'BSD',\n BTN = 'BTN',\n BWP = 'BWP',\n BYN = 'BYN',\n BYR = 'BYR',\n BZD = 'BZD',\n CAD = 'CAD',\n CDF = 'CDF',\n CHF = 'CHF',\n CLP = 'CLP',\n CNY = 'CNY',\n COP = 'COP',\n CRC = 'CRC',\n CVE = 'CVE',\n CZK = 'CZK',\n DJF = 'DJF',\n DKK = 'DKK',\n DOP = 'DOP',\n DZD = 'DZD',\n EGP = 'EGP',\n ERN = 'ERN',\n ETB = 'ETB',\n EUR = 'EUR',\n FJD = 'FJD',\n FKP = 'FKP',\n GBP = 'GBP',\n GEL = 'GEL',\n GHS = 'GHS',\n GIP = 'GIP',\n GMD = 'GMD',\n GNF = 'GNF',\n GTQ = 'GTQ',\n GYD = 'GYD',\n HKD = 'HKD',\n HNL = 'HNL',\n HRK = 'HRK',\n HTG = 'HTG',\n HUF = 'HUF',\n IDR = 'IDR',\n ILS = 'ILS',\n INR = 'INR',\n IQD = 'IQD',\n IRR = 'IRR',\n ISK = 'ISK',\n JEP = 'JEP',\n JMD = 'JMD',\n JOD = 'JOD',\n JPY = 'JPY',\n KES = 'KES',\n KGS = 'KGS',\n KHR = 'KHR',\n KID = 'KID',\n KMF = 'KMF',\n KRW = 'KRW',\n KWD = 'KWD',\n KYD = 'KYD',\n KZT = 'KZT',\n LAK = 'LAK',\n LBP = 'LBP',\n LKR = 'LKR',\n LRD = 'LRD',\n LSL = 'LSL',\n LTL = 'LTL',\n LVL = 'LVL',\n LYD = 'LYD',\n MAD = 'MAD',\n MDL = 'MDL',\n MGA = 'MGA',\n MKD = 'MKD',\n MMK = 'MMK',\n MNT = 'MNT',\n MOP = 'MOP',\n MRU = 'MRU',\n MUR = 'MUR',\n MVR = 'MVR',\n MWK = 'MWK',\n MXN = 'MXN',\n MYR = 'MYR',\n MZN = 'MZN',\n NAD = 'NAD',\n NGN = 'NGN',\n NIO = 'NIO',\n NOK = 'NOK',\n NPR = 'NPR',\n NZD = 'NZD',\n OMR = 'OMR',\n PAB = 'PAB',\n PEN = 'PEN',\n PGK = 'PGK',\n PHP = 'PHP',\n PKR = 'PKR',\n PLN = 'PLN',\n PYG = 'PYG',\n QAR = 'QAR',\n RON = 'RON',\n RSD = 'RSD',\n RUB = 'RUB',\n RWF = 'RWF',\n SAR = 'SAR',\n SBD = 'SBD',\n SCR = 'SCR',\n SDG = 'SDG',\n SEK = 'SEK',\n SGD = 'SGD',\n SHP = 'SHP',\n SLL = 'SLL',\n SOS = 'SOS',\n SRD = 'SRD',\n SSP = 'SSP',\n STD = 'STD',\n STN = 'STN',\n SYP = 'SYP',\n SZL = 'SZL',\n THB = 'THB',\n TJS = 'TJS',\n TMT = 'TMT',\n TND = 'TND',\n TOP = 'TOP',\n TRY = 'TRY',\n TTD = 'TTD',\n TWD = 'TWD',\n TZS = 'TZS',\n UAH = 'UAH',\n UGX = 'UGX',\n USD = 'USD',\n UYU = 'UYU',\n UZS = 'UZS',\n VED = 'VED',\n VEF = 'VEF',\n VES = 'VES',\n VND = 'VND',\n VUV = 'VUV',\n WST = 'WST',\n XAF = 'XAF',\n XCD = 'XCD',\n XOF = 'XOF',\n XPF = 'XPF',\n XXX = 'XXX',\n YER = 'YER',\n ZAR = 'ZAR',\n ZMW = 'ZMW',\n}\n\nexport type Decimal = string\n\nexport type MiniAppParams = any\n\nexport interface MiniAppConfig<\n _DeprecatedParams extends MiniAppParams = undefined,\n> {\n /**\n * Root component of used inside the Minis Viewer\n */\n ViewerRoot: () => JSX.Element | null\n}\n\nexport interface MiniManifest {\n trusted_domains?: string[]\n permissions?: string[]\n [key: string]: any\n}\n\nexport type Permission = 'CAMERA' | 'GALLERY' | 'MICROPHONE'\n\nexport interface Money {\n amount: Decimal\n currencyCode: CurrencyCode\n}\n\nexport interface ProductImage {\n id?: string | null\n altText?: string | null\n url: string\n sensitive?: boolean | null\n}\n\nexport interface ProductVariant {\n id: string\n isFavorited: boolean\n image?: ProductImage | null\n price: Money\n compareAtPrice?: Money | null\n}\n\nexport interface ProductShop {\n id: string\n name: string\n}\n\nexport type ProductMedia =\n | {\n id: string\n image: ProductImage | null\n mediaContentType: 'IMAGE'\n alt: string | null\n }\n | {\n id: string\n mediaContentType: 'MODEL_3D'\n previewImage: ProductImage | null\n sources: {\n filesize: number\n format: string\n mimeType: string\n url: string\n }[]\n alt: string | null\n }\n | {\n id: string\n mediaContentType: 'VIDEO'\n previewImage: ProductImage | null\n sources: {\n format: string\n mimeType: string\n url: string\n width: number\n height: number\n }[]\n alt: string | null\n }\n | {\n id: string\n mediaContentType: 'EXTERNAL_VIDEO'\n previewImage: ProductImage | null\n embedUrl: string\n alt: string | null\n }\n\nexport interface Product {\n id: string\n title: string\n reviewAnalytics: {\n averageRating?: number | null\n reviewCount?: number | null\n }\n shop: ProductShop\n selectedVariant?: ProductVariant\n defaultVariantId: string\n isFavorited: boolean\n variants?: ProductVariant[]\n featuredImage?: ProductImage | null\n price: Money\n compareAtPrice?: Money | null\n}\n\nexport interface Shop {\n id: string\n name: string\n isFollowing?: boolean | null\n shareUrl?: string | null\n primaryDomain: {\n url: string\n }\n logoImage?: ProductImage | null\n reviewAnalytics: {\n averageRating?: number | null\n reviewCount: number\n }\n}\n\nexport interface QueryOptions {\n fetchPolicy?: WatchQueryFetchPolicy\n skip?: boolean\n}\n\nexport interface ProductList {\n id: string\n publicId: string | null\n name: string | null\n products: Product[]\n}\n\nexport interface Order {\n id: string\n name: string\n lineItems: {\n productTitle: string\n variantTitle: string | null\n quantity: number\n product: Product | null\n }[]\n shop: Shop | null\n}\n\nexport interface BuyerAttributes {\n genderAffinity?: Gender\n categoryAffinities: TaxonomyCategory[]\n}\n\nexport enum Gender {\n Male = 'MALE',\n Female = 'FEMALE',\n Neutral = 'NEUTRAL',\n}\n\nexport interface TaxonomyCategory {\n id: string\n name: string\n ancestors?: TaxonomyCategory[]\n}\n\n/**\n * A user profile.\n */\nexport interface UserProfile {\n /**\n * The display name of the user.\n */\n displayName?: string | null\n /**\n * The avatar image of the user.\n */\n avatarImage?: {\n url: string\n } | null\n}\n\n/**\n * A user metafield.\n */\nexport interface UserMetafield {\n /**\n * The key of the user metafield.\n */\n key: string\n /**\n * The value of the user metafield.\n */\n value: string\n}\n\nexport interface ContentImage {\n id: string | null\n url: string\n width: number | null\n height: number | null\n}\n\nexport interface ContentProduct {\n id: string\n title: string\n featuredImage: ContentImage | null\n}\n\nexport type ContentVisibility = 'DISCOVERABLE' | 'LINKABLE'\n\nexport interface Content {\n publicId: string\n externalId: string | null\n image: ContentImage\n title: string\n description: string | null\n visibility: ContentVisibility[]\n shareableUrl: string | null\n products: ContentProduct[] | null\n}\n\n/**\n * The fetch policy to use. `cache-first` will only fetch from the network if there is no\n * cached data. `network-only` will fetch from the network regardless of whether there\n * is cached data.\n */\nexport type DataHookFetchPolicy = 'cache-first' | 'network-only'\n\nexport interface DataHookOptionsBase {\n /**\n * When true, the data will not be fetched immediately.\n */\n skip?: boolean\n /**\n * The fetch policy to use for the initial data load. Subsequent loads may use different policies.\n */\n fetchPolicy?: DataHookFetchPolicy\n}\n\nexport interface PaginatedDataHookOptionsBase extends DataHookOptionsBase {\n /**\n * The number of products to fetch.\n * @default 20\n */\n first?: number\n}\n\nexport interface DataHookReturnsBase {\n /**\n * Whether data is loading. Represents the initial data load but not `refetch`/`fetchMore` calls.\n */\n loading: boolean\n /**\n * The error that occurred while loading. Represents the initial data load and `refetch` calls but not `fetchMore`\n */\n error: Error | null\n /**\n * Refetch the data. Data is updated in place. The `loading` state will not update but the `error` state will.\n */\n refetch: () => Promise<void>\n}\n\nexport interface PaginatedDataHookReturnsBase extends DataHookReturnsBase {\n /**\n * Whether there is a next page to fetch.\n */\n hasNextPage: boolean\n /**\n * Fetch more data. Data is updated in place. The `loading` and `error` states will not update\n */\n fetchMore: () => Promise<void>\n}\n\nexport const Consent = {\n MiniConsent: 'mini_consent',\n CameraConsent: 'camera_consent',\n PhotoLibraryConsent: 'photo_library_consent',\n MicrophoneConsent: 'microphone_consent',\n} as const\n\nexport const ConsentStatus = {\n Granted: 'granted',\n Dismissed: 'dismissed',\n Idle: 'idle',\n} as const\n\nexport type ConsentType = (typeof Consent)[keyof typeof Consent]\n\nexport type ConsentStatusType =\n (typeof ConsentStatus)[keyof typeof ConsentStatus]\n\nexport interface PaginatedDataHookPageInfo {\n /**\n * Whether there is a next page to fetch.\n */\n hasNextPage: boolean\n /**\n * The cursor to use for the next page of data.\n */\n endCursor: string | null\n}\n\ndeclare global {\n interface Window {\n minisSDK: ShopActions\n minisParams: MinisParams\n }\n}\n\nexport {}\n"],"names":["CurrencyCode","Gender","Consent","ConsentStatus"],"mappings":"AA0uBY,IAAAA,sBAAAA,OACVA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAA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AAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OACNA,EAAA,MAAM,OAjKIA,IAAAA,KAAA,CAAA,CAAA,GAuTAC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,UAAU,WAHAA,IAAAA,KAAA,CAAA,CAAA;AAwHL,MAAMC,IAAU;AAAA,EACrB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,mBAAmB;AACrB,GAEaC,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AACR;"}
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.8",
4
+ "version": "0.0.10",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "engines": {
@@ -1,5 +1,7 @@
1
1
  import React, {useEffect, useState} from 'react'
2
2
 
3
+ import {ImagePickerProvider} from '../providers/ImagePickerProvider'
4
+
3
5
  export function MinisContainer({children}: {children: React.ReactNode}) {
4
6
  const [isSDKReady, setIsSDKReady] = useState(false)
5
7
 
@@ -58,5 +60,5 @@ export function MinisContainer({children}: {children: React.ReactNode}) {
58
60
  )
59
61
  }
60
62
 
61
- return children
63
+ return <ImagePickerProvider>{children}</ImagePickerProvider>
62
64
  }
@@ -20,6 +20,7 @@ export * from './storage/useImageUpload'
20
20
  // - Navigation Hooks
21
21
  export * from './navigation/useShopNavigation'
22
22
  export * from './navigation/useCloseMini'
23
+ export * from './navigation/useDeeplink'
23
24
 
24
25
  // - Shop Hooks
25
26
  export * from './shop/useShopCartActions'
@@ -30,3 +31,5 @@ export * from './shop/useRecommendedShops'
30
31
  // - Utility Hooks
31
32
  export * from './util/useErrorToast'
32
33
  export * from './util/useErrorScreen'
34
+ export * from './util/useShare'
35
+ export * from './util/useImagePicker'
@@ -0,0 +1,32 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useDeeplink',
5
+ category: 'hooks',
6
+ subCategory: 'navigation',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description:
10
+ 'The `useDeeplink` hook returns the path, query parameters, and hash parameters of the deep link URL that opened the Mini.',
11
+ type: 'hook',
12
+ defaultExample: {
13
+ codeblock: {
14
+ tabs: [
15
+ {
16
+ code: './useDeeplink.example.tsx',
17
+ language: 'tsx',
18
+ },
19
+ ],
20
+ title: 'Example code',
21
+ },
22
+ },
23
+ definitions: [
24
+ {
25
+ title: '',
26
+ type: 'UseDeeplinkGeneratedType',
27
+ description: '',
28
+ },
29
+ ],
30
+ }
31
+
32
+ export default data
@@ -0,0 +1,7 @@
1
+ import {useDeeplink} from '@shopify/shop-minis-react'
2
+
3
+ export default function MyComponent() {
4
+ const {path, queryParams, hash} = useDeeplink()
5
+
6
+ console.log({path, queryParams, hash})
7
+ }
@@ -0,0 +1,40 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {parseUrl} from '../../utils/parseUrl'
4
+
5
+ interface UseDeeplinkReturnType {
6
+ /**
7
+ * The path of the deeplink.
8
+ */
9
+ path?: string
10
+ /**
11
+ * The query parameters of the deeplink.
12
+ */
13
+ queryParams?: {[key: string]: string | undefined}
14
+ /**
15
+ * The hash of the deeplink.
16
+ */
17
+ hash?: string
18
+ }
19
+
20
+ export const useDeeplink = (): UseDeeplinkReturnType => {
21
+ const {initialUrl} = window.minisParams
22
+
23
+ return useMemo(() => {
24
+ if (!initialUrl) {
25
+ return {
26
+ path: undefined,
27
+ queryParams: undefined,
28
+ hash: undefined,
29
+ }
30
+ }
31
+
32
+ const parsedUrl = parseUrl(initialUrl)
33
+
34
+ return {
35
+ path: parsedUrl.pathname,
36
+ queryParams: parsedUrl.query,
37
+ hash: parsedUrl.hash,
38
+ }
39
+ }, [initialUrl])
40
+ }
@@ -0,0 +1,41 @@
1
+ export const useImagePickerDoc = {
2
+ name: 'useImagePicker',
3
+ category: 'Utility',
4
+ description:
5
+ 'Hook for selecting images from camera or gallery in web-based mini apps',
6
+ params: [
7
+ {
8
+ name: 'options',
9
+ type: 'UseImagePickerOptions',
10
+ description: 'Configuration options for the image picker',
11
+ optional: true,
12
+ properties: [
13
+ {
14
+ name: 'cameraFacing',
15
+ type: "'user' | 'environment'",
16
+ description: 'Which camera to use when opening camera',
17
+ optional: true,
18
+ default: "'environment'",
19
+ },
20
+ ],
21
+ },
22
+ ],
23
+ returns: [
24
+ {
25
+ name: 'openCamera',
26
+ type: '() => Promise<File>',
27
+ description: 'Function to open the camera for capturing an image',
28
+ },
29
+ {
30
+ name: 'openGallery',
31
+ type: '() => Promise<File>',
32
+ description: 'Function to open the gallery for selecting an image',
33
+ },
34
+ {
35
+ name: 'ImagePickerInputs',
36
+ type: 'React.FC',
37
+ description:
38
+ 'Component that renders hidden file inputs. Must be rendered in your component for the picker to work',
39
+ },
40
+ ],
41
+ }
@@ -0,0 +1,85 @@
1
+ import React, {useState} from 'react'
2
+
3
+ import {Camera, Image} from 'lucide-react'
4
+
5
+ import {Alert, AlertDescription, AlertTitle} from '../../components/ui/alert'
6
+ import {Button} from '../../components/ui/button'
7
+ import {
8
+ Card,
9
+ CardContent,
10
+ CardHeader,
11
+ CardTitle,
12
+ } from '../../components/ui/card'
13
+
14
+ import {useImagePicker} from './useImagePicker'
15
+
16
+ export const UseImagePickerExample = () => {
17
+ const [selectedImage, setSelectedImage] = useState<string | null>(null)
18
+ const [error, setError] = useState<string | null>(null)
19
+ const {openCamera, openGallery, ImagePickerInputs} = useImagePicker({
20
+ cameraFacing: 'user',
21
+ })
22
+
23
+ const handleCameraCapture = async () => {
24
+ try {
25
+ setError(null)
26
+ const file = await openCamera()
27
+ const url = URL.createObjectURL(file)
28
+ setSelectedImage(url)
29
+ } catch (err) {
30
+ setError(err instanceof Error ? err.message : 'Failed to capture image')
31
+ }
32
+ }
33
+
34
+ const handleGallerySelect = async () => {
35
+ try {
36
+ setError(null)
37
+ const file = await openGallery()
38
+ const url = URL.createObjectURL(file)
39
+ setSelectedImage(url)
40
+ } catch (err) {
41
+ setError(err instanceof Error ? err.message : 'Failed to select image')
42
+ }
43
+ }
44
+
45
+ return (
46
+ <Card>
47
+ <CardHeader>
48
+ <CardTitle>Image Picker Example</CardTitle>
49
+ </CardHeader>
50
+ <CardContent className="space-y-4">
51
+ <ImagePickerInputs />
52
+
53
+ <div className="flex gap-2">
54
+ <Button onClick={handleCameraCapture} variant="primary">
55
+ <Camera className="mr-2 h-4 w-4" />
56
+ Open Camera
57
+ </Button>
58
+
59
+ <Button onClick={handleGallerySelect} variant="secondary">
60
+ <Image className="mr-2 h-4 w-4" />
61
+ Open Gallery
62
+ </Button>
63
+ </div>
64
+
65
+ {error && (
66
+ <Alert variant="destructive">
67
+ <AlertTitle>Error</AlertTitle>
68
+ <AlertDescription>{error}</AlertDescription>
69
+ </Alert>
70
+ )}
71
+
72
+ {selectedImage && (
73
+ <div className="space-y-2">
74
+ <h3 className="text-sm font-medium">Selected Image:</h3>
75
+ <img
76
+ src={selectedImage}
77
+ alt="Selected"
78
+ className="w-full rounded-md border"
79
+ />
80
+ </div>
81
+ )}
82
+ </CardContent>
83
+ </Card>
84
+ )
85
+ }
@@ -0,0 +1,18 @@
1
+ import {
2
+ CameraFacing,
3
+ useImagePickerContext,
4
+ } from '../../providers/ImagePickerProvider'
5
+
6
+ interface UseImagePickerReturn {
7
+ openCamera: (cameraFacing?: CameraFacing) => Promise<File>
8
+ openGallery: () => Promise<File>
9
+ }
10
+
11
+ export function useImagePicker(): UseImagePickerReturn {
12
+ const {openCamera, openGallery} = useImagePickerContext()
13
+
14
+ return {
15
+ openCamera,
16
+ openGallery,
17
+ }
18
+ }
@@ -0,0 +1,18 @@
1
+ import {useHandleAction} from '../../internal/useHandleAction'
2
+ import {useShopActions} from '../../internal/useShopActions'
3
+ import {ShareParams} from '../../types'
4
+
5
+ interface UseShareReturns {
6
+ /**
7
+ * Closes the Mini viewer.
8
+ */
9
+ share: (params: ShareParams) => void
10
+ }
11
+
12
+ export const useShare = (): UseShareReturns => {
13
+ const {share} = useShopActions()
14
+
15
+ return {
16
+ share: useHandleAction(share),
17
+ }
18
+ }
@@ -233,4 +233,5 @@ window.minisSDK = window.minisSDK || {
233
233
  ],
234
234
  },
235
235
  }),
236
+ share: logAction('share'),
236
237
  }
@@ -0,0 +1,198 @@
1
+ import React, {
2
+ createContext,
3
+ useContext,
4
+ useRef,
5
+ useCallback,
6
+ useEffect,
7
+ useMemo,
8
+ } from 'react'
9
+
10
+ export type CameraFacing = 'front' | 'back'
11
+
12
+ interface ImagePickerContextValue {
13
+ openCamera: (cameraFacing?: CameraFacing) => Promise<File>
14
+ openGallery: () => Promise<File>
15
+ }
16
+
17
+ const ImagePickerContext = createContext<ImagePickerContextValue | null>(null)
18
+
19
+ export function useImagePickerContext() {
20
+ const context = useContext(ImagePickerContext)
21
+ if (!context) {
22
+ throw new Error(
23
+ 'useImagePickerContext must be used within an ImagePickerProvider'
24
+ )
25
+ }
26
+ return context
27
+ }
28
+
29
+ interface ImagePickerProviderProps {
30
+ children: React.ReactNode
31
+ }
32
+
33
+ export function ImagePickerProvider({children}: ImagePickerProviderProps) {
34
+ const galleryInputRef = useRef<HTMLInputElement>(null)
35
+ const frontCameraInputRef = useRef<HTMLInputElement>(null)
36
+ const backCameraInputRef = useRef<HTMLInputElement>(null)
37
+ const resolveRef = useRef<((file: File) => void) | null>(null)
38
+ const rejectRef = useRef<((reason: Error) => void) | null>(null)
39
+ const activeCancelHandlerRef = useRef<{
40
+ input: HTMLInputElement
41
+ handler: () => void
42
+ } | null>(null)
43
+
44
+ const cleanupCancelHandler = useCallback(() => {
45
+ if (activeCancelHandlerRef.current) {
46
+ const {input, handler} = activeCancelHandlerRef.current
47
+ input.removeEventListener('cancel', handler)
48
+ activeCancelHandlerRef.current = null
49
+ }
50
+ }, [])
51
+
52
+ const rejectPendingPromise = useCallback(() => {
53
+ if (rejectRef.current) {
54
+ rejectRef.current(
55
+ new Error('New file picker opened before previous completed')
56
+ )
57
+ resolveRef.current = null
58
+ rejectRef.current = null
59
+ }
60
+ }, [])
61
+
62
+ const handleFileChange = useCallback(
63
+ (event: React.ChangeEvent<HTMLInputElement>) => {
64
+ const file = event.target.files?.[0]
65
+
66
+ if (file && resolveRef.current) {
67
+ resolveRef.current(file)
68
+
69
+ resolveRef.current = null
70
+ rejectRef.current = null
71
+
72
+ cleanupCancelHandler()
73
+ }
74
+
75
+ event.target.value = ''
76
+ },
77
+ [cleanupCancelHandler]
78
+ )
79
+
80
+ const openGallery = useCallback(() => {
81
+ return new Promise<File>((resolve, reject) => {
82
+ rejectPendingPromise()
83
+ cleanupCancelHandler()
84
+
85
+ resolveRef.current = resolve
86
+ rejectRef.current = reject
87
+
88
+ const input = galleryInputRef.current
89
+
90
+ if (!input) {
91
+ reject(new Error('Gallery input not found'))
92
+ resolveRef.current = null
93
+ rejectRef.current = null
94
+ return
95
+ }
96
+
97
+ const handleCancel = () => {
98
+ if (rejectRef.current) {
99
+ rejectRef.current(new Error('User cancelled file selection'))
100
+ resolveRef.current = null
101
+ rejectRef.current = null
102
+ }
103
+ cleanupCancelHandler()
104
+ }
105
+
106
+ input.addEventListener('cancel', handleCancel)
107
+ activeCancelHandlerRef.current = {input, handler: handleCancel}
108
+
109
+ input.click()
110
+ })
111
+ }, [rejectPendingPromise, cleanupCancelHandler])
112
+
113
+ const openCamera = useCallback(
114
+ (cameraFacing: CameraFacing = 'back') => {
115
+ return new Promise<File>((resolve, reject) => {
116
+ rejectPendingPromise()
117
+ cleanupCancelHandler()
118
+
119
+ resolveRef.current = resolve
120
+ rejectRef.current = reject
121
+
122
+ const input =
123
+ cameraFacing === 'front'
124
+ ? frontCameraInputRef.current
125
+ : backCameraInputRef.current
126
+
127
+ if (!input) {
128
+ reject(new Error('Camera input not found'))
129
+ resolveRef.current = null
130
+ rejectRef.current = null
131
+ return
132
+ }
133
+
134
+ const handleCancel = () => {
135
+ if (rejectRef.current) {
136
+ rejectRef.current(new Error('User cancelled camera'))
137
+ resolveRef.current = null
138
+ rejectRef.current = null
139
+ }
140
+ cleanupCancelHandler()
141
+ }
142
+
143
+ input.addEventListener('cancel', handleCancel)
144
+ activeCancelHandlerRef.current = {input, handler: handleCancel}
145
+
146
+ input.click()
147
+ })
148
+ },
149
+ [rejectPendingPromise, cleanupCancelHandler]
150
+ )
151
+
152
+ useEffect(() => {
153
+ return () => {
154
+ rejectPendingPromise()
155
+ cleanupCancelHandler()
156
+ }
157
+ }, [rejectPendingPromise, cleanupCancelHandler])
158
+
159
+ const contextValue: ImagePickerContextValue = useMemo(
160
+ () => ({
161
+ openCamera,
162
+ openGallery,
163
+ }),
164
+ [openCamera, openGallery]
165
+ )
166
+
167
+ return (
168
+ <ImagePickerContext.Provider value={contextValue}>
169
+ {children}
170
+ <input
171
+ ref={galleryInputRef}
172
+ type="file"
173
+ accept="image/*"
174
+ onChange={handleFileChange}
175
+ style={{display: 'none'}}
176
+ aria-hidden="true"
177
+ />
178
+ <input
179
+ ref={frontCameraInputRef}
180
+ type="file"
181
+ accept="image/*"
182
+ capture="user"
183
+ onChange={handleFileChange}
184
+ style={{display: 'none'}}
185
+ aria-hidden="true"
186
+ />
187
+ <input
188
+ ref={backCameraInputRef}
189
+ type="file"
190
+ accept="image/*"
191
+ capture="environment"
192
+ onChange={handleFileChange}
193
+ style={{display: 'none'}}
194
+ aria-hidden="true"
195
+ />
196
+ </ImagePickerContext.Provider>
197
+ )
198
+ }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @shopify/typescript/prefer-pascal-case-enums */
2
2
  // Auto-generated type definitions for MinisSDK
3
- // Generated on: 2025-06-16T14:51:57.942Z
3
+ // Generated on: 2025-06-18T10:56:57.588Z
4
4
  // Do not edit this file manually - run the generation script instead
5
5
  // Source: useShopActionsImplementationV3.ts + shopActionsV3Definitions.ts + shopActionsV3Types.ts
6
6
  // Generated using TypeScript compiler API for reliable AST parsing
@@ -171,6 +171,8 @@ export interface ShopActions {
171
171
  getPopularProducts(
172
172
  params?: GetPopularProductsParams
173
173
  ): Promise<ShopActionResult<GetPopularProductsResponse>>
174
+
175
+ share(params: ShareParams): Promise<ShopActionResult>
174
176
  }
175
177
 
176
178
  export interface AuthShopActions {
@@ -261,10 +263,6 @@ export interface UpdateLineItemAttributesParams {
261
263
 
262
264
  export interface NavigateToShopParams {
263
265
  shopId: string
264
- /**
265
- * @deprecated
266
- */
267
- shopName?: string
268
266
  }
269
267
 
270
268
  export interface NavigateToOrderParams {
@@ -501,7 +499,7 @@ export interface ReportImpressionParams {
501
499
 
502
500
  export interface ReportContentImpressionParams {
503
501
  publicId: string
504
- pageValue?: string
502
+ pageValue: string
505
503
  }
506
504
 
507
505
  export interface GetProductListsParams {
@@ -657,6 +655,10 @@ export interface GetOrdersParams {
657
655
  fetchPolicy?: DataHookFetchPolicy
658
656
  }
659
657
 
658
+ export interface ShowFeedbackSheetParams {
659
+ publicId: string
660
+ }
661
+
660
662
  export interface GetPopularProductsParams {
661
663
  first?: number
662
664
  after?: string
@@ -717,6 +719,22 @@ export interface GetProductResponse {
717
719
  data: Product
718
720
  }
719
721
 
722
+ export interface ShareParams {
723
+ message?: string
724
+ title?: string
725
+ url?: string
726
+ urls?: string[]
727
+ type?: string
728
+ failOnCancel?: boolean
729
+ }
730
+
731
+ export interface MinisParams {
732
+ /** The handle/identifier of the Mini application */
733
+ handle: string
734
+ /** The initial URL that was used to load the Mini (optional) */
735
+ initialUrl?: string
736
+ }
737
+
720
738
  export type FetchPolicy =
721
739
  | 'cache-first'
722
740
  | 'network-only'
@@ -1189,6 +1207,7 @@ export interface PaginatedDataHookPageInfo {
1189
1207
  declare global {
1190
1208
  interface Window {
1191
1209
  minisSDK: ShopActions
1210
+ minisParams: MinisParams
1192
1211
  }
1193
1212
  }
1194
1213