@calimero-network/mero-react 9.14.1 → 9.16.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/README.md +32 -1
- package/dist/index.cjs +345 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +343 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,6 +273,7 @@ import {
|
|
|
273
273
|
primeInvitationCapture,
|
|
274
274
|
useInviteRedemption,
|
|
275
275
|
InvitationDialog,
|
|
276
|
+
InvitationGate,
|
|
276
277
|
buildInviteLink,
|
|
277
278
|
} from '@calimero-network/mero-react';
|
|
278
279
|
|
|
@@ -287,7 +288,13 @@ function Invitations() {
|
|
|
287
288
|
redeemer: { join, isMember }, // mero-js `InviteRedeemer`
|
|
288
289
|
onJoined: (namespaceId) => navigate(`/w/${namespaceId}`),
|
|
289
290
|
});
|
|
290
|
-
return
|
|
291
|
+
return (
|
|
292
|
+
<>
|
|
293
|
+
{/* Logged out: "You're invited", with the login. Logged in: nothing. */}
|
|
294
|
+
<InvitationGate parse={decodeMyToken} noun="workspace" appName="My App" />
|
|
295
|
+
<InvitationDialog redemption={redemption} noun="workspace" appName="My App" />
|
|
296
|
+
</>
|
|
297
|
+
);
|
|
291
298
|
}
|
|
292
299
|
|
|
293
300
|
// Sharing: one link shape for every app.
|
|
@@ -296,6 +303,8 @@ const link = buildInviteLink('com.example.my-app', token);
|
|
|
296
303
|
|
|
297
304
|
An app whose join does more than join the namespace (entering a context, choosing where to land) passes `redeem: (parsed) => Promise<RedeemOutcome>` instead of `redeemer`; `parse` may return extra fields, which reach `redeem` and come back as `parsed`. The dialog takes `detail` (the app's own words under the question) and `status` (the step a slow join is on).
|
|
298
305
|
|
|
306
|
+
`InvitationGate` is what a link shows someone who is not logged in. Without it they land on the app's ordinary logged-out page (usually its marketing landing), with nothing saying they were invited, while the invitation waits in storage for a login they have to think of themselves. The gate shows a full page instead: **You're invited to join “Design team”** (decoded by the app's own `parse`, which needs no session), in which app, with **Log in to join** (`ConnectButton` and its Node / Cloud dialog) and **Not now** (acks the invitation, so it does not come back). While the session is still restoring it shows a blank page with a spinner, so neither the landing page nor the invite screen flashes; once logged in it renders nothing and the dialog takes over. Mounted with no children it covers the page as a full-page layer; wrapped around the app (`<InvitationGate …>{app}</InvitationGate>`) it renders instead of the app. Test ids: `invite-landing` (with `data-state`: `checking`, `invited`, `invalid`), `invite-landing-login`, `invite-landing-decline`.
|
|
307
|
+
|
|
299
308
|
`InvitationDialog` walks through every stage in one modal: **ask** (Join / Not now) → **joining** (cannot be closed) → **syncing** → **ready** (closes by itself), or **already a member**, or **failed** (the reason in plain words, with Try again when a retry can help).
|
|
300
309
|
|
|
301
310
|
**Syncing** lasts until the joined namespace's data has arrived. Redemption marks the namespace just-joined, and the page that reads its data clears that mark:
|
|
@@ -353,6 +362,28 @@ The same theme is forwarded to the embedded `LoginModal` and is also exposed as
|
|
|
353
362
|
}
|
|
354
363
|
```
|
|
355
364
|
|
|
365
|
+
The connect dialog also carries stable class names, for what the tokens do not cover. Its inline styles still win over a class, so a class rule can add what the dialog leaves unset (its font is inherited from the page, for one) but not replace an inline value; the dialog's shadow, the one look that is neither a token nor inherited, reads `--mero-login-shadow` and keeps its default when that is unset.
|
|
366
|
+
|
|
367
|
+
| Class | Element |
|
|
368
|
+
| --- | --- |
|
|
369
|
+
| `mero-login-overlay` | the full-screen backdrop, a direct child of `body` |
|
|
370
|
+
| `mero-login-dialog` | the dialog surface |
|
|
371
|
+
| `mero-login-close`, `mero-login-header`, `mero-login-logo`, `mero-login-title` | close button, header, emblem, "Connect to Calimero" |
|
|
372
|
+
| `mero-login-tabs`, `mero-login-tab` (+ `mero-login-tab-active`), `mero-login-panel` | Node / Cloud tabs and their panels |
|
|
373
|
+
| `mero-login-info`, `mero-login-error`, `mero-login-note`, `mero-login-hint` | body copy, the connection error, the Cloud tab's note and wallet hint |
|
|
374
|
+
| `mero-login-options`, `mero-login-option` (+ `mero-login-option-active`), `mero-login-option-indicator`, `mero-login-option-dot`, `mero-login-option-meta` | discovered-node radio list |
|
|
375
|
+
| `mero-login-input`, `mero-login-toolbar`, `mero-login-rescan` | manual URL field, rescan link |
|
|
376
|
+
| `mero-login-actions`, `mero-login-button mero-login-primary` | Connect / Enrol buttons |
|
|
377
|
+
| `mero-login-discovering`, `mero-login-loading`, `mero-login-spinner`, `mero-login-account` | progress states, the Cloud tab's body |
|
|
378
|
+
|
|
379
|
+
```css
|
|
380
|
+
/* `body >` outranks mero-react's own single-class rules, injected after yours. */
|
|
381
|
+
body > .mero-login-overlay {
|
|
382
|
+
--mero-login-shadow: 0 30px 60px -30px rgba(20, 26, 60, 0.45);
|
|
383
|
+
font-family: 'Figtree', sans-serif;
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
356
387
|
`MeroTheme` keys (all optional): `primary`, `primaryHover`, `primaryText`, `background`, `backgroundSecondary`, `backgroundTertiary`, `border`, `text`, `textSecondary`, `error`, `overlay`, `radius`. Defaults: `#a5ff11` / `#8ed40d` / `#0d1117` / `#161b22` / `#1c2128` / `#30363d` / `#e6edf3` / `#8b949e` / `#ff6b6b` / `rgba(0,0,0,0.75)` / `8px`.
|
|
357
388
|
|
|
358
389
|
Helpers: `defaultMeroTheme` (the full default palette), `resolveMeroTheme(partial?)` (merges a partial with defaults), and `themeToCssVars(resolved)` (returns a `CSSProperties` map of `--mero-*` variables for applying to your own container) are exported for advanced use.
|