@calimero-network/mero-react 9.13.2 → 9.14.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 +46 -0
- package/dist/index.cjs +1010 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +327 -2
- package/dist/index.d.ts +327 -2
- package/dist/index.js +990 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// src/components/styles.css
|
|
31
|
-
styleInject(':root {\n --mero-bg: #0d1117;\n --mero-bg-secondary: #161b22;\n --mero-bg-tertiary: #1c2128;\n --mero-text: #e6edf3;\n --mero-text-secondary: #8b949e;\n --mero-accent: #a5ff11;\n --mero-accent-hover: #8ed40d;\n --mero-on-primary: #0d1117;\n --mero-error: #ff6b6b;\n --mero-border: #30363d;\n --mero-disabled: #555555;\n --mero-shadow: rgba(0, 0, 0, 0.5);\n --mero-overlay: rgba(0, 0, 0, 0.75);\n --mero-radius: 8px;\n}\n.mero-connect-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 10px 20px;\n background-color: var(--mero-accent);\n border: 1px solid var(--mero-accent);\n border-radius: var(--mero-radius);\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 0.01em;\n color: var(--mero-on-primary);\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n transform 0.1s ease;\n min-width: 140px;\n box-sizing: border-box;\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n}\n.mero-connect-button:hover:not(.mero-connected):not(.mero-reconnecting) {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n box-shadow: 0 0 0 4px rgba(165, 255, 17, 0.18);\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--mero-accent) 18%, transparent);\n}\n.mero-connect-button:active:not(.mero-connected):not(.mero-reconnecting) {\n transform: translateY(1px);\n}\n.mero-connect-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(165, 255, 17, 0.45);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mero-accent) 45%, transparent);\n}\n.mero-connect-button.mero-logo-only {\n min-width: 0;\n width: 40px;\n height: 40px;\n padding: 0;\n gap: 0;\n}\n.mero-connect-button.mero-connected {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n border-color: var(--mero-accent);\n}\n.mero-connect-button.mero-connected:hover {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n}\n.mero-connect-button.mero-reconnecting {\n background-color: var(--mero-bg-secondary);\n color: var(--mero-text-secondary);\n border-color: var(--mero-border);\n cursor: not-allowed;\n}\n.mero-connect-container {\n position: relative;\n display: inline-block;\n}\n.mero-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n background-color: var(--mero-bg-secondary);\n border: 1px solid var(--mero-border);\n border-radius: var(--mero-radius);\n margin-top: 6px;\n padding: 0;\n z-index: 1001;\n width: 100%;\n min-width: 180px;\n overflow: hidden;\n box-shadow: 0 8px 24px var(--mero-shadow);\n}\n.mero-dropdown-info {\n padding: 10px 16px;\n color: var(--mero-text-secondary);\n font-size: 13px;\n border-bottom: 1px solid var(--mero-border);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 220px;\n}\n.mero-dropdown-item {\n display: block;\n width: 100%;\n padding: 10px 16px;\n background: none;\n border: none;\n color: var(--mero-text);\n text-align: left;\n cursor: pointer;\n font-size: 14px;\n text-decoration: none;\n font-family: inherit;\n}\n.mero-dropdown-item:hover {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-logo {\n width: 24px;\n height: 24px;\n color: currentColor;\n}\n@keyframes meroFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes meroSlideIn {\n from {\n transform: translateY(-12px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n@keyframes meroSpin {\n to {\n transform: rotate(360deg);\n }\n}\n');
|
|
31
|
+
styleInject(':root {\n --mero-bg: #0d1117;\n --mero-bg-secondary: #161b22;\n --mero-bg-tertiary: #1c2128;\n --mero-text: #e6edf3;\n --mero-text-secondary: #8b949e;\n --mero-accent: #a5ff11;\n --mero-accent-hover: #8ed40d;\n --mero-on-primary: #0d1117;\n --mero-error: #ff6b6b;\n --mero-border: #30363d;\n --mero-disabled: #555555;\n --mero-shadow: rgba(0, 0, 0, 0.5);\n --mero-overlay: rgba(0, 0, 0, 0.75);\n --mero-radius: 8px;\n}\n.mero-connect-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 10px 20px;\n background-color: var(--mero-accent);\n border: 1px solid var(--mero-accent);\n border-radius: var(--mero-radius);\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 0.01em;\n color: var(--mero-on-primary);\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n transform 0.1s ease;\n min-width: 140px;\n box-sizing: border-box;\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n}\n.mero-connect-button:hover:not(.mero-connected):not(.mero-reconnecting) {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n box-shadow: 0 0 0 4px rgba(165, 255, 17, 0.18);\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--mero-accent) 18%, transparent);\n}\n.mero-connect-button:active:not(.mero-connected):not(.mero-reconnecting) {\n transform: translateY(1px);\n}\n.mero-connect-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(165, 255, 17, 0.45);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mero-accent) 45%, transparent);\n}\n.mero-connect-button.mero-logo-only {\n min-width: 0;\n width: 40px;\n height: 40px;\n padding: 0;\n gap: 0;\n}\n.mero-connect-button.mero-connected {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n border-color: var(--mero-accent);\n}\n.mero-connect-button.mero-connected:hover {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n}\n.mero-connect-button.mero-reconnecting {\n background-color: var(--mero-bg-secondary);\n color: var(--mero-text-secondary);\n border-color: var(--mero-border);\n cursor: not-allowed;\n}\n.mero-connect-container {\n position: relative;\n display: inline-block;\n}\n.mero-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n background-color: var(--mero-bg-secondary);\n border: 1px solid var(--mero-border);\n border-radius: var(--mero-radius);\n margin-top: 6px;\n padding: 0;\n z-index: 1001;\n width: 100%;\n min-width: 180px;\n overflow: hidden;\n box-shadow: 0 8px 24px var(--mero-shadow);\n}\n.mero-dropdown-info {\n padding: 10px 16px;\n color: var(--mero-text-secondary);\n font-size: 13px;\n border-bottom: 1px solid var(--mero-border);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 220px;\n}\n.mero-dropdown-item {\n display: block;\n width: 100%;\n padding: 10px 16px;\n background: none;\n border: none;\n color: var(--mero-text);\n text-align: left;\n cursor: pointer;\n font-size: 14px;\n text-decoration: none;\n font-family: inherit;\n}\n.mero-dropdown-item:hover {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-logo {\n width: 24px;\n height: 24px;\n color: currentColor;\n}\n@keyframes meroFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes meroSlideIn {\n from {\n transform: translateY(-12px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n@keyframes meroSpin {\n to {\n transform: rotate(360deg);\n }\n}\n.mero-invite-overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483646;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n background: var(--mero-overlay);\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n}\n.mero-invite-dialog {\n box-sizing: border-box;\n width: min(420px, 100%);\n padding: 24px;\n border: 1px solid var(--mero-border);\n border-radius: calc(var(--mero-radius) * 1.5);\n background: var(--mero-bg-secondary);\n color: var(--mero-text);\n box-shadow: 0 16px 48px var(--mero-shadow);\n outline: none;\n animation: mero-invite-in 0.16s ease-out;\n}\n.mero-invite-app {\n margin: 0 0 12px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--mero-text-secondary);\n}\n.mero-invite-head {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.mero-invite-title {\n margin: 0;\n min-width: 0;\n font-size: 18px;\n font-weight: 600;\n line-height: 1.3;\n overflow-wrap: anywhere;\n}\n.mero-invite-body {\n margin: 12px 0 0;\n font-size: 14px;\n line-height: 1.5;\n color: var(--mero-text-secondary);\n}\n.mero-invite-body-error {\n color: var(--mero-error);\n}\n.mero-invite-icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n border-radius: 50%;\n background: var(--mero-bg-tertiary);\n color: var(--mero-accent);\n}\n.mero-invite-icon-error {\n color: var(--mero-error);\n}\n.mero-invite-spinner {\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n border: 3px solid var(--mero-bg-tertiary);\n border-top-color: var(--mero-accent);\n background: none;\n animation: mero-invite-spin 0.8s linear infinite;\n}\n.mero-invite-progress {\n position: relative;\n height: 3px;\n margin-top: 16px;\n overflow: hidden;\n border-radius: 2px;\n background: var(--mero-bg-tertiary);\n}\n.mero-invite-progress-bar {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 40%;\n border-radius: 2px;\n background: var(--mero-accent);\n animation: mero-invite-progress 1.4s ease-in-out infinite;\n}\n.mero-invite-actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 20px;\n}\n.mero-invite-actions:empty {\n display: none;\n}\n.mero-invite-button {\n padding: 9px 16px;\n border-radius: var(--mero-radius);\n font: inherit;\n font-size: 14px;\n font-weight: 600;\n line-height: 1.2;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n}\n.mero-invite-button:focus-visible {\n outline: 2px solid var(--mero-accent);\n outline-offset: 2px;\n}\n.mero-invite-primary {\n border: 1px solid var(--mero-accent);\n background: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-invite-primary:hover {\n border-color: var(--mero-accent-hover);\n background: var(--mero-accent-hover);\n}\n.mero-invite-secondary {\n border: 1px solid var(--mero-border);\n background: transparent;\n color: var(--mero-text);\n}\n.mero-invite-secondary:hover {\n background: var(--mero-bg-tertiary);\n}\n@keyframes mero-invite-spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes mero-invite-progress {\n from {\n left: -40%;\n }\n to {\n left: 100%;\n }\n}\n@keyframes mero-invite-in {\n from {\n opacity: 0;\n transform: translateY(6px) scale(0.98);\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .mero-invite-dialog,\n .mero-invite-spinner,\n .mero-invite-progress-bar {\n animation: none;\n }\n}\n');
|
|
32
32
|
|
|
33
33
|
// src/types.ts
|
|
34
34
|
var AppMode = /* @__PURE__ */ ((AppMode2) => {
|
|
@@ -93,13 +93,13 @@ function expiresAtFromJwt(token, fallbackMs = Date.now() + HOUR_MS) {
|
|
|
93
93
|
function isCallbackNewer(callbackAccessToken, stored) {
|
|
94
94
|
const incoming = decodeJwtClaims(callbackAccessToken);
|
|
95
95
|
if (!incoming) return false;
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
if (incoming.iat !== void 0 &&
|
|
99
|
-
return incoming.iat >
|
|
96
|
+
const current2 = decodeJwtClaims(stored.access_token);
|
|
97
|
+
if (current2) {
|
|
98
|
+
if (incoming.iat !== void 0 && current2.iat !== void 0 && incoming.iat !== current2.iat) {
|
|
99
|
+
return incoming.iat > current2.iat;
|
|
100
100
|
}
|
|
101
|
-
if (incoming.exp !== void 0 &&
|
|
102
|
-
return incoming.exp >
|
|
101
|
+
if (incoming.exp !== void 0 && current2.exp !== void 0 && incoming.exp !== current2.exp) {
|
|
102
|
+
return incoming.exp > current2.exp;
|
|
103
103
|
}
|
|
104
104
|
return false;
|
|
105
105
|
}
|
|
@@ -1365,12 +1365,12 @@ function LoginModal({
|
|
|
1365
1365
|
if (!isOpen) {
|
|
1366
1366
|
return;
|
|
1367
1367
|
}
|
|
1368
|
-
const
|
|
1368
|
+
const controller2 = new AbortController();
|
|
1369
1369
|
let active = true;
|
|
1370
1370
|
setDiscovering(true);
|
|
1371
1371
|
setDiscovered([]);
|
|
1372
1372
|
setError(null);
|
|
1373
|
-
meroJs.discoverLocalNodes({ ports: localNodePorts, signal:
|
|
1373
|
+
meroJs.discoverLocalNodes({ ports: localNodePorts, signal: controller2.signal }).then((nodes) => {
|
|
1374
1374
|
if (!active) return;
|
|
1375
1375
|
setDiscovered(nodes);
|
|
1376
1376
|
setSelected(nodes.length > 0 ? nodes[0] : CUSTOM_SELECTION);
|
|
@@ -1381,7 +1381,7 @@ function LoginModal({
|
|
|
1381
1381
|
});
|
|
1382
1382
|
return () => {
|
|
1383
1383
|
active = false;
|
|
1384
|
-
|
|
1384
|
+
controller2.abort();
|
|
1385
1385
|
};
|
|
1386
1386
|
}, [isOpen, portsKey, scanNonce]);
|
|
1387
1387
|
const isCustom = selected === CUSTOM_SELECTION;
|
|
@@ -3717,11 +3717,11 @@ function useDelegatedBootstrap(options = {}) {
|
|
|
3717
3717
|
const { connectWithAccount, cloudBaseUrl: providerCloud } = useMero();
|
|
3718
3718
|
const [running, setRunning] = react.useState(false);
|
|
3719
3719
|
const [result, setResult] = react.useState(null);
|
|
3720
|
-
const
|
|
3720
|
+
const read2 = meroJs.readDelegatedCredential();
|
|
3721
3721
|
const credential = react.useMemo(
|
|
3722
|
-
() =>
|
|
3722
|
+
() => read2,
|
|
3723
3723
|
// Keyed on the contents, not the parsed object.
|
|
3724
|
-
[
|
|
3724
|
+
[read2?.account, read2?.credential, read2?.deviceSecret]
|
|
3725
3725
|
);
|
|
3726
3726
|
const relayUrl = meroJs.readDelegatedSession()?.relayUrl ?? null;
|
|
3727
3727
|
const cloudBaseUrl = options.cloudBaseUrl ?? providerCloud;
|
|
@@ -3771,6 +3771,980 @@ function useDelegatedBootstrap(options = {}) {
|
|
|
3771
3771
|
bootstrap
|
|
3772
3772
|
};
|
|
3773
3773
|
}
|
|
3774
|
+
|
|
3775
|
+
// node_modules/.pnpm/@calimero-network+mero-platform@0.1.0/node_modules/@calimero-network/mero-platform/dist/bridge/index.js
|
|
3776
|
+
function getBridge() {
|
|
3777
|
+
if (typeof window === "undefined")
|
|
3778
|
+
return null;
|
|
3779
|
+
const b = window.__calimero_platform__;
|
|
3780
|
+
if (!b || typeof b !== "object")
|
|
3781
|
+
return null;
|
|
3782
|
+
const bridge = b;
|
|
3783
|
+
if (typeof bridge.version !== "number" || !Array.isArray(bridge.capabilities) || typeof bridge.invoke !== "function" || typeof bridge.on !== "function") {
|
|
3784
|
+
return null;
|
|
3785
|
+
}
|
|
3786
|
+
return bridge;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
// node_modules/.pnpm/@calimero-network+mero-platform@0.1.0/node_modules/@calimero-network/mero-platform/dist/deep-link/link.js
|
|
3790
|
+
var DEFAULT_HOST = "https://links.calimero.network";
|
|
3791
|
+
function createLink(slug, action, params = {}, host = DEFAULT_HOST) {
|
|
3792
|
+
const base = host.replace(/\/+$/, "");
|
|
3793
|
+
const path = `${encodeURIComponent(slug)}/${encodeURIComponent(action)}`;
|
|
3794
|
+
const url = new URL(`${base}/${path}`);
|
|
3795
|
+
for (const [key, value] of Object.entries(params)) {
|
|
3796
|
+
url.searchParams.set(key, value);
|
|
3797
|
+
}
|
|
3798
|
+
return url.toString();
|
|
3799
|
+
}
|
|
3800
|
+
|
|
3801
|
+
// node_modules/.pnpm/@calimero-network+mero-platform@0.1.0/node_modules/@calimero-network/mero-platform/dist/deep-link/pending-intent.js
|
|
3802
|
+
var STORAGE_KEY = "calimero.platform.pendingIntents";
|
|
3803
|
+
function hashNonce(raw) {
|
|
3804
|
+
let h = 2166136261;
|
|
3805
|
+
for (let i = 0; i < raw.length; i++) {
|
|
3806
|
+
h ^= raw.charCodeAt(i);
|
|
3807
|
+
h = Math.imul(h, 16777619);
|
|
3808
|
+
}
|
|
3809
|
+
return (h >>> 0).toString(16).padStart(8, "0");
|
|
3810
|
+
}
|
|
3811
|
+
var PendingIntentStore = class {
|
|
3812
|
+
constructor(storage2, now = () => Date.now()) {
|
|
3813
|
+
this.storage = storage2;
|
|
3814
|
+
this.now = now;
|
|
3815
|
+
}
|
|
3816
|
+
read() {
|
|
3817
|
+
try {
|
|
3818
|
+
const raw = this.storage.getItem(STORAGE_KEY);
|
|
3819
|
+
if (!raw)
|
|
3820
|
+
return [];
|
|
3821
|
+
const parsed = JSON.parse(raw);
|
|
3822
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
3823
|
+
} catch {
|
|
3824
|
+
return [];
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
write(list) {
|
|
3828
|
+
try {
|
|
3829
|
+
this.storage.setItem(STORAGE_KEY, JSON.stringify(list));
|
|
3830
|
+
} catch {
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
/** Capture an intent; idempotent by content nonce. Returns the stored entry. */
|
|
3834
|
+
capture(raw) {
|
|
3835
|
+
const nonce = hashNonce(raw);
|
|
3836
|
+
const list = this.read();
|
|
3837
|
+
const existing = list.find((i) => i.nonce === nonce);
|
|
3838
|
+
if (existing)
|
|
3839
|
+
return existing;
|
|
3840
|
+
const intent = { nonce, raw, capturedAt: this.now() };
|
|
3841
|
+
this.write([...list, intent]);
|
|
3842
|
+
return intent;
|
|
3843
|
+
}
|
|
3844
|
+
/** The oldest unacked intent, or null. */
|
|
3845
|
+
peek() {
|
|
3846
|
+
return this.read()[0] ?? null;
|
|
3847
|
+
}
|
|
3848
|
+
/** All unacked intents, oldest first. */
|
|
3849
|
+
all() {
|
|
3850
|
+
return this.read();
|
|
3851
|
+
}
|
|
3852
|
+
/** Drop an intent once the app has handled it. */
|
|
3853
|
+
ack(nonce) {
|
|
3854
|
+
this.write(this.read().filter((i) => i.nonce !== nonce));
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
|
|
3858
|
+
// node_modules/.pnpm/@calimero-network+mero-platform@0.1.0/node_modules/@calimero-network/mero-platform/dist/deep-link/index.js
|
|
3859
|
+
function parseIntent(raw) {
|
|
3860
|
+
const params = {};
|
|
3861
|
+
let slug = null;
|
|
3862
|
+
let action = null;
|
|
3863
|
+
try {
|
|
3864
|
+
if (/^calimero:\/\//i.test(raw)) {
|
|
3865
|
+
const rest = raw.slice("calimero://".length);
|
|
3866
|
+
const qIdx = rest.indexOf("?");
|
|
3867
|
+
const pathPart = qIdx >= 0 ? rest.slice(0, qIdx) : rest;
|
|
3868
|
+
const queryPart = qIdx >= 0 ? rest.slice(qIdx + 1) : "";
|
|
3869
|
+
const segs = pathPart.split("/").filter(Boolean);
|
|
3870
|
+
slug = segs[0] ?? null;
|
|
3871
|
+
action = segs[1] ?? null;
|
|
3872
|
+
new URLSearchParams(queryPart).forEach((v, k) => params[k] = v);
|
|
3873
|
+
} else {
|
|
3874
|
+
const url = new URL(raw, "https://x.invalid/");
|
|
3875
|
+
const segs = url.pathname.replace(/^\/+|\/+$/g, "").split("/").filter(Boolean);
|
|
3876
|
+
slug = segs[0] ?? null;
|
|
3877
|
+
action = segs[1] ?? null;
|
|
3878
|
+
url.searchParams.forEach((v, k) => params[k] = v);
|
|
3879
|
+
}
|
|
3880
|
+
} catch {
|
|
3881
|
+
}
|
|
3882
|
+
return { slug, action, params };
|
|
3883
|
+
}
|
|
3884
|
+
function hasIntentSignal(href) {
|
|
3885
|
+
try {
|
|
3886
|
+
const url = new URL(href, "https://x.invalid/");
|
|
3887
|
+
const segs = url.pathname.replace(/^\/+|\/+$/g, "").split("/").filter(Boolean);
|
|
3888
|
+
return url.search.length > 1 || segs.length > 0;
|
|
3889
|
+
} catch {
|
|
3890
|
+
return false;
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
var DeepLinkController = class {
|
|
3894
|
+
constructor(store, sources = {}) {
|
|
3895
|
+
this.store = store;
|
|
3896
|
+
this.handlers = /* @__PURE__ */ new Set();
|
|
3897
|
+
this.delivered = /* @__PURE__ */ new Set();
|
|
3898
|
+
this.unsubscribers = [];
|
|
3899
|
+
if (sources.location?.href && hasIntentSignal(sources.location.href)) {
|
|
3900
|
+
this.capture(sources.location.href);
|
|
3901
|
+
}
|
|
3902
|
+
if (sources.bridge) {
|
|
3903
|
+
const off = sources.bridge.on("deep-link", (payload) => {
|
|
3904
|
+
const raw = extractRaw(payload);
|
|
3905
|
+
if (raw)
|
|
3906
|
+
this.capture(raw);
|
|
3907
|
+
});
|
|
3908
|
+
this.unsubscribers.push(off);
|
|
3909
|
+
}
|
|
3910
|
+
if (sources.launchQueue) {
|
|
3911
|
+
sources.launchQueue.setConsumer((p) => {
|
|
3912
|
+
if (p?.targetURL && hasIntentSignal(p.targetURL))
|
|
3913
|
+
this.capture(p.targetURL);
|
|
3914
|
+
});
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
/** Register an intent handler; immediately replays buffered (unacked,
|
|
3918
|
+
* not-yet-delivered) intents. Returns an unsubscribe fn. */
|
|
3919
|
+
on(handler) {
|
|
3920
|
+
this.handlers.add(handler);
|
|
3921
|
+
for (const stored of this.store.all()) {
|
|
3922
|
+
if (!this.delivered.has(stored.nonce)) {
|
|
3923
|
+
this.delivered.add(stored.nonce);
|
|
3924
|
+
handler(this.toIntent(stored));
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
return () => this.handlers.delete(handler);
|
|
3928
|
+
}
|
|
3929
|
+
/** Tear down source subscriptions + handlers. */
|
|
3930
|
+
dispose() {
|
|
3931
|
+
for (const off of this.unsubscribers.splice(0))
|
|
3932
|
+
off();
|
|
3933
|
+
this.handlers.clear();
|
|
3934
|
+
}
|
|
3935
|
+
capture(raw) {
|
|
3936
|
+
const stored = this.store.capture(raw);
|
|
3937
|
+
if (this.delivered.has(stored.nonce) || this.handlers.size === 0)
|
|
3938
|
+
return;
|
|
3939
|
+
this.delivered.add(stored.nonce);
|
|
3940
|
+
const intent = this.toIntent(stored);
|
|
3941
|
+
for (const handler of this.handlers)
|
|
3942
|
+
handler(intent);
|
|
3943
|
+
}
|
|
3944
|
+
toIntent(stored) {
|
|
3945
|
+
return {
|
|
3946
|
+
raw: stored.raw,
|
|
3947
|
+
...parseIntent(stored.raw),
|
|
3948
|
+
resolve: () => this.store.ack(stored.nonce)
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
};
|
|
3952
|
+
function extractRaw(payload) {
|
|
3953
|
+
if (typeof payload === "string")
|
|
3954
|
+
return payload;
|
|
3955
|
+
if (payload && typeof payload === "object") {
|
|
3956
|
+
const o = payload;
|
|
3957
|
+
if (typeof o.raw === "string")
|
|
3958
|
+
return o.raw;
|
|
3959
|
+
if (typeof o.url === "string")
|
|
3960
|
+
return o.url;
|
|
3961
|
+
}
|
|
3962
|
+
return null;
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3965
|
+
// src/invitations/capture.ts
|
|
3966
|
+
var JOIN_ACTION = "join";
|
|
3967
|
+
var INVITATION_PARAM = "invitation";
|
|
3968
|
+
function buildInviteLink(slug, token, extra = {}) {
|
|
3969
|
+
const params = { [INVITATION_PARAM]: token };
|
|
3970
|
+
for (const [key, value] of Object.entries(extra)) {
|
|
3971
|
+
if (value !== void 0 && value !== "") params[key] = value;
|
|
3972
|
+
}
|
|
3973
|
+
return createLink(slug, JOIN_ACTION, params);
|
|
3974
|
+
}
|
|
3975
|
+
var MAX_AUTO_JOIN_ATTEMPTS = 3;
|
|
3976
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
3977
|
+
var buffered = null;
|
|
3978
|
+
var current = null;
|
|
3979
|
+
var controller = null;
|
|
3980
|
+
var attemptsKey = "calimero:invitation-attempts";
|
|
3981
|
+
var ownSlugs = /* @__PURE__ */ new Set();
|
|
3982
|
+
function memoryStorage() {
|
|
3983
|
+
const map = /* @__PURE__ */ new Map();
|
|
3984
|
+
return {
|
|
3985
|
+
get length() {
|
|
3986
|
+
return map.size;
|
|
3987
|
+
},
|
|
3988
|
+
clear: () => map.clear(),
|
|
3989
|
+
getItem: (k) => map.get(k) ?? null,
|
|
3990
|
+
key: (i) => [...map.keys()][i] ?? null,
|
|
3991
|
+
removeItem: (k) => void map.delete(k),
|
|
3992
|
+
setItem: (k, v) => void map.set(k, v)
|
|
3993
|
+
};
|
|
3994
|
+
}
|
|
3995
|
+
function storage() {
|
|
3996
|
+
try {
|
|
3997
|
+
const probe = "__calimero_invite_probe__";
|
|
3998
|
+
window.localStorage.setItem(probe, "1");
|
|
3999
|
+
window.localStorage.removeItem(probe);
|
|
4000
|
+
return window.localStorage;
|
|
4001
|
+
} catch {
|
|
4002
|
+
return memoryStorage();
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
function readAttempts() {
|
|
4006
|
+
try {
|
|
4007
|
+
const parsed = JSON.parse(storage().getItem(attemptsKey) ?? "{}");
|
|
4008
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
4009
|
+
} catch {
|
|
4010
|
+
return {};
|
|
4011
|
+
}
|
|
4012
|
+
}
|
|
4013
|
+
function writeAttempts(attempts) {
|
|
4014
|
+
try {
|
|
4015
|
+
storage().setItem(attemptsKey, JSON.stringify(attempts));
|
|
4016
|
+
} catch {
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
function spendAttempt(token) {
|
|
4020
|
+
const attempts = readAttempts();
|
|
4021
|
+
const spent = attempts[token] ?? 0;
|
|
4022
|
+
if (spent >= MAX_AUTO_JOIN_ATTEMPTS) return false;
|
|
4023
|
+
attempts[token] = spent + 1;
|
|
4024
|
+
writeAttempts(attempts);
|
|
4025
|
+
return true;
|
|
4026
|
+
}
|
|
4027
|
+
function forgetAttempts(token) {
|
|
4028
|
+
const attempts = readAttempts();
|
|
4029
|
+
if (!(token in attempts)) return;
|
|
4030
|
+
delete attempts[token];
|
|
4031
|
+
writeAttempts(attempts);
|
|
4032
|
+
}
|
|
4033
|
+
function invitationFromRaw(raw) {
|
|
4034
|
+
const direct = raw.trim();
|
|
4035
|
+
if (!direct) return null;
|
|
4036
|
+
try {
|
|
4037
|
+
const params = new URLSearchParams(
|
|
4038
|
+
direct.includes("?") ? direct.slice(direct.indexOf("?") + 1) : direct
|
|
4039
|
+
);
|
|
4040
|
+
const found = params.get(INVITATION_PARAM);
|
|
4041
|
+
if (found && found.trim()) return found.trim();
|
|
4042
|
+
} catch {
|
|
4043
|
+
}
|
|
4044
|
+
if (direct.includes("=") || direct.includes("?")) return null;
|
|
4045
|
+
if (direct.startsWith("/") || /^[a-z][a-z0-9+.-]*:/i.test(direct)) return null;
|
|
4046
|
+
return direct;
|
|
4047
|
+
}
|
|
4048
|
+
function urlWithoutInvitation(href) {
|
|
4049
|
+
try {
|
|
4050
|
+
const url = new URL(href);
|
|
4051
|
+
if (!url.searchParams.has(INVITATION_PARAM)) return href;
|
|
4052
|
+
url.searchParams.delete(INVITATION_PARAM);
|
|
4053
|
+
return url.toString();
|
|
4054
|
+
} catch {
|
|
4055
|
+
return href;
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
function deliver(invitation) {
|
|
4059
|
+
current = invitation;
|
|
4060
|
+
if (listeners.size === 0) {
|
|
4061
|
+
buffered = invitation;
|
|
4062
|
+
return;
|
|
4063
|
+
}
|
|
4064
|
+
for (const listener of listeners) listener(invitation);
|
|
4065
|
+
}
|
|
4066
|
+
function ensureController() {
|
|
4067
|
+
if (controller) return;
|
|
4068
|
+
controller = new DeepLinkController(new PendingIntentStore(storage()), {
|
|
4069
|
+
location: typeof window !== "undefined" ? window.location : null,
|
|
4070
|
+
bridge: getBridge(),
|
|
4071
|
+
launchQueue: typeof window !== "undefined" ? window.launchQueue ?? null : null
|
|
4072
|
+
});
|
|
4073
|
+
controller.on((intent) => {
|
|
4074
|
+
if (intent.action !== null && intent.action !== JOIN_ACTION && !intent.params[INVITATION_PARAM]) {
|
|
4075
|
+
return;
|
|
4076
|
+
}
|
|
4077
|
+
if (intent.action === JOIN_ACTION && intent.slug !== null && ownSlugs.size > 0 && !ownSlugs.has(intent.slug)) {
|
|
4078
|
+
intent.resolve();
|
|
4079
|
+
return;
|
|
4080
|
+
}
|
|
4081
|
+
const token = invitationFromRaw(intent.raw);
|
|
4082
|
+
if (!token) {
|
|
4083
|
+
intent.resolve();
|
|
4084
|
+
return;
|
|
4085
|
+
}
|
|
4086
|
+
try {
|
|
4087
|
+
const cleaned = urlWithoutInvitation(window.location.href);
|
|
4088
|
+
if (cleaned !== window.location.href) {
|
|
4089
|
+
window.history.replaceState(null, "", cleaned);
|
|
4090
|
+
}
|
|
4091
|
+
} catch {
|
|
4092
|
+
}
|
|
4093
|
+
deliver({
|
|
4094
|
+
token,
|
|
4095
|
+
params: { ...intent.params, [INVITATION_PARAM]: token },
|
|
4096
|
+
resolve: () => {
|
|
4097
|
+
forgetAttempts(token);
|
|
4098
|
+
if (current?.token === token) current = null;
|
|
4099
|
+
intent.resolve();
|
|
4100
|
+
},
|
|
4101
|
+
autoJoin: spendAttempt(token)
|
|
4102
|
+
});
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
4105
|
+
function primeInvitationCapture(appKey, options = {}) {
|
|
4106
|
+
if (appKey) attemptsKey = `${appKey}:invitation-attempts`;
|
|
4107
|
+
const { slug } = options;
|
|
4108
|
+
if (slug) ownSlugs = new Set(typeof slug === "string" ? [slug] : slug);
|
|
4109
|
+
ensureController();
|
|
4110
|
+
}
|
|
4111
|
+
function onInvitation(listener) {
|
|
4112
|
+
ensureController();
|
|
4113
|
+
listeners.add(listener);
|
|
4114
|
+
if (buffered) {
|
|
4115
|
+
const pending = buffered;
|
|
4116
|
+
buffered = null;
|
|
4117
|
+
listener(pending);
|
|
4118
|
+
}
|
|
4119
|
+
return () => {
|
|
4120
|
+
listeners.delete(listener);
|
|
4121
|
+
};
|
|
4122
|
+
}
|
|
4123
|
+
function peekInvitation() {
|
|
4124
|
+
ensureController();
|
|
4125
|
+
return current;
|
|
4126
|
+
}
|
|
4127
|
+
function resetInvitationCaptureForTests() {
|
|
4128
|
+
controller?.dispose();
|
|
4129
|
+
controller = null;
|
|
4130
|
+
listeners.clear();
|
|
4131
|
+
buffered = null;
|
|
4132
|
+
current = null;
|
|
4133
|
+
attemptsKey = "calimero:invitation-attempts";
|
|
4134
|
+
ownSlugs = /* @__PURE__ */ new Set();
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
// src/invitations/describeInviteFailure.ts
|
|
4138
|
+
function describeInviteFailure(reason, noun = "team") {
|
|
4139
|
+
switch (reason) {
|
|
4140
|
+
case "expired":
|
|
4141
|
+
return "This invitation has expired. Ask for a new link.";
|
|
4142
|
+
case "invalid":
|
|
4143
|
+
return "This invitation link isn't valid. Ask for a new one.";
|
|
4144
|
+
case "refused":
|
|
4145
|
+
return `You can't join this ${noun} with this invitation. Ask an admin to invite you again.`;
|
|
4146
|
+
case "signed-out":
|
|
4147
|
+
return "Your session with your node has ended. Sign in again to finish joining.";
|
|
4148
|
+
case "no-one-online":
|
|
4149
|
+
return `No one in this ${noun} is online to let you in yet. It will try again the next time you open the app.`;
|
|
4150
|
+
case "node-unreachable":
|
|
4151
|
+
return "Couldn't reach your node. Check that it is running, then try again.";
|
|
4152
|
+
case "unknown":
|
|
4153
|
+
return null;
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
// src/invitations/justJoined.ts
|
|
4158
|
+
var KEY = "calimero:justJoinedNamespaces";
|
|
4159
|
+
function read() {
|
|
4160
|
+
try {
|
|
4161
|
+
if (typeof sessionStorage === "undefined") return /* @__PURE__ */ new Set();
|
|
4162
|
+
const raw = sessionStorage.getItem(KEY);
|
|
4163
|
+
if (!raw) return /* @__PURE__ */ new Set();
|
|
4164
|
+
const parsed = JSON.parse(raw);
|
|
4165
|
+
return Array.isArray(parsed) ? new Set(parsed.filter((v) => typeof v === "string")) : /* @__PURE__ */ new Set();
|
|
4166
|
+
} catch {
|
|
4167
|
+
return /* @__PURE__ */ new Set();
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
4171
|
+
function notify() {
|
|
4172
|
+
for (const listener of [...listeners2]) {
|
|
4173
|
+
try {
|
|
4174
|
+
listener();
|
|
4175
|
+
} catch {
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4178
|
+
}
|
|
4179
|
+
function subscribeJustJoined(listener) {
|
|
4180
|
+
listeners2.add(listener);
|
|
4181
|
+
return () => {
|
|
4182
|
+
listeners2.delete(listener);
|
|
4183
|
+
};
|
|
4184
|
+
}
|
|
4185
|
+
function write(set) {
|
|
4186
|
+
try {
|
|
4187
|
+
if (typeof sessionStorage === "undefined") return;
|
|
4188
|
+
sessionStorage.setItem(KEY, JSON.stringify([...set]));
|
|
4189
|
+
} catch {
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
function markNamespaceJustJoined(namespaceId) {
|
|
4193
|
+
if (!namespaceId) return;
|
|
4194
|
+
const set = read();
|
|
4195
|
+
if (set.has(namespaceId)) return;
|
|
4196
|
+
set.add(namespaceId);
|
|
4197
|
+
write(set);
|
|
4198
|
+
notify();
|
|
4199
|
+
}
|
|
4200
|
+
function clearNamespaceJustJoined(namespaceId) {
|
|
4201
|
+
const set = read();
|
|
4202
|
+
if (!set.delete(namespaceId)) return;
|
|
4203
|
+
write(set);
|
|
4204
|
+
notify();
|
|
4205
|
+
}
|
|
4206
|
+
function isNamespaceJustJoined(namespaceId) {
|
|
4207
|
+
if (!namespaceId) return false;
|
|
4208
|
+
return read().has(namespaceId);
|
|
4209
|
+
}
|
|
4210
|
+
function useInviteRedemption({
|
|
4211
|
+
parse,
|
|
4212
|
+
redeemer,
|
|
4213
|
+
redeem,
|
|
4214
|
+
confirm = true,
|
|
4215
|
+
onJoined,
|
|
4216
|
+
enabled = true
|
|
4217
|
+
}) {
|
|
4218
|
+
const [state, setState] = react.useState({ stage: "idle" });
|
|
4219
|
+
const [token, setToken] = react.useState(null);
|
|
4220
|
+
const [parsed, setParsed] = react.useState(null);
|
|
4221
|
+
const parseRef = react.useRef(parse);
|
|
4222
|
+
parseRef.current = parse;
|
|
4223
|
+
const redeemerRef = react.useRef(redeemer);
|
|
4224
|
+
redeemerRef.current = redeemer;
|
|
4225
|
+
const redeemRef = react.useRef(redeem);
|
|
4226
|
+
redeemRef.current = redeem;
|
|
4227
|
+
const onJoinedRef = react.useRef(onJoined);
|
|
4228
|
+
onJoinedRef.current = onJoined;
|
|
4229
|
+
const confirmRef = react.useRef(confirm);
|
|
4230
|
+
confirmRef.current = confirm;
|
|
4231
|
+
const attempted = react.useRef(/* @__PURE__ */ new Set());
|
|
4232
|
+
const pending = react.useRef(null);
|
|
4233
|
+
const parsedRef = react.useRef(null);
|
|
4234
|
+
const alive = react.useRef(true);
|
|
4235
|
+
react.useEffect(() => {
|
|
4236
|
+
alive.current = true;
|
|
4237
|
+
return () => {
|
|
4238
|
+
alive.current = false;
|
|
4239
|
+
};
|
|
4240
|
+
}, []);
|
|
4241
|
+
const perform = react.useCallback(
|
|
4242
|
+
async (captured, invitation) => {
|
|
4243
|
+
if (alive.current)
|
|
4244
|
+
setState({ stage: "joining", teamName: invitation.teamName });
|
|
4245
|
+
const outcome = await runRedeem(
|
|
4246
|
+
invitation,
|
|
4247
|
+
redeemRef.current,
|
|
4248
|
+
redeemerRef.current
|
|
4249
|
+
);
|
|
4250
|
+
if (!meroJs.shouldRetain(outcome)) captured.resolve();
|
|
4251
|
+
if (outcome.status === "joined" || outcome.status === "already-member") {
|
|
4252
|
+
markNamespaceJustJoined(outcome.namespaceId);
|
|
4253
|
+
onJoinedRef.current?.(outcome.namespaceId, outcome.teamName);
|
|
4254
|
+
}
|
|
4255
|
+
if (!alive.current) return;
|
|
4256
|
+
setState(
|
|
4257
|
+
outcome.status === "failed" ? {
|
|
4258
|
+
stage: "failed",
|
|
4259
|
+
message: outcome.message,
|
|
4260
|
+
reason: outcome.reason,
|
|
4261
|
+
retryable: outcome.retryable
|
|
4262
|
+
} : {
|
|
4263
|
+
stage: outcome.status,
|
|
4264
|
+
namespaceId: outcome.namespaceId,
|
|
4265
|
+
teamName: outcome.teamName
|
|
4266
|
+
}
|
|
4267
|
+
);
|
|
4268
|
+
},
|
|
4269
|
+
[]
|
|
4270
|
+
);
|
|
4271
|
+
const begin = react.useCallback(
|
|
4272
|
+
(captured) => {
|
|
4273
|
+
let invitation = null;
|
|
4274
|
+
try {
|
|
4275
|
+
invitation = parseRef.current(captured.token, captured.params);
|
|
4276
|
+
} catch {
|
|
4277
|
+
invitation = null;
|
|
4278
|
+
}
|
|
4279
|
+
if (!invitation?.namespaceId) {
|
|
4280
|
+
captured.resolve();
|
|
4281
|
+
if (alive.current) {
|
|
4282
|
+
setState({
|
|
4283
|
+
stage: "failed",
|
|
4284
|
+
message: "That invitation could not be read.",
|
|
4285
|
+
reason: "invalid",
|
|
4286
|
+
retryable: false
|
|
4287
|
+
});
|
|
4288
|
+
}
|
|
4289
|
+
return;
|
|
4290
|
+
}
|
|
4291
|
+
parsedRef.current = invitation;
|
|
4292
|
+
if (alive.current) setParsed(invitation);
|
|
4293
|
+
if (confirmRef.current) {
|
|
4294
|
+
if (alive.current) {
|
|
4295
|
+
setState({
|
|
4296
|
+
stage: "awaiting-confirmation",
|
|
4297
|
+
teamName: invitation.teamName
|
|
4298
|
+
});
|
|
4299
|
+
}
|
|
4300
|
+
return;
|
|
4301
|
+
}
|
|
4302
|
+
void perform(captured, invitation);
|
|
4303
|
+
},
|
|
4304
|
+
[perform]
|
|
4305
|
+
);
|
|
4306
|
+
react.useEffect(() => {
|
|
4307
|
+
if (!enabled) return;
|
|
4308
|
+
return onInvitation((captured) => {
|
|
4309
|
+
pending.current = captured;
|
|
4310
|
+
setToken(captured.token);
|
|
4311
|
+
if (attempted.current.has(captured.token)) return;
|
|
4312
|
+
if (!captured.autoJoin && !confirmRef.current) return;
|
|
4313
|
+
attempted.current.add(captured.token);
|
|
4314
|
+
begin(captured);
|
|
4315
|
+
});
|
|
4316
|
+
}, [enabled, begin]);
|
|
4317
|
+
const accept = react.useCallback(() => {
|
|
4318
|
+
const captured = pending.current;
|
|
4319
|
+
const invitation = parsedRef.current;
|
|
4320
|
+
if (!captured || !invitation) return;
|
|
4321
|
+
void perform(captured, invitation);
|
|
4322
|
+
}, [perform]);
|
|
4323
|
+
const decline = react.useCallback(() => {
|
|
4324
|
+
pending.current?.resolve();
|
|
4325
|
+
setState({ stage: "idle" });
|
|
4326
|
+
}, []);
|
|
4327
|
+
const retry = react.useCallback(() => {
|
|
4328
|
+
const captured = pending.current;
|
|
4329
|
+
if (!captured) return;
|
|
4330
|
+
attempted.current.add(captured.token);
|
|
4331
|
+
const invitation = parsedRef.current;
|
|
4332
|
+
if (invitation) void perform(captured, invitation);
|
|
4333
|
+
else begin(captured);
|
|
4334
|
+
}, [begin, perform]);
|
|
4335
|
+
const dismiss = react.useCallback(() => setState({ stage: "idle" }), []);
|
|
4336
|
+
return { state, token, parsed, accept, decline, retry, dismiss };
|
|
4337
|
+
}
|
|
4338
|
+
async function runRedeem(invitation, redeem, redeemer) {
|
|
4339
|
+
try {
|
|
4340
|
+
if (redeem) return await redeem(invitation);
|
|
4341
|
+
if (redeemer) return await meroJs.redeemInvitation(invitation, redeemer);
|
|
4342
|
+
return {
|
|
4343
|
+
status: "failed",
|
|
4344
|
+
namespaceId: invitation.namespaceId,
|
|
4345
|
+
message: "This app cannot redeem invitations: no redeemer is configured.",
|
|
4346
|
+
reason: "unknown",
|
|
4347
|
+
retryable: false
|
|
4348
|
+
};
|
|
4349
|
+
} catch (err) {
|
|
4350
|
+
return {
|
|
4351
|
+
status: "failed",
|
|
4352
|
+
namespaceId: invitation.namespaceId,
|
|
4353
|
+
message: err instanceof Error ? err.message : String(err),
|
|
4354
|
+
reason: "unknown",
|
|
4355
|
+
retryable: true
|
|
4356
|
+
};
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
var JOIN_SYNC_WATCHDOG_MS = 3e4;
|
|
4360
|
+
var JOIN_SYNC_MAX_MS = 12e4;
|
|
4361
|
+
var JOIN_SYNC_POLL_MS = 2e3;
|
|
4362
|
+
function useJoinSync({
|
|
4363
|
+
namespaceId,
|
|
4364
|
+
settled,
|
|
4365
|
+
active
|
|
4366
|
+
}) {
|
|
4367
|
+
const [tick, setTick] = react.useState(0);
|
|
4368
|
+
const firstSeen = react.useRef(/* @__PURE__ */ new Map());
|
|
4369
|
+
const activeRef = react.useRef(active);
|
|
4370
|
+
activeRef.current = active;
|
|
4371
|
+
const flagged = react.useMemo(() => {
|
|
4372
|
+
if (!namespaceId) return false;
|
|
4373
|
+
if (!isNamespaceJustJoined(namespaceId)) return false;
|
|
4374
|
+
if (!firstSeen.current.has(namespaceId)) {
|
|
4375
|
+
firstSeen.current.set(namespaceId, Date.now());
|
|
4376
|
+
}
|
|
4377
|
+
return true;
|
|
4378
|
+
}, [namespaceId, tick]);
|
|
4379
|
+
react.useEffect(() => {
|
|
4380
|
+
if (!namespaceId || !flagged || !settled) return;
|
|
4381
|
+
clearNamespaceJustJoined(namespaceId);
|
|
4382
|
+
setTick((t) => t + 1);
|
|
4383
|
+
}, [namespaceId, flagged, settled]);
|
|
4384
|
+
react.useEffect(() => {
|
|
4385
|
+
if (!namespaceId || !flagged || settled) return;
|
|
4386
|
+
const since = firstSeen.current.get(namespaceId) ?? Date.now();
|
|
4387
|
+
let timer;
|
|
4388
|
+
const check = () => {
|
|
4389
|
+
const elapsed = Date.now() - since;
|
|
4390
|
+
const giveUp = elapsed >= JOIN_SYNC_MAX_MS || elapsed >= JOIN_SYNC_WATCHDOG_MS && !activeRef.current;
|
|
4391
|
+
if (giveUp) {
|
|
4392
|
+
clearNamespaceJustJoined(namespaceId);
|
|
4393
|
+
setTick((t) => t + 1);
|
|
4394
|
+
return;
|
|
4395
|
+
}
|
|
4396
|
+
timer = setTimeout(check, JOIN_SYNC_POLL_MS);
|
|
4397
|
+
};
|
|
4398
|
+
timer = setTimeout(check, JOIN_SYNC_WATCHDOG_MS);
|
|
4399
|
+
return () => clearTimeout(timer);
|
|
4400
|
+
}, [namespaceId, flagged, settled]);
|
|
4401
|
+
return {
|
|
4402
|
+
isSyncing: flagged && !settled,
|
|
4403
|
+
dismiss: () => {
|
|
4404
|
+
if (!namespaceId) return;
|
|
4405
|
+
clearNamespaceJustJoined(namespaceId);
|
|
4406
|
+
setTick((t) => t + 1);
|
|
4407
|
+
}
|
|
4408
|
+
};
|
|
4409
|
+
}
|
|
4410
|
+
var INVITATION_READY_MS = 1200;
|
|
4411
|
+
function useJustJoined(namespaceId) {
|
|
4412
|
+
return react.useSyncExternalStore(
|
|
4413
|
+
subscribeJustJoined,
|
|
4414
|
+
() => isNamespaceJustJoined(namespaceId),
|
|
4415
|
+
() => false
|
|
4416
|
+
);
|
|
4417
|
+
}
|
|
4418
|
+
function InvitationDialog({
|
|
4419
|
+
redemption,
|
|
4420
|
+
noun = "team",
|
|
4421
|
+
appName,
|
|
4422
|
+
synced,
|
|
4423
|
+
detail,
|
|
4424
|
+
status
|
|
4425
|
+
}) {
|
|
4426
|
+
const { state, accept, decline, retry, dismiss } = redemption;
|
|
4427
|
+
const joinedId = state.stage === "joined" ? state.namespaceId : null;
|
|
4428
|
+
const stillSyncing = useJustJoined(joinedId);
|
|
4429
|
+
react.useEffect(() => {
|
|
4430
|
+
if (joinedId && stillSyncing && synced) clearNamespaceJustJoined(joinedId);
|
|
4431
|
+
}, [joinedId, stillSyncing, synced]);
|
|
4432
|
+
const [slow, setSlow] = react.useState(false);
|
|
4433
|
+
react.useEffect(() => {
|
|
4434
|
+
setSlow(false);
|
|
4435
|
+
if (!joinedId || !stillSyncing) return;
|
|
4436
|
+
const slowTimer = setTimeout(() => setSlow(true), JOIN_SYNC_WATCHDOG_MS);
|
|
4437
|
+
const ceiling = setTimeout(
|
|
4438
|
+
() => clearNamespaceJustJoined(joinedId),
|
|
4439
|
+
JOIN_SYNC_MAX_MS
|
|
4440
|
+
);
|
|
4441
|
+
return () => {
|
|
4442
|
+
clearTimeout(slowTimer);
|
|
4443
|
+
clearTimeout(ceiling);
|
|
4444
|
+
};
|
|
4445
|
+
}, [joinedId, stillSyncing]);
|
|
4446
|
+
const stage = state.stage === "idle" ? null : state.stage === "joined" ? stillSyncing ? "syncing" : "ready" : state.stage;
|
|
4447
|
+
react.useEffect(() => {
|
|
4448
|
+
if (stage !== "ready") return;
|
|
4449
|
+
const t = setTimeout(dismiss, INVITATION_READY_MS);
|
|
4450
|
+
return () => clearTimeout(t);
|
|
4451
|
+
}, [stage, dismiss]);
|
|
4452
|
+
const titleId = react.useId();
|
|
4453
|
+
const bodyId = react.useId();
|
|
4454
|
+
const dialogRef = react.useRef(null);
|
|
4455
|
+
const primaryRef = react.useRef(null);
|
|
4456
|
+
react.useEffect(() => {
|
|
4457
|
+
if (!stage) return;
|
|
4458
|
+
(primaryRef.current ?? dialogRef.current)?.focus();
|
|
4459
|
+
}, [stage]);
|
|
4460
|
+
const close = react.useCallback(() => {
|
|
4461
|
+
if (stage === "awaiting-confirmation") decline();
|
|
4462
|
+
else if (stage && stage !== "joining") dismiss();
|
|
4463
|
+
}, [stage, decline, dismiss]);
|
|
4464
|
+
const onKeyDown = (event) => {
|
|
4465
|
+
if (event.key === "Escape") {
|
|
4466
|
+
event.stopPropagation();
|
|
4467
|
+
close();
|
|
4468
|
+
return;
|
|
4469
|
+
}
|
|
4470
|
+
if (event.key !== "Tab" || !dialogRef.current) return;
|
|
4471
|
+
const focusable = dialogRef.current.querySelectorAll(
|
|
4472
|
+
'button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'
|
|
4473
|
+
);
|
|
4474
|
+
if (focusable.length === 0) return;
|
|
4475
|
+
const first = focusable[0];
|
|
4476
|
+
const last = focusable[focusable.length - 1];
|
|
4477
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
4478
|
+
event.preventDefault();
|
|
4479
|
+
last.focus();
|
|
4480
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
4481
|
+
event.preventDefault();
|
|
4482
|
+
first.focus();
|
|
4483
|
+
}
|
|
4484
|
+
};
|
|
4485
|
+
if (!stage || typeof document === "undefined") return null;
|
|
4486
|
+
const teamName = "teamName" in state ? state.teamName : void 0;
|
|
4487
|
+
const named = teamName ? `\u201C${teamName}\u201D` : `this ${noun}`;
|
|
4488
|
+
const busy = stage === "joining" || stage === "syncing";
|
|
4489
|
+
let icon = "invite";
|
|
4490
|
+
let title = "";
|
|
4491
|
+
let body = null;
|
|
4492
|
+
if (stage === "awaiting-confirmation") {
|
|
4493
|
+
title = teamName ? `Join \u201C${teamName}\u201D?` : `Join this ${noun}?`;
|
|
4494
|
+
body = detail ?? `You have been invited. Joining makes this device a member, and the ${noun}'s data syncs to it from the other members.`;
|
|
4495
|
+
} else if (stage === "joining") {
|
|
4496
|
+
icon = "spinner";
|
|
4497
|
+
title = `Joining ${named}\u2026`;
|
|
4498
|
+
body = status || "Asking a member to let you in. With few members online this can take up to a minute.";
|
|
4499
|
+
} else if (stage === "syncing") {
|
|
4500
|
+
icon = "spinner";
|
|
4501
|
+
title = `Syncing ${named}\u2026`;
|
|
4502
|
+
body = slow ? `Still waiting on the other members. You can carry on; the ${noun} fills in as its data arrives.` : `You're in. Getting the ${noun}'s data from the other members.`;
|
|
4503
|
+
} else if (stage === "ready") {
|
|
4504
|
+
icon = "done";
|
|
4505
|
+
title = `You're in ${named}`;
|
|
4506
|
+
} else if (stage === "already-member") {
|
|
4507
|
+
icon = "done";
|
|
4508
|
+
title = `You're already in ${named}`;
|
|
4509
|
+
} else {
|
|
4510
|
+
icon = "error";
|
|
4511
|
+
title = "Couldn't join";
|
|
4512
|
+
body = state.stage === "failed" ? describeInviteFailure(state.reason, noun) ?? state.message : null;
|
|
4513
|
+
}
|
|
4514
|
+
const retryable = state.stage === "failed" && state.retryable;
|
|
4515
|
+
return reactDom.createPortal(
|
|
4516
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4517
|
+
"div",
|
|
4518
|
+
{
|
|
4519
|
+
className: "mero-invite-overlay",
|
|
4520
|
+
onMouseDown: (event) => {
|
|
4521
|
+
if (event.target === event.currentTarget) close();
|
|
4522
|
+
},
|
|
4523
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4524
|
+
"div",
|
|
4525
|
+
{
|
|
4526
|
+
ref: dialogRef,
|
|
4527
|
+
className: "mero-invite-dialog",
|
|
4528
|
+
role: "dialog",
|
|
4529
|
+
"aria-modal": "true",
|
|
4530
|
+
"aria-labelledby": titleId,
|
|
4531
|
+
"aria-describedby": body ? bodyId : void 0,
|
|
4532
|
+
"aria-busy": busy,
|
|
4533
|
+
tabIndex: -1,
|
|
4534
|
+
"data-testid": "invite-prompt",
|
|
4535
|
+
"data-stage": stage,
|
|
4536
|
+
onKeyDown,
|
|
4537
|
+
children: [
|
|
4538
|
+
appName ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mero-invite-app", children: appName }) : null,
|
|
4539
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-invite-head", children: [
|
|
4540
|
+
/* @__PURE__ */ jsxRuntime.jsx(InviteIcon, { kind: icon }),
|
|
4541
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: "mero-invite-title", children: title })
|
|
4542
|
+
] }),
|
|
4543
|
+
body ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4544
|
+
"p",
|
|
4545
|
+
{
|
|
4546
|
+
id: bodyId,
|
|
4547
|
+
className: stage === "failed" ? "mero-invite-body mero-invite-body-error" : "mero-invite-body",
|
|
4548
|
+
role: stage === "failed" ? "alert" : void 0,
|
|
4549
|
+
"data-testid": stage === "failed" ? "invite-error" : void 0,
|
|
4550
|
+
children: body
|
|
4551
|
+
}
|
|
4552
|
+
) : null,
|
|
4553
|
+
stage === "syncing" || stage === "joining" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mero-invite-progress", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mero-invite-progress-bar" }) }) : null,
|
|
4554
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-invite-actions", children: [
|
|
4555
|
+
stage === "awaiting-confirmation" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4556
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4557
|
+
"button",
|
|
4558
|
+
{
|
|
4559
|
+
type: "button",
|
|
4560
|
+
className: "mero-invite-button mero-invite-secondary",
|
|
4561
|
+
onClick: decline,
|
|
4562
|
+
"data-testid": "invite-decline",
|
|
4563
|
+
children: "Not now"
|
|
4564
|
+
}
|
|
4565
|
+
),
|
|
4566
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4567
|
+
"button",
|
|
4568
|
+
{
|
|
4569
|
+
ref: primaryRef,
|
|
4570
|
+
type: "button",
|
|
4571
|
+
className: "mero-invite-button mero-invite-primary",
|
|
4572
|
+
onClick: accept,
|
|
4573
|
+
"data-testid": "invite-accept",
|
|
4574
|
+
children: "Join"
|
|
4575
|
+
}
|
|
4576
|
+
)
|
|
4577
|
+
] }) : null,
|
|
4578
|
+
stage === "syncing" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4579
|
+
"button",
|
|
4580
|
+
{
|
|
4581
|
+
ref: primaryRef,
|
|
4582
|
+
type: "button",
|
|
4583
|
+
className: "mero-invite-button mero-invite-secondary",
|
|
4584
|
+
onClick: dismiss,
|
|
4585
|
+
"data-testid": "invite-continue",
|
|
4586
|
+
children: "Continue in background"
|
|
4587
|
+
}
|
|
4588
|
+
) : null,
|
|
4589
|
+
stage === "ready" || stage === "already-member" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4590
|
+
"button",
|
|
4591
|
+
{
|
|
4592
|
+
ref: primaryRef,
|
|
4593
|
+
type: "button",
|
|
4594
|
+
className: "mero-invite-button mero-invite-primary",
|
|
4595
|
+
onClick: dismiss,
|
|
4596
|
+
"data-testid": "invite-done",
|
|
4597
|
+
children: "Done"
|
|
4598
|
+
}
|
|
4599
|
+
) : null,
|
|
4600
|
+
stage === "failed" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4602
|
+
"button",
|
|
4603
|
+
{
|
|
4604
|
+
ref: retryable ? void 0 : primaryRef,
|
|
4605
|
+
type: "button",
|
|
4606
|
+
className: "mero-invite-button mero-invite-secondary",
|
|
4607
|
+
onClick: dismiss,
|
|
4608
|
+
"data-testid": "invite-decline",
|
|
4609
|
+
children: "Close"
|
|
4610
|
+
}
|
|
4611
|
+
),
|
|
4612
|
+
retryable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4613
|
+
"button",
|
|
4614
|
+
{
|
|
4615
|
+
ref: primaryRef,
|
|
4616
|
+
type: "button",
|
|
4617
|
+
className: "mero-invite-button mero-invite-primary",
|
|
4618
|
+
onClick: retry,
|
|
4619
|
+
"data-testid": "invite-retry",
|
|
4620
|
+
children: "Try again"
|
|
4621
|
+
}
|
|
4622
|
+
) : null
|
|
4623
|
+
] }) : null
|
|
4624
|
+
] })
|
|
4625
|
+
]
|
|
4626
|
+
}
|
|
4627
|
+
)
|
|
4628
|
+
}
|
|
4629
|
+
),
|
|
4630
|
+
document.body
|
|
4631
|
+
);
|
|
4632
|
+
}
|
|
4633
|
+
function InviteIcon({ kind }) {
|
|
4634
|
+
if (kind === "spinner") {
|
|
4635
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mero-invite-icon mero-invite-spinner", "aria-hidden": "true" });
|
|
4636
|
+
}
|
|
4637
|
+
const path = kind === "done" ? "M5 12.5l4.5 4.5L19 7.5" : kind === "error" ? "M12 7v6m0 4h.01" : "M4 7l8 6 8-6M5 6h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1z";
|
|
4638
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: `mero-invite-icon mero-invite-icon-${kind}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: path }) }) });
|
|
4639
|
+
}
|
|
4640
|
+
function JoinSyncBanner({
|
|
4641
|
+
show,
|
|
4642
|
+
what = "data",
|
|
4643
|
+
onDismiss,
|
|
4644
|
+
className,
|
|
4645
|
+
style,
|
|
4646
|
+
children
|
|
4647
|
+
}) {
|
|
4648
|
+
if (!show) return null;
|
|
4649
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4650
|
+
"div",
|
|
4651
|
+
{
|
|
4652
|
+
role: "status",
|
|
4653
|
+
"aria-live": "polite",
|
|
4654
|
+
className,
|
|
4655
|
+
style: {
|
|
4656
|
+
display: "flex",
|
|
4657
|
+
alignItems: "center",
|
|
4658
|
+
gap: "0.625rem",
|
|
4659
|
+
padding: "0.625rem 0.875rem",
|
|
4660
|
+
borderRadius: "0.5rem",
|
|
4661
|
+
border: "1px solid var(--join-sync-border, rgba(127,127,127,0.28))",
|
|
4662
|
+
background: "var(--join-sync-bg, rgba(127,127,127,0.08))",
|
|
4663
|
+
color: "var(--join-sync-fg, inherit)",
|
|
4664
|
+
font: "inherit",
|
|
4665
|
+
fontSize: "0.875rem",
|
|
4666
|
+
lineHeight: 1.4,
|
|
4667
|
+
...style
|
|
4668
|
+
},
|
|
4669
|
+
children: [
|
|
4670
|
+
/* @__PURE__ */ jsxRuntime.jsx(Spinner, {}),
|
|
4671
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 }, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4672
|
+
"Joined. Syncing ",
|
|
4673
|
+
what,
|
|
4674
|
+
" from peers\u2026",
|
|
4675
|
+
" ",
|
|
4676
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { opacity: 0.75 }, children: "This can take a moment on a cold connection." })
|
|
4677
|
+
] }) }),
|
|
4678
|
+
onDismiss && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4679
|
+
"button",
|
|
4680
|
+
{
|
|
4681
|
+
type: "button",
|
|
4682
|
+
onClick: onDismiss,
|
|
4683
|
+
style: {
|
|
4684
|
+
font: "inherit",
|
|
4685
|
+
fontSize: "0.8125rem",
|
|
4686
|
+
background: "none",
|
|
4687
|
+
border: "none",
|
|
4688
|
+
padding: 0,
|
|
4689
|
+
color: "inherit",
|
|
4690
|
+
opacity: 0.75,
|
|
4691
|
+
textDecoration: "underline",
|
|
4692
|
+
cursor: "pointer"
|
|
4693
|
+
},
|
|
4694
|
+
children: "Show anyway"
|
|
4695
|
+
}
|
|
4696
|
+
)
|
|
4697
|
+
]
|
|
4698
|
+
}
|
|
4699
|
+
);
|
|
4700
|
+
}
|
|
4701
|
+
function Spinner() {
|
|
4702
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4703
|
+
"svg",
|
|
4704
|
+
{
|
|
4705
|
+
width: "14",
|
|
4706
|
+
height: "14",
|
|
4707
|
+
viewBox: "0 0 16 16",
|
|
4708
|
+
"aria-hidden": "true",
|
|
4709
|
+
style: { flexShrink: 0, opacity: 0.85 },
|
|
4710
|
+
children: [
|
|
4711
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4712
|
+
"circle",
|
|
4713
|
+
{
|
|
4714
|
+
cx: "8",
|
|
4715
|
+
cy: "8",
|
|
4716
|
+
r: "6.5",
|
|
4717
|
+
fill: "none",
|
|
4718
|
+
stroke: "currentColor",
|
|
4719
|
+
strokeOpacity: "0.25",
|
|
4720
|
+
strokeWidth: "2"
|
|
4721
|
+
}
|
|
4722
|
+
),
|
|
4723
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4724
|
+
"path",
|
|
4725
|
+
{
|
|
4726
|
+
d: "M8 1.5A6.5 6.5 0 0 1 14.5 8",
|
|
4727
|
+
fill: "none",
|
|
4728
|
+
stroke: "currentColor",
|
|
4729
|
+
strokeWidth: "2",
|
|
4730
|
+
strokeLinecap: "round",
|
|
4731
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4732
|
+
"animateTransform",
|
|
4733
|
+
{
|
|
4734
|
+
attributeName: "transform",
|
|
4735
|
+
type: "rotate",
|
|
4736
|
+
from: "0 8 8",
|
|
4737
|
+
to: "360 8 8",
|
|
4738
|
+
dur: "0.8s",
|
|
4739
|
+
repeatCount: "indefinite"
|
|
4740
|
+
}
|
|
4741
|
+
)
|
|
4742
|
+
}
|
|
4743
|
+
)
|
|
4744
|
+
]
|
|
4745
|
+
}
|
|
4746
|
+
);
|
|
4747
|
+
}
|
|
3774
4748
|
function statusOf(err) {
|
|
3775
4749
|
if (!err || typeof err !== "object") return void 0;
|
|
3776
4750
|
const e = err;
|
|
@@ -4020,37 +4994,58 @@ exports.ConnectButton = ConnectButton;
|
|
|
4020
4994
|
exports.ConnectButtonAccount = ConnectButtonAccount;
|
|
4021
4995
|
exports.ConnectionType = ConnectionType;
|
|
4022
4996
|
exports.DEFAULT_MIGRATION_POLL_INTERVAL_MS = DEFAULT_MIGRATION_POLL_INTERVAL_MS;
|
|
4997
|
+
exports.INVITATION_PARAM = INVITATION_PARAM;
|
|
4998
|
+
exports.INVITATION_READY_MS = INVITATION_READY_MS;
|
|
4999
|
+
exports.InvitationDialog = InvitationDialog;
|
|
5000
|
+
exports.JOIN_ACTION = JOIN_ACTION;
|
|
5001
|
+
exports.JOIN_SYNC_MAX_MS = JOIN_SYNC_MAX_MS;
|
|
5002
|
+
exports.JOIN_SYNC_POLL_MS = JOIN_SYNC_POLL_MS;
|
|
5003
|
+
exports.JOIN_SYNC_WATCHDOG_MS = JOIN_SYNC_WATCHDOG_MS;
|
|
5004
|
+
exports.JoinSyncBanner = JoinSyncBanner;
|
|
4023
5005
|
exports.LoginModal = LoginModal;
|
|
5006
|
+
exports.MAX_AUTO_JOIN_ATTEMPTS = MAX_AUTO_JOIN_ATTEMPTS;
|
|
4024
5007
|
exports.MERO_CSS_VARS = MERO_CSS_VARS;
|
|
4025
5008
|
exports.MeroContext = MeroContext;
|
|
4026
5009
|
exports.MeroProvider = MeroProvider;
|
|
4027
5010
|
exports.MigrationAdminPanel = MigrationAdminPanel;
|
|
4028
5011
|
exports.MigrationPendingBanner = MigrationPendingBanner;
|
|
5012
|
+
exports.buildInviteLink = buildInviteLink;
|
|
4029
5013
|
exports.clearAllStorage = clearAllStorage;
|
|
4030
5014
|
exports.clearApplicationId = clearApplicationId;
|
|
4031
5015
|
exports.clearContextId = clearContextId;
|
|
4032
5016
|
exports.clearContextIdentity = clearContextIdentity;
|
|
5017
|
+
exports.clearNamespaceJustJoined = clearNamespaceJustJoined;
|
|
4033
5018
|
exports.clearNodeUrl = clearNodeUrl;
|
|
4034
5019
|
exports.clearTokenNodeUrl = clearTokenNodeUrl;
|
|
4035
5020
|
exports.cssVar = cssVar;
|
|
4036
5021
|
exports.defaultMeroTheme = defaultMeroTheme;
|
|
5022
|
+
exports.describeInviteFailure = describeInviteFailure;
|
|
4037
5023
|
exports.getApplicationId = getApplicationId;
|
|
4038
5024
|
exports.getContextId = getContextId;
|
|
4039
5025
|
exports.getContextIdentity = getContextIdentity;
|
|
4040
5026
|
exports.getNodeUrl = getNodeUrl;
|
|
4041
5027
|
exports.getPermissionsForMode = getPermissionsForMode;
|
|
4042
5028
|
exports.getTokenNodeUrl = getTokenNodeUrl;
|
|
5029
|
+
exports.invitationFromRaw = invitationFromRaw;
|
|
4043
5030
|
exports.isDesktopWindow = isDesktopWindow;
|
|
4044
5031
|
exports.isFinalInvitationError = isFinalInvitationError;
|
|
5032
|
+
exports.isNamespaceJustJoined = isNamespaceJustJoined;
|
|
4045
5033
|
exports.isReturningFromWallet = isReturningFromWallet;
|
|
4046
5034
|
exports.localStorageTokenStorage = localStorageTokenStorage;
|
|
5035
|
+
exports.markNamespaceJustJoined = markNamespaceJustJoined;
|
|
5036
|
+
exports.onInvitation = onInvitation;
|
|
5037
|
+
exports.peekInvitation = peekInvitation;
|
|
5038
|
+
exports.primeInvitationCapture = primeInvitationCapture;
|
|
5039
|
+
exports.resetInvitationCaptureForTests = resetInvitationCaptureForTests;
|
|
4047
5040
|
exports.resolveMeroTheme = resolveMeroTheme;
|
|
4048
5041
|
exports.setApplicationId = setApplicationId;
|
|
4049
5042
|
exports.setContextId = setContextId;
|
|
4050
5043
|
exports.setContextIdentity = setContextIdentity;
|
|
4051
5044
|
exports.setNodeUrl = setNodeUrl;
|
|
4052
5045
|
exports.setTokenNodeUrl = setTokenNodeUrl;
|
|
5046
|
+
exports.subscribeJustJoined = subscribeJustJoined;
|
|
4053
5047
|
exports.themeToCssVars = themeToCssVars;
|
|
5048
|
+
exports.urlWithoutInvitation = urlWithoutInvitation;
|
|
4054
5049
|
exports.useAccountEnrolment = useAccountEnrolment;
|
|
4055
5050
|
exports.useAddGroupMembers = useAddGroupMembers;
|
|
4056
5051
|
exports.useAppVersion = useAppVersion;
|
|
@@ -4082,11 +5077,13 @@ exports.useGroupMembers = useGroupMembers;
|
|
|
4082
5077
|
exports.useGroupMetadata = useGroupMetadata;
|
|
4083
5078
|
exports.useGroupUpgradeStatus = useGroupUpgradeStatus;
|
|
4084
5079
|
exports.useInstallFromRegistry = useInstallFromRegistry;
|
|
5080
|
+
exports.useInviteRedemption = useInviteRedemption;
|
|
4085
5081
|
exports.useJoinContext = useJoinContext;
|
|
4086
5082
|
exports.useJoinGroup = useJoinGroup;
|
|
4087
5083
|
exports.useJoinInvitation = useJoinInvitation;
|
|
4088
5084
|
exports.useJoinNamespace = useJoinNamespace;
|
|
4089
5085
|
exports.useJoinSubgroupInheritance = useJoinSubgroupInheritance;
|
|
5086
|
+
exports.useJoinSync = useJoinSync;
|
|
4090
5087
|
exports.useLatestVersion = useLatestVersion;
|
|
4091
5088
|
exports.useMemberMetadata = useMemberMetadata;
|
|
4092
5089
|
exports.useMero = useMero;
|