@coasys/ad4m-connect 0.13.0-test-2 → 0.13.0-test-4
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/components/icons/CheckCircleIcon.d.ts +1 -0
- package/dist/components/icons/TickIcon.d.ts +1 -0
- package/dist/components/shared/Ad4mLogo.d.ts +1 -0
- package/dist/components/shared/AppLogo.d.ts +1 -0
- package/dist/components/shared/Header.d.ts +1 -0
- package/dist/components/shared/Logo.d.ts +1 -0
- package/dist/components/states/ErrorState.d.ts +6 -0
- package/dist/components/views/ConnectionOverview.d.ts +22 -0
- package/dist/components/views/Hosting.d.ts +22 -0
- package/dist/components/views/MultiUserAuth.d.ts +26 -0
- package/dist/components/views/RemoteConnection.d.ts +19 -0
- package/dist/components/views/RequestCapability.d.ts +16 -0
- package/dist/components/views/ScanQRCode.d.ts +14 -0
- package/dist/components/views/Settings.d.ts +19 -0
- package/dist/components/views/Start.d.ts +19 -0
- package/dist/components/views/old/Hosting.d.ts +22 -0
- package/dist/components/views/old/MultiUserAuth.d.ts +26 -0
- package/dist/components/views/old/RemoteConnection.d.ts +19 -0
- package/dist/components/views/old/RequestCapability.d.ts +16 -0
- package/dist/components/views/old/ScanQRCode.d.ts +14 -0
- package/dist/components/views/old/Settings.d.ts +19 -0
- package/dist/components/views/old/Start.d.ts +19 -0
- package/dist/core.d.ts +3 -7
- package/dist/core.js +132 -1703
- package/dist/index.js +305 -1876
- package/dist/old/components/InvalidToken.d.ts +0 -0
- package/dist/old/components/VerifyCode.d.ts +0 -0
- package/dist/old/core.d.ts +0 -0
- package/dist/old/electron.d.ts +0 -0
- package/dist/old/state/ConnectState.d.ts +0 -0
- package/dist/old/state/index.d.ts +0 -0
- package/dist/old/utils.d.ts +0 -0
- package/dist/old/views/Hosting.d.ts +0 -0
- package/dist/old/views/MultiUserAuth.d.ts +0 -0
- package/dist/old/views/RemoteConnection.d.ts +0 -0
- package/dist/old/views/RequestCapability.d.ts +0 -0
- package/dist/old/views/ScanQRCode.d.ts +0 -0
- package/dist/old/views/Settings.d.ts +0 -0
- package/dist/old/views/Start.d.ts +0 -0
- package/dist/old/web.d.ts +0 -0
- package/dist/services/hostIndex.d.ts +2 -2
- package/dist/state/ConnectState.d.ts +101 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +1 -1
- package/dist/web.js +269 -1828
- package/package.json +21 -19
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,9 +2,9 @@ import type { RemoteHost, UserInfo } from '../types';
|
|
|
2
2
|
import type { Ad4mClient } from '@coasys/ad4m';
|
|
3
3
|
/** Fetch available hosts from the central index API */
|
|
4
4
|
export declare function fetchHosts(indexUrl?: string): Promise<RemoteHost[]>;
|
|
5
|
-
/** Fetch current user info from the executor
|
|
5
|
+
/** Fetch current user info from the executor */
|
|
6
6
|
export declare function fetchUserInfo(ad4mClient: Ad4mClient): Promise<UserInfo>;
|
|
7
|
-
/** Trigger a payment request via the executor
|
|
7
|
+
/** Trigger a payment request via the executor */
|
|
8
8
|
export declare function requestPayment(ad4mClient: Ad4mClient, amountHOT: number): Promise<{
|
|
9
9
|
success: boolean;
|
|
10
10
|
message: string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* UI View States
|
|
4
|
+
*/
|
|
5
|
+
export type UIView = 'connection_overview' | 'remote_connection' | 'settings' | 'start' | 'qr' | 'requestcap' | 'verifycode' | 'disconnected' | 'hosting' | 'agentlocked' | 'multiuser_auth';
|
|
6
|
+
/**
|
|
7
|
+
* Multi-user authentication steps
|
|
8
|
+
*/
|
|
9
|
+
export type MultiUserStep = 'email' | 'password' | 'code';
|
|
10
|
+
export type MultiUserVerificationType = 'signup' | 'login';
|
|
11
|
+
/**
|
|
12
|
+
* Form state for different auth methods
|
|
13
|
+
*/
|
|
14
|
+
interface FormState {
|
|
15
|
+
email: string;
|
|
16
|
+
password: string;
|
|
17
|
+
hostingStep: number;
|
|
18
|
+
multiUserEmail: string;
|
|
19
|
+
multiUserPassword: string;
|
|
20
|
+
multiUserVerificationCode: string;
|
|
21
|
+
multiUserStep: MultiUserStep;
|
|
22
|
+
multiUserVerificationType: MultiUserVerificationType;
|
|
23
|
+
remoteUrl: string;
|
|
24
|
+
code: string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Error state for different operations
|
|
28
|
+
*/
|
|
29
|
+
interface ErrorState {
|
|
30
|
+
password: string | null;
|
|
31
|
+
hostingNotRunning: string | null;
|
|
32
|
+
verifyCode: string | null;
|
|
33
|
+
multiUser: string | null;
|
|
34
|
+
remote: string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Loading state for async operations
|
|
38
|
+
*/
|
|
39
|
+
interface LoadingState {
|
|
40
|
+
hosting: boolean;
|
|
41
|
+
multiUser: boolean;
|
|
42
|
+
remoteDetecting: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Detection state
|
|
46
|
+
*/
|
|
47
|
+
interface DetectionState {
|
|
48
|
+
localDetected: boolean;
|
|
49
|
+
remoteMultiUserDetected: boolean | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Reactive state controller for Ad4m Connect
|
|
53
|
+
* Manages all UI and form state in a centralized, reactive way
|
|
54
|
+
*/
|
|
55
|
+
export declare class ConnectState implements ReactiveController {
|
|
56
|
+
private host;
|
|
57
|
+
currentView: UIView;
|
|
58
|
+
isOpen: boolean;
|
|
59
|
+
isMobile: boolean;
|
|
60
|
+
isRemote: boolean;
|
|
61
|
+
hasClickedDownload: boolean;
|
|
62
|
+
forms: FormState;
|
|
63
|
+
errors: ErrorState;
|
|
64
|
+
loading: LoadingState;
|
|
65
|
+
detection: DetectionState;
|
|
66
|
+
constructor(host: ReactiveControllerHost);
|
|
67
|
+
hostConnected(): void;
|
|
68
|
+
hostDisconnected(): void;
|
|
69
|
+
get canSubmitMultiUser(): boolean;
|
|
70
|
+
get canSubmitVerificationCode(): boolean;
|
|
71
|
+
get hasAnyError(): boolean;
|
|
72
|
+
get isAnyLoading(): boolean;
|
|
73
|
+
get showLocalOption(): boolean;
|
|
74
|
+
get showRemoteOption(): boolean;
|
|
75
|
+
get showQROption(): boolean;
|
|
76
|
+
get showDownload(): boolean;
|
|
77
|
+
setView(view: UIView): void;
|
|
78
|
+
toggleOpen(): void;
|
|
79
|
+
open(): void;
|
|
80
|
+
close(): void;
|
|
81
|
+
setMobile(isMobile: boolean): void;
|
|
82
|
+
setRemote(isRemote: boolean): void;
|
|
83
|
+
setHasClickedDownload(clicked: boolean): void;
|
|
84
|
+
updateForm<K extends keyof FormState>(field: K, value: FormState[K]): void;
|
|
85
|
+
resetMultiUserForm(): void;
|
|
86
|
+
nextMultiUserStep(): void;
|
|
87
|
+
previousMultiUserStep(): void;
|
|
88
|
+
toggleMultiUserVerificationType(): void;
|
|
89
|
+
setError<K extends keyof ErrorState>(field: K, message: string | null): void;
|
|
90
|
+
clearError<K extends keyof ErrorState>(field: K): void;
|
|
91
|
+
clearAllErrors(): void;
|
|
92
|
+
setLoading<K extends keyof LoadingState>(field: K, isLoading: boolean): void;
|
|
93
|
+
setLocalDetected(detected: boolean): void;
|
|
94
|
+
setRemoteMultiUserDetected(detected: boolean | null): void;
|
|
95
|
+
private requestUpdate;
|
|
96
|
+
/**
|
|
97
|
+
* Reset all state to initial values
|
|
98
|
+
*/
|
|
99
|
+
reset(): void;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,7 +2,10 @@ export declare function isEmbedded(): boolean;
|
|
|
2
2
|
export declare function setLocal(key: string, value: string): void;
|
|
3
3
|
export declare function getLocal(key: string): string | null;
|
|
4
4
|
export declare function removeLocal(key: string): void;
|
|
5
|
-
|
|
5
|
+
/** Convert a WebSocket URL to an HTTP base URL. */
|
|
6
|
+
export declare function wsUrlToHttpBase(wsUrl: string): string;
|
|
7
|
+
/** Check that the AD4M executor is reachable at the given HTTP base URL. */
|
|
8
|
+
export declare function checkConnection(baseUrl: string, timeout?: number): Promise<void>;
|
|
6
9
|
/** Extract up to 2 initials from a name (first letter of first two words) */
|
|
7
10
|
export declare function getInitials(name: string): string;
|
|
8
11
|
/** Deterministic hue (0-359) from a string — same input always yields same color */
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=(e,o,t)=>new Promise((a,r)=>{var c=n=>{try{i(t.next(n))}catch(u){r(u)}},p=n=>{try{i(t.throw(n))}catch(u){r(u)}},i=n=>n.done?a(n.value):Promise.resolve(n.value).then(c,p);i((t=t.apply(e,o)).next())});var s="0.13.0-test-4";function f(){return typeof window!="undefined"&&window.self!==window.top}function l(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(e){return!1}return!0}function w(e,o){l()&&localStorage.setItem(`${s}/${e}`,o)}function y(e){return l()?localStorage.getItem(`${s}/${e}`):null}function k(e){l()&&localStorage.removeItem(`${s}/${e}`)}function v(e){return e.replace(/^ws(s?):\/\//,(o,t)=>`http${t}://`)}function x(e,o=1e4){return d(this,null,function*(){let t=new AbortController,a=setTimeout(()=>t.abort(),o);try{let r=yield fetch(`${e}/health`,{signal:t.signal});if(!r.ok)throw new Error(`Health check returned ${r.status}`);let c=yield r.json();if((c==null?void 0:c.status)!=="ok")throw new Error("Not an AD4M executor")}catch(r){throw r.name==="AbortError"?new Error("Connection timed out"):r}finally{clearTimeout(a)}})}function j(e){let o=e.trim();if(!o)return"";let t=o.split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():o.slice(0,2).toUpperCase()}function $(e){let o=0;for(let t=0;t<e.length;t++)o=e.charCodeAt(t)+((o<<5)-o);return(o%360+360)%360}export{x as checkConnection,$ as getHue,j as getInitials,y as getLocal,f as isEmbedded,k as removeLocal,w as setLocal,v as wsUrlToHttpBase};
|