@celljs/ta-web 4.18.0 → 4.19.0
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/esm/browser/account/account-side.d.ts +13 -0
- package/esm/browser/account/account-side.js +74 -0
- package/esm/browser/account/device-account.d.ts +69 -0
- package/esm/browser/account/device-account.js +215 -0
- package/esm/browser/components/account-menu.d.ts +1 -1
- package/esm/browser/components/account-menu.js +5 -2
- package/esm/browser/components/account-view.d.ts +17 -0
- package/esm/browser/components/account-view.js +216 -0
- package/esm/browser/components/app-view.js +2 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +5 -1
- package/esm/browser/components/cloud-sign-in-view.js +1 -1
- package/esm/browser/components/host-view.d.ts +3 -1
- package/esm/browser/components/host-view.js +7 -0
- package/esm/browser/components/workbench-view.js +5 -1
- package/esm/browser/hosts.d.ts +5 -0
- package/esm/browser/hosts.js +11 -0
- package/esm/browser/i18n/locales.d.ts +28 -3
- package/esm/browser/i18n/messages-ja.js +25 -0
- package/esm/browser/i18n/messages-zh-tw.js +25 -0
- package/esm/browser/i18n/messages.d.ts +25 -0
- package/esm/browser/i18n/messages.js +50 -0
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +31 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -1
- package/esm/browser/workbench-hosts.d.ts +7 -0
- package/esm/browser/workbench-hosts.js +20 -0
- package/esm/browser/workbench-protocol.d.ts +8 -1
- package/esm/browser/workbench-services.d.ts +2 -1
- package/esm/browser/workbench-services.js +3 -0
- package/esm/browser/workbench-util.d.ts +1 -1
- package/lib/browser/account/account-side.d.ts +14 -0
- package/lib/browser/account/account-side.js +111 -0
- package/lib/browser/account/device-account.d.ts +70 -0
- package/lib/browser/account/device-account.js +219 -0
- package/lib/browser/components/account-menu.d.ts +1 -1
- package/lib/browser/components/account-menu.js +4 -1
- package/lib/browser/components/account-view.d.ts +18 -0
- package/lib/browser/components/account-view.js +255 -0
- package/lib/browser/components/app-view.js +1 -1
- package/lib/browser/components/cloud-sign-in-view.d.ts +5 -1
- package/lib/browser/components/cloud-sign-in-view.js +1 -0
- package/lib/browser/components/host-view.d.ts +3 -1
- package/lib/browser/components/host-view.js +8 -0
- package/lib/browser/components/workbench-view.js +5 -1
- package/lib/browser/hosts.d.ts +5 -0
- package/lib/browser/hosts.js +11 -0
- package/lib/browser/i18n/locales.d.ts +28 -3
- package/lib/browser/i18n/messages-ja.js +25 -0
- package/lib/browser/i18n/messages-zh-tw.js +25 -0
- package/lib/browser/i18n/messages.d.ts +25 -0
- package/lib/browser/i18n/messages.js +50 -0
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +31 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -1
- package/lib/browser/workbench-hosts.d.ts +7 -0
- package/lib/browser/workbench-hosts.js +20 -0
- package/lib/browser/workbench-protocol.d.ts +8 -1
- package/lib/browser/workbench-services.d.ts +2 -1
- package/lib/browser/workbench-services.js +3 -0
- package/lib/browser/workbench-util.d.ts +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TaAccountInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import { type AccountSide } from './device-account.js';
|
|
3
|
+
/**
|
|
4
|
+
* The account a page shows (docs/design/ta-account.md): in the app, the phone's own; elsewhere, that of the computer
|
|
5
|
+
* whose page it is, once connected to it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useAccountSide(): AccountSide | undefined;
|
|
8
|
+
/** The account as it is now, read again every few seconds while shown; `act` runs a change and shows what it made. */
|
|
9
|
+
export declare function useAccountInfo(side: AccountSide | undefined, every?: number): {
|
|
10
|
+
info: TaAccountInfo | undefined;
|
|
11
|
+
failed: unknown;
|
|
12
|
+
act: (run: (side: AccountSide) => Promise<TaAccountInfo>) => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { relayDefaultUrl } from '@celljs/ta-relay';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CloudSignInUtil } from '../cloud/cloud-sign-in.js';
|
|
4
|
+
import { useWorkbench } from '../hooks.js';
|
|
5
|
+
import { WorkbenchUtil } from '../workbench-util.js';
|
|
6
|
+
import { DeviceAccount } from './device-account.js';
|
|
7
|
+
/** The account of the computer of the page, through its ta serve (TaAccountServer). */
|
|
8
|
+
function serveSide(account) {
|
|
9
|
+
return {
|
|
10
|
+
read: () => account.getAccount(),
|
|
11
|
+
signIn: (provider, service) => account.signIn(provider, service),
|
|
12
|
+
cancelSignIn: () => account.cancelSignIn(),
|
|
13
|
+
approve: id => account.approve(id),
|
|
14
|
+
remove: id => account.remove(id),
|
|
15
|
+
signOut: () => account.signOut(),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The relay the app's account is on: that of the computers it is paired with, as theirs is; else the relay of the
|
|
20
|
+
* deployment this build is for, else the default one.
|
|
21
|
+
*/
|
|
22
|
+
async function appService(hosts, current) {
|
|
23
|
+
var _a;
|
|
24
|
+
var _b, _c, _d;
|
|
25
|
+
const paired = (one) => (one && 'pairing' in one.credential ? one.credential.pairing.relay : undefined);
|
|
26
|
+
return ((_d = (_c = (_b = paired(hosts.find(one => one.id === current))) !== null && _b !== void 0 ? _b : hosts.map(paired).find(Boolean)) !== null && _c !== void 0 ? _c : (_a = (await CloudSignInUtil.distribution())) === null || _a === void 0 ? void 0 : _a.relay) !== null && _d !== void 0 ? _d : relayDefaultUrl());
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The account a page shows (docs/design/ta-account.md): in the app, the phone's own; elsewhere, that of the computer
|
|
30
|
+
* whose page it is, once connected to it.
|
|
31
|
+
*/
|
|
32
|
+
export function useAccountSide() {
|
|
33
|
+
const [{ status, hosts, host }, bench] = useWorkbench();
|
|
34
|
+
const app = WorkbenchUtil.isApp();
|
|
35
|
+
const where = React.useRef({ hosts, host });
|
|
36
|
+
where.current = { hosts, host };
|
|
37
|
+
const online = status === 'online';
|
|
38
|
+
return React.useMemo(() => {
|
|
39
|
+
if (app) {
|
|
40
|
+
return DeviceAccount.of(bench, () => appService(where.current.hosts, where.current.host), async () => {
|
|
41
|
+
var _a;
|
|
42
|
+
const chosen = CloudSignInUtil.chosen();
|
|
43
|
+
const built = (_a = (await CloudSignInUtil.distribution())) === null || _a === void 0 ? void 0 : _a.gateway;
|
|
44
|
+
return [chosen, built].filter((one) => !!one);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return online ? serveSide(bench.account) : undefined;
|
|
48
|
+
}, [app, online, bench]);
|
|
49
|
+
}
|
|
50
|
+
/** The account as it is now, read again every few seconds while shown; `act` runs a change and shows what it made. */
|
|
51
|
+
export function useAccountInfo(side, every = 3000) {
|
|
52
|
+
const [info, setInfo] = React.useState();
|
|
53
|
+
const [failed, setFailed] = React.useState();
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (!side) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let live = true;
|
|
59
|
+
const read = () => side.read().then(next => live && setInfo(next), (error) => live && setFailed(error));
|
|
60
|
+
void read();
|
|
61
|
+
const timer = setInterval(() => document.visibilityState !== 'hidden' && void read(), every);
|
|
62
|
+
return () => {
|
|
63
|
+
live = false;
|
|
64
|
+
clearInterval(timer);
|
|
65
|
+
};
|
|
66
|
+
}, [side, every]);
|
|
67
|
+
const act = React.useCallback(async (run) => {
|
|
68
|
+
if (side) {
|
|
69
|
+
setInfo(await run(side));
|
|
70
|
+
}
|
|
71
|
+
}, [side]);
|
|
72
|
+
return { info, failed, act };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=account-side.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { TaAccountInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import { AccountAgent, type AccountKept, type AccountView, type AccountWay } from '@celljs/ta-relay';
|
|
3
|
+
import type { SavedHost } from '../workbench-protocol.js';
|
|
4
|
+
/** What a page does about the account: of its ta serve (a computer), or of the device itself (the app). */
|
|
5
|
+
export interface AccountSide {
|
|
6
|
+
read(): Promise<TaAccountInfo>;
|
|
7
|
+
signIn(provider: string, service?: string): Promise<TaAccountInfo>;
|
|
8
|
+
cancelSignIn(): Promise<TaAccountInfo>;
|
|
9
|
+
approve(id: string): Promise<TaAccountInfo>;
|
|
10
|
+
remove(id: string): Promise<TaAccountInfo>;
|
|
11
|
+
signOut(): Promise<TaAccountInfo>;
|
|
12
|
+
}
|
|
13
|
+
/** The computers a device's account brings, kept with the device's computers (TaWorkbench). */
|
|
14
|
+
export interface AccountHosts {
|
|
15
|
+
readonly state: {
|
|
16
|
+
hosts: SavedHost[];
|
|
17
|
+
};
|
|
18
|
+
addAccountHost(link: string, account: string): Promise<void>;
|
|
19
|
+
forgetAccountHosts(account?: string): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The app as a device of the user's account (docs/design/ta-account.md): its own keys in localStorage; the computers
|
|
23
|
+
* of the account come into its list of computers as they let it in, and go as they are removed. The same agent as a
|
|
24
|
+
* computer's (AccountAgent), with the hooks of a device that pairs with computers rather than letting devices in.
|
|
25
|
+
*/
|
|
26
|
+
export declare class DeviceAccount implements AccountSide {
|
|
27
|
+
protected readonly hosts: AccountHosts;
|
|
28
|
+
protected readonly service: () => Promise<string>;
|
|
29
|
+
protected readonly gateways: () => Promise<string[]>;
|
|
30
|
+
protected static instance?: DeviceAccount;
|
|
31
|
+
protected agent?: AccountAgent;
|
|
32
|
+
protected view?: AccountView;
|
|
33
|
+
protected signingIn?: {
|
|
34
|
+
way: AccountWay;
|
|
35
|
+
handle: string;
|
|
36
|
+
code: string;
|
|
37
|
+
url: string;
|
|
38
|
+
interval: number;
|
|
39
|
+
expiresAt: number;
|
|
40
|
+
};
|
|
41
|
+
protected error?: string;
|
|
42
|
+
protected timer?: ReturnType<typeof setTimeout>;
|
|
43
|
+
protected running?: Promise<void>;
|
|
44
|
+
protected constructor(hosts: AccountHosts, service: () => Promise<string>, gateways: () => Promise<string[]>);
|
|
45
|
+
/** The one of the page. */
|
|
46
|
+
static of(hosts: AccountHosts, service: () => Promise<string>, gateways: () => Promise<string[]>): DeviceAccount;
|
|
47
|
+
/** What the device calls itself in the account. */
|
|
48
|
+
static deviceName(agent?: string): string;
|
|
49
|
+
protected static read(): AccountKept | undefined;
|
|
50
|
+
protected agentOf(kept: AccountKept): AccountAgent;
|
|
51
|
+
/** A Ta in the cloud signed in to: its token is the account of its gateway, which this device joins by itself. */
|
|
52
|
+
protected cloudToken(): {
|
|
53
|
+
service: string;
|
|
54
|
+
token: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
/** Joins the account of the gateway of a Ta in the cloud of this device, unless the user left the account. */
|
|
57
|
+
protected adopt(): Promise<boolean>;
|
|
58
|
+
protected forget(): void;
|
|
59
|
+
protected schedule(after: number): void;
|
|
60
|
+
protected round(): Promise<void>;
|
|
61
|
+
protected pollSignIn(): Promise<number>;
|
|
62
|
+
read(): Promise<TaAccountInfo>;
|
|
63
|
+
signIn(provider: string, service?: string): Promise<TaAccountInfo>;
|
|
64
|
+
cancelSignIn(): Promise<TaAccountInfo>;
|
|
65
|
+
protected act(run: (agent: AccountAgent) => Promise<AccountView>): Promise<TaAccountInfo>;
|
|
66
|
+
approve(id: string): Promise<TaAccountInfo>;
|
|
67
|
+
remove(id: string): Promise<TaAccountInfo>;
|
|
68
|
+
signOut(): Promise<TaAccountInfo>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { AccountAgent, AccountCallError, AccountService } from '@celljs/ta-relay';
|
|
2
|
+
import { storage } from '../workbench-util.js';
|
|
3
|
+
const KEY = 'ta.account';
|
|
4
|
+
/** Signed out of the account by the user: not signed in again by itself with the token of a Ta in the cloud. */
|
|
5
|
+
const OFF_KEY = 'ta.account.off';
|
|
6
|
+
const SYNC_MS = 15000;
|
|
7
|
+
const WAITING_SYNC_MS = 3000;
|
|
8
|
+
/**
|
|
9
|
+
* The app as a device of the user's account (docs/design/ta-account.md): its own keys in localStorage; the computers
|
|
10
|
+
* of the account come into its list of computers as they let it in, and go as they are removed. The same agent as a
|
|
11
|
+
* computer's (AccountAgent), with the hooks of a device that pairs with computers rather than letting devices in.
|
|
12
|
+
*/
|
|
13
|
+
export class DeviceAccount {
|
|
14
|
+
constructor(hosts, service, gateways) {
|
|
15
|
+
this.hosts = hosts;
|
|
16
|
+
this.service = service;
|
|
17
|
+
this.gateways = gateways;
|
|
18
|
+
const kept = DeviceAccount.read();
|
|
19
|
+
if (kept) {
|
|
20
|
+
this.agent = this.agentOf(kept);
|
|
21
|
+
}
|
|
22
|
+
this.schedule(0);
|
|
23
|
+
document.addEventListener('visibilitychange', () => document.visibilityState === 'visible' && this.schedule(0));
|
|
24
|
+
}
|
|
25
|
+
/** The one of the page. */
|
|
26
|
+
static of(hosts, service, gateways) {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = DeviceAccount.instance) !== null && _a !== void 0 ? _a : (DeviceAccount.instance = new DeviceAccount(hosts, service, gateways));
|
|
29
|
+
return DeviceAccount.instance;
|
|
30
|
+
}
|
|
31
|
+
/** What the device calls itself in the account. */
|
|
32
|
+
static deviceName(agent = navigator.userAgent) {
|
|
33
|
+
return /iPad/.test(agent) ? 'iPad' : /iPhone/.test(agent) ? 'iPhone' : /Android/.test(agent) ? 'Android' : 'Phone';
|
|
34
|
+
}
|
|
35
|
+
static read() {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
var _c;
|
|
38
|
+
try {
|
|
39
|
+
const kept = JSON.parse((_c = (_a = storage()) === null || _a === void 0 ? void 0 : _a.getItem(KEY)) !== null && _c !== void 0 ? _c : 'null');
|
|
40
|
+
return (kept === null || kept === void 0 ? void 0 : kept.token) && ((_b = kept.self) === null || _b === void 0 ? void 0 : _b.signKey) ? kept : undefined;
|
|
41
|
+
}
|
|
42
|
+
catch (_d) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
agentOf(kept) {
|
|
47
|
+
return new AccountAgent(kept, {
|
|
48
|
+
save: next => { var _a; return (_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(KEY, JSON.stringify(next)); },
|
|
49
|
+
name: () => DeviceAccount.deviceName(),
|
|
50
|
+
pairing: (from, link) => this.hosts.addAccountHost(link, from.id),
|
|
51
|
+
unpaired: from => this.hosts.forgetAccountHosts(from),
|
|
52
|
+
signedOut: () => {
|
|
53
|
+
var _a;
|
|
54
|
+
this.forget();
|
|
55
|
+
// A token no longer good, or this device removed: not joined again by itself.
|
|
56
|
+
(_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(OFF_KEY, '1');
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** A Ta in the cloud signed in to: its token is the account of its gateway, which this device joins by itself. */
|
|
61
|
+
cloudToken() {
|
|
62
|
+
for (const host of this.hosts.state.hosts) {
|
|
63
|
+
if ('token' in host.credential && host.credential.url) {
|
|
64
|
+
return { service: host.credential.url.replace(/\/+$/, ''), token: host.credential.token };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
/** Joins the account of the gateway of a Ta in the cloud of this device, unless the user left the account. */
|
|
70
|
+
async adopt() {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const cloud = ((_a = storage()) === null || _a === void 0 ? void 0 : _a.getItem(OFF_KEY)) ? undefined : this.cloudToken();
|
|
73
|
+
if (!cloud || !(await AccountService.ways(cloud.service, [cloud.service])).some(one => one.gateway)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const kept = await AccountAgent.create(cloud.service, cloud.token, { id: '', name: '' }, 'phone', DeviceAccount.deviceName());
|
|
77
|
+
(_b = storage()) === null || _b === void 0 ? void 0 : _b.setItem(KEY, JSON.stringify(kept));
|
|
78
|
+
this.agent = this.agentOf(kept);
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
forget() {
|
|
82
|
+
var _a;
|
|
83
|
+
(_a = storage()) === null || _a === void 0 ? void 0 : _a.removeItem(KEY);
|
|
84
|
+
this.agent = undefined;
|
|
85
|
+
this.view = undefined;
|
|
86
|
+
this.hosts.forgetAccountHosts();
|
|
87
|
+
}
|
|
88
|
+
schedule(after) {
|
|
89
|
+
clearTimeout(this.timer);
|
|
90
|
+
if (!this.agent && !this.signingIn && !this.cloudToken()) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.timer = setTimeout(() => void this.round(), after);
|
|
94
|
+
}
|
|
95
|
+
round() {
|
|
96
|
+
var _a;
|
|
97
|
+
(_a = this.running) !== null && _a !== void 0 ? _a : (this.running = (async () => {
|
|
98
|
+
let next = SYNC_MS;
|
|
99
|
+
try {
|
|
100
|
+
if (this.signingIn) {
|
|
101
|
+
next = await this.pollSignIn();
|
|
102
|
+
}
|
|
103
|
+
else if (this.agent || (await this.adopt())) {
|
|
104
|
+
const agent = this.agent;
|
|
105
|
+
this.view = await agent.sync();
|
|
106
|
+
this.error = undefined;
|
|
107
|
+
if (this.view.waiting || this.view.devices.some(one => one.waiting)) {
|
|
108
|
+
next = WAITING_SYNC_MS;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
this.running = undefined;
|
|
117
|
+
}
|
|
118
|
+
if (document.visibilityState !== 'hidden') {
|
|
119
|
+
this.schedule(next);
|
|
120
|
+
}
|
|
121
|
+
})());
|
|
122
|
+
return this.running;
|
|
123
|
+
}
|
|
124
|
+
async pollSignIn() {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
const signing = this.signingIn;
|
|
127
|
+
if (Date.now() > signing.expiresAt) {
|
|
128
|
+
this.signingIn = undefined;
|
|
129
|
+
return SYNC_MS;
|
|
130
|
+
}
|
|
131
|
+
const answer = await AccountService.check(signing.way, signing.handle);
|
|
132
|
+
if (answer.status === 'pending') {
|
|
133
|
+
return signing.interval * 1000;
|
|
134
|
+
}
|
|
135
|
+
this.signingIn = undefined;
|
|
136
|
+
if (answer.status === 'failed') {
|
|
137
|
+
this.error = answer.error;
|
|
138
|
+
return SYNC_MS;
|
|
139
|
+
}
|
|
140
|
+
const kept = await AccountAgent.create(signing.way.service, answer.token, answer.account, 'phone', DeviceAccount.deviceName());
|
|
141
|
+
(_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(KEY, JSON.stringify(kept));
|
|
142
|
+
(_b = storage()) === null || _b === void 0 ? void 0 : _b.removeItem(OFF_KEY);
|
|
143
|
+
this.agent = this.agentOf(kept);
|
|
144
|
+
this.view = await this.agent.sync();
|
|
145
|
+
return WAITING_SYNC_MS;
|
|
146
|
+
}
|
|
147
|
+
async read() {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
var _c, _d;
|
|
150
|
+
const service = (_d = (_c = (_a = this.agent) === null || _a === void 0 ? void 0 : _a.state.service) !== null && _c !== void 0 ? _c : (_b = this.signingIn) === null || _b === void 0 ? void 0 : _b.way.service) !== null && _d !== void 0 ? _d : (await this.service());
|
|
151
|
+
const error = this.error ? { error: this.error } : {};
|
|
152
|
+
if (!this.agent) {
|
|
153
|
+
const signing = this.signingIn;
|
|
154
|
+
return {
|
|
155
|
+
service,
|
|
156
|
+
providers: await AccountService.ways(service, await this.gateways().catch(() => [])).catch(() => []),
|
|
157
|
+
devices: [],
|
|
158
|
+
...(signing ? { signingIn: { provider: signing.way.id, code: signing.code, url: signing.url, expiresAt: signing.expiresAt } } : {}),
|
|
159
|
+
...error,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (!this.view) {
|
|
163
|
+
await this.round();
|
|
164
|
+
}
|
|
165
|
+
const view = this.view;
|
|
166
|
+
if (!view) {
|
|
167
|
+
return { service, providers: [], account: this.agent.state.account, devices: [], ...error };
|
|
168
|
+
}
|
|
169
|
+
const devices = view.devices.map(({ trusted: _trusted, ...device }) => device);
|
|
170
|
+
return { service, providers: [], account: view.account, waiting: view.waiting, code: view.code, devices, ...error };
|
|
171
|
+
}
|
|
172
|
+
async signIn(provider, service) {
|
|
173
|
+
if (!this.agent) {
|
|
174
|
+
const ways = await AccountService.ways(await this.service(), await this.gateways().catch(() => []));
|
|
175
|
+
const way = ways.find(one => one.id === provider && (service === undefined || one.service === service));
|
|
176
|
+
if (!way) {
|
|
177
|
+
throw new AccountCallError(404, `No way to sign in with ${provider} here.`);
|
|
178
|
+
}
|
|
179
|
+
const start = await AccountService.begin(way, DeviceAccount.deviceName());
|
|
180
|
+
this.signingIn = { way, ...start, expiresAt: Date.now() + start.expiresIn * 1000 };
|
|
181
|
+
this.error = undefined;
|
|
182
|
+
this.schedule(start.interval * 1000);
|
|
183
|
+
}
|
|
184
|
+
return this.read();
|
|
185
|
+
}
|
|
186
|
+
async cancelSignIn() {
|
|
187
|
+
this.signingIn = undefined;
|
|
188
|
+
return this.read();
|
|
189
|
+
}
|
|
190
|
+
async act(run) {
|
|
191
|
+
if (!this.agent) {
|
|
192
|
+
throw new AccountCallError(401, 'Sign in to an account first.');
|
|
193
|
+
}
|
|
194
|
+
this.view = await run(this.agent);
|
|
195
|
+
this.schedule(WAITING_SYNC_MS);
|
|
196
|
+
return this.read();
|
|
197
|
+
}
|
|
198
|
+
approve(id) {
|
|
199
|
+
return this.act(agent => agent.approve(id));
|
|
200
|
+
}
|
|
201
|
+
remove(id) {
|
|
202
|
+
return this.act(agent => agent.remove(id));
|
|
203
|
+
}
|
|
204
|
+
async signOut() {
|
|
205
|
+
var _a;
|
|
206
|
+
if (this.agent) {
|
|
207
|
+
await this.agent.signOut();
|
|
208
|
+
this.forget();
|
|
209
|
+
(_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(OFF_KEY, '1');
|
|
210
|
+
}
|
|
211
|
+
this.error = undefined;
|
|
212
|
+
return this.read();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=device-account.js.map
|
|
@@ -2,7 +2,7 @@ import { type LucideIcon } from 'lucide-react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { SettingsSection } from './settings-view.js';
|
|
4
4
|
/** What an entry of the account opens over the page. */
|
|
5
|
-
export type AccountDialog = 'accounts' | 'directory' | 'relay' | 'hosts';
|
|
5
|
+
export type AccountDialog = 'accounts' | 'directory' | 'relay' | 'hosts' | 'devices';
|
|
6
6
|
export interface AccountChoice {
|
|
7
7
|
key: string;
|
|
8
8
|
label: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TaLanguageUtil } from '@celljs/ta-protocol';
|
|
2
|
-
import { ArrowLeftRight, Check, ChevronRight, Download, FolderOpen, Info, Keyboard, KeyRound, Languages, LogOut, Monitor, Palette, Puzzle, RotateCw, Settings2, Smartphone, Sparkles, } from 'lucide-react';
|
|
2
|
+
import { ArrowLeftRight, Check, ChevronRight, Download, FolderOpen, Info, Keyboard, KeyRound, Languages, LogOut, Monitor, MonitorSmartphone, Palette, Puzzle, RotateCw, Settings2, Smartphone, Sparkles, } from 'lucide-react';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useDevice } from '../device/device.js';
|
|
5
5
|
import { usePwa, useSettings, useWorkbench } from '../hooks.js';
|
|
6
6
|
import { HostUtil } from '../hosts.js';
|
|
7
7
|
import { useT } from '../i18n/use-t.js';
|
|
8
8
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
9
|
+
import { DevicesDialog } from './account-view.js';
|
|
9
10
|
import { AuthDialog } from './auth-view.js';
|
|
10
11
|
import { DinoLookPicker } from './dino-look-picker.js';
|
|
11
12
|
import { useDismiss } from './dismiss.js';
|
|
@@ -53,6 +54,7 @@ export function useAccountEntries(onSettings, onDialog) {
|
|
|
53
54
|
...(touch ? [] : [entry('shortcuts', t('ta.manage.shortcuts'), Keyboard, () => onSettings('shortcuts'))]),
|
|
54
55
|
],
|
|
55
56
|
[
|
|
57
|
+
entry('devices', t('ta.myDevices.title'), MonitorSmartphone, () => onDialog('devices')),
|
|
56
58
|
entry('hosts', t('ta.hosts.title'), Monitor, () => onDialog('hosts'), { detail: inUse && (HostUtil.label(inUse) || t('ta.hosts.thisServer')) }),
|
|
57
59
|
entry('accounts', t('ta.manage.accounts'), KeyRound, () => onDialog('accounts')),
|
|
58
60
|
entry('directory', t('ta.manage.workingDirectory'), FolderOpen, () => onDialog('directory')),
|
|
@@ -96,7 +98,8 @@ export function AccountDialogs({ dialog, onClose }) {
|
|
|
96
98
|
dialog === 'accounts' && React.createElement(AuthDialog, { onClose: onClose }),
|
|
97
99
|
dialog === 'directory' && React.createElement(WorkingDirectoryPicker, { onClose: onClose }),
|
|
98
100
|
dialog === 'relay' && React.createElement(RelayDialog, { onClose: onClose }),
|
|
99
|
-
dialog === 'hosts' && React.createElement(HostsDialog, { onClose: onClose })
|
|
101
|
+
dialog === 'hosts' && React.createElement(HostsDialog, { onClose: onClose }),
|
|
102
|
+
dialog === 'devices' && React.createElement(DevicesDialog, { onClose: onClose })));
|
|
100
103
|
}
|
|
101
104
|
/** The round figure of the account: a close-up of the double, the dinosaur the user picked for it (a T. rex until then). */
|
|
102
105
|
export function AccountFigure({ size, className }) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AccountSide } from '../account/device-account.js';
|
|
3
|
+
/** What the account panel shows: signing in, waiting, or the devices. */
|
|
4
|
+
export declare function AccountPanel({ side }: {
|
|
5
|
+
side: AccountSide;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
/** The account and its devices, over the page: from Me, the menu of the account, the settings. */
|
|
8
|
+
export declare function DevicesDialog({ onClose }: {
|
|
9
|
+
onClose(): void;
|
|
10
|
+
}): React.ReactPortal;
|
|
11
|
+
/**
|
|
12
|
+
* A device asks to join the account: whichever device of it the user has at hand says so, with the code to compare,
|
|
13
|
+
* until it is let in, refused, or put off for now.
|
|
14
|
+
*/
|
|
15
|
+
export declare function AccountAsk(): React.ReactPortal | null;
|
|
16
|
+
/** On the sign-in of the app: sign in to the account, and the computers of it come by themselves. */
|
|
17
|
+
export declare function AccountSignInEntry(): React.JSX.Element | null;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Globe, Laptop, LogOut, Smartphone, Trash2, X } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { useAccountInfo, useAccountSide } from '../account/account-side.js';
|
|
5
|
+
import { useBackLayer } from '../device/back-stack.js';
|
|
6
|
+
import { ConsoleUtil } from '../gateway/console-util.js';
|
|
7
|
+
import { useNotices, useWorkbench } from '../hooks.js';
|
|
8
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
9
|
+
import { WorkbenchUtil } from '../workbench-util.js';
|
|
10
|
+
import { BusyMark, useBusy } from './busy.js';
|
|
11
|
+
import { Callout } from './callout.js';
|
|
12
|
+
import { CodeBox } from './cloud-sign-in-view.js';
|
|
13
|
+
import { Icon, IconButton } from './icon.js';
|
|
14
|
+
import { Loading } from './loading.js';
|
|
15
|
+
import { SignInMark } from './sign-in-marks.js';
|
|
16
|
+
/*
|
|
17
|
+
* The user's account and its devices (docs/design/ta-account.md): signing in, waiting to be let in, letting a new
|
|
18
|
+
* device in after comparing its code, and the devices with whether they are online. The same on a computer (its ta
|
|
19
|
+
* serve's account) and in the app (the phone's own).
|
|
20
|
+
*/
|
|
21
|
+
const KIND_ICONS = { computer: Laptop, phone: Smartphone, browser: Globe };
|
|
22
|
+
/** The code of six digits, split in two for the eye: 482 913. */
|
|
23
|
+
function codeText(code) {
|
|
24
|
+
return `${code.slice(0, 3)} ${code.slice(3)}`;
|
|
25
|
+
}
|
|
26
|
+
function providerName(info, id) {
|
|
27
|
+
var _a;
|
|
28
|
+
var _b;
|
|
29
|
+
return (_b = (_a = info.providers.find(one => one.id === id)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (id === 'github' ? 'GitHub' : id);
|
|
30
|
+
}
|
|
31
|
+
/** Signing in: the ways of the service, then the code to enter on the provider's page. */
|
|
32
|
+
function SignInPart({ info, act }) {
|
|
33
|
+
const t = useT();
|
|
34
|
+
const [busy, run] = useBusy();
|
|
35
|
+
const [, notices] = useNotices();
|
|
36
|
+
const go = (action) => void run(() => act(action).catch((error) => notices.error(error)));
|
|
37
|
+
const signing = info.signingIn;
|
|
38
|
+
if (signing) {
|
|
39
|
+
const name = providerName(info, signing.provider);
|
|
40
|
+
return (React.createElement("div", { className: "ta-account-signing" },
|
|
41
|
+
React.createElement("p", null, t('ta.myDevices.enterCode', { name })),
|
|
42
|
+
React.createElement(CodeBox, { code: signing.code }),
|
|
43
|
+
React.createElement("button", { type: "button", className: "ta-button ta-primary ta-wide", onClick: () => window.open(signing.url, '_blank', 'noopener,noreferrer') },
|
|
44
|
+
React.createElement(SignInMark, { provider: signing.provider, size: 16 }),
|
|
45
|
+
" ",
|
|
46
|
+
t('ta.myDevices.openProvider', { name })),
|
|
47
|
+
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => go(side => side.cancelSignIn()) }, t('ta.cancel'))));
|
|
48
|
+
}
|
|
49
|
+
if (info.providers.length === 0) {
|
|
50
|
+
return React.createElement(Loading, { compact: true });
|
|
51
|
+
}
|
|
52
|
+
return (React.createElement("div", { className: "ta-account-ways" }, info.providers.map(provider => (React.createElement("button", { key: `${provider.service} ${provider.id}`, type: "button", className: busy ? 'ta-button ta-primary ta-wide ta-busy' : 'ta-button ta-primary ta-wide', "aria-busy": busy || undefined, onClick: () => go(async (side) => {
|
|
53
|
+
const next = await side.signIn(provider.id, provider.service);
|
|
54
|
+
if (next.signingIn) {
|
|
55
|
+
window.open(next.signingIn.url, '_blank', 'noopener,noreferrer');
|
|
56
|
+
}
|
|
57
|
+
return next;
|
|
58
|
+
}) },
|
|
59
|
+
React.createElement(SignInMark, { provider: provider.id, size: 16 }),
|
|
60
|
+
" ",
|
|
61
|
+
t('ta.myDevices.signInWith', { name: provider.name }),
|
|
62
|
+
React.createElement(BusyMark, { busy: busy }))))));
|
|
63
|
+
}
|
|
64
|
+
/** This device waits to be let in by another of the account: the code both show. */
|
|
65
|
+
function WaitingPart({ code }) {
|
|
66
|
+
const t = useT();
|
|
67
|
+
return (React.createElement("div", { className: "ta-account-waiting" },
|
|
68
|
+
React.createElement("strong", null, t('ta.myDevices.waitingTitle')),
|
|
69
|
+
React.createElement("div", { className: "ta-account-code", role: "img", "aria-label": code }, codeText(code)),
|
|
70
|
+
React.createElement("p", null, t('ta.myDevices.waitingHint'))));
|
|
71
|
+
}
|
|
72
|
+
function DeviceRow({ device, onApprove, onRemove, onOpen }) {
|
|
73
|
+
var _a;
|
|
74
|
+
const t = useT();
|
|
75
|
+
const language = useLanguage();
|
|
76
|
+
const detail = device.waiting
|
|
77
|
+
? `${t('ta.myDevices.waiting')} · ${t('ta.myDevices.code', { code: codeText((_a = device.code) !== null && _a !== void 0 ? _a : '') })}`
|
|
78
|
+
: device.self
|
|
79
|
+
? t('ta.myDevices.thisDevice')
|
|
80
|
+
: device.online
|
|
81
|
+
? t('ta.myDevices.online')
|
|
82
|
+
: t('ta.myDevices.seen', { time: ConsoleUtil.ago(device.seenAt, language) });
|
|
83
|
+
return (React.createElement("li", { className: `ta-account-device${device.waiting ? ' ta-waiting' : ''}` },
|
|
84
|
+
React.createElement("span", { className: "ta-account-device-icon", "aria-hidden": "true" },
|
|
85
|
+
React.createElement(Icon, { icon: KIND_ICONS[device.kind], size: 18 }),
|
|
86
|
+
!device.waiting && React.createElement("span", { className: `ta-account-dot${device.online ? ' ta-on' : ''}` })),
|
|
87
|
+
React.createElement("span", { className: "ta-account-device-text" },
|
|
88
|
+
React.createElement("span", { className: "ta-ellipsis" }, device.name),
|
|
89
|
+
React.createElement("span", { className: "ta-account-device-detail ta-ellipsis" }, detail)),
|
|
90
|
+
device.waiting ? (React.createElement("span", { className: "ta-account-device-actions" },
|
|
91
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: onRemove }, t('ta.myDevices.notMe')),
|
|
92
|
+
React.createElement("button", { type: "button", className: "ta-button ta-primary", onClick: onApprove }, t('ta.myDevices.allow')))) : (React.createElement("span", { className: "ta-account-device-actions" },
|
|
93
|
+
onOpen && (React.createElement("button", { type: "button", className: "ta-button", onClick: onOpen }, t('ta.myDevices.open'))),
|
|
94
|
+
!device.self && React.createElement(IconButton, { icon: Trash2, label: t('ta.myDevices.remove'), onClick: onRemove })))));
|
|
95
|
+
}
|
|
96
|
+
/** What the account panel shows: signing in, waiting, or the devices. */
|
|
97
|
+
export function AccountPanel({ side }) {
|
|
98
|
+
var _a;
|
|
99
|
+
const t = useT();
|
|
100
|
+
const [{ hosts, host }, bench] = useWorkbench();
|
|
101
|
+
const [, notices] = useNotices();
|
|
102
|
+
const { info, failed, act } = useAccountInfo(side);
|
|
103
|
+
const app = WorkbenchUtil.isApp();
|
|
104
|
+
const go = (action) => void act(action).catch((error) => notices.error(error));
|
|
105
|
+
if (!info) {
|
|
106
|
+
return failed ? React.createElement(Callout, { level: "error" }, String((_a = failed.message) !== null && _a !== void 0 ? _a : failed)) : React.createElement(Loading, { compact: true });
|
|
107
|
+
}
|
|
108
|
+
if (!info.account) {
|
|
109
|
+
return (React.createElement(React.Fragment, null,
|
|
110
|
+
React.createElement("p", { className: "ta-account-hint" }, t('ta.myDevices.hint')),
|
|
111
|
+
info.error && React.createElement(Callout, { level: "error" }, info.error),
|
|
112
|
+
React.createElement(SignInPart, { info: info, act: act })));
|
|
113
|
+
}
|
|
114
|
+
const remove = async (device) => {
|
|
115
|
+
if (device.waiting ||
|
|
116
|
+
(await notices.confirm({ title: t('ta.myDevices.removeConfirm', { name: device.name }), confirmLabel: t('ta.myDevices.remove'), danger: true }))) {
|
|
117
|
+
go(one => one.remove(device.id));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const signOut = async () => {
|
|
121
|
+
if (await notices.confirm({
|
|
122
|
+
title: t(app ? 'ta.myDevices.signOutConfirm' : 'ta.myDevices.signOutConfirmComputer'),
|
|
123
|
+
confirmLabel: t('ta.myDevices.signOut'),
|
|
124
|
+
danger: true,
|
|
125
|
+
})) {
|
|
126
|
+
go(one => one.signOut());
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/** In the app, a computer of the account is one of the list: a tap switches to it. */
|
|
130
|
+
const openOf = (device) => {
|
|
131
|
+
if (device.self || device.kind !== 'computer') {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
const saved = app ? hosts.find(one => one.account === device.id) : undefined;
|
|
135
|
+
if (saved) {
|
|
136
|
+
return saved.id === host ? undefined : () => bench.switchTo(saved.id);
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
};
|
|
140
|
+
const devices = [...info.devices].sort((a, b) => Number(b.waiting) - Number(a.waiting) || Number(b.self) - Number(a.self) || a.addedAt - b.addedAt);
|
|
141
|
+
return (React.createElement(React.Fragment, null,
|
|
142
|
+
info.waiting && info.code ? React.createElement(WaitingPart, { code: info.code }) : null,
|
|
143
|
+
info.error && React.createElement(Callout, { level: "error" }, info.error),
|
|
144
|
+
!info.waiting && (React.createElement("ul", { className: "ta-account-devices" }, devices.map(device => (React.createElement(DeviceRow, { key: device.id, device: device, onApprove: () => go(one => one.approve(device.id)), onRemove: () => void remove(device), onOpen: openOf(device) }))))),
|
|
145
|
+
!info.waiting && devices.length < 2 && React.createElement("p", { className: "ta-account-hint" }, t('ta.myDevices.none')),
|
|
146
|
+
React.createElement("div", { className: "ta-account-foot" },
|
|
147
|
+
React.createElement("span", { className: "ta-account-who" },
|
|
148
|
+
React.createElement(SignInMark, { provider: info.account.id.split(':')[0], size: 14 }),
|
|
149
|
+
React.createElement("span", { className: "ta-ellipsis" }, info.account.name)),
|
|
150
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: () => void signOut() },
|
|
151
|
+
React.createElement(Icon, { icon: LogOut, size: 14 }),
|
|
152
|
+
" ",
|
|
153
|
+
t('ta.myDevices.signOut')))));
|
|
154
|
+
}
|
|
155
|
+
/** The account and its devices, over the page: from Me, the menu of the account, the settings. */
|
|
156
|
+
export function DevicesDialog({ onClose }) {
|
|
157
|
+
const t = useT();
|
|
158
|
+
const side = useAccountSide();
|
|
159
|
+
useBackLayer(true, onClose);
|
|
160
|
+
React.useEffect(() => {
|
|
161
|
+
const onKey = (event) => event.key === 'Escape' && onClose();
|
|
162
|
+
document.addEventListener('keydown', onKey);
|
|
163
|
+
return () => document.removeEventListener('keydown', onKey);
|
|
164
|
+
}, [onClose]);
|
|
165
|
+
return createPortal(React.createElement("div", { className: "ta-modal-scrim" },
|
|
166
|
+
React.createElement("button", { type: "button", className: "ta-overlay-close", "aria-label": t('ta.close'), tabIndex: -1, onClick: onClose }),
|
|
167
|
+
React.createElement("div", { className: "ta-modal ta-account-dialog", role: "dialog", "aria-modal": "true", "aria-label": t('ta.myDevices.title') },
|
|
168
|
+
React.createElement("div", { className: "ta-modal-head" },
|
|
169
|
+
React.createElement("span", { className: "ta-modal-title" }, t('ta.myDevices.title')),
|
|
170
|
+
React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: onClose })),
|
|
171
|
+
side ? React.createElement(AccountPanel, { side: side }) : React.createElement(Loading, { compact: true }))), document.body);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* A device asks to join the account: whichever device of it the user has at hand says so, with the code to compare,
|
|
175
|
+
* until it is let in, refused, or put off for now.
|
|
176
|
+
*/
|
|
177
|
+
export function AccountAsk() {
|
|
178
|
+
var _a;
|
|
179
|
+
const t = useT();
|
|
180
|
+
const side = useAccountSide();
|
|
181
|
+
const [, notices] = useNotices();
|
|
182
|
+
const { info, act } = useAccountInfo(side, 5000);
|
|
183
|
+
const [later, setLater] = React.useState([]);
|
|
184
|
+
const asking = (info === null || info === void 0 ? void 0 : info.account) && !info.waiting ? info.devices.find(one => one.waiting && !later.includes(one.id)) : undefined;
|
|
185
|
+
if (!asking) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const go = (action) => void act(action).catch((error) => notices.error(error));
|
|
189
|
+
return createPortal(React.createElement("div", { className: "ta-account-ask", role: "alertdialog", "aria-label": t('ta.myDevices.askTitle', { name: asking.name }) },
|
|
190
|
+
React.createElement("span", { className: "ta-account-device-icon", "aria-hidden": "true" },
|
|
191
|
+
React.createElement(Icon, { icon: KIND_ICONS[asking.kind], size: 20 })),
|
|
192
|
+
React.createElement("div", { className: "ta-account-ask-text" },
|
|
193
|
+
React.createElement("strong", { className: "ta-ellipsis" }, t('ta.myDevices.askTitle', { name: asking.name })),
|
|
194
|
+
React.createElement("span", { className: "ta-account-code" }, codeText((_a = asking.code) !== null && _a !== void 0 ? _a : '')),
|
|
195
|
+
React.createElement("span", { className: "ta-account-hint" }, t('ta.myDevices.askHint'))),
|
|
196
|
+
React.createElement("div", { className: "ta-account-ask-actions" },
|
|
197
|
+
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => setLater(before => [...before, asking.id]) }, t('ta.myDevices.later')),
|
|
198
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: () => go(one => one.remove(asking.id)) }, t('ta.myDevices.notMe')),
|
|
199
|
+
React.createElement("button", { type: "button", className: "ta-button ta-primary", onClick: () => go(one => one.approve(asking.id)) }, t('ta.myDevices.allow')))), document.body);
|
|
200
|
+
}
|
|
201
|
+
/** On the sign-in of the app: sign in to the account, and the computers of it come by themselves. */
|
|
202
|
+
export function AccountSignInEntry() {
|
|
203
|
+
const t = useT();
|
|
204
|
+
const side = useAccountSide();
|
|
205
|
+
const [open, setOpen] = React.useState(false);
|
|
206
|
+
const { info } = useAccountInfo(side);
|
|
207
|
+
if (!side || !info || (!info.account && info.providers.length === 0 && !info.signingIn)) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
if (open || info.account || info.signingIn) {
|
|
211
|
+
return (React.createElement("section", { className: "ta-account-sign-in" },
|
|
212
|
+
React.createElement(AccountPanel, { side: side })));
|
|
213
|
+
}
|
|
214
|
+
return (React.createElement("button", { type: "button", className: "ta-button ta-wide", onClick: () => setOpen(true) }, t('ta.myDevices.signInAccount')));
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=account-view.js.map
|