@sanvika/auth 2.5.0 → 2.5.2
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 +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,7 +17,6 @@ var SanvikaAuthContext = createContext(null);
|
|
|
17
17
|
function SanvikaAuthProvider({
|
|
18
18
|
children,
|
|
19
19
|
clientId,
|
|
20
|
-
redirectUri,
|
|
21
20
|
dashboardPath
|
|
22
21
|
}) {
|
|
23
22
|
const [user, setUser] = useState(null);
|
|
@@ -103,7 +102,6 @@ function SanvikaAuthProvider({
|
|
|
103
102
|
setAuth,
|
|
104
103
|
authFetch,
|
|
105
104
|
clientId,
|
|
106
|
-
redirectUri,
|
|
107
105
|
dashboardPath
|
|
108
106
|
};
|
|
109
107
|
return /* @__PURE__ */ jsx(SanvikaAuthContext.Provider, { value, children });
|
|
@@ -143,6 +141,7 @@ styleInject("@keyframes snvk-shimmer {\n 0% {\n background-position: 200% 0;
|
|
|
143
141
|
|
|
144
142
|
// SanvikaAccountButton.jsx
|
|
145
143
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
144
|
+
var S_AUTH_URL2 = "https://accounts.sanvikaproduction.com";
|
|
146
145
|
var SanvikaAccountButtonErrorBoundary = class extends Component {
|
|
147
146
|
constructor(props) {
|
|
148
147
|
super(props);
|
|
@@ -273,8 +272,9 @@ function SanvikaAccountButtonContent({
|
|
|
273
272
|
setImgError(false);
|
|
274
273
|
}
|
|
275
274
|
if (!isAuthenticated || loading) {
|
|
276
|
-
const { clientId
|
|
277
|
-
const
|
|
275
|
+
const { clientId } = auth;
|
|
276
|
+
const redirectUri = typeof window !== "undefined" ? window.location.origin + "/auth/callback" : "";
|
|
277
|
+
const authorizeUrl = clientId && redirectUri ? `${S_AUTH_URL2}/authorize?client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}` : `${S_AUTH_URL2}/authorize`;
|
|
278
278
|
return /* @__PURE__ */ jsxs(
|
|
279
279
|
"button",
|
|
280
280
|
{
|