@levo-so/react 0.1.28 → 0.1.29
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/membership/components/Container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAClD,OAAO,EAAE,CACP,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9D,IAAI,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,eAAe,CAAC,YAAY,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAClD,OAAO,EAAE,CACP,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9D,IAAI,CAAC;CACX;AAaD,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/membership/components/Container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAClD,OAAO,EAAE,CACP,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9D,IAAI,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,eAAe,CAAC,YAAY,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAClD,OAAO,EAAE,CACP,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9D,IAAI,CAAC;CACX;AAaD,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAwEhD,CAAC;AAEF,eAAO,MAAM,YAAY,4BAExB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/dist/membership/index.js
CHANGED
|
@@ -1,130 +1,146 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var
|
|
3
|
-
var R = (e, t, n) => t in e ?
|
|
4
|
-
var
|
|
5
|
-
import { j as
|
|
6
|
-
import j, { useState as
|
|
7
|
-
import { u as
|
|
8
|
-
const
|
|
2
|
+
var P = Object.defineProperty;
|
|
3
|
+
var R = (e, t, n) => t in e ? P(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
|
+
var x = (e, t, n) => R(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
|
+
import { j as h } from "../jsx-runtime-B6kdoens.js";
|
|
6
|
+
import j, { useState as L, useEffect as C, useMemo as y, useContext as U, useRef as W, useCallback as _ } from "react";
|
|
7
|
+
import { u as k } from "../LevoProvider-BAZy7_tP.js";
|
|
8
|
+
const O = j.createContext({
|
|
9
9
|
urls: null,
|
|
10
10
|
title: "",
|
|
11
11
|
onSuccess: () => {
|
|
12
12
|
},
|
|
13
13
|
onError: () => {
|
|
14
14
|
}
|
|
15
|
-
}),
|
|
15
|
+
}), A = ({
|
|
16
16
|
title: e,
|
|
17
17
|
onSuccess: t,
|
|
18
18
|
onError: n,
|
|
19
|
-
children:
|
|
19
|
+
children: c
|
|
20
20
|
}) => {
|
|
21
|
-
const { membership:
|
|
21
|
+
const { membership: r, client: u } = k(), s = typeof window < "u" ? window.location.href : "", [o, l] = L(null);
|
|
22
22
|
C(() => {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
r && (r == null || r.getOAuthURL().then((a) => {
|
|
24
|
+
l(a);
|
|
25
25
|
}).catch(() => {
|
|
26
26
|
n({
|
|
27
27
|
code: "SOMETHING_WENT_WRONG",
|
|
28
28
|
message: "We could not connect with our service for your sign-in."
|
|
29
29
|
});
|
|
30
30
|
}));
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
33
|
-
() => ({ title: e, urls:
|
|
34
|
-
[e,
|
|
31
|
+
}, [r]);
|
|
32
|
+
const i = y(
|
|
33
|
+
() => ({ title: e, urls: o, onSuccess: t, onError: n }),
|
|
34
|
+
[e, o, t, n]
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
return C(() => {
|
|
37
|
+
if (o && s) {
|
|
38
|
+
const a = {}, p = Object.keys(o);
|
|
39
|
+
for (const w of p)
|
|
40
|
+
try {
|
|
41
|
+
const f = o[w];
|
|
42
|
+
if (f) {
|
|
43
|
+
const d = new URL(f), m = d.searchParams;
|
|
44
|
+
m.set("redirect_uri", s);
|
|
45
|
+
const g = u.getPageContext();
|
|
46
|
+
g && m.set("page_context", JSON.stringify(g)), a[w] = d.toString();
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
l(a);
|
|
51
|
+
}
|
|
52
|
+
}, [s]), /* @__PURE__ */ h.jsx(O.Provider, { value: i, children: c });
|
|
53
|
+
}, E = () => U(O), S = ({ url: e, title: t, height: n, width: c }) => {
|
|
54
|
+
const r = window.screenX + (window.outerWidth - c) / 2, u = window.screenY + (window.outerHeight - n) / 2.5;
|
|
39
55
|
return window.open(
|
|
40
56
|
e,
|
|
41
57
|
t,
|
|
42
|
-
`width=${
|
|
58
|
+
`width=${c},height=${n},left=${r},top=${u}`
|
|
43
59
|
);
|
|
44
|
-
},
|
|
60
|
+
}, N = ({
|
|
45
61
|
title: e = "",
|
|
46
62
|
width: t = 500,
|
|
47
63
|
height: n = 500,
|
|
48
|
-
url:
|
|
49
|
-
children:
|
|
64
|
+
url: c,
|
|
65
|
+
children: r,
|
|
50
66
|
onCode: u,
|
|
51
|
-
onClose:
|
|
67
|
+
onClose: s
|
|
52
68
|
}) => {
|
|
53
|
-
const [
|
|
54
|
-
window.clearInterval(
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
url:
|
|
69
|
+
const [o, l] = L(), i = W(), a = () => {
|
|
70
|
+
window.clearInterval(i.current);
|
|
71
|
+
}, p = () => {
|
|
72
|
+
l(
|
|
73
|
+
S({
|
|
74
|
+
url: c,
|
|
59
75
|
title: e,
|
|
60
76
|
width: t,
|
|
61
77
|
height: n
|
|
62
78
|
})
|
|
63
79
|
);
|
|
64
80
|
};
|
|
65
|
-
return C(() => (
|
|
81
|
+
return C(() => (o && (i.current = window.setInterval(() => {
|
|
66
82
|
try {
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
83
|
+
const w = o.location.href, f = new URL(w).searchParams, d = f.get("code");
|
|
84
|
+
if (!d)
|
|
69
85
|
return;
|
|
70
|
-
u(
|
|
86
|
+
u(d, f), a(), o.close();
|
|
71
87
|
} catch {
|
|
72
88
|
} finally {
|
|
73
|
-
(!
|
|
89
|
+
(!o || o.closed) && (s(), a());
|
|
74
90
|
}
|
|
75
91
|
}, 700)), () => {
|
|
76
|
-
|
|
77
|
-
}), [
|
|
92
|
+
o && o.close(), s && s();
|
|
93
|
+
}), [o]), /* @__PURE__ */ h.jsx(
|
|
78
94
|
"div",
|
|
79
95
|
{
|
|
80
96
|
onClick: () => {
|
|
81
|
-
|
|
97
|
+
p();
|
|
82
98
|
},
|
|
83
|
-
children:
|
|
99
|
+
children: r
|
|
84
100
|
}
|
|
85
101
|
);
|
|
86
|
-
},
|
|
102
|
+
}, $ = ({
|
|
87
103
|
title: e = "Levo",
|
|
88
104
|
url: t,
|
|
89
105
|
children: n,
|
|
90
|
-
onSuccess:
|
|
91
|
-
onError:
|
|
106
|
+
onSuccess: c,
|
|
107
|
+
onError: r,
|
|
92
108
|
width: u = 500,
|
|
93
|
-
height:
|
|
109
|
+
height: s = 700
|
|
94
110
|
}) => {
|
|
95
|
-
const
|
|
96
|
-
|
|
111
|
+
const o = _((l, i) => {
|
|
112
|
+
l.toLowerCase() === "success" ? c(i) : r(i);
|
|
97
113
|
}, []);
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
|
|
114
|
+
return /* @__PURE__ */ h.jsx(
|
|
115
|
+
N,
|
|
100
116
|
{
|
|
101
117
|
title: e,
|
|
102
118
|
width: u,
|
|
103
|
-
height:
|
|
119
|
+
height: s,
|
|
104
120
|
onClose: () => {
|
|
105
121
|
},
|
|
106
122
|
url: t,
|
|
107
|
-
onCode:
|
|
123
|
+
onCode: o,
|
|
108
124
|
children: n
|
|
109
125
|
}
|
|
110
126
|
);
|
|
111
127
|
}, I = ({ children: e, provider: t }) => {
|
|
112
|
-
const { title: n, urls:
|
|
113
|
-
return
|
|
114
|
-
|
|
128
|
+
const { title: n, urls: c, onSuccess: r, onError: u } = E(), s = c == null ? void 0 : c[t];
|
|
129
|
+
return s ? /* @__PURE__ */ h.jsx(
|
|
130
|
+
$,
|
|
115
131
|
{
|
|
116
132
|
title: n,
|
|
117
133
|
provider: t,
|
|
118
|
-
url:
|
|
119
|
-
onSuccess:
|
|
134
|
+
url: s,
|
|
135
|
+
onSuccess: r,
|
|
120
136
|
onError: u,
|
|
121
137
|
children: e
|
|
122
138
|
}
|
|
123
139
|
) : null;
|
|
124
140
|
};
|
|
125
|
-
class
|
|
141
|
+
class v {
|
|
126
142
|
}
|
|
127
|
-
|
|
143
|
+
x(v, "Container", A), x(v, "Button", I);
|
|
128
144
|
export {
|
|
129
|
-
|
|
145
|
+
v as LevoOAuth
|
|
130
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levo-so/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"author": "Levo Engineering <devs@theinternetfolks.com>",
|
|
5
5
|
"description": "Levo suite for React based applications",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": ">=18",
|
|
18
18
|
"react-dom": ">=18",
|
|
19
|
-
"@levo-so/core": "0.1.
|
|
19
|
+
"@levo-so/core": "0.1.29"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@radix-ui/react-checkbox": "1.1.1",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"vite": "5.4.3",
|
|
92
92
|
"vite-plugin-dts": "4.1.0",
|
|
93
93
|
"@levo/eslint-config": "0.0.0",
|
|
94
|
-
"@levo/
|
|
95
|
-
"@levo/
|
|
94
|
+
"@levo/tw-config": "0.0.0",
|
|
95
|
+
"@levo/ts-config": "0.0.0"
|
|
96
96
|
},
|
|
97
97
|
"main": "./dist/index.js",
|
|
98
98
|
"module": "./dist/index.js",
|