@levo-so/react 0.1.86 → 0.1.105
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/audience/components/block.js +31 -0
- package/dist/audience/components/component.js +19 -0
- package/dist/audience/components/page.js +16 -0
- package/dist/components/Dialog.js +57 -0
- package/dist/components/DialogWrapper.js +20 -0
- package/dist/components/Sonner.d.ts +1 -1
- package/dist/components/Sonner.d.ts.map +1 -1
- package/dist/components/Sonner.js +32 -0
- package/dist/components/Spinner.js +7 -0
- package/dist/components/Tabs.js +27 -0
- package/dist/components/Tooltip.js +24 -0
- package/dist/components/button/Button.js +24 -0
- package/dist/components/button/buttonVariants.d.ts +1 -1
- package/dist/components/button/buttonVariants.d.ts.map +1 -1
- package/dist/components/button/buttonVariants.js +38 -0
- package/dist/constants/fileUploadPresets.js +80 -0
- package/dist/index.js +24 -495
- package/dist/membership/components/Button.js +22 -0
- package/dist/membership/components/Container.js +59 -0
- package/dist/membership/components/Core.js +18 -0
- package/dist/membership/components/Popup.js +37 -0
- package/dist/membership/index.js +10 -0
- package/dist/membership/useLevoOAuth.js +57 -0
- package/dist/providers/LevoProvider.js +20 -0
- package/dist/styles/index.css +2 -0
- package/dist/utils/byteToSize.js +18 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/errorHandler.js +9 -0
- package/dist/utils/isDateObject.js +4 -0
- package/dist/utils/isEmptyObject.js +5 -0
- package/dist/utils/isNullOrUndefined.js +4 -0
- package/dist/utils/isObject.js +6 -0
- package/package.json +32 -32
- package/dist/index.css +0 -2
package/dist/index.js
CHANGED
|
@@ -1,495 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!e.client) throw Error("useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider.");
|
|
26
|
-
return e.client;
|
|
27
|
-
}, E = () => a(w).insights, te = ({ id: t, properties: n = {} }) => {
|
|
28
|
-
let { logger: r } = T(), i = E(), a = c(!1), s = c(n);
|
|
29
|
-
return s.current = n, o(() => {
|
|
30
|
-
if (a.current || typeof i?.track != "function") return;
|
|
31
|
-
let n = document.getElementById(t);
|
|
32
|
-
if (!n) return;
|
|
33
|
-
let o = new IntersectionObserver((n) => {
|
|
34
|
-
for (let c of n) if (c.isIntersecting && !a.current) try {
|
|
35
|
-
i.track("block.view", {
|
|
36
|
-
...s.current,
|
|
37
|
-
resource: "block",
|
|
38
|
-
identifier: t
|
|
39
|
-
}), a.current = !0, o.disconnect();
|
|
40
|
-
} catch (t) {
|
|
41
|
-
r?.error("[LevoAudienceBlock] track failed", e(t));
|
|
42
|
-
}
|
|
43
|
-
}, { threshold: 0 });
|
|
44
|
-
return o.observe(n), () => o.disconnect();
|
|
45
|
-
}, [
|
|
46
|
-
i,
|
|
47
|
-
t,
|
|
48
|
-
r
|
|
49
|
-
]), null;
|
|
50
|
-
}, ne = ({ event: t, properties: n }) => {
|
|
51
|
-
let { logger: r } = T(), i = E(), a = c(!1), s = c(t);
|
|
52
|
-
s.current = t;
|
|
53
|
-
let l = c(n);
|
|
54
|
-
return l.current = n, o(() => {
|
|
55
|
-
if (!(a.current || !i)) try {
|
|
56
|
-
i.track(s.current, l.current), a.current = !0;
|
|
57
|
-
} catch (t) {
|
|
58
|
-
r?.error("[LevoAudienceComponent] track failed", e(t));
|
|
59
|
-
}
|
|
60
|
-
}, [i, r]), null;
|
|
61
|
-
}, re = ({ id: e }) => {
|
|
62
|
-
let t = T(), n = E();
|
|
63
|
-
return o(() => {
|
|
64
|
-
t && typeof window < "u" && (window.levo_client = t);
|
|
65
|
-
}, [t]), o(() => {
|
|
66
|
-
n && typeof window < "u" && (window.levo_insights = n);
|
|
67
|
-
}, [n]), o(() => {
|
|
68
|
-
n && n.init({ pageId: e });
|
|
69
|
-
}, [n, e]), null;
|
|
70
|
-
}, D = (...e) => v(y(e)), O = b("inline-flex items-center justify-center font-medium text-sm ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", {
|
|
71
|
-
variants: {
|
|
72
|
-
variant: {
|
|
73
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
74
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90",
|
|
75
|
-
destructiveOutline: "border border-red-500 bg-transparent text-destructive shadow-sm hover:bg-destructive hover:text-white",
|
|
76
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
77
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
78
|
-
secondaryOutline: "border border-white border-solid bg-transparent hover:border-input hover:bg-white",
|
|
79
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
80
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
81
|
-
},
|
|
82
|
-
size: {
|
|
83
|
-
default: "h-10 px-4 py-2",
|
|
84
|
-
xs: "h-8 px-3 text-xs",
|
|
85
|
-
sm: "h-9 px-3",
|
|
86
|
-
lg: "h-11 px-8",
|
|
87
|
-
icon: "h-10 w-10",
|
|
88
|
-
"icon-small": "h-8 w-8"
|
|
89
|
-
},
|
|
90
|
-
rounded: {
|
|
91
|
-
small: "rounded",
|
|
92
|
-
default: "rounded-md",
|
|
93
|
-
large: "rounded-lg",
|
|
94
|
-
full: "rounded-full"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
defaultVariants: {
|
|
98
|
-
variant: "default",
|
|
99
|
-
size: "default",
|
|
100
|
-
rounded: "default"
|
|
101
|
-
}
|
|
102
|
-
}), ie = t.forwardRef(({ className: e, variant: t, size: n, rounded: r, asChild: i = !1, isLoading: a = !1, loadingText: o, disabled: s, ...c }, l) => /* @__PURE__ */ d(i ? m.Root : "button", {
|
|
103
|
-
className: D(O({
|
|
104
|
-
variant: t,
|
|
105
|
-
size: n,
|
|
106
|
-
rounded: r,
|
|
107
|
-
className: e
|
|
108
|
-
})),
|
|
109
|
-
ref: l,
|
|
110
|
-
disabled: s || a,
|
|
111
|
-
type: "button",
|
|
112
|
-
...c,
|
|
113
|
-
children: a ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(_, { className: v("h-4 w-4 animate-spin", o ? "mr-2" : "") }), o] }) : c.children
|
|
114
|
-
}));
|
|
115
|
-
ie.displayName = "Button";
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/components/Dialog.tsx
|
|
118
|
-
var ae = p.Root, oe = p.Trigger, k = p.Portal, se = p.Close, A = t.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ d(p.Overlay, {
|
|
119
|
-
ref: n,
|
|
120
|
-
className: D("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 grid max-h-screen place-items-center overflow-y-auto bg-background/80 py-10 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
121
|
-
...t
|
|
122
|
-
}));
|
|
123
|
-
A.displayName = p.Overlay.displayName;
|
|
124
|
-
var j = t.forwardRef(({ className: e, children: t, container: n, hideCloseButton: r, overlayStyles: i, ...a }, o) => /* @__PURE__ */ d(k, {
|
|
125
|
-
container: n,
|
|
126
|
-
children: /* @__PURE__ */ d(A, {
|
|
127
|
-
className: i,
|
|
128
|
-
children: /* @__PURE__ */ f(p.Content, {
|
|
129
|
-
ref: o,
|
|
130
|
-
className: D("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:rounded-lg", e),
|
|
131
|
-
...a,
|
|
132
|
-
children: [t, !r && /* @__PURE__ */ f(p.Close, {
|
|
133
|
-
type: "button",
|
|
134
|
-
className: "absolute top-4 right-4 rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
135
|
-
children: [/* @__PURE__ */ d(x, { className: "h-4 w-4" }), /* @__PURE__ */ d("span", {
|
|
136
|
-
className: "sr-only",
|
|
137
|
-
children: "Close"
|
|
138
|
-
})]
|
|
139
|
-
})]
|
|
140
|
-
})
|
|
141
|
-
})
|
|
142
|
-
}));
|
|
143
|
-
j.displayName = p.Content.displayName;
|
|
144
|
-
var M = ({ className: e, ...t }) => /* @__PURE__ */ d("div", {
|
|
145
|
-
className: D("flex flex-col space-y-1.5 text-center sm:text-left", e),
|
|
146
|
-
...t
|
|
147
|
-
});
|
|
148
|
-
M.displayName = "DialogHeader";
|
|
149
|
-
var N = ({ className: e, ...t }) => /* @__PURE__ */ d("div", {
|
|
150
|
-
className: D("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
|
|
151
|
-
...t
|
|
152
|
-
});
|
|
153
|
-
N.displayName = "DialogFooter";
|
|
154
|
-
var P = t.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ d(p.Title, {
|
|
155
|
-
ref: n,
|
|
156
|
-
className: D("font-semibold text-lg leading-none tracking-tight", e),
|
|
157
|
-
...t
|
|
158
|
-
}));
|
|
159
|
-
P.displayName = p.Title.displayName;
|
|
160
|
-
var F = t.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ d(p.Description, {
|
|
161
|
-
ref: n,
|
|
162
|
-
className: D("text-muted-foreground text-sm", e),
|
|
163
|
-
...t
|
|
164
|
-
}));
|
|
165
|
-
F.displayName = p.Description.displayName;
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/components/DialogWrapper.tsx
|
|
168
|
-
var ce = ({ isOpen: e, onClose: t, children: n, title: r, description: i = "", contentClassName: a, modal: o = !0 }) => /* @__PURE__ */ d(ae, {
|
|
169
|
-
open: e,
|
|
170
|
-
onOpenChange: t,
|
|
171
|
-
modal: o,
|
|
172
|
-
children: /* @__PURE__ */ f(j, {
|
|
173
|
-
className: a,
|
|
174
|
-
children: [r && /* @__PURE__ */ f(M, {
|
|
175
|
-
className: "flex-1 font-medium",
|
|
176
|
-
children: [/* @__PURE__ */ d(P, { children: r }), /* @__PURE__ */ d(F, { children: i })]
|
|
177
|
-
}), /* @__PURE__ */ d("div", {
|
|
178
|
-
className: "w-full",
|
|
179
|
-
children: n
|
|
180
|
-
})]
|
|
181
|
-
})
|
|
182
|
-
}), le = ({ ...e }) => /* @__PURE__ */ d(S, {
|
|
183
|
-
closeButton: !0,
|
|
184
|
-
richColors: !0,
|
|
185
|
-
className: "toaster group",
|
|
186
|
-
toastOptions: { classNames: {
|
|
187
|
-
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
188
|
-
description: "group-[.toast]:text-muted-foreground",
|
|
189
|
-
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
190
|
-
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
|
|
191
|
-
} },
|
|
192
|
-
...e
|
|
193
|
-
}), I = (e, t = "Error", n = {}) => {
|
|
194
|
-
C.error(t, {
|
|
195
|
-
description: e,
|
|
196
|
-
duration: 4e3,
|
|
197
|
-
position: "bottom-right",
|
|
198
|
-
...n
|
|
199
|
-
});
|
|
200
|
-
}, ue = (e, t = "Success", n = {}) => {
|
|
201
|
-
n?.id && C.dismiss(n?.id), C.success(t, {
|
|
202
|
-
description: e,
|
|
203
|
-
duration: 4e3,
|
|
204
|
-
position: "bottom-right",
|
|
205
|
-
...n
|
|
206
|
-
});
|
|
207
|
-
}, L = ({ className: e }) => /* @__PURE__ */ d(_, { className: D("h-8 w-8 animate-spin font-light", e) }), de = h.Root, R = t.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ d(h.List, {
|
|
208
|
-
ref: n,
|
|
209
|
-
className: D("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", e),
|
|
210
|
-
...t
|
|
211
|
-
}));
|
|
212
|
-
R.displayName = h.List.displayName;
|
|
213
|
-
var z = t.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ d(h.Trigger, {
|
|
214
|
-
ref: n,
|
|
215
|
-
className: D("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm", e),
|
|
216
|
-
"data-levo-studio-interactive": "true",
|
|
217
|
-
...t
|
|
218
|
-
}));
|
|
219
|
-
z.displayName = h.Trigger.displayName;
|
|
220
|
-
var B = t.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ d(h.Content, {
|
|
221
|
-
ref: n,
|
|
222
|
-
className: D("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", e),
|
|
223
|
-
...t
|
|
224
|
-
}));
|
|
225
|
-
B.displayName = h.Content.displayName;
|
|
226
|
-
//#endregion
|
|
227
|
-
//#region src/components/Tooltip.tsx
|
|
228
|
-
var fe = g.Provider, V = g.Root, H = g.Trigger, U = g.Portal, W = t.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ d(g.Content, {
|
|
229
|
-
ref: r,
|
|
230
|
-
sideOffset: t,
|
|
231
|
-
className: D("fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 animate-in overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-popover-foreground text-xs shadow-md data-[state=closed]:animate-out", e),
|
|
232
|
-
...n
|
|
233
|
-
}));
|
|
234
|
-
W.displayName = g.Content.displayName;
|
|
235
|
-
var pe = ({ children: e, label: t, labelClassName: n, asChild: r = !0, contentProps: i = {}, side: a }) => /* @__PURE__ */ f(V, { children: [t && /* @__PURE__ */ d(U, { children: /* @__PURE__ */ d(W, {
|
|
236
|
-
side: a,
|
|
237
|
-
className: n,
|
|
238
|
-
...i,
|
|
239
|
-
children: t
|
|
240
|
-
}) }), /* @__PURE__ */ d(H, {
|
|
241
|
-
asChild: r,
|
|
242
|
-
children: e
|
|
243
|
-
})] }), G = [
|
|
244
|
-
"pdf",
|
|
245
|
-
"txt",
|
|
246
|
-
"xml",
|
|
247
|
-
"xls",
|
|
248
|
-
"xlsx",
|
|
249
|
-
"ods",
|
|
250
|
-
"odt",
|
|
251
|
-
"doc",
|
|
252
|
-
"docx",
|
|
253
|
-
"csv",
|
|
254
|
-
"odp",
|
|
255
|
-
"ppt",
|
|
256
|
-
"pptx"
|
|
257
|
-
], K = [
|
|
258
|
-
"svg",
|
|
259
|
-
"png",
|
|
260
|
-
"jpg",
|
|
261
|
-
"jpeg",
|
|
262
|
-
"gif",
|
|
263
|
-
"webp",
|
|
264
|
-
"avif"
|
|
265
|
-
], q = [
|
|
266
|
-
"mp4",
|
|
267
|
-
"ogv",
|
|
268
|
-
"webm"
|
|
269
|
-
], J = [
|
|
270
|
-
"mp3",
|
|
271
|
-
"ogg",
|
|
272
|
-
"opus"
|
|
273
|
-
], Y = {
|
|
274
|
-
"application/xml": [".xml"],
|
|
275
|
-
"text/plain": [".txt"],
|
|
276
|
-
"application/pdf": [".pdf"],
|
|
277
|
-
"application/msword": [".doc"],
|
|
278
|
-
"application/vnd.ms-excel": [".xls"],
|
|
279
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
|
280
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
|
281
|
-
"text/csv": [".csv"]
|
|
282
|
-
}, X = {
|
|
283
|
-
"image/jpeg": [".jpeg", ".jpg"],
|
|
284
|
-
"image/jpg": [".jpg"],
|
|
285
|
-
"image/png": [".png"],
|
|
286
|
-
"image/gif": [".gif"],
|
|
287
|
-
"image/svg": [".svg"],
|
|
288
|
-
"image/svg+xml": [".svg"],
|
|
289
|
-
"image/webp": [".webp"],
|
|
290
|
-
"image/avif": [".avif"]
|
|
291
|
-
}, Z = {
|
|
292
|
-
"video/mp4": [".mp4"],
|
|
293
|
-
"video/mpeg": [".mpeg"],
|
|
294
|
-
"video/webm": [".webm"]
|
|
295
|
-
}, me = {
|
|
296
|
-
"audio/mpeg": [".mp3"],
|
|
297
|
-
"audio/ogg": [".oga"],
|
|
298
|
-
"audio/opus": [".opus"]
|
|
299
|
-
}, Q = {
|
|
300
|
-
audio: me,
|
|
301
|
-
document: Y,
|
|
302
|
-
image: X,
|
|
303
|
-
video: Z
|
|
304
|
-
}, $ = {
|
|
305
|
-
audio: J,
|
|
306
|
-
document: G,
|
|
307
|
-
image: K,
|
|
308
|
-
video: q
|
|
309
|
-
}, he = [
|
|
310
|
-
...$.audio,
|
|
311
|
-
...$.document,
|
|
312
|
-
...$.image,
|
|
313
|
-
...$.video
|
|
314
|
-
], ge = {
|
|
315
|
-
...Q.audio,
|
|
316
|
-
...Q.document,
|
|
317
|
-
...Q.image,
|
|
318
|
-
...Q.video
|
|
319
|
-
}, _e = n.createContext({
|
|
320
|
-
urls: null,
|
|
321
|
-
title: "",
|
|
322
|
-
isLoading: !1,
|
|
323
|
-
onSuccess: () => {},
|
|
324
|
-
onError: () => {}
|
|
325
|
-
}), ve = ({ title: e, onSuccess: t, onError: n, children: r }) => {
|
|
326
|
-
let i = T(), a = typeof window < "u" ? window.location.href : "", [c, u] = l(null), [f, p] = l(!1);
|
|
327
|
-
o(() => {
|
|
328
|
-
i.membership && (p(!0), i.membership?.getOAuthURL().then((e) => {
|
|
329
|
-
u(e);
|
|
330
|
-
}).catch((e) => {
|
|
331
|
-
n({
|
|
332
|
-
code: e?.code || "SOMETHING_WENT_WRONG",
|
|
333
|
-
message: e?.message || "We could not connect with our service for your sign-in."
|
|
334
|
-
});
|
|
335
|
-
}).finally(() => {
|
|
336
|
-
p(!1);
|
|
337
|
-
}));
|
|
338
|
-
}, []);
|
|
339
|
-
let m = s(() => ({
|
|
340
|
-
title: e,
|
|
341
|
-
urls: c,
|
|
342
|
-
isLoading: f,
|
|
343
|
-
onSuccess: t,
|
|
344
|
-
onError: n
|
|
345
|
-
}), [
|
|
346
|
-
e,
|
|
347
|
-
c,
|
|
348
|
-
t,
|
|
349
|
-
n,
|
|
350
|
-
f
|
|
351
|
-
]);
|
|
352
|
-
return o(() => {
|
|
353
|
-
if (c && a) {
|
|
354
|
-
let e = {}, t = Object.keys(c);
|
|
355
|
-
for (let n of t) try {
|
|
356
|
-
let t = c[n];
|
|
357
|
-
if (t) {
|
|
358
|
-
let r = new URL(t), o = r.searchParams;
|
|
359
|
-
o.set("redirect_uri", a);
|
|
360
|
-
let s = i.pageContext;
|
|
361
|
-
s && o.set("page_context", JSON.stringify(s)), e[n] = r.toString();
|
|
362
|
-
}
|
|
363
|
-
} catch {}
|
|
364
|
-
u(e);
|
|
365
|
-
}
|
|
366
|
-
}, [a]), /* @__PURE__ */ d(_e.Provider, {
|
|
367
|
-
value: m,
|
|
368
|
-
children: r
|
|
369
|
-
});
|
|
370
|
-
}, ye = () => a(_e), be = ({ url: e, title: t, height: n, width: r }) => {
|
|
371
|
-
let i = window.screenX + (window.outerWidth - r) / 2, a = window.screenY + (window.outerHeight - n) / 2.5;
|
|
372
|
-
return window.open(e, t, `width=${r},height=${n},left=${i},top=${a}`);
|
|
373
|
-
}, xe = ({ title: e = "", width: t = 500, height: n = 500, url: r, children: i, onCode: a, onClose: s }) => {
|
|
374
|
-
let [u, f] = l(), p = c(void 0), m = () => {
|
|
375
|
-
window.clearInterval(p.current);
|
|
376
|
-
}, h = () => {
|
|
377
|
-
f(be({
|
|
378
|
-
url: r,
|
|
379
|
-
title: e,
|
|
380
|
-
width: t,
|
|
381
|
-
height: n
|
|
382
|
-
}));
|
|
383
|
-
};
|
|
384
|
-
return o(() => (u && (p.current = window.setInterval(() => {
|
|
385
|
-
try {
|
|
386
|
-
let e = u.location.href, t = new URL(e).searchParams, n = t.get("code");
|
|
387
|
-
if (!n) return;
|
|
388
|
-
a(n, t), m(), u.close();
|
|
389
|
-
} catch {} finally {
|
|
390
|
-
(!u || u.closed) && (s(), m());
|
|
391
|
-
}
|
|
392
|
-
}, 700)), () => {
|
|
393
|
-
u && u.close(), s && s();
|
|
394
|
-
}), [u]), /* @__PURE__ */ d("div", {
|
|
395
|
-
onClick: () => {
|
|
396
|
-
h();
|
|
397
|
-
},
|
|
398
|
-
children: i
|
|
399
|
-
});
|
|
400
|
-
}, Se = ({ title: e = "Levo", url: t, children: n, onSuccess: r, onError: a, width: o = 500, height: s = 700 }) => /* @__PURE__ */ d(xe, {
|
|
401
|
-
title: e,
|
|
402
|
-
width: o,
|
|
403
|
-
height: s,
|
|
404
|
-
onClose: () => {},
|
|
405
|
-
url: t,
|
|
406
|
-
onCode: i((e, t) => {
|
|
407
|
-
e.toLowerCase() === "success" ? r(t) : a(t);
|
|
408
|
-
}, []),
|
|
409
|
-
children: n
|
|
410
|
-
}), Ce = ({ children: e, provider: t }) => {
|
|
411
|
-
let { title: n, urls: r, isLoading: i, onSuccess: a, onError: o } = ye(), s = r?.[t];
|
|
412
|
-
return s ? /* @__PURE__ */ d(Se, {
|
|
413
|
-
title: n,
|
|
414
|
-
provider: t,
|
|
415
|
-
url: s,
|
|
416
|
-
onSuccess: a,
|
|
417
|
-
onError: o,
|
|
418
|
-
children: i ? /* @__PURE__ */ d("div", {
|
|
419
|
-
className: "w-full items-center justify-center",
|
|
420
|
-
children: /* @__PURE__ */ d(L, { className: "h-5 w-5 bg-brand" })
|
|
421
|
-
}) : e
|
|
422
|
-
}) : null;
|
|
423
|
-
}, we = ({ url: e, title: t, height: n, width: r }) => {
|
|
424
|
-
let i = window.screenX + (window.outerWidth - r) / 2, a = window.screenY + (window.outerHeight - n) / 2.5;
|
|
425
|
-
return window.open(e, t, `width=${r},height=${n},left=${i},top=${a}`);
|
|
426
|
-
}, Te = ({ title: t = "Levo", width: n = 500, height: r = 700, onSuccess: a }) => {
|
|
427
|
-
let u = T(), [d, f] = l(!1), [p, m] = l(null), [h, g] = l(null), [_, v] = l(), y = c(void 0), b = () => {
|
|
428
|
-
window.clearInterval(y.current);
|
|
429
|
-
}, x = i((e, t) => {
|
|
430
|
-
e.toLowerCase() === "success" ? (g(null), a(t)) : g(t);
|
|
431
|
-
}, []);
|
|
432
|
-
o(() => {
|
|
433
|
-
u.membership && (f(!0), u.membership?.getOAuthURL().then((e) => {
|
|
434
|
-
if (e) return m(e), e;
|
|
435
|
-
throw Error();
|
|
436
|
-
}).catch((t) => {
|
|
437
|
-
let n = e(t);
|
|
438
|
-
u.logger?.error("Failed to get OAuth URL", n.message), g({
|
|
439
|
-
code: n?.code || "SOMETHING_WENT_WRONG",
|
|
440
|
-
message: n?.message || "We could not connect with our service for your sign-in."
|
|
441
|
-
});
|
|
442
|
-
}).finally(() => {
|
|
443
|
-
f(!1);
|
|
444
|
-
}));
|
|
445
|
-
}, []), o(() => (_ && (y.current = window.setInterval(() => {
|
|
446
|
-
try {
|
|
447
|
-
let e = _.location.href, t = new URL(e).searchParams, n = t.get("code");
|
|
448
|
-
if (!n) return;
|
|
449
|
-
x(n, t), b(), _.close();
|
|
450
|
-
} catch {} finally {
|
|
451
|
-
(!_ || _.closed) && (b(), g(null));
|
|
452
|
-
}
|
|
453
|
-
}, 700)), () => {
|
|
454
|
-
_ && _.close();
|
|
455
|
-
}), [_]);
|
|
456
|
-
let S = i((e) => {
|
|
457
|
-
if (e && p !== null) {
|
|
458
|
-
let i = p?.[e];
|
|
459
|
-
i && (_ && _.close(), v(we({
|
|
460
|
-
url: i,
|
|
461
|
-
title: t,
|
|
462
|
-
width: n,
|
|
463
|
-
height: r
|
|
464
|
-
})));
|
|
465
|
-
}
|
|
466
|
-
}, [p, _]);
|
|
467
|
-
return {
|
|
468
|
-
providers: s(() => p === null ? [] : Object.keys(p).filter((e) => !!p[e]), [p]),
|
|
469
|
-
isLoading: d,
|
|
470
|
-
error: h,
|
|
471
|
-
launchPopup: S
|
|
472
|
-
};
|
|
473
|
-
}, Ee = class {
|
|
474
|
-
static Container = ve;
|
|
475
|
-
static Button = Ce;
|
|
476
|
-
}, De = (e, t = 2) => {
|
|
477
|
-
if (e === 0) return "0 B";
|
|
478
|
-
let n = 1024, r = t < 0 ? 0 : t, i = [
|
|
479
|
-
"Bytes",
|
|
480
|
-
"KB",
|
|
481
|
-
"MB",
|
|
482
|
-
"GB",
|
|
483
|
-
"TB",
|
|
484
|
-
"PB",
|
|
485
|
-
"EB",
|
|
486
|
-
"ZB",
|
|
487
|
-
"YB"
|
|
488
|
-
], a = Math.floor(Math.log(e) / Math.log(n));
|
|
489
|
-
return `${Number.parseFloat((e / n ** a).toFixed(r))} ${i[a]}`;
|
|
490
|
-
}, Oe = (t) => {
|
|
491
|
-
let n = e(t);
|
|
492
|
-
return n?.code === "REQUEST_TIMEOUT" || n?.code === "NETWORK_ERROR" || n?.status === 408 || n?.status === 0 || I(n?.message || "", n?.title || "Error", { id: `${n?.title || ""}-${n?.message || ""}` }), n;
|
|
493
|
-
}, ke = (e) => e instanceof Date, Ae = (e) => e == null, je = (e) => typeof e == "object", Me = (e) => !Ae(e) && !Array.isArray(e) && je(e) && !ke(e), Ne = (e) => Me(e) && !Object.keys(e).length;
|
|
494
|
-
//#endregion
|
|
495
|
-
export { ie as Button, ae as Dialog, se as DialogClose, j as DialogContent, F as DialogDescription, N as DialogFooter, M as DialogHeader, A as DialogOverlay, k as DialogPortal, P as DialogTitle, oe as DialogTrigger, ce as DialogWrapper, te as LevoInsightsBlock, ne as LevoInsightsComponent, re as LevoInsightsPage, Ee as LevoOAuth, ee as LevoProvider, pe as SimpleTooltipWrapper, L as Spinner, de as Tabs, B as TabsContent, R as TabsList, z as TabsTrigger, le as Toaster, V as Tooltip, W as TooltipContent, U as TooltipPortal, fe as TooltipProvider, H as TooltipTrigger, he as allMediaFileExtensions, ge as allMediaMimetypes, J as audioFileExtensions, me as audioMimetype, O as buttonVariants, De as byteToSize, D as cn, G as documentFileExtensions, Y as documentMimetype, Oe as errorHandler, I as errorToast, K as imageFileExtensions, X as imageMimetype, ke as isDateObject, Ne as isEmptyObject, Ae as isNullOrUndefined, Me as isObject, je as isObjectType, $ as mediaExtensionsByKind, Q as mediaMimetypeByKind, ue as successToast, C as toast, T as useLevo, E as useLevoInsights, Te as useLevoOAuth, q as videoFileExtensions, Z as videoMimetype };
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { LevoProvider as e, useLevo as t, useLevoInsights as n } from "./providers/LevoProvider.js";
|
|
3
|
+
import r from "./audience/components/block.js";
|
|
4
|
+
import i from "./audience/components/component.js";
|
|
5
|
+
import a from "./audience/components/page.js";
|
|
6
|
+
import o from "./utils/cn.js";
|
|
7
|
+
import { buttonVariants as s } from "./components/button/buttonVariants.js";
|
|
8
|
+
import c from "./components/button/Button.js";
|
|
9
|
+
import { Dialog as l, DialogClose as u, DialogContent as d, DialogDescription as f, DialogFooter as p, DialogHeader as m, DialogOverlay as h, DialogPortal as g, DialogTitle as _, DialogTrigger as v } from "./components/Dialog.js";
|
|
10
|
+
import { DialogWrapper as y } from "./components/DialogWrapper.js";
|
|
11
|
+
import { Toaster as b, errorToast as x, successToast as S, toast as C } from "./components/Sonner.js";
|
|
12
|
+
import w from "./components/Spinner.js";
|
|
13
|
+
import { Tabs as T, TabsContent as E, TabsList as D, TabsTrigger as O } from "./components/Tabs.js";
|
|
14
|
+
import { SimpleTooltipWrapper as k, Tooltip as A, TooltipContent as j, TooltipPortal as M, TooltipProvider as N, TooltipTrigger as P } from "./components/Tooltip.js";
|
|
15
|
+
import { allMediaFileExtensions as F, allMediaMimetypes as I, audioFileExtensions as L, audioMimetype as R, documentFileExtensions as z, documentMimetype as B, imageFileExtensions as V, imageMimetype as H, mediaExtensionsByKind as U, mediaMimetypeByKind as W, videoFileExtensions as G, videoMimetype as K } from "./constants/fileUploadPresets.js";
|
|
16
|
+
import { useLevoOAuth as q } from "./membership/useLevoOAuth.js";
|
|
17
|
+
import { LevoOAuth as J } from "./membership/index.js";
|
|
18
|
+
import Y from "./utils/byteToSize.js";
|
|
19
|
+
import { errorHandler as X } from "./utils/errorHandler.js";
|
|
20
|
+
import { isDateObject as Z } from "./utils/isDateObject.js";
|
|
21
|
+
import { isNullOrUndefined as Q } from "./utils/isNullOrUndefined.js";
|
|
22
|
+
import { isObject as $, isObjectType as ee } from "./utils/isObject.js";
|
|
23
|
+
import { isEmptyObject as te } from "./utils/isEmptyObject.js";
|
|
24
|
+
export { c as Button, l as Dialog, u as DialogClose, d as DialogContent, f as DialogDescription, p as DialogFooter, m as DialogHeader, h as DialogOverlay, g as DialogPortal, _ as DialogTitle, v as DialogTrigger, y as DialogWrapper, r as LevoInsightsBlock, i as LevoInsightsComponent, a as LevoInsightsPage, J as LevoOAuth, e as LevoProvider, k as SimpleTooltipWrapper, w as Spinner, T as Tabs, E as TabsContent, D as TabsList, O as TabsTrigger, b as Toaster, A as Tooltip, j as TooltipContent, M as TooltipPortal, N as TooltipProvider, P as TooltipTrigger, F as allMediaFileExtensions, I as allMediaMimetypes, L as audioFileExtensions, R as audioMimetype, s as buttonVariants, Y as byteToSize, o as cn, z as documentFileExtensions, B as documentMimetype, X as errorHandler, x as errorToast, V as imageFileExtensions, H as imageMimetype, Z as isDateObject, te as isEmptyObject, Q as isNullOrUndefined, $ as isObject, ee as isObjectType, U as mediaExtensionsByKind, W as mediaMimetypeByKind, S as successToast, C as toast, t as useLevo, n as useLevoInsights, q as useLevoOAuth, G as videoFileExtensions, K as videoMimetype };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../../components/Spinner.js";
|
|
3
|
+
import { useLevoOAuth as t } from "./Container.js";
|
|
4
|
+
import n from "./Core.js";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
//#region src/membership/components/Button.tsx
|
|
7
|
+
var i = ({ children: i, provider: a }) => {
|
|
8
|
+
let { title: o, urls: s, isLoading: c, onSuccess: l, onError: u } = t(), d = s?.[a];
|
|
9
|
+
return d ? /* @__PURE__ */ r(n, {
|
|
10
|
+
title: o,
|
|
11
|
+
provider: a,
|
|
12
|
+
url: d,
|
|
13
|
+
onSuccess: l,
|
|
14
|
+
onError: u,
|
|
15
|
+
children: c ? /* @__PURE__ */ r("div", {
|
|
16
|
+
className: "w-full items-center justify-center",
|
|
17
|
+
children: /* @__PURE__ */ r(e, { className: "h-5 w-5 bg-brand" })
|
|
18
|
+
}) : i
|
|
19
|
+
}) : null;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLevo as e } from "../../providers/LevoProvider.js";
|
|
3
|
+
import t, { useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
4
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
+
//#region src/membership/components/Container.tsx
|
|
6
|
+
var s = t.createContext({
|
|
7
|
+
urls: null,
|
|
8
|
+
title: "",
|
|
9
|
+
isLoading: !1,
|
|
10
|
+
onSuccess: () => {},
|
|
11
|
+
onError: () => {}
|
|
12
|
+
}), c = ({ title: t, onSuccess: n, onError: c, children: l }) => {
|
|
13
|
+
let u = e(), d = typeof window < "u" ? window.location.href : "", [f, p] = a(null), [m, h] = a(!1);
|
|
14
|
+
r(() => {
|
|
15
|
+
u.membership && (h(!0), u.membership?.getOAuthURL().then((e) => {
|
|
16
|
+
p(e);
|
|
17
|
+
}).catch((e) => {
|
|
18
|
+
c({
|
|
19
|
+
code: e?.code || "SOMETHING_WENT_WRONG",
|
|
20
|
+
message: e?.message || "We could not connect with our service for your sign-in."
|
|
21
|
+
});
|
|
22
|
+
}).finally(() => {
|
|
23
|
+
h(!1);
|
|
24
|
+
}));
|
|
25
|
+
}, []);
|
|
26
|
+
let g = i(() => ({
|
|
27
|
+
title: t,
|
|
28
|
+
urls: f,
|
|
29
|
+
isLoading: m,
|
|
30
|
+
onSuccess: n,
|
|
31
|
+
onError: c
|
|
32
|
+
}), [
|
|
33
|
+
t,
|
|
34
|
+
f,
|
|
35
|
+
n,
|
|
36
|
+
c,
|
|
37
|
+
m
|
|
38
|
+
]);
|
|
39
|
+
return r(() => {
|
|
40
|
+
if (f && d) {
|
|
41
|
+
let e = {}, t = Object.keys(f);
|
|
42
|
+
for (let n of t) try {
|
|
43
|
+
let t = f[n];
|
|
44
|
+
if (t) {
|
|
45
|
+
let r = new URL(t), i = r.searchParams;
|
|
46
|
+
i.set("redirect_uri", d);
|
|
47
|
+
let a = u.pageContext;
|
|
48
|
+
a && i.set("page_context", JSON.stringify(a)), e[n] = r.toString();
|
|
49
|
+
}
|
|
50
|
+
} catch {}
|
|
51
|
+
p(e);
|
|
52
|
+
}
|
|
53
|
+
}, [d]), /* @__PURE__ */ o(s.Provider, {
|
|
54
|
+
value: g,
|
|
55
|
+
children: l
|
|
56
|
+
});
|
|
57
|
+
}, l = () => n(s);
|
|
58
|
+
//#endregion
|
|
59
|
+
export { c as default, l as useLevoOAuth };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "./Popup.js";
|
|
3
|
+
import { useCallback as t } from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/membership/components/Core.tsx
|
|
6
|
+
var r = ({ title: r = "Levo", url: i, children: a, onSuccess: o, onError: s, width: c = 500, height: l = 700 }) => /* @__PURE__ */ n(e, {
|
|
7
|
+
title: r,
|
|
8
|
+
width: c,
|
|
9
|
+
height: l,
|
|
10
|
+
onClose: () => {},
|
|
11
|
+
url: i,
|
|
12
|
+
onCode: t((e, t) => {
|
|
13
|
+
e.toLowerCase() === "success" ? o(t) : s(t);
|
|
14
|
+
}, []),
|
|
15
|
+
children: a
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/membership/components/Popup.tsx
|
|
5
|
+
var i = ({ url: e, title: t, height: n, width: r }) => {
|
|
6
|
+
let i = window.screenX + (window.outerWidth - r) / 2, a = window.screenY + (window.outerHeight - n) / 2.5;
|
|
7
|
+
return window.open(e, t, `width=${r},height=${n},left=${i},top=${a}`);
|
|
8
|
+
}, a = ({ title: a = "", width: o = 500, height: s = 500, url: c, children: l, onCode: u, onClose: d }) => {
|
|
9
|
+
let [f, p] = n(), m = t(void 0), h = () => {
|
|
10
|
+
window.clearInterval(m.current);
|
|
11
|
+
}, g = () => {
|
|
12
|
+
p(i({
|
|
13
|
+
url: c,
|
|
14
|
+
title: a,
|
|
15
|
+
width: o,
|
|
16
|
+
height: s
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
return e(() => (f && (m.current = window.setInterval(() => {
|
|
20
|
+
try {
|
|
21
|
+
let e = f.location.href, t = new URL(e).searchParams, n = t.get("code");
|
|
22
|
+
if (!n) return;
|
|
23
|
+
u(n, t), h(), f.close();
|
|
24
|
+
} catch {} finally {
|
|
25
|
+
(!f || f.closed) && (d(), h());
|
|
26
|
+
}
|
|
27
|
+
}, 700)), () => {
|
|
28
|
+
f && f.close(), d && d();
|
|
29
|
+
}), [f]), /* @__PURE__ */ r("div", {
|
|
30
|
+
onClick: () => {
|
|
31
|
+
g();
|
|
32
|
+
},
|
|
33
|
+
children: l
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { a as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "./components/Container.js";
|
|
2
|
+
import t from "./components/Button.js";
|
|
3
|
+
import "./useLevoOAuth.js";
|
|
4
|
+
//#region src/membership/index.ts
|
|
5
|
+
var n = class {
|
|
6
|
+
static Container = e;
|
|
7
|
+
static Button = t;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as LevoOAuth };
|