@shopify/shop-minis-react 0.0.6 → 0.0.7

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.
@@ -0,0 +1,28 @@
1
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
+ import { useState as m, useEffect as l } from "react";
3
+ function v({ children: s }) {
4
+ const [a, r] = m(!1);
5
+ return l(() => {
6
+ const n = () => window.minisSDK ? (r(!0), !0) : !1;
7
+ if (n())
8
+ return;
9
+ const e = (d) => {
10
+ const { type: o } = JSON.parse(d.data);
11
+ o === "MINIS_SDK_READY" && r(!0);
12
+ };
13
+ window.addEventListener("message", e), document.addEventListener("message", e);
14
+ const i = setInterval(() => {
15
+ n() && clearInterval(i);
16
+ }, 100);
17
+ return () => {
18
+ window.removeEventListener("message", e), document.removeEventListener("message", e);
19
+ };
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..." })
23
+ ] }) });
24
+ }
25
+ export {
26
+ v as MinisContainer
27
+ };
28
+ //# sourceMappingURL=MinisContainer.js.map
@@ -0,0 +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;"}
package/dist/index.js CHANGED
@@ -1,189 +1,191 @@
1
- import { ProductCard as o, ProductCardBadge as t, ProductCardCurrentPrice as a, ProductCardFavoriteButton as i, ProductCardImage as l, ProductCardImageContainer as n, ProductCardInfo as c, ProductCardOriginalPrice as u, ProductCardPrice as d, ProductCardRoot as s, ProductCardTitle as p } from "./components/commerce/product-card.js";
2
- import { ProductLink as f, ProductLinkActions as g, ProductLinkCurrentPrice as x, ProductLinkDiscountPrice as C, ProductLinkImage as P, ProductLinkInfo as D, ProductLinkOriginalPrice as S, ProductLinkPrice as A, ProductLinkRating as T, ProductLinkRoot as L, ProductLinkTitle as h } from "./components/commerce/product-link.js";
3
- import { Accordion as w, AccordionContent as b, AccordionItem as I, AccordionTrigger as v } from "./components/ui/accordion.js";
4
- import { Alert as F, AlertDescription as B, AlertTitle as y } from "./components/ui/alert.js";
5
- import { AlertDialog as H, AlertDialogAction as O, AlertDialogCancel as G, AlertDialogContent as M, AlertDialogDescription as N, AlertDialogFooter as U, AlertDialogHeader as V, AlertDialogOverlay as z, AlertDialogPortal as j, AlertDialogTitle as q, AlertDialogTrigger as J } from "./components/ui/alert-dialog.js";
6
- import { Avatar as Q, AvatarFallback as W, AvatarImage as X } from "./components/ui/avatar.js";
7
- import { Badge as Z, badgeVariants as _ } from "./components/ui/badge.js";
8
- import { Button as rr, buttonVariants as er } from "./components/ui/button.js";
9
- import { Card as tr, CardAction as ar, CardContent as ir, CardDescription as lr, CardFooter as nr, CardHeader as cr, CardTitle as ur } from "./components/ui/card.js";
10
- import { Carousel as sr, CarouselContent as pr, CarouselItem as mr, CarouselNext as fr, CarouselPrevious as gr } from "./components/ui/carousel.js";
11
- import { Checkbox as Cr } from "./components/ui/checkbox.js";
12
- import { Dialog as Dr, DialogClose as Sr, DialogContent as Ar, DialogDescription as Tr, DialogFooter as Lr, DialogHeader as hr, DialogOverlay as kr, DialogPortal as wr, DialogTitle as br, DialogTrigger as Ir } from "./components/ui/dialog.js";
13
- import { Drawer as Rr, DrawerClose as Fr, DrawerContent as Br, DrawerDescription as yr, DrawerFooter as Er, DrawerHeader as Hr, DrawerOverlay as Or, DrawerPortal as Gr, DrawerTitle as Mr, DrawerTrigger as Nr } from "./components/ui/drawer.js";
14
- import { Input as Vr } from "./components/ui/input.js";
15
- import { Label as jr } from "./components/ui/label.js";
16
- import { Progress as Jr } from "./components/ui/progress.js";
17
- import { RadioGroup as Qr, RadioGroupItem as Wr } from "./components/ui/radio-group.js";
18
- import { ResizableHandle as Yr, ResizablePanel as Zr, ResizablePanelGroup as _r } from "./components/ui/resizable.js";
19
- import { ScrollArea as re, ScrollBar as ee } from "./components/ui/scroll-area.js";
20
- import { Select as te, SelectContent as ae, SelectGroup as ie, SelectItem as le, SelectLabel as ne, SelectScrollDownButton as ce, SelectScrollUpButton as ue, SelectSeparator as de, SelectTrigger as se, SelectValue as pe } from "./components/ui/select.js";
21
- import { Separator as fe } from "./components/ui/separator.js";
22
- import { Sheet as xe, SheetClose as Ce, SheetContent as Pe, SheetDescription as De, SheetFooter as Se, SheetHeader as Ae, SheetTitle as Te, SheetTrigger as Le } from "./components/ui/sheet.js";
23
- import { Toaster as ke } from "./components/ui/sonner.js";
24
- import { Touchable as be, touchableVariants as Ie } from "./components/ui/touchable.js";
25
- import { useSavedProductsActions as Re } from "./hooks/user/useSavedProductsActions.js";
26
- import { useFollowedShopsActions as Be } from "./hooks/user/useFollowedShopsActions.js";
27
- import { useCurrentUser as Ee } from "./hooks/user/useCurrentUser.js";
28
- import { useOrders as Oe } from "./hooks/user/useOrders.js";
29
- import { useBuyerAttributes as Me } from "./hooks/user/useBuyerAttributes.js";
30
- import { useProductListActions as Ue } from "./hooks/product/useProductListActions.js";
31
- import { useProductLists as ze } from "./hooks/product/useProductLists.js";
32
- import { useProductList as qe } from "./hooks/product/useProductList.js";
33
- import { useRecommendedProducts as Ke } from "./hooks/product/useRecommendedProducts.js";
34
- import { usePopularProducts as We } from "./hooks/product/usePopularProducts.js";
35
- import { useAsyncStorage as Ye } from "./hooks/storage/useAsyncStorage.js";
36
- import { useSecureStorage as _e } from "./hooks/storage/useSecureStorage.js";
37
- import { useImageUpload as ro } from "./hooks/storage/useImageUpload.js";
38
- import { useShopNavigation as oo } from "./hooks/navigation/useShopNavigation.js";
39
- import { useCloseMini as ao } from "./hooks/navigation/useCloseMini.js";
40
- import { useShopCartActions as lo } from "./hooks/shop/useShopCartActions.js";
41
- import { useRecommendedShops as co } from "./hooks/shop/useRecommendedShops.js";
42
- import { useErrorToast as so } from "./hooks/util/useErrorToast.js";
43
- import { useErrorScreen as mo } from "./hooks/util/useErrorScreen.js";
44
- import { MiniEntityNotFoundError as go, MiniError as xo, MiniNetworkError as Co, formatError as Po } from "./utils/errors.js";
45
- import { parseUrl as So } from "./utils/parseUrl.js";
46
- import { Consent as To, ConsentStatus as Lo, CurrencyCode as ho, Gender as ko } from "./types/minisSDK.generated.d.js";
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 g, ProductLinkActions as C, ProductLinkCurrentPrice as P, ProductLinkDiscountPrice as D, ProductLinkImage as S, ProductLinkInfo as A, ProductLinkOriginalPrice as T, ProductLinkPrice as L, ProductLinkRating as h, ProductLinkRoot as k, ProductLinkTitle as w } from "./components/commerce/product-link.js";
4
+ import { Accordion as I, AccordionContent as v, AccordionItem as R, AccordionTrigger as F } from "./components/ui/accordion.js";
5
+ import { Alert as y, AlertDescription as E, AlertTitle as H } from "./components/ui/alert.js";
6
+ import { AlertDialog as G, AlertDialogAction as M, AlertDialogCancel as N, AlertDialogContent as U, AlertDialogDescription as V, AlertDialogFooter as z, AlertDialogHeader as j, AlertDialogOverlay as q, AlertDialogPortal as J, AlertDialogTitle as K, AlertDialogTrigger as Q } from "./components/ui/alert-dialog.js";
7
+ import { Avatar as X, AvatarFallback as Y, AvatarImage as Z } from "./components/ui/avatar.js";
8
+ import { Badge as $, badgeVariants as rr } from "./components/ui/badge.js";
9
+ import { Button as or, buttonVariants as tr } from "./components/ui/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/ui/card.js";
11
+ import { Carousel as mr, CarouselContent as fr, CarouselItem as xr, CarouselNext as gr, CarouselPrevious as Cr } from "./components/ui/carousel.js";
12
+ import { Checkbox as Dr } from "./components/ui/checkbox.js";
13
+ import { Dialog as Ar, DialogClose as Tr, DialogContent as Lr, DialogDescription as hr, DialogFooter as kr, DialogHeader as wr, DialogOverlay as br, DialogPortal as Ir, DialogTitle as vr, DialogTrigger as Rr } from "./components/ui/dialog.js";
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 Vr } from "./components/ui/drawer.js";
15
+ import { Input as jr } from "./components/ui/input.js";
16
+ import { Label as Jr } from "./components/ui/label.js";
17
+ import { Progress as Qr } from "./components/ui/progress.js";
18
+ import { RadioGroup as Xr, RadioGroupItem as Yr } from "./components/ui/radio-group.js";
19
+ import { ResizableHandle as _r, ResizablePanel as $r, ResizablePanelGroup as re } from "./components/ui/resizable.js";
20
+ import { ScrollArea as oe, ScrollBar as te } from "./components/ui/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/ui/select.js";
22
+ import { Separator as ge } from "./components/ui/separator.js";
23
+ import { Sheet as Pe, SheetClose as De, SheetContent as Se, SheetDescription as Ae, SheetFooter as Te, SheetHeader as Le, SheetTitle as he, SheetTrigger as ke } from "./components/ui/sheet.js";
24
+ import { Toaster as be } from "./components/ui/sonner.js";
25
+ import { Touchable as ve, touchableVariants as Re } from "./components/ui/touchable.js";
26
+ import { useSavedProductsActions as Be } from "./hooks/user/useSavedProductsActions.js";
27
+ import { useFollowedShopsActions as Ee } from "./hooks/user/useFollowedShopsActions.js";
28
+ import { useCurrentUser as Oe } from "./hooks/user/useCurrentUser.js";
29
+ import { useOrders as Me } from "./hooks/user/useOrders.js";
30
+ import { useBuyerAttributes as Ue } from "./hooks/user/useBuyerAttributes.js";
31
+ import { useProductListActions as ze } from "./hooks/product/useProductListActions.js";
32
+ import { useProductLists as qe } from "./hooks/product/useProductLists.js";
33
+ import { useProductList as Ke } from "./hooks/product/useProductList.js";
34
+ import { useRecommendedProducts as We } from "./hooks/product/useRecommendedProducts.js";
35
+ import { usePopularProducts as Ye } from "./hooks/product/usePopularProducts.js";
36
+ import { useAsyncStorage as _e } from "./hooks/storage/useAsyncStorage.js";
37
+ import { useSecureStorage as ro } from "./hooks/storage/useSecureStorage.js";
38
+ import { useImageUpload as oo } from "./hooks/storage/useImageUpload.js";
39
+ import { useShopNavigation as ao } from "./hooks/navigation/useShopNavigation.js";
40
+ import { useCloseMini as lo } from "./hooks/navigation/useCloseMini.js";
41
+ import { useShopCartActions as co } from "./hooks/shop/useShopCartActions.js";
42
+ import { useRecommendedShops as so } from "./hooks/shop/useRecommendedShops.js";
43
+ import { useErrorToast as mo } from "./hooks/util/useErrorToast.js";
44
+ import { useErrorScreen as xo } from "./hooks/util/useErrorScreen.js";
45
+ import { MiniEntityNotFoundError as Co, MiniError as Po, MiniNetworkError as Do, formatError as So } from "./utils/errors.js";
46
+ import { parseUrl as To } from "./utils/parseUrl.js";
47
+ import { Consent as ho, ConsentStatus as ko, CurrencyCode as wo, Gender as bo } from "./types/minisSDK.generated.d.js";
47
48
  export {
48
- w as Accordion,
49
- b as AccordionContent,
50
- I as AccordionItem,
51
- v as AccordionTrigger,
52
- F as Alert,
53
- B as AlertDescription,
54
- H as AlertDialog,
55
- O as AlertDialogAction,
56
- G as AlertDialogCancel,
57
- M as AlertDialogContent,
58
- N as AlertDialogDescription,
59
- U as AlertDialogFooter,
60
- V as AlertDialogHeader,
61
- z as AlertDialogOverlay,
62
- j as AlertDialogPortal,
63
- q as AlertDialogTitle,
64
- J as AlertDialogTrigger,
65
- y as AlertTitle,
66
- Q as Avatar,
67
- W as AvatarFallback,
68
- X as AvatarImage,
69
- Z as Badge,
70
- rr as Button,
71
- tr as Card,
72
- ar as CardAction,
73
- ir as CardContent,
74
- lr as CardDescription,
75
- nr as CardFooter,
76
- cr as CardHeader,
77
- ur as CardTitle,
78
- sr as Carousel,
79
- pr as CarouselContent,
80
- mr as CarouselItem,
81
- fr as CarouselNext,
82
- gr as CarouselPrevious,
83
- Cr as Checkbox,
84
- To as Consent,
85
- Lo as ConsentStatus,
86
- ho as CurrencyCode,
87
- Dr as Dialog,
88
- Sr as DialogClose,
89
- Ar as DialogContent,
90
- Tr as DialogDescription,
91
- Lr as DialogFooter,
92
- hr as DialogHeader,
93
- kr as DialogOverlay,
94
- wr as DialogPortal,
95
- br as DialogTitle,
96
- Ir as DialogTrigger,
97
- Rr as Drawer,
98
- Fr as DrawerClose,
99
- Br as DrawerContent,
100
- yr as DrawerDescription,
101
- Er as DrawerFooter,
102
- Hr as DrawerHeader,
103
- Or as DrawerOverlay,
104
- Gr as DrawerPortal,
105
- Mr as DrawerTitle,
106
- Nr as DrawerTrigger,
107
- ko as Gender,
108
- Vr as Input,
109
- jr as Label,
110
- go as MiniEntityNotFoundError,
111
- xo as MiniError,
112
- Co as MiniNetworkError,
113
- o as ProductCard,
114
- t as ProductCardBadge,
115
- a as ProductCardCurrentPrice,
116
- i as ProductCardFavoriteButton,
117
- l as ProductCardImage,
118
- n as ProductCardImageContainer,
119
- c as ProductCardInfo,
120
- u as ProductCardOriginalPrice,
121
- d as ProductCardPrice,
122
- s as ProductCardRoot,
123
- p as ProductCardTitle,
124
- f as ProductLink,
125
- g as ProductLinkActions,
126
- x as ProductLinkCurrentPrice,
127
- C as ProductLinkDiscountPrice,
128
- P as ProductLinkImage,
129
- D as ProductLinkInfo,
130
- S as ProductLinkOriginalPrice,
131
- A as ProductLinkPrice,
132
- T as ProductLinkRating,
133
- L as ProductLinkRoot,
134
- h as ProductLinkTitle,
135
- Jr as Progress,
136
- Qr as RadioGroup,
137
- Wr as RadioGroupItem,
138
- Yr as ResizableHandle,
139
- Zr as ResizablePanel,
140
- _r as ResizablePanelGroup,
141
- re as ScrollArea,
142
- ee as ScrollBar,
143
- te as Select,
144
- ae as SelectContent,
145
- ie as SelectGroup,
146
- le as SelectItem,
147
- ne as SelectLabel,
148
- ce as SelectScrollDownButton,
149
- ue as SelectScrollUpButton,
150
- de as SelectSeparator,
151
- se as SelectTrigger,
152
- pe as SelectValue,
153
- fe as Separator,
154
- xe as Sheet,
155
- Ce as SheetClose,
156
- Pe as SheetContent,
157
- De as SheetDescription,
158
- Se as SheetFooter,
159
- Ae as SheetHeader,
160
- Te as SheetTitle,
161
- Le as SheetTrigger,
162
- ke as Toaster,
163
- be as Touchable,
164
- _ as badgeVariants,
165
- er as buttonVariants,
166
- Po as formatError,
167
- So as parseUrl,
168
- Ie as touchableVariants,
169
- Ye as useAsyncStorage,
170
- Me as useBuyerAttributes,
171
- ao as useCloseMini,
172
- Ee as useCurrentUser,
173
- mo as useErrorScreen,
174
- so as useErrorToast,
175
- Be as useFollowedShopsActions,
176
- ro as useImageUpload,
177
- Oe as useOrders,
178
- We as usePopularProducts,
179
- qe as useProductList,
180
- Ue as useProductListActions,
181
- ze as useProductLists,
182
- Ke as useRecommendedProducts,
183
- co as useRecommendedShops,
184
- Re as useSavedProductsActions,
185
- _e as useSecureStorage,
186
- lo as useShopCartActions,
187
- oo as useShopNavigation
49
+ I as Accordion,
50
+ v as AccordionContent,
51
+ R as AccordionItem,
52
+ F as AccordionTrigger,
53
+ y as Alert,
54
+ E as AlertDescription,
55
+ G as AlertDialog,
56
+ M as AlertDialogAction,
57
+ N as AlertDialogCancel,
58
+ U as AlertDialogContent,
59
+ V as AlertDialogDescription,
60
+ z as AlertDialogFooter,
61
+ j as AlertDialogHeader,
62
+ q as AlertDialogOverlay,
63
+ J as AlertDialogPortal,
64
+ K as AlertDialogTitle,
65
+ Q as AlertDialogTrigger,
66
+ H as AlertTitle,
67
+ X as Avatar,
68
+ Y as AvatarFallback,
69
+ Z as AvatarImage,
70
+ $ as Badge,
71
+ or as Button,
72
+ ir as Card,
73
+ lr as CardAction,
74
+ nr as CardContent,
75
+ cr as CardDescription,
76
+ ur as CardFooter,
77
+ dr as CardHeader,
78
+ sr as CardTitle,
79
+ mr as Carousel,
80
+ fr as CarouselContent,
81
+ xr as CarouselItem,
82
+ gr as CarouselNext,
83
+ Cr as CarouselPrevious,
84
+ Dr as Checkbox,
85
+ ho as Consent,
86
+ ko as ConsentStatus,
87
+ wo as CurrencyCode,
88
+ Ar as Dialog,
89
+ Tr as DialogClose,
90
+ Lr as DialogContent,
91
+ hr as DialogDescription,
92
+ kr as DialogFooter,
93
+ wr as DialogHeader,
94
+ br as DialogOverlay,
95
+ Ir as DialogPortal,
96
+ vr as DialogTitle,
97
+ Rr as DialogTrigger,
98
+ Br as Drawer,
99
+ yr as DrawerClose,
100
+ Er as DrawerContent,
101
+ Hr as DrawerDescription,
102
+ Or as DrawerFooter,
103
+ Gr as DrawerHeader,
104
+ Mr as DrawerOverlay,
105
+ Nr as DrawerPortal,
106
+ Ur as DrawerTitle,
107
+ Vr as DrawerTrigger,
108
+ bo as Gender,
109
+ jr as Input,
110
+ Jr as Label,
111
+ Co as MiniEntityNotFoundError,
112
+ Po as MiniError,
113
+ Do as MiniNetworkError,
114
+ o as MinisContainer,
115
+ a as ProductCard,
116
+ i as ProductCardBadge,
117
+ l as ProductCardCurrentPrice,
118
+ n as ProductCardFavoriteButton,
119
+ c as ProductCardImage,
120
+ u as ProductCardImageContainer,
121
+ d as ProductCardInfo,
122
+ s as ProductCardOriginalPrice,
123
+ p as ProductCardPrice,
124
+ m as ProductCardRoot,
125
+ f as ProductCardTitle,
126
+ g as ProductLink,
127
+ C as ProductLinkActions,
128
+ P as ProductLinkCurrentPrice,
129
+ D as ProductLinkDiscountPrice,
130
+ S as ProductLinkImage,
131
+ A as ProductLinkInfo,
132
+ T as ProductLinkOriginalPrice,
133
+ L as ProductLinkPrice,
134
+ h as ProductLinkRating,
135
+ k as ProductLinkRoot,
136
+ w as ProductLinkTitle,
137
+ Qr as Progress,
138
+ Xr as RadioGroup,
139
+ Yr as RadioGroupItem,
140
+ _r as ResizableHandle,
141
+ $r as ResizablePanel,
142
+ re as ResizablePanelGroup,
143
+ oe as ScrollArea,
144
+ te as ScrollBar,
145
+ ie as Select,
146
+ le as SelectContent,
147
+ ne as SelectGroup,
148
+ ce as SelectItem,
149
+ ue as SelectLabel,
150
+ de as SelectScrollDownButton,
151
+ se as SelectScrollUpButton,
152
+ pe as SelectSeparator,
153
+ me as SelectTrigger,
154
+ fe as SelectValue,
155
+ ge as Separator,
156
+ Pe as Sheet,
157
+ De as SheetClose,
158
+ Se as SheetContent,
159
+ Ae as SheetDescription,
160
+ Te as SheetFooter,
161
+ Le as SheetHeader,
162
+ he as SheetTitle,
163
+ ke as SheetTrigger,
164
+ be as Toaster,
165
+ ve as Touchable,
166
+ rr as badgeVariants,
167
+ tr as buttonVariants,
168
+ So as formatError,
169
+ To as parseUrl,
170
+ Re as touchableVariants,
171
+ _e as useAsyncStorage,
172
+ Ue as useBuyerAttributes,
173
+ lo as useCloseMini,
174
+ Oe as useCurrentUser,
175
+ xo as useErrorScreen,
176
+ mo as useErrorToast,
177
+ Ee as useFollowedShopsActions,
178
+ oo as useImageUpload,
179
+ Me as useOrders,
180
+ Ye as usePopularProducts,
181
+ Ke as useProductList,
182
+ ze as useProductListActions,
183
+ qe as useProductLists,
184
+ We as useRecommendedProducts,
185
+ so as useRecommendedShops,
186
+ Be as useSavedProductsActions,
187
+ ro as useSecureStorage,
188
+ co as useShopCartActions,
189
+ ao as useShopNavigation
188
190
  };
189
191
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/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.6",
4
+ "version": "0.0.7",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "engines": {
@@ -0,0 +1,62 @@
1
+ import React, {useEffect, useState} from 'react'
2
+
3
+ export function MinisContainer({children}: {children: React.ReactNode}) {
4
+ const [isSDKReady, setIsSDKReady] = useState(false)
5
+
6
+ useEffect(() => {
7
+ // Function to check if SDK is ready
8
+ const checkSDKReady = () => {
9
+ if (window.minisSDK) {
10
+ setIsSDKReady(true)
11
+ return true
12
+ }
13
+ return false
14
+ }
15
+
16
+ // Check immediately
17
+ if (checkSDKReady()) {
18
+ return
19
+ }
20
+
21
+ // If not ready, set up a listener for the MINIS_SDK_READY event
22
+ const handleSDKReady = (event: any) => {
23
+ const {type} = JSON.parse(event.data)
24
+
25
+ if (type === 'MINIS_SDK_READY') {
26
+ setIsSDKReady(true)
27
+ }
28
+ }
29
+
30
+ // Listen for the MINIS_SDK_READY event
31
+ window.addEventListener('message', handleSDKReady)
32
+ document.addEventListener('message', handleSDKReady)
33
+
34
+ // Also poll for SDK availability as a fallback
35
+ const pollInterval = setInterval(() => {
36
+ if (checkSDKReady()) {
37
+ clearInterval(pollInterval)
38
+ }
39
+ }, 100)
40
+
41
+ // Cleanup
42
+ return () => {
43
+ // clearInterval(pollInterval);
44
+ window.removeEventListener('message', handleSDKReady)
45
+ document.removeEventListener('message', handleSDKReady)
46
+ }
47
+ }, [])
48
+
49
+ // Don't render anything until SDK is ready
50
+ if (!isSDKReady) {
51
+ return (
52
+ <div className="h-screen bg-gray-50 flex items-center justify-center">
53
+ <div className="text-center">
54
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-4" />
55
+ <p className="text-gray-600">Loading...</p>
56
+ </div>
57
+ </div>
58
+ )
59
+ }
60
+
61
+ return children
62
+ }
@@ -1,3 +1,5 @@
1
+ export * from './MinisContainer'
2
+
1
3
  export * from './commerce/product-card'
2
4
  export * from './commerce/product-link'
3
5