@levo-so/react 0.1.79 → 0.1.81
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/index.js +611 -80
- package/package.json +9 -7
- package/dist/audience/components/block.js +0 -32
- package/dist/audience/components/component.js +0 -13
- package/dist/audience/components/page.js +0 -19
- package/dist/components/Dialog.js +0 -84
- package/dist/components/DialogWrapper.js +0 -20
- package/dist/components/Sonner.js +0 -41
- package/dist/components/Spinner.js +0 -8
- package/dist/components/Tabs.js +0 -48
- package/dist/components/Tooltip.js +0 -30
- package/dist/components/button/Button.js +0 -41
- package/dist/components/button/buttonVariants.js +0 -40
- package/dist/constants/fileUploadPresets.js +0 -75
- package/dist/membership/components/Button.js +0 -13
- package/dist/membership/components/Container.js +0 -52
- package/dist/membership/components/Core.js +0 -33
- package/dist/membership/components/Popup.js +0 -56
- package/dist/membership/index.js +0 -9
- package/dist/membership/useLevoOAuth.js +0 -76
- package/dist/providers/LevoProvider.js +0 -19
- package/dist/utils/byteToSize.js +0 -9
- package/dist/utils/cn.js +0 -7
- package/dist/utils/errorHandler.js +0 -11
- package/dist/utils/isDateObject.js +0 -4
- package/dist/utils/isEmptyObject.js +0 -5
- package/dist/utils/isNullOrUndefined.js +0 -4
- package/dist/utils/isObject.js +0 -7
- /package/dist/{styles/index.css → index.css} +0 -0
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { getLevoError as W } from "@levo-so/core";
|
|
2
|
-
import { useState as i, useRef as x, useCallback as h, useEffect as g, useMemo as y } from "react";
|
|
3
|
-
import { useLevo as I } from "../providers/LevoProvider.js";
|
|
4
|
-
const P = ({ url: u, title: a, height: s, width: c }) => {
|
|
5
|
-
const n = window.screenX + (window.outerWidth - c) / 2, f = window.screenY + (window.outerHeight - s) / 2.5;
|
|
6
|
-
return window.open(
|
|
7
|
-
u,
|
|
8
|
-
a,
|
|
9
|
-
`width=${c},height=${s},left=${n},top=${f}`
|
|
10
|
-
);
|
|
11
|
-
}, C = ({
|
|
12
|
-
title: u = "Levo",
|
|
13
|
-
width: a = 500,
|
|
14
|
-
height: s = 700,
|
|
15
|
-
onSuccess: c
|
|
16
|
-
}) => {
|
|
17
|
-
const n = I(), [f, w] = i(!1), [t, v] = i(null), [L, l] = i(null), [r, E] = i(), d = x(void 0), p = () => {
|
|
18
|
-
window.clearInterval(d.current);
|
|
19
|
-
}, O = h((e, o) => {
|
|
20
|
-
e.toLowerCase() === "success" ? (l(null), c(o)) : l(o);
|
|
21
|
-
}, []);
|
|
22
|
-
g(() => {
|
|
23
|
-
n.membership && (w(!0), n.membership?.getOAuthURL().then((e) => {
|
|
24
|
-
if (e)
|
|
25
|
-
return v(e), e;
|
|
26
|
-
throw new Error();
|
|
27
|
-
}).catch((e) => {
|
|
28
|
-
const o = W(e);
|
|
29
|
-
n.logger?.error("Failed to get OAuth URL", o.message), l({
|
|
30
|
-
code: o?.code || "SOMETHING_WENT_WRONG",
|
|
31
|
-
message: o?.message || "We could not connect with our service for your sign-in."
|
|
32
|
-
});
|
|
33
|
-
}).finally(() => {
|
|
34
|
-
w(!1);
|
|
35
|
-
}));
|
|
36
|
-
}, []), g(() => (r && (d.current = window.setInterval(() => {
|
|
37
|
-
try {
|
|
38
|
-
const e = r.location.href, o = new URL(e).searchParams, m = o.get("code");
|
|
39
|
-
if (!m)
|
|
40
|
-
return;
|
|
41
|
-
O(m, o), p(), r.close();
|
|
42
|
-
} catch {
|
|
43
|
-
} finally {
|
|
44
|
-
(!r || r.closed) && (p(), l(null));
|
|
45
|
-
}
|
|
46
|
-
}, 700)), () => {
|
|
47
|
-
r && r.close();
|
|
48
|
-
}), [r]);
|
|
49
|
-
const R = h(
|
|
50
|
-
(e) => {
|
|
51
|
-
if (e && t !== null) {
|
|
52
|
-
const o = t?.[e];
|
|
53
|
-
o && (r && r.close(), E(
|
|
54
|
-
P({
|
|
55
|
-
url: o,
|
|
56
|
-
title: u,
|
|
57
|
-
width: a,
|
|
58
|
-
height: s
|
|
59
|
-
})
|
|
60
|
-
));
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
[t, r]
|
|
64
|
-
);
|
|
65
|
-
return {
|
|
66
|
-
providers: y(() => t !== null ? Object.keys(t).filter(
|
|
67
|
-
(e) => !!t[e]
|
|
68
|
-
) : [], [t]),
|
|
69
|
-
isLoading: f,
|
|
70
|
-
error: L,
|
|
71
|
-
launchPopup: R
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
export {
|
|
75
|
-
C as useLevoOAuth
|
|
76
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
-
import { createContext as i, useContext as o } from "react";
|
|
4
|
-
const t = i({
|
|
5
|
-
client: null,
|
|
6
|
-
insights: null
|
|
7
|
-
}), v = ({ children: e, client: n, insights: r = null }) => /* @__PURE__ */ s(t.Provider, { value: { client: n, insights: r }, children: e }), l = () => {
|
|
8
|
-
const e = o(t);
|
|
9
|
-
if (!e.client)
|
|
10
|
-
throw new Error(
|
|
11
|
-
"useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider."
|
|
12
|
-
);
|
|
13
|
-
return e.client;
|
|
14
|
-
}, x = () => o(t).insights;
|
|
15
|
-
export {
|
|
16
|
-
v as LevoProvider,
|
|
17
|
-
l as useLevo,
|
|
18
|
-
x as useLevoInsights
|
|
19
|
-
};
|
package/dist/utils/byteToSize.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const s = (t, o = 2) => {
|
|
2
|
-
if (t === 0) return "0 B";
|
|
3
|
-
const B = 1024, r = o < 0 ? 0 : o, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], e = Math.floor(Math.log(t) / Math.log(B));
|
|
4
|
-
return `${Number.parseFloat((t / B ** e).toFixed(r))} ${n[e]}`;
|
|
5
|
-
};
|
|
6
|
-
export {
|
|
7
|
-
s as byteToSize,
|
|
8
|
-
s as default
|
|
9
|
-
};
|
package/dist/utils/cn.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getLevoError as s } from "@levo-so/core";
|
|
2
|
-
import { errorToast as t } from "../components/Sonner.js";
|
|
3
|
-
const E = (o) => {
|
|
4
|
-
const r = s(o);
|
|
5
|
-
return r?.code === "REQUEST_TIMEOUT" || r?.code === "NETWORK_ERROR" || r?.status === 408 || r?.status === 0 || t(r?.message || "", r?.title || "Error", {
|
|
6
|
-
id: `${r?.title || ""}-${r?.message || ""}`
|
|
7
|
-
}), r;
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
E as errorHandler
|
|
11
|
-
};
|
package/dist/utils/isObject.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { isDateObject as r } from "./isDateObject.js";
|
|
2
|
-
import { isNullOrUndefined as o } from "./isNullOrUndefined.js";
|
|
3
|
-
const i = (t) => typeof t == "object", c = (t) => !o(t) && !Array.isArray(t) && i(t) && !r(t);
|
|
4
|
-
export {
|
|
5
|
-
c as isObject,
|
|
6
|
-
i as isObjectType
|
|
7
|
-
};
|
|
File without changes
|