@le-space/ui 0.7.0 → 0.9.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/package.json +3 -3
- package/react/index.d.ts +62 -0
- package/react/index.js +907 -165
- package/shared/index.d.ts +72 -2
- package/shared/index.js +477 -41
- package/styles.css +6 -0
- package/svelte/SponsorRelayFab.svelte +286 -0
- package/svelte/styles/theme.css +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Floating Aleph Relay Button UI components for Svelte and React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"url": "https://github.com/NiKrause/relay-button/issues"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@le-space/browser": "0.
|
|
48
|
-
"@le-space/core": "0.
|
|
47
|
+
"@le-space/browser": "0.9.0",
|
|
48
|
+
"@le-space/core": "0.9.0",
|
|
49
49
|
"viem": "^2.53.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
package/react/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
+
type CrnSource = 'list' | 'aggregate';
|
|
4
|
+
type CrnSourcePreference = 'auto' | 'aggregate' | 'list';
|
|
5
|
+
|
|
3
6
|
type MessageStatus = 'processed' | 'pending' | 'rejected' | 'removing' | 'removed' | 'unknown';
|
|
4
7
|
interface BalanceResponse {
|
|
5
8
|
address: string;
|
|
@@ -222,6 +225,12 @@ interface SponsorRelayProps {
|
|
|
222
225
|
apiHost?: string;
|
|
223
226
|
apiHosts?: string | readonly string[];
|
|
224
227
|
crnListUrl?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Which CRN source to read. `auto` falls back to the corechannel aggregate
|
|
230
|
+
* when crns.json is down, `aggregate` skips crns.json, `list` disables the
|
|
231
|
+
* fallback. `localStorage.LE_SPACE_CRN_SOURCE` overrides this at runtime.
|
|
232
|
+
*/
|
|
233
|
+
crnSource?: CrnSourcePreference;
|
|
225
234
|
schedulerApiHost?: string;
|
|
226
235
|
twoN6ApiHost?: string;
|
|
227
236
|
}
|
|
@@ -255,6 +264,12 @@ interface CompactInstanceDetails {
|
|
|
255
264
|
vmIpv4: string | null;
|
|
256
265
|
webUrl: string | null;
|
|
257
266
|
sshCommand: string | null;
|
|
267
|
+
/**
|
|
268
|
+
* Hostname of the deployment's HTTPS proxy. The mapped ports are plain HTTP,
|
|
269
|
+
* which a browser on an HTTPS page refuses to fetch, so this is the only
|
|
270
|
+
* address the card can read the relay's own documents from.
|
|
271
|
+
*/
|
|
272
|
+
proxyHostname: string | null;
|
|
258
273
|
mappedPorts: Array<{
|
|
259
274
|
label: string;
|
|
260
275
|
hostPort: number | null;
|
|
@@ -262,6 +277,32 @@ interface CompactInstanceDetails {
|
|
|
262
277
|
execution: InstanceExecution | null;
|
|
263
278
|
error: string | null;
|
|
264
279
|
}
|
|
280
|
+
/** One transport's worth of addresses, as the relay itself groups them. */
|
|
281
|
+
interface SponsorRelayAddressGroup {
|
|
282
|
+
key: string;
|
|
283
|
+
label: string;
|
|
284
|
+
addresses: string[];
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* What a deployment reports about itself at `/multiaddrs`. Deliberately not
|
|
288
|
+
* normalised into "the best address": the card shows what the relay says, and
|
|
289
|
+
* choosing between addresses is the consumer's business, not this UI's.
|
|
290
|
+
*/
|
|
291
|
+
interface SponsorRelayInstanceAddresses {
|
|
292
|
+
status: 'idle' | 'loading' | 'ready' | 'unsupported' | 'error';
|
|
293
|
+
/** Transport groups, empty for a profile that publishes no libp2p addresses. */
|
|
294
|
+
groups: SponsorRelayAddressGroup[];
|
|
295
|
+
/** Ready-to-paste environment block, when the profile publishes one. */
|
|
296
|
+
pwaEnv: Record<string, string> | null;
|
|
297
|
+
/** Raw payload, rendered verbatim on the health tab. */
|
|
298
|
+
payload: Record<string, unknown> | null;
|
|
299
|
+
peerId: string | null;
|
|
300
|
+
version: string | null;
|
|
301
|
+
fetchedAt: number | null;
|
|
302
|
+
error: string | null;
|
|
303
|
+
/** Source URL, shown so a person can curl exactly what the card read. */
|
|
304
|
+
sourceUrl: string | null;
|
|
305
|
+
}
|
|
265
306
|
interface CompactInstanceRecord {
|
|
266
307
|
instance: InstanceMessage;
|
|
267
308
|
details: CompactInstanceDetails;
|
|
@@ -314,6 +355,8 @@ interface SponsorRelayState {
|
|
|
314
355
|
pricingSummary: SponsorRelayPricingSummary;
|
|
315
356
|
balance: BalanceResponse | null;
|
|
316
357
|
crns: Crn[];
|
|
358
|
+
/** Which source the current `crns` came from; `null` until the first load. */
|
|
359
|
+
crnSource: CrnSource | null;
|
|
317
360
|
selectedCrn: Crn | null;
|
|
318
361
|
crnOptions: Array<{
|
|
319
362
|
hash: string;
|
|
@@ -326,6 +369,13 @@ interface SponsorRelayState {
|
|
|
326
369
|
orphanBootstrapRegistrations: CompactBootstrapRegistrationRecord[];
|
|
327
370
|
lastDeploymentHash: string | null;
|
|
328
371
|
deploymentProgress: DeploymentProgressEvent;
|
|
372
|
+
/**
|
|
373
|
+
* What each deployment reports at `/multiaddrs`, keyed by instance item hash.
|
|
374
|
+
* Fetched on demand rather than with the instance list: AutoTLS addresses only
|
|
375
|
+
* appear a minute or two after a deploy reports success, so this is state that
|
|
376
|
+
* has to be refreshable on its own.
|
|
377
|
+
*/
|
|
378
|
+
instanceAddresses: Record<string, SponsorRelayInstanceAddresses>;
|
|
329
379
|
}
|
|
330
380
|
type SponsorRelaySubscriber = (state: SponsorRelayState) => void;
|
|
331
381
|
|
|
@@ -379,6 +429,18 @@ declare class SponsorRelayController {
|
|
|
379
429
|
private refreshWalletDerivedState;
|
|
380
430
|
refresh(): Promise<void>;
|
|
381
431
|
deploy(): Promise<void>;
|
|
432
|
+
/**
|
|
433
|
+
* Read one deployment's own address document over its HTTPS proxy.
|
|
434
|
+
*
|
|
435
|
+
* The mapped ports are plain HTTP, which a browser on an HTTPS page refuses to
|
|
436
|
+
* fetch, so the proxy hostname is the only way in. Deliberately single-shot:
|
|
437
|
+
* unlike the deploy-time readiness probe this backs a button someone pressed,
|
|
438
|
+
* and a caller who wants newer data presses it again.
|
|
439
|
+
*/
|
|
440
|
+
loadInstanceAddresses(instanceHash: string, options?: {
|
|
441
|
+
force?: boolean;
|
|
442
|
+
}): Promise<void>;
|
|
443
|
+
private patchInstanceAddresses;
|
|
382
444
|
deleteInstance(instanceHash: string): Promise<void>;
|
|
383
445
|
deleteBootstrapRegistration(registrationHash: string): Promise<void>;
|
|
384
446
|
}
|