@sevenfold/setto-client 0.6.0 → 0.6.1
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/lib/api.d.ts +2 -0
- package/dist/setto-client.js +15 -9
- package/dist/setto-client.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/api.d.ts
CHANGED
|
@@ -16,5 +16,7 @@ export declare function createApi(args: {
|
|
|
16
16
|
expired: number;
|
|
17
17
|
}>;
|
|
18
18
|
cancelDeployment(siteId: string, deploymentId: string): Promise<void>;
|
|
19
|
+
/** Request a password-reset email (link goes via setto-server, then site /setto). */
|
|
20
|
+
requestPasswordReset(siteId: string, email: string): Promise<void>;
|
|
19
21
|
};
|
|
20
22
|
export type SettoApi = ReturnType<typeof createApi>;
|
package/dist/setto-client.js
CHANGED
|
@@ -20805,6 +20805,18 @@ function createApi(args) {
|
|
|
20805
20805
|
}
|
|
20806
20806
|
);
|
|
20807
20807
|
if (!res.ok) throw await asError(res, "cancelDeployment failed");
|
|
20808
|
+
},
|
|
20809
|
+
/** Request a password-reset email (link goes via setto-server, then site /setto). */
|
|
20810
|
+
async requestPasswordReset(siteId, email) {
|
|
20811
|
+
const res = await fetch(
|
|
20812
|
+
`${apiUrl}/sites/${encodeURIComponent(siteId)}/auth/password-reset`,
|
|
20813
|
+
{
|
|
20814
|
+
method: "POST",
|
|
20815
|
+
headers: { "Content-Type": "application/json" },
|
|
20816
|
+
body: JSON.stringify({ email })
|
|
20817
|
+
}
|
|
20818
|
+
);
|
|
20819
|
+
if (!res.ok) throw await asError(res, "requestPasswordReset failed");
|
|
20808
20820
|
}
|
|
20809
20821
|
};
|
|
20810
20822
|
}
|
|
@@ -21199,9 +21211,6 @@ function isAdminRoute() {
|
|
|
21199
21211
|
function isAdminDeploymentView() {
|
|
21200
21212
|
return isAdminRoute() && new URLSearchParams(window.location.search).has("deployment");
|
|
21201
21213
|
}
|
|
21202
|
-
function adminRedirectUrl() {
|
|
21203
|
-
return `${window.location.origin}${SETTO_BASE}`;
|
|
21204
|
-
}
|
|
21205
21214
|
const FAB_SIZE = 52;
|
|
21206
21215
|
const FAB_INSET = 16;
|
|
21207
21216
|
const STYLE_ID$1 = "setto-edit-layout";
|
|
@@ -24034,10 +24043,10 @@ function consumeInviteErrorFromUrl() {
|
|
|
24034
24043
|
params.delete("setto_invite_error");
|
|
24035
24044
|
const qs = params.toString();
|
|
24036
24045
|
window.history.replaceState(null, "", `${window.location.pathname}${qs ? `?${qs}` : ""}`);
|
|
24037
|
-
return code === "invalid" ? "
|
|
24046
|
+
return code === "invalid" ? "Lenken er ugyldig eller utløpt. Be om en ny nullstilling eller invitasjon." : "Kunne ikke aktivere lenken.";
|
|
24038
24047
|
}
|
|
24039
24048
|
function AuthGate({ children }) {
|
|
24040
|
-
const { supabase, session, authLoading } = useSetto();
|
|
24049
|
+
const { supabase, api, config, session, authLoading } = useSetto();
|
|
24041
24050
|
const [mode, setMode] = useState("signin");
|
|
24042
24051
|
const [email, setEmail] = useState("");
|
|
24043
24052
|
const [password, setPassword] = useState("");
|
|
@@ -24088,10 +24097,7 @@ function AuthGate({ children }) {
|
|
|
24088
24097
|
setError(null);
|
|
24089
24098
|
setInfo(null);
|
|
24090
24099
|
try {
|
|
24091
|
-
|
|
24092
|
-
redirectTo: adminRedirectUrl()
|
|
24093
|
-
});
|
|
24094
|
-
if (resetError) throw resetError;
|
|
24100
|
+
await api.requestPasswordReset(config.siteId, email);
|
|
24095
24101
|
setInfo("Vi har sendt en lenke for å nullstille passordet. Sjekk innboksen.");
|
|
24096
24102
|
} catch (err) {
|
|
24097
24103
|
setError(err instanceof Error ? err.message : "Ukjent feil");
|