@coasys/ad4m-connect 0.12.0-rc2 → 0.12.1-dev
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/index.d.ts +3 -0
- package/dist/components/views/ConnectionOptions.d.ts +2 -7
- package/dist/components/views/RemoteAuthentication.d.ts +4 -0
- package/dist/core.d.ts +13 -1
- package/dist/core.js +299 -262
- package/dist/index.js +1172 -399
- package/dist/types.d.ts +25 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +1 -1
- package/dist/web.d.ts +18 -2
- package/dist/web.js +1147 -374
- package/package.json +2 -2
- package/public/dialog.html +0 -49
package/dist/types.d.ts
CHANGED
|
@@ -18,7 +18,32 @@ export type Ad4mConnectOptions = {
|
|
|
18
18
|
userEmail?: string;
|
|
19
19
|
userPassword?: string;
|
|
20
20
|
allowedOrigins?: string[];
|
|
21
|
+
hostIndexUrl?: string;
|
|
21
22
|
};
|
|
22
23
|
export type ConfigStates = "port" | "url" | "token";
|
|
23
24
|
export type AuthStates = "authenticated" | "locked" | "unauthenticated";
|
|
24
25
|
export type ConnectionStates = "connecting" | "connected" | "error" | "port-not-found" | "not-connected" | "disconnected" | "checking-local";
|
|
26
|
+
/** Host as returned by the central index API */
|
|
27
|
+
export type RemoteHost = {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
profilePicUrl: string;
|
|
32
|
+
location: string;
|
|
33
|
+
url: string;
|
|
34
|
+
rates: PricingItem[];
|
|
35
|
+
aiModels: string[];
|
|
36
|
+
computeSpecs?: string | null;
|
|
37
|
+
};
|
|
38
|
+
/** Flexible pricing item — avoids locking the interface to a specific pricing model */
|
|
39
|
+
export type PricingItem = {
|
|
40
|
+
description: string;
|
|
41
|
+
priceInHOT: number;
|
|
42
|
+
};
|
|
43
|
+
/** User account data returned by the host after auth */
|
|
44
|
+
export type UserInfo = {
|
|
45
|
+
email: string;
|
|
46
|
+
remainingCredits: number;
|
|
47
|
+
hotWalletAddress: string | null;
|
|
48
|
+
freeAccess: boolean;
|
|
49
|
+
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,3 +3,7 @@ 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
|
export declare function connectWebSocket(url: any, timeout?: number): Promise<unknown>;
|
|
6
|
+
/** Extract up to 2 initials from a name (first letter of first two words) */
|
|
7
|
+
export declare function getInitials(name: string): string;
|
|
8
|
+
/** Deterministic hue (0-359) from a string — same input always yields same color */
|
|
9
|
+
export declare function getHue(str: string): number;
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=(
|
|
1
|
+
var l=(e,t,o)=>new Promise((c,r)=>{var n=s=>{try{i(o.next(s))}catch(u){r(u)}},p=s=>{try{i(o.throw(s))}catch(u){r(u)}},i=s=>s.done?c(s.value):Promise.resolve(s.value).then(n,p);i((o=o.apply(e,t)).next())});var a="0.12.1-dev";function f(){return typeof window!="undefined"&&window.self!==window.top}function d(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(e){return!1}return!0}function w(e,t){d()&&localStorage.setItem(`${a}/${e}`,t)}function k(e){return d()?localStorage.getItem(`${a}/${e}`):null}function y(e){d()&&localStorage.removeItem(`${a}/${e}`)}function v(e,t=1e4){return l(this,null,function*(){return Promise.race([new Promise((o,c)=>{let r;try{r=new WebSocket(e,"graphql-transport-ws"),r.onopen=()=>{r.close(),o(r)},r.onerror=n=>{c(n)},r.onclose=n=>{n.code!==1e3&&c(new Error(`WebSocket closed with code ${n.code}: ${n.reason}`))}}catch(n){r&&r.close(),c(n)}}),new Promise((o,c)=>{setTimeout(()=>{c(new Error("WebSocket connection timed out"))},t)})])})}function x(e){let t=e.trim();if(!t)return"";let o=t.split(/\s+/);return o.length>=2?(o[0][0]+o[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function S(e){let t=0;for(let o=0;o<e.length;o++)t=e.charCodeAt(o)+((t<<5)-t);return(t%360+360)%360}export{v as connectWebSocket,S as getHue,x as getInitials,k as getLocal,f as isEmbedded,y as removeLocal,w as setLocal};
|
package/dist/web.d.ts
CHANGED
|
@@ -4,23 +4,39 @@ import "./components/views/ConnectionOptions";
|
|
|
4
4
|
import "./components/views/LocalAuthentication";
|
|
5
5
|
import "./components/views/RemoteAuthentication";
|
|
6
6
|
import "./components/views/CurrentState";
|
|
7
|
+
import "./components/views/HostBrowser";
|
|
8
|
+
import "./components/views/HostDetail";
|
|
9
|
+
import "./components/views/LoggedInDashboard";
|
|
7
10
|
export declare class Ad4mConnectElement extends LitElement {
|
|
8
11
|
static styles: import("lit").CSSResult[];
|
|
9
12
|
core: Ad4mConnect;
|
|
10
13
|
modalOpen: boolean;
|
|
11
14
|
private currentView;
|
|
12
|
-
private connectingToRemoteNode;
|
|
13
|
-
private remoteNodeError;
|
|
14
15
|
private verificationError;
|
|
15
16
|
private remoteAuthLoading;
|
|
16
17
|
private remoteAuthState;
|
|
17
18
|
private emailCodeError;
|
|
18
19
|
private passwordError;
|
|
19
20
|
private accountCreationError;
|
|
21
|
+
private hosts;
|
|
22
|
+
private hostsLoading;
|
|
23
|
+
private hostsError;
|
|
24
|
+
private selectedHost;
|
|
25
|
+
private userInfo;
|
|
26
|
+
private lowCredit;
|
|
27
|
+
private requestingPayment;
|
|
28
|
+
private paymentError;
|
|
20
29
|
connectedCallback(): void;
|
|
21
30
|
private changePort;
|
|
22
31
|
private connectLocalNode;
|
|
23
32
|
private verifyLocalAd4mCode;
|
|
33
|
+
private browseHosts;
|
|
34
|
+
private retryFetchHosts;
|
|
35
|
+
private selectHost;
|
|
36
|
+
private proceedToAuth;
|
|
37
|
+
private handleAuthSuccess;
|
|
38
|
+
private handleRequestTopUp;
|
|
39
|
+
private handleSetWalletAddress;
|
|
24
40
|
private connectRemoteNode;
|
|
25
41
|
private emailLogin;
|
|
26
42
|
private verifyEmailCode;
|