@shopify/shop-minis-react 0.0.5 → 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.
- package/dist/_virtual/index2.js +2 -3
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.js +3 -2
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/components/MinisContainer.js +28 -0
- package/dist/components/MinisContainer.js.map +1 -0
- package/dist/index.js +188 -186
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/package.json +1 -1
- package/src/components/MinisContainer.tsx +62 -0
- package/src/components/index.ts +2 -0
- package/src/index.css +15 -0
package/dist/_virtual/index2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
o as
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
f as
|
|
125
|
-
g as
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Qr as
|
|
137
|
-
|
|
138
|
-
Yr as
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
re as
|
|
142
|
-
|
|
143
|
-
te as
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
fe as
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
ke as
|
|
163
|
-
be as
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
So as
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
ze as
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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
|
@@ -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
|
+
}
|
package/src/components/index.ts
CHANGED
package/src/index.css
CHANGED
|
@@ -200,3 +200,18 @@
|
|
|
200
200
|
@apply bg-background text-foreground;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
|
|
204
|
+
/* Disable text selection */
|
|
205
|
+
body {
|
|
206
|
+
-webkit-user-select: none;
|
|
207
|
+
-moz-user-select: -moz-none;
|
|
208
|
+
-ms-user-select: none;
|
|
209
|
+
user-select: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* Disable image drag */
|
|
213
|
+
img,
|
|
214
|
+
.no-drag {
|
|
215
|
+
-webkit-user-drag: none;
|
|
216
|
+
user-drag: none;
|
|
217
|
+
}
|