@protobase/ui 0.62.3 → 0.62.5
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/account/account-page.js +3 -0
- package/dist/account/blocks/connected-accounts-block.js +1 -1
- package/dist/account/blocks/personal-mail-block.js +36 -0
- package/dist/account/messages.js +4 -0
- package/dist/account/sign-in-providers-section.js +3 -3
- package/dist/app/pages/render-node.js +2 -0
- package/dist/auth/auth-provider.js +7 -0
- package/dist/package.js +1 -1
- package/dist/shell/assets/app-z3__9x3P.js +9 -0
- package/dist/shell/assets/calls-C63xSTRj.js +2 -0
- package/dist/shell/assets/{index-C-RfkRTE.js → index-C6bDRZz0.js} +2 -2
- package/dist/shell/assets/{records-map-C5LoYF8K.js → records-map-B5MPNRQc.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-DC02tB2e.js → shared-protobase-ui-COFhNI_R.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-z3__9x3P.js.map +1 -0
- package/dist/shell-source-maps/assets/calls-C63xSTRj.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-C-RfkRTE.js.map → index-C6bDRZz0.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-C5LoYF8K.js.map → records-map-B5MPNRQc.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-DC02tB2e.js.map → shared-protobase-ui-COFhNI_R.js.map} +1 -1
- package/package.json +4 -4
- package/dist/shell/assets/app-C5MP7OgJ.js +0 -9
- package/dist/shell/assets/calls-DwVdIhNM.js +0 -2
- package/dist/shell-source-maps/assets/app-C5MP7OgJ.js.map +0 -1
- package/dist/shell-source-maps/assets/calls-DwVdIhNM.js.map +0 -1
|
@@ -18,11 +18,13 @@ const useAccountPage = () => {
|
|
|
18
18
|
const auth = useAuth();
|
|
19
19
|
const { mcp, accountDeletion } = auth;
|
|
20
20
|
const linkable = linkableProviders(auth).length > 0;
|
|
21
|
+
const mailboxes = auth.personalMail.length > 0;
|
|
21
22
|
return useMemo(() => {
|
|
22
23
|
if (!account) return void 0;
|
|
23
24
|
const hidden = /* @__PURE__ */ new Set([
|
|
24
25
|
...mcp ? [] : ["ConnectedApps"],
|
|
25
26
|
...linkable ? [] : ["ConnectedAccounts"],
|
|
27
|
+
...mailboxes ? [] : ["PersonalMail"],
|
|
26
28
|
...accountDeletion ? [] : ["DeleteAccount"]
|
|
27
29
|
]);
|
|
28
30
|
return {
|
|
@@ -33,6 +35,7 @@ const useAccountPage = () => {
|
|
|
33
35
|
account,
|
|
34
36
|
mcp,
|
|
35
37
|
linkable,
|
|
38
|
+
mailboxes,
|
|
36
39
|
accountDeletion
|
|
37
40
|
]);
|
|
38
41
|
};
|
|
@@ -34,4 +34,4 @@ const ConnectedAccountsBlock = () => {
|
|
|
34
34
|
return linkable.length > 0 ? /* @__PURE__ */ jsx(Linked, { providers: linkable }) : null;
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
|
-
export { ConnectedAccountsBlock, linkableProviders };
|
|
37
|
+
export { ConnectedAccountsBlock, linkableProviders, takeLinkError };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { text } from "../messages.js";
|
|
2
|
+
import { useAuth } from "../../auth/auth-provider.js";
|
|
3
|
+
import { providerMessage } from "../../auth/auth-messages.js";
|
|
4
|
+
import { SignInProvidersSection } from "../sign-in-providers-section.js";
|
|
5
|
+
import { AccountLoading } from "./account-loading.js";
|
|
6
|
+
import { useAccountData } from "./use-account-data.js";
|
|
7
|
+
import { takeLinkError } from "./connected-accounts-block.js";
|
|
8
|
+
import { useCallback, useState } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
//#region src/account/blocks/personal-mail-block.tsx
|
|
11
|
+
const Mailboxes = ({ links }) => {
|
|
12
|
+
const { session, linkPersonalMail } = useAuth();
|
|
13
|
+
const { account } = session;
|
|
14
|
+
const [linkError] = useState(takeLinkError);
|
|
15
|
+
const { data: linked, error } = useAccountData(useCallback(() => account.linkedPersonalMail(links), [account, links]), text("couldNotReadMethods"));
|
|
16
|
+
if (!linked) return /* @__PURE__ */ jsx(AccountLoading, { error });
|
|
17
|
+
const connect = (id) => linkPersonalMail(links.find((link) => link.id === id));
|
|
18
|
+
return /* @__PURE__ */ jsx(SignInProvidersSection, {
|
|
19
|
+
title: text("mailbox"),
|
|
20
|
+
description: text("mailboxDescription"),
|
|
21
|
+
providers: links.map(({ id, name }) => ({
|
|
22
|
+
id,
|
|
23
|
+
name
|
|
24
|
+
})),
|
|
25
|
+
linked,
|
|
26
|
+
onConnect: connect,
|
|
27
|
+
error: linkError && providerMessage(linkError, links.length === 1 ? links[0].name : text("theProvider"))
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
/** The `PersonalMail` block: the mailboxes the signed-in person can link for the app to send mail from, hidden when the app has none. */
|
|
31
|
+
const PersonalMailBlock = () => {
|
|
32
|
+
const { personalMail } = useAuth();
|
|
33
|
+
return personalMail.length > 0 ? /* @__PURE__ */ jsx(Mailboxes, { links: personalMail }) : null;
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { PersonalMailBlock };
|
package/dist/account/messages.js
CHANGED
|
@@ -71,6 +71,8 @@ const text = defineMessages({
|
|
|
71
71
|
connectedAccountsDescription: "Sign in with these instead of your password. Connecting one asks you to sign in there; its address may differ from yours here.",
|
|
72
72
|
connected: "Connected",
|
|
73
73
|
connect: (name) => `Connect ${name}`,
|
|
74
|
+
mailbox: "Mailbox",
|
|
75
|
+
mailboxDescription: "Mail this app sends for you goes out from your own mailbox. Connecting one asks you to sign in there and allow sending mail; it cannot read your mail.",
|
|
74
76
|
stopped: (time) => `Stopped ${time}`,
|
|
75
77
|
ended: (time) => `Ended ${time}`,
|
|
76
78
|
signedInUntil: (time) => `Signed in until ${time}`,
|
|
@@ -234,6 +236,8 @@ const text = defineMessages({
|
|
|
234
236
|
connectedAccountsDescription: "Log hiermee in in plaats van met je wachtwoord. Koppelen vraagt je daar in te loggen; het adres daar kan anders zijn dan hier.",
|
|
235
237
|
connected: "Gekoppeld",
|
|
236
238
|
connect: (name) => `${name} koppelen`,
|
|
239
|
+
mailbox: "Mailbox",
|
|
240
|
+
mailboxDescription: "Mail die deze app voor je verstuurt, gaat uit vanuit je eigen mailbox. Koppelen vraagt je daar in te loggen en het versturen van mail toe te staan; je mail lezen kan de app niet.",
|
|
237
241
|
stopped: (time) => `Gestopt ${time}`,
|
|
238
242
|
ended: (time) => `Afgelopen ${time}`,
|
|
239
243
|
signedInUntil: (time) => `Ingelogd tot ${time}`,
|
|
@@ -9,7 +9,7 @@ import { AuthError } from "@protobase/client";
|
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/account/sign-in-providers-section.tsx
|
|
11
11
|
/** The providers someone can sign in with besides a password, and a way to connect one whatever address it has. */
|
|
12
|
-
const SignInProvidersSection = ({ providers, linked, onConnect, error: returned }) => {
|
|
12
|
+
const SignInProvidersSection = ({ providers, linked, onConnect, error: returned, title = text("connectedAccounts"), description = text("connectedAccountsDescription") }) => {
|
|
13
13
|
const [busy, setBusy] = useState();
|
|
14
14
|
const [error, setError] = useState(returned);
|
|
15
15
|
const connect = async (provider) => {
|
|
@@ -24,8 +24,8 @@ const SignInProvidersSection = ({ providers, linked, onConnect, error: returned
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
return /* @__PURE__ */ jsxs(AccountSection, {
|
|
27
|
-
title
|
|
28
|
-
description
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
29
|
children: [/* @__PURE__ */ jsx(SectionError, { message: error }), /* @__PURE__ */ jsx("ul", {
|
|
30
30
|
className: "divide-y rounded-md border",
|
|
31
31
|
children: providers.map((provider) => /* @__PURE__ */ jsxs("li", {
|
|
@@ -23,6 +23,7 @@ import { TableBlock } from "./blocks/table.js";
|
|
|
23
23
|
import { TabBlock, TabsBlock } from "./blocks/tabs.js";
|
|
24
24
|
import { UsersBlock } from "../../users/users-block.js";
|
|
25
25
|
import { ConnectedAccountsBlock } from "../../account/blocks/connected-accounts-block.js";
|
|
26
|
+
import { PersonalMailBlock } from "../../account/blocks/personal-mail-block.js";
|
|
26
27
|
import { ConnectedAppsBlock } from "../../account/blocks/connected-apps-block.js";
|
|
27
28
|
import { DeleteAccountBlock } from "../../account/blocks/delete-account-block.js";
|
|
28
29
|
import { DevicesBlock } from "../../account/blocks/devices-block.js";
|
|
@@ -61,6 +62,7 @@ const blocks = {
|
|
|
61
62
|
Passkeys: PasskeysBlock,
|
|
62
63
|
TwoFactor: TwoFactorBlock,
|
|
63
64
|
ConnectedAccounts: ConnectedAccountsBlock,
|
|
65
|
+
PersonalMail: PersonalMailBlock,
|
|
64
66
|
Devices: DevicesBlock,
|
|
65
67
|
ConnectedApps: ConnectedAppsBlock,
|
|
66
68
|
DeleteAccount: DeleteAccountBlock
|
|
@@ -31,6 +31,7 @@ const AuthProvider = ({ session: given, origin, nativeBridge, children }) => {
|
|
|
31
31
|
const [passkeyDomains, setPasskeyDomains] = useState([]);
|
|
32
32
|
const [socialProviders, setSocialProviders] = useState([]);
|
|
33
33
|
const [platformSignIn, setPlatformSignIn] = useState();
|
|
34
|
+
const [personalMail, setPersonalMail] = useState([]);
|
|
34
35
|
const [samlProviders, setSamlProviders] = useState([]);
|
|
35
36
|
const [staffSignIn, setStaffSignIn] = useState();
|
|
36
37
|
const [organizations, setOrganizations] = useState();
|
|
@@ -117,6 +118,7 @@ const AuthProvider = ({ session: given, origin, nativeBridge, children }) => {
|
|
|
117
118
|
setPasskeyDomains(status.passkeyDomains ?? []);
|
|
118
119
|
setSocialProviders(status.socialProviders);
|
|
119
120
|
setPlatformSignIn(status.platformSignIn);
|
|
121
|
+
setPersonalMail(status.personalMail ?? []);
|
|
120
122
|
setSamlProviders(status.samlProviders);
|
|
121
123
|
setStaffSignIn(status.staffSignIn);
|
|
122
124
|
setOrganizations(status.organizations);
|
|
@@ -183,6 +185,10 @@ const AuthProvider = ({ session: given, origin, nativeBridge, children }) => {
|
|
|
183
185
|
linkProvider: async (provider) => {
|
|
184
186
|
window.location.assign(await session.account.linkProvider(provider, new URL(withoutSignInLink(window.location.href), window.location.href).href));
|
|
185
187
|
},
|
|
188
|
+
personalMail,
|
|
189
|
+
linkPersonalMail: async (link) => {
|
|
190
|
+
window.location.assign(await session.account.linkPersonalMail(link, new URL(withoutSignInLink(window.location.href), window.location.href).href));
|
|
191
|
+
},
|
|
186
192
|
stopStaffSession: async () => {
|
|
187
193
|
await push.forget();
|
|
188
194
|
await session.staff.stop();
|
|
@@ -213,6 +219,7 @@ const AuthProvider = ({ session: given, origin, nativeBridge, children }) => {
|
|
|
213
219
|
passkeyDomains,
|
|
214
220
|
socialProviders,
|
|
215
221
|
platformSignIn,
|
|
222
|
+
personalMail,
|
|
216
223
|
samlProviders,
|
|
217
224
|
staffSignIn,
|
|
218
225
|
organizations,
|
package/dist/package.js
CHANGED