@calimero-network/mero-react 11.6.0 → 11.7.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/dist/index.cjs +151 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +151 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1872,7 +1872,7 @@ function ConnectButton({
|
|
|
1872
1872
|
chunkRRETZWNI_cjs.styleInject('.mero-cw,\n.mero-cw-review {\n --_ink: var(--cw-ink, light-dark(#0f1117, #eceef5));\n --_muted: var(--cw-muted, light-dark(#6b7280, #9097ab));\n --_line: var(--cw-line, light-dark(#e6e8ee, rgba(255, 255, 255, 0.16)));\n --_surface: var(--cw-surface, light-dark(#ffffff, #161b2b));\n --_primary-bg: var(--cw-primary-bg, light-dark(#0f1117, #eceef5));\n --_primary-ink: var(--cw-primary-ink, light-dark(#ffffff, #0f1117));\n --_focus: var(--cw-link, light-dark(#3b5bfd, #9aafff));\n --_good-bg: var(--cw-good-bg, light-dark(#dcfce7, #0e3324));\n --_good-ink: var(--cw-good-ink, light-dark(#15803d, #7fe0b0));\n --_bad-bg: var(--cw-bad-bg, light-dark(#ffe4ea, #3d0f1e));\n --_bad-ink: var(--cw-bad-ink, light-dark(#a2194b, #f78bb0));\n --_busy-bg: var(--cw-busy-bg, light-dark(#e3e9ff, #1c2650));\n --_busy-ink: var(--cw-busy-ink, light-dark(#3451d1, #9aafff));\n --_warn-bg: var(--cw-warn-bg, light-dark(#fff1d6, #3a2a08));\n --_warn-ink: var(--cw-warn-ink, light-dark(#8a5a00, #f2c36b));\n --_code-bg: var(--cw-code-bg, light-dark(#f4f5f8, #1f2538));\n font-family: var(--cw-font, inherit);\n}\n.mero-cw-review [data-kind=verified] {\n --_tone: var(--_good-ink);\n --_tone-bg: var(--_good-bg);\n}\n.mero-cw-review [data-kind=refused] {\n --_tone: var(--_bad-ink);\n --_tone-bg: var(--_bad-bg);\n}\n.mero-cw-review [data-kind=checking] {\n --_tone: var(--_busy-ink);\n --_tone-bg: var(--_busy-bg);\n}\n.mero-cw-review [data-kind=unsealed] {\n --_tone: var(--_muted);\n --_tone-bg: color-mix(in srgb, var(--_muted) 14%, var(--_surface));\n}\n.mero-cw-shield__icon {\n flex: none;\n color: var(--_tone);\n}\n.mero-cw-shield__tick {\n flex: none;\n margin-top: 2px;\n color: var(--_muted);\n}\n@media (prefers-reduced-motion: no-preference) {\n [data-kind=checking] .mero-cw-shield__icon {\n animation: mero-cw-shield-pulse 1.4s ease-in-out infinite;\n }\n}\n@keyframes mero-cw-shield-pulse {\n 50% {\n opacity: 0.4;\n }\n}\n.mero-cw-review {\n box-sizing: border-box;\n width: 100%;\n color: var(--_ink);\n font-size: 14px;\n line-height: 1.45;\n text-align: left;\n}\n.mero-cw-review *,\n.mero-cw-review *::before,\n.mero-cw-review *::after {\n box-sizing: border-box;\n}\n.mero-cw-review__title {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n line-height: 1.3;\n}\n.mero-cw-review__title:focus {\n outline: none;\n}\n.mero-cw-review__lede {\n margin: 4px 0 6px;\n color: var(--_muted);\n}\n.mero-cw-review__muted,\n.mero-cw-review__sub {\n color: var(--_muted);\n font-size: 12.5px;\n}\n.mero-cw-review__muted {\n margin: 8px 0 0;\n}\n.mero-cw-review__sub {\n display: block;\n margin-top: 2px;\n}\n.mero-cw-review__mono {\n font-family:\n ui-monospace,\n "SF Mono",\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace;\n font-size: 12.5px;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__icon {\n flex: none;\n}\n.mero-cw-review__nobreak {\n white-space: nowrap;\n}\n.mero-cw-review__sec {\n padding: 14px 0;\n border-top: 1px solid var(--_line);\n}\n.mero-cw-review__h {\n display: flex;\n align-items: center;\n gap: 7px;\n margin: 0 0 10px;\n font-size: 13px;\n font-weight: 700;\n letter-spacing: 0.02em;\n}\n.mero-cw-review__h .mero-cw-shield__icon {\n margin-top: -1px;\n}\n.mero-cw-review__kv {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 0;\n}\n.mero-cw-review__kv > div {\n display: grid;\n grid-template-columns: 96px minmax(0, 1fr);\n gap: 12px;\n}\n.mero-cw-review__kv dt {\n color: var(--_muted);\n}\n.mero-cw-review__kv dd {\n margin: 0;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__kv--raw {\n margin-bottom: 12px;\n}\n.mero-cw-review__tone--good {\n color: var(--_good-ink);\n}\n.mero-cw-review__tone--bad {\n color: var(--_bad-ink);\n font-weight: 600;\n}\n.mero-cw-review__copy,\n.mero-cw-review__link {\n margin-left: 8px;\n padding: 0;\n border: 0;\n background: none;\n color: var(--_focus);\n font: inherit;\n font-size: 12.5px;\n font-weight: 600;\n text-decoration: none;\n cursor: pointer;\n}\n.mero-cw-review__link {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n}\n.mero-cw-review__copy:hover,\n.mero-cw-review__link:hover {\n text-decoration: underline;\n}\n.mero-cw-review__sum {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.mero-cw-review__sum li {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n}\n.mero-cw-review__ic {\n display: grid;\n place-items: center;\n flex: none;\n width: 28px;\n height: 28px;\n border-radius: 50%;\n background: var(--_chip-bg);\n color: var(--_muted);\n}\n.mero-cw-review__sum li[data-tone=warn] .mero-cw-review__ic {\n background: var(--_warn-bg);\n color: var(--_warn-ink);\n}\n.mero-cw-review__sum li[data-tone=ok] .mero-cw-review__ic {\n background: var(--_good-bg);\n color: var(--_good-ink);\n}\n.mero-cw-review__tx {\n display: flex;\n flex-direction: column;\n min-width: 0;\n padding-top: 3px;\n}\n.mero-cw-review__tx span {\n color: var(--_muted);\n font-size: 12.5px;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__more {\n margin-top: 0;\n}\n.mero-cw-review__sum + .mero-cw-review__more {\n margin-top: 10px;\n}\n.mero-cw-review__more > summary,\n.mero-cw-review__how > summary {\n display: flex;\n align-items: center;\n gap: 6px;\n min-height: 32px;\n color: var(--_focus);\n font-weight: 600;\n cursor: pointer;\n list-style: none;\n}\n.mero-cw-review summary::-webkit-details-marker {\n display: none;\n}\n.mero-cw-review__more > summary::after,\n.mero-cw-review__how > summary::after,\n.mero-cw-review__grp > summary::after,\n.mero-cw-review__act > summary::after {\n content: "";\n flex: none;\n width: 7px;\n height: 7px;\n margin: 0 3px;\n border: solid currentColor;\n border-width: 0 2px 2px 0;\n transform: rotate(-45deg);\n transition: transform 0.15s ease;\n}\n.mero-cw-review details[open] > summary::after {\n transform: rotate(45deg);\n}\n.mero-cw-review summary:focus-visible,\n.mero-cw-review__btn:focus-visible,\n.mero-cw-review__chip:focus-visible,\n.mero-cw-review__copy:focus-visible,\n.mero-cw-review__link:focus-visible {\n outline: 2px solid var(--_focus);\n outline-offset: 2px;\n border-radius: 6px;\n}\n.mero-cw-review__chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin: 4px 0 10px;\n}\n.mero-cw-review__chip {\n min-height: 30px;\n padding: 0 11px;\n border: 1px solid var(--_line);\n border-radius: 999px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-size: 12.5px;\n font-weight: 600;\n cursor: pointer;\n}\n.mero-cw-review__chip[aria-pressed=true] {\n border-color: transparent;\n background: var(--_primary-bg);\n color: var(--_primary-ink);\n}\n.mero-cw-review__grp {\n margin-top: 8px;\n border: 1px solid var(--_line);\n border-radius: 12px;\n}\n.mero-cw-review__grp > summary {\n display: flex;\n align-items: center;\n gap: 10px;\n min-height: 48px;\n padding: 8px 12px;\n cursor: pointer;\n list-style: none;\n color: var(--_muted);\n}\n.mero-cw-review__grp-text {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n}\n.mero-cw-review__grp-text b {\n color: var(--_ink);\n}\n.mero-cw-review__grp-text span {\n font-size: 12.5px;\n}\n.mero-cw-review__count {\n flex: none;\n min-width: 22px;\n padding: 1px 7px;\n border-radius: 999px;\n background: var(--_chip-bg);\n color: var(--_ink);\n font-size: 12px;\n font-weight: 600;\n text-align: center;\n}\n.mero-cw-review__acts {\n border-top: 1px solid var(--_line);\n}\n.mero-cw-review__act + .mero-cw-review__act {\n border-top: 1px solid var(--_line);\n}\n.mero-cw-review__act > summary,\n.mero-cw-review__act-head {\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: 40px;\n padding: 6px 12px;\n cursor: pointer;\n list-style: none;\n color: var(--_muted);\n}\n.mero-cw-review__act-head {\n cursor: default;\n}\n.mero-cw-review__act-main {\n display: flex;\n flex: 1 1 0;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n}\n.mero-cw-review__act-title {\n color: var(--_ink);\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__act-doc {\n font-size: 12px;\n font-style: italic;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__act-doc code,\n.mero-cw-review__said code {\n font-family:\n ui-monospace,\n "SF Mono",\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace;\n font-size: 0.92em;\n font-style: normal;\n}\n.mero-cw-review__act > summary::after {\n margin-left: 0;\n}\n.mero-cw-review__tags {\n display: flex;\n flex: none;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 4px;\n max-width: 55%;\n}\n.mero-cw-review__tag {\n padding: 1px 8px;\n border-radius: 999px;\n background: var(--_chip-bg);\n color: var(--_muted);\n font-size: 11.5px;\n font-weight: 600;\n white-space: nowrap;\n}\n.mero-cw-review__tag--passkey {\n background: var(--_warn-bg);\n color: var(--_warn-ink);\n}\n.mero-cw-review__tag--public {\n background: var(--_busy-bg);\n color: var(--_busy-ink);\n}\n.mero-cw-review__facts {\n padding: 2px 12px 12px;\n}\n.mero-cw-review__facts .mero-cw-review__kv {\n font-size: 12.5px;\n}\n.mero-cw-review__said {\n margin-top: 10px;\n padding: 8px 10px;\n border: 1px dashed var(--_line);\n border-radius: 8px;\n}\n.mero-cw-review__said span {\n color: var(--_muted);\n font-size: 11.5px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n.mero-cw-review__said p {\n margin: 2px 0 0;\n font-style: italic;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__note {\n margin: 10px 0 0;\n color: var(--_muted);\n font-size: 12px;\n}\n.mero-cw-review__claims {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.mero-cw-review__claims li {\n display: flex;\n align-items: flex-start;\n gap: 7px;\n}\n.mero-cw-review__claims .mero-cw-shield__tick {\n margin-top: 3px;\n color: var(--_good-ink);\n}\n.mero-cw-review__claims--plain b {\n font-weight: 500;\n color: var(--_muted);\n}\n.mero-cw-review__claims + .mero-cw-review__grey {\n margin-top: 10px;\n}\n.mero-cw-review__how {\n margin-top: 6px;\n}\n.mero-cw-review__how ul {\n margin: 0 0 4px;\n padding-left: 18px;\n color: var(--_muted);\n font-size: 12.5px;\n}\n.mero-cw-review__except {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 10px 0 0;\n padding: 0;\n list-style: none;\n}\n.mero-cw-review__except li {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 8px 10px;\n border-radius: 10px;\n background: var(--_warn-bg);\n color: var(--_warn-ink);\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__except .mero-cw-review__icon {\n margin-top: 2px;\n}\n.mero-cw-review__grey {\n display: flex;\n flex-direction: column;\n gap: 2px;\n margin: 0;\n padding: 10px 12px;\n border-radius: 10px;\n background: var(--_tone-bg);\n color: var(--_ink);\n}\n.mero-cw-review__grey span {\n color: var(--_muted);\n font-size: 12.5px;\n}\n.mero-cw-review__alert {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px 12px;\n margin: 10px 0 4px;\n padding: 10px 12px;\n border-radius: 10px;\n background: var(--_bad-bg);\n color: var(--_bad-ink);\n}\n.mero-cw-review__alert p {\n flex: 1 1 220px;\n margin: 0;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.mero-cw-review__buttons {\n position: sticky;\n bottom: calc(0px - var(--cw-review-inset, 0px));\n z-index: 1;\n display: flex;\n justify-content: space-between;\n gap: 10px;\n margin-top: 6px;\n padding: 14px 0 calc(env(safe-area-inset-bottom, 0px) + 8px);\n border-top: 1px solid var(--_line);\n background: var(--_surface);\n}\n.mero-cw-review__btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 40px;\n padding: 0 18px;\n border: 1px solid var(--_line);\n border-radius: 999px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n}\n.mero-cw-review__btn:hover:not(:disabled) {\n border-color: var(--_ink);\n}\n.mero-cw-review__btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n.mero-cw-review__buttons .mero-cw-review__btn {\n white-space: nowrap;\n}\n.mero-cw-review__btn--primary {\n border-color: transparent;\n background: var(--_primary-bg);\n color: var(--_primary-ink);\n}\n.mero-cw-review__btn--primary:hover:not(:disabled) {\n border-color: transparent;\n opacity: 0.88;\n}\n@media (max-width: 480px) {\n .mero-cw-review__kv > div {\n grid-template-columns: minmax(0, 1fr);\n gap: 0;\n }\n .mero-cw-review__kv dt {\n font-size: 12px;\n }\n .mero-cw-review__buttons .mero-cw-review__btn {\n flex: 1;\n padding: 0 12px;\n }\n .mero-cw-review__buttons .mero-cw-review__btn--primary {\n flex: 2;\n }\n}\n');
|
|
1873
1873
|
|
|
1874
1874
|
// src/create-workspace/createWorkspace.css
|
|
1875
|
-
chunkRRETZWNI_cjs.styleInject('.mero-cw-overlay {\n position: fixed;\n inset: 0;\n z-index: var(--cw-z, 2147483000);\n display: grid;\n place-items: center;\n padding: 16px;\n background: rgba(15, 17, 23, 0.45);\n}\n.mero-cw-card {\n position: relative;\n box-sizing: border-box;\n width: 100%;\n max-width: 420px;\n max-height: calc(100dvh - 32px);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n border-radius: 18px;\n background: var(--_surface);\n color: var(--_ink);\n box-shadow: 0 10px 30px rgba(15, 17, 23, 0.18);\n}\n.mero-cw-body {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n padding: 20px 22px 0;\n}\n.mero-cw-body > :last-child {\n margin-bottom: 20px;\n}\n.mero-cw-body .mero-cw-review__buttons {\n margin-bottom: 0;\n padding-bottom: 18px;\n}\n.mero-cw-card *,\n.mero-cw-card *::before,\n.mero-cw-card *::after {\n box-sizing: border-box;\n}\n.mero-cw-x {\n position: absolute;\n top: 12px;\n right: 14px;\n z-index: 2;\n display: grid;\n place-items: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: none;\n color: var(--_muted);\n cursor: pointer;\n}\n.mero-cw-x:hover {\n background: var(--_code-bg);\n color: var(--_ink);\n}\n.mero-cw-title {\n margin: 0 0 4px;\n padding-right: 28px;\n font-size: 17px;\n font-weight: 700;\n}\n.mero-cw-sub {\n margin: 0 0 14px;\n color: var(--_muted);\n font-size: 12.5px;\n line-height: 1.45;\n}\n.mero-cw-field {\n margin: 0 0 12px;\n}\n.mero-cw-field label {\n display: block;\n margin: 0 0 5px;\n font-size: 12px;\n font-weight: 600;\n}\n.mero-cw-field input {\n width: 100%;\n padding: 9px 11px;\n border: 1px solid var(--_line);\n border-radius: 10px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-size: 13px;\n}\n.mero-cw-field input:focus-visible {\n outline: 2px solid var(--_focus);\n outline-offset: 1px;\n}\n.mero-cw-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 38px;\n padding: 0 16px;\n border: 1px solid var(--_line);\n border-radius: 999px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n}\n.mero-cw-btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n.mero-cw-btn--primary {\n border-color: transparent;\n background: var(--_primary-bg);\n color: var(--_primary-ink);\n}\n.mero-cw-btn--full {\n width: 100%;\n}\n.mero-cw-btn:focus-visible,\n.mero-cw-link:focus-visible,\n.mero-cw-x:focus-visible {\n outline: 2px solid var(--_focus);\n outline-offset: 2px;\n}\n.mero-cw-link {\n border: 0;\n background: none;\n color: var(--_focus);\n font: inherit;\n font-size: 12.5px;\n font-weight: 600;\n cursor: pointer;\n}\n.mero-cw-link:hover {\n text-decoration: underline;\n}\n.mero-cw-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n margin-top: 14px;\n}\n.mero-cw-code {\n margin: 10px 0;\n padding: 10px;\n border-radius: 12px;\n background: var(--_code-bg);\n font-family:\n ui-monospace,\n "SF Mono",\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace;\n font-size: 22px;\n font-weight: 700;\n letter-spacing: 3px;\n text-align: center;\n}\n.mero-cw-wait {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--_muted);\n font-size: 12.5px;\n}\n.mero-cw-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--_focus);\n}\n@media (prefers-reduced-motion: no-preference) {\n .mero-cw-dot {\n animation: mero-cw-pulse 1.2s infinite;\n }\n}\n@keyframes mero-cw-pulse {\n 50% {\n opacity: 0.25;\n }\n}\n.mero-cw-error {\n margin: 0 0 12px;\n padding: 10px 12px;\n border-radius: 10px;\n background: var(--_bad-bg);\n color: var(--_bad-ink);\n font-size: 13px;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.mero-cw-notice {\n position: fixed;\n right: 16px;\n bottom: 16px;\n z-index: var(--cw-z, 2147483000);\n max-width: 360px;\n padding: 10px 14px;\n border-radius: 10px;\n background: var(--_surface);\n color: var(--_ink);\n font-size: 13px;\n line-height: 1.4;\n box-shadow: 0 0 0 1px var(--_line), 0 12px 28px -12px rgba(14, 18, 34, 0.4);\n}\n.mero-cw-choices {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin: 0 0 12px;\n padding: 0;\n border: 0;\n}\n.mero-cw-choice {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 10px 12px;\n border: 1px solid var(--_line);\n border-radius: 12px;\n cursor: pointer;\n}\n.mero-cw-choice:has(input:checked) {\n border-color: var(--_ink);\n}\n.mero-cw-choice input {\n margin-top: 3px;\n accent-color: var(--_primary-bg);\n}\n.mero-cw-choice b {\n display: block;\n font-size: 13px;\n}\n.mero-cw-choice .mero-cw-sub {\n display: block;\n margin: 2px 0 0;\n}\n.mero-cw-caps {\n display: flex;\n flex-direction: column;\n gap: 2px;\n margin: 0 0 14px;\n padding: 6px 4px;\n border-top: 1px solid var(--_line);\n border-bottom: 1px solid var(--_line);\n max-height: 220px;\n overflow-y: auto;\n}\n.mero-cw-cap {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 0 10px;\n padding: 6px 8px;\n font-size: 13px;\n}\n.mero-cw-cap label {\n display: flex;\n align-items: center;\n gap: 10px;\n cursor: pointer;\n}\n.mero-cw-cap[data-disabled] {\n color: var(--_muted);\n}\n.mero-cw-cap[data-disabled] label {\n cursor: not-allowed;\n}\n.mero-cw-cap input {\n margin: 0;\n accent-color: var(--_primary-bg);\n}\n.mero-cw-hint {\n display: inline;\n color: var(--_muted);\n font-size: 11.5px;\n}\n.mero-cw-visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n');
|
|
1875
|
+
chunkRRETZWNI_cjs.styleInject('.mero-cw-overlay {\n position: fixed;\n inset: 0;\n z-index: var(--cw-z, 2147483000);\n display: grid;\n place-items: center;\n padding: 16px;\n background: rgba(15, 17, 23, 0.45);\n}\n.mero-cw-card {\n position: relative;\n box-sizing: border-box;\n width: 100%;\n max-width: 420px;\n max-height: calc(100dvh - 32px);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n border-radius: 18px;\n background: var(--_surface);\n color: var(--_ink);\n box-shadow: 0 10px 30px rgba(15, 17, 23, 0.18);\n}\n.mero-cw-body {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n padding: 20px 22px 0;\n}\n.mero-cw-body > :last-child {\n margin-bottom: 20px;\n}\n.mero-cw-body .mero-cw-review__buttons {\n margin-bottom: 0;\n padding-bottom: 18px;\n}\n.mero-cw-card *,\n.mero-cw-card *::before,\n.mero-cw-card *::after {\n box-sizing: border-box;\n}\n.mero-cw-x {\n position: absolute;\n top: 12px;\n right: 14px;\n z-index: 2;\n display: grid;\n place-items: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: none;\n color: var(--_muted);\n cursor: pointer;\n}\n.mero-cw-x:hover {\n background: var(--_code-bg);\n color: var(--_ink);\n}\n.mero-cw-title {\n margin: 0 0 4px;\n padding-right: 28px;\n font-size: 17px;\n font-weight: 700;\n}\n.mero-cw-sub {\n margin: 0 0 14px;\n color: var(--_muted);\n font-size: 12.5px;\n line-height: 1.45;\n}\n.mero-cw-field {\n margin: 0 0 12px;\n}\n.mero-cw-field label {\n display: block;\n margin: 0 0 5px;\n font-size: 12px;\n font-weight: 600;\n}\n.mero-cw-field input {\n width: 100%;\n padding: 9px 11px;\n border: 1px solid var(--_line);\n border-radius: 10px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-size: 13px;\n}\n.mero-cw-field select {\n width: 100%;\n padding: 9px 11px;\n border: 1px solid var(--_line);\n border-radius: 10px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-size: 13px;\n}\n.mero-cw-field input:focus-visible,\n.mero-cw-field select:focus-visible {\n outline: 2px solid var(--_focus);\n outline-offset: 1px;\n}\n.mero-cw-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 38px;\n padding: 0 16px;\n border: 1px solid var(--_line);\n border-radius: 999px;\n background: var(--_surface);\n color: var(--_ink);\n font: inherit;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n}\n.mero-cw-btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n.mero-cw-btn--primary {\n border-color: transparent;\n background: var(--_primary-bg);\n color: var(--_primary-ink);\n}\n.mero-cw-btn--full {\n width: 100%;\n}\n.mero-cw-btn:focus-visible,\n.mero-cw-link:focus-visible,\n.mero-cw-x:focus-visible {\n outline: 2px solid var(--_focus);\n outline-offset: 2px;\n}\n.mero-cw-link {\n border: 0;\n background: none;\n color: var(--_focus);\n font: inherit;\n font-size: 12.5px;\n font-weight: 600;\n cursor: pointer;\n}\n.mero-cw-link:hover {\n text-decoration: underline;\n}\n.mero-cw-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n margin-top: 14px;\n}\n.mero-cw-code {\n margin: 10px 0;\n padding: 10px;\n border-radius: 12px;\n background: var(--_code-bg);\n font-family:\n ui-monospace,\n "SF Mono",\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace;\n font-size: 22px;\n font-weight: 700;\n letter-spacing: 3px;\n text-align: center;\n}\n.mero-cw-wait {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--_muted);\n font-size: 12.5px;\n}\n.mero-cw-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--_focus);\n}\n@media (prefers-reduced-motion: no-preference) {\n .mero-cw-dot {\n animation: mero-cw-pulse 1.2s infinite;\n }\n}\n@keyframes mero-cw-pulse {\n 50% {\n opacity: 0.25;\n }\n}\n.mero-cw-error {\n margin: 0 0 12px;\n padding: 10px 12px;\n border-radius: 10px;\n background: var(--_bad-bg);\n color: var(--_bad-ink);\n font-size: 13px;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.mero-cw-notice {\n position: fixed;\n right: 16px;\n bottom: 16px;\n z-index: var(--cw-z, 2147483000);\n max-width: 360px;\n padding: 10px 14px;\n border-radius: 10px;\n background: var(--_surface);\n color: var(--_ink);\n font-size: 13px;\n line-height: 1.4;\n box-shadow: 0 0 0 1px var(--_line), 0 12px 28px -12px rgba(14, 18, 34, 0.4);\n}\n.mero-cw-choices {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin: 0 0 12px;\n padding: 0;\n border: 0;\n}\n.mero-cw-choice {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 10px 12px;\n border: 1px solid var(--_line);\n border-radius: 12px;\n cursor: pointer;\n}\n.mero-cw-choice:has(input:checked) {\n border-color: var(--_ink);\n}\n.mero-cw-choice input {\n margin-top: 3px;\n accent-color: var(--_primary-bg);\n}\n.mero-cw-choice b {\n display: block;\n font-size: 13px;\n}\n.mero-cw-choice .mero-cw-sub {\n display: block;\n margin: 2px 0 0;\n}\n.mero-cw-caps {\n display: flex;\n flex-direction: column;\n gap: 2px;\n margin: 0 0 14px;\n padding: 6px 4px;\n border-top: 1px solid var(--_line);\n border-bottom: 1px solid var(--_line);\n max-height: 220px;\n overflow-y: auto;\n}\n.mero-cw-cap {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 0 10px;\n padding: 6px 8px;\n font-size: 13px;\n}\n.mero-cw-cap label {\n display: flex;\n align-items: center;\n gap: 10px;\n cursor: pointer;\n}\n.mero-cw-cap[data-disabled] {\n color: var(--_muted);\n}\n.mero-cw-cap[data-disabled] label {\n cursor: not-allowed;\n}\n.mero-cw-cap input {\n margin: 0;\n accent-color: var(--_primary-bg);\n}\n.mero-cw-hint {\n display: inline;\n color: var(--_muted);\n font-size: 11.5px;\n}\n.mero-cw-visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n');
|
|
1876
1876
|
var subscribeNothing = () => () => void 0;
|
|
1877
1877
|
var useMounted = () => react.useSyncExternalStore(subscribeNothing, () => true, () => false);
|
|
1878
1878
|
var CloseIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) });
|
|
@@ -2503,7 +2503,7 @@ function forgetIntent(key2) {
|
|
|
2503
2503
|
} catch {
|
|
2504
2504
|
}
|
|
2505
2505
|
}
|
|
2506
|
-
function useNodeConsent({ storageKey }) {
|
|
2506
|
+
function useNodeConsent({ storageKey, onError }) {
|
|
2507
2507
|
const { client } = useMero();
|
|
2508
2508
|
const consent = useConsent({ throwOnError: true });
|
|
2509
2509
|
const [bound, setBound] = react.useState(null);
|
|
@@ -2608,6 +2608,7 @@ function useNodeConsent({ storageKey }) {
|
|
|
2608
2608
|
if (problem) setError({ message: problem, code: null });
|
|
2609
2609
|
} catch (e) {
|
|
2610
2610
|
setError({ message: messageOf2(e), code: codeOf(e) });
|
|
2611
|
+
onError?.(e);
|
|
2611
2612
|
} finally {
|
|
2612
2613
|
if (win && !win.closed) win.close();
|
|
2613
2614
|
popup.current = null;
|
|
@@ -2825,7 +2826,7 @@ function heldCapabilities(org, account) {
|
|
|
2825
2826
|
var INVITE_KEY = "mero-react:invite-intent";
|
|
2826
2827
|
var ACCEPT_KEY = "mero-react:accept-invite-intent";
|
|
2827
2828
|
var NO_TOKEN = "Your node approved the request but made no invite. Nothing was changed.";
|
|
2828
|
-
var
|
|
2829
|
+
var noOrg = (noun) => `Your node approved the request but named no ${noun}. Nothing was changed.`;
|
|
2829
2830
|
var isInviteIntent = (v) => !!v && typeof v.role === "string";
|
|
2830
2831
|
var isObject = (v) => !!v && typeof v === "object";
|
|
2831
2832
|
var tokenOf = (r) => r.status === "approved" && r.kind === "createInvite" ? r.outcome?.token : void 0;
|
|
@@ -2838,19 +2839,25 @@ function useInviteCreate({ returnTo, linkBase, onCreated }) {
|
|
|
2838
2839
|
onCreated({ token, link: inviteLink(token, linkBase), ...capabilities === void 0 ? {} : { capabilities } });
|
|
2839
2840
|
return void 0;
|
|
2840
2841
|
};
|
|
2841
|
-
const create = ({ org, role, teams, capabilities }) =>
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2842
|
+
const create = ({ org, role, teams, uses, ttlSecs, allApps, capabilities }) => {
|
|
2843
|
+
const terms = {
|
|
2844
|
+
...teams?.length ? { teams } : {},
|
|
2845
|
+
...uses === void 0 ? {} : { uses },
|
|
2846
|
+
...ttlSecs === void 0 ? {} : { ttlSecs },
|
|
2847
|
+
...allApps === void 0 ? {} : { allApps },
|
|
2848
|
+
...capabilities === void 0 ? {} : { capabilities }
|
|
2849
|
+
};
|
|
2850
|
+
return start({
|
|
2851
|
+
request: meroJs.createInviteConsent({ org, role, ...terms }, returnTo),
|
|
2852
|
+
intent: { role, ...capabilities === void 0 ? {} : { capabilities }, ...linkBase ? { linkBase } : {} },
|
|
2853
|
+
direct: async () => {
|
|
2854
|
+
if (!client) throw new Error("Not connected to a node.");
|
|
2855
|
+
const answer = await client.orgs.inviteCreate({ org, role, ...terms }, confirmWith(passkey));
|
|
2856
|
+
return answer.token;
|
|
2857
|
+
},
|
|
2858
|
+
done: (outcome) => finish("direct" in outcome ? outcome.direct : tokenOf(outcome.consent), capabilities)
|
|
2859
|
+
});
|
|
2860
|
+
};
|
|
2854
2861
|
return { create, ...flow };
|
|
2855
2862
|
}
|
|
2856
2863
|
function useInviteResume({ linkBase, onCreated }) {
|
|
@@ -2860,14 +2867,14 @@ function useInviteResume({ linkBase, onCreated }) {
|
|
|
2860
2867
|
onApproved: (intent, result) => {
|
|
2861
2868
|
const token = tokenOf(result);
|
|
2862
2869
|
if (!token) return NO_TOKEN;
|
|
2863
|
-
onCreated({ token, link: inviteLink(token, linkBase), ...intent.capabilities === void 0 ? {} : { capabilities: intent.capabilities } });
|
|
2870
|
+
onCreated({ token, link: inviteLink(token, intent.linkBase ?? linkBase), ...intent.capabilities === void 0 ? {} : { capabilities: intent.capabilities } });
|
|
2864
2871
|
return void 0;
|
|
2865
2872
|
}
|
|
2866
2873
|
});
|
|
2867
2874
|
}
|
|
2868
|
-
function useInviteAccept({ returnTo, onJoined }) {
|
|
2875
|
+
function useInviteAccept({ returnTo, noun, onJoined, onError }) {
|
|
2869
2876
|
const ctx = useMero();
|
|
2870
|
-
const { start, ...flow } = useNodeConsent({ storageKey: ACCEPT_KEY });
|
|
2877
|
+
const { start, ...flow } = useNodeConsent({ storageKey: ACCEPT_KEY, onError });
|
|
2871
2878
|
const accept = (token) => start({
|
|
2872
2879
|
request: meroJs.acceptInviteConsent(token, returnTo),
|
|
2873
2880
|
intent: {},
|
|
@@ -2877,20 +2884,20 @@ function useInviteAccept({ returnTo, onJoined }) {
|
|
|
2877
2884
|
},
|
|
2878
2885
|
done: (outcome) => {
|
|
2879
2886
|
const org = "direct" in outcome ? outcome.direct : orgOf(outcome.consent);
|
|
2880
|
-
if (!org) return
|
|
2887
|
+
if (!org) return noOrg(noun);
|
|
2881
2888
|
onJoined({ org });
|
|
2882
2889
|
return void 0;
|
|
2883
2890
|
}
|
|
2884
2891
|
});
|
|
2885
2892
|
return { accept, ...flow };
|
|
2886
2893
|
}
|
|
2887
|
-
function useAcceptResume({ onJoined }) {
|
|
2894
|
+
function useAcceptResume({ noun, onJoined }) {
|
|
2888
2895
|
return useConsentResume({
|
|
2889
2896
|
storageKey: ACCEPT_KEY,
|
|
2890
2897
|
valid: isObject,
|
|
2891
2898
|
onApproved: (_intent, result) => {
|
|
2892
2899
|
const org = orgOf(result);
|
|
2893
|
-
if (!org) return
|
|
2900
|
+
if (!org) return noOrg(noun);
|
|
2894
2901
|
onJoined({ org });
|
|
2895
2902
|
return void 0;
|
|
2896
2903
|
}
|
|
@@ -2902,15 +2909,16 @@ var REFUSALS = {
|
|
|
2902
2909
|
UNKNOWN_CAPABILITIES: { text: "This cluster does not know one of the permissions you chose.", fallback: true }
|
|
2903
2910
|
};
|
|
2904
2911
|
var DEFAULT_LABELS = {
|
|
2912
|
+
noun: "workspace",
|
|
2905
2913
|
title: "Invite people",
|
|
2906
2914
|
subtitle: "Choose what the people you invite can do.",
|
|
2907
2915
|
next: "Create invite"
|
|
2908
2916
|
};
|
|
2909
|
-
function useOrgFacts(org) {
|
|
2917
|
+
function useOrgFacts(org, active) {
|
|
2910
2918
|
const { client, accountId } = useMero();
|
|
2911
2919
|
const [facts, setFacts] = react.useState(null);
|
|
2912
2920
|
react.useEffect(() => {
|
|
2913
|
-
if (!client) return;
|
|
2921
|
+
if (!client || !org || !active) return;
|
|
2914
2922
|
let live = true;
|
|
2915
2923
|
setFacts(null);
|
|
2916
2924
|
client.orgs.get({ org }).then(
|
|
@@ -2920,21 +2928,28 @@ function useOrgFacts(org) {
|
|
|
2920
2928
|
return () => {
|
|
2921
2929
|
live = false;
|
|
2922
2930
|
};
|
|
2923
|
-
}, [client, org, accountId]);
|
|
2931
|
+
}, [client, org, active, accountId]);
|
|
2924
2932
|
return facts;
|
|
2925
2933
|
}
|
|
2934
|
+
function describeDuration(secs) {
|
|
2935
|
+
const [unit, size] = secs >= 86400 ? ["day", 86400] : secs >= 3600 ? ["hour", 3600] : ["minute", 60];
|
|
2936
|
+
const n = Math.round(secs / size);
|
|
2937
|
+
return `${n} ${unit}${n === 1 ? "" : "s"}`;
|
|
2938
|
+
}
|
|
2926
2939
|
var originRoot = () => `${typeof window === "undefined" ? "" : window.location.origin}/`;
|
|
2927
2940
|
function InviteDialog({ client, passkey, ...props }) {
|
|
2928
2941
|
return /* @__PURE__ */ jsxRuntime.jsx(WithClient, { client, passkey, children: /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { ...props }) });
|
|
2929
2942
|
}
|
|
2930
|
-
function Dialog2({ open, onClose, org, teams, role = "member", appName, labels, onInvited, linkBase, returnTo }) {
|
|
2943
|
+
function Dialog2({ open, onClose, org, teams, role = "member", appName, inviterName, labels, onInvited, linkBase, returnTo, uses, ttlSecs, expiryOptions, allApps, permissions = true, shareExtra }) {
|
|
2931
2944
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
2932
|
-
const facts = useOrgFacts(org);
|
|
2945
|
+
const facts = useOrgFacts(org, open && permissions);
|
|
2946
|
+
const [expiry, setExpiry] = react.useState(null);
|
|
2947
|
+
const ttl = expiryOptions?.length ? expiry ?? (ttlSecs !== void 0 && expiryOptions.includes(ttlSecs) ? ttlSecs : expiryOptions[0]) : ttlSecs;
|
|
2933
2948
|
const [mode, setMode] = react.useState("default");
|
|
2934
2949
|
const [picked, setPicked] = react.useState(null);
|
|
2935
2950
|
const [shared, setShared] = react.useState(null);
|
|
2936
2951
|
const [copied, copy] = useCopy();
|
|
2937
|
-
const ids = [react.useId(), react.useId()];
|
|
2952
|
+
const ids = [react.useId(), react.useId(), react.useId()];
|
|
2938
2953
|
const onCreated = (invite) => {
|
|
2939
2954
|
setShared(invite);
|
|
2940
2955
|
onInvited?.(invite);
|
|
@@ -2961,17 +2976,20 @@ function Dialog2({ open, onClose, org, teams, role = "member", appName, labels,
|
|
|
2961
2976
|
body = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2962
2977
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mero-cw-title", children: "Invite link ready" }),
|
|
2963
2978
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mero-cw-sub", children: [
|
|
2979
|
+
inviterName ? `${inviterName} invites you${appName ? ` to ${appName}` : ""}. ` : "",
|
|
2964
2980
|
"Anyone with this link can join as a ",
|
|
2965
2981
|
role,
|
|
2966
2982
|
appName ? ` in ${appName}` : "",
|
|
2967
2983
|
".",
|
|
2968
2984
|
" ",
|
|
2969
|
-
perms ? perms.length ? `They can: ${perms.join(", ")}.` : "They get basic access only." :
|
|
2985
|
+
perms ? perms.length ? `They can: ${perms.join(", ")}.` : "They get basic access only." : `They get the ${text.noun}'s member defaults.`
|
|
2970
2986
|
] }),
|
|
2987
|
+
labels?.note && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mero-cw-sub", children: labels.note }),
|
|
2971
2988
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-cw-field", children: [
|
|
2972
2989
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: ids[0], children: "Invite link" }),
|
|
2973
2990
|
/* @__PURE__ */ jsxRuntime.jsx("input", { id: ids[0], readOnly: true, value: shared.link, onFocus: (e) => e.currentTarget.select() })
|
|
2974
2991
|
] }),
|
|
2992
|
+
shareExtra?.(shared.link),
|
|
2975
2993
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-cw-row", children: [
|
|
2976
2994
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "mero-cw-btn mero-cw-btn--primary", onClick: () => copy(shared.link), children: "Copy link" }),
|
|
2977
2995
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mero-cw-wait", role: "status", children: copied === "done" ? "Copied" : copied === "failed" ? "Could not copy" : "" }),
|
|
@@ -2979,7 +2997,7 @@ function Dialog2({ open, onClose, org, teams, role = "member", appName, labels,
|
|
|
2979
2997
|
] })
|
|
2980
2998
|
] });
|
|
2981
2999
|
} else {
|
|
2982
|
-
const defaultWords = !readable ?
|
|
3000
|
+
const defaultWords = !readable ? `the ${text.noun}'s member defaults` : describeCapabilities(facts.defaults).join(", ") || "basic access only";
|
|
2983
3001
|
body = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2984
3002
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mero-cw-title", children: text.title }),
|
|
2985
3003
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mero-cw-sub", children: text.subtitle }),
|
|
@@ -3006,42 +3024,52 @@ function Dialog2({ open, onClose, org, teams, role = "member", appName, labels,
|
|
|
3006
3024
|
)
|
|
3007
3025
|
] })
|
|
3008
3026
|
] }),
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3015
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "Default" }),
|
|
3016
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mero-cw-sub", children: `They get the workspace's member defaults: ${defaultWords}.` })
|
|
3017
|
-
] })
|
|
3027
|
+
permissions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3028
|
+
facts === "unreadable" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mero-cw-sub", children: [
|
|
3029
|
+
"We could not read this ",
|
|
3030
|
+
text.noun,
|
|
3031
|
+
"'s permissions, so only a default invite is available."
|
|
3018
3032
|
] }),
|
|
3019
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
3020
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
3021
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
3022
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
3023
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3033
|
+
/* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "mero-cw-choices", children: [
|
|
3034
|
+
/* @__PURE__ */ jsxRuntime.jsx("legend", { className: "mero-cw-visually-hidden", children: "Permissions" }),
|
|
3035
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "mero-cw-choice", children: [
|
|
3036
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "radio", name: ids[1], checked: mode === "default", onChange: () => setMode("default") }),
|
|
3037
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3038
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "Default" }),
|
|
3039
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mero-cw-sub", children: `They get the ${text.noun}'s member defaults: ${defaultWords}.` })
|
|
3040
|
+
] })
|
|
3041
|
+
] }),
|
|
3042
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "mero-cw-choice", children: [
|
|
3043
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "radio", name: ids[1], checked: mode === "custom", disabled: !readable, onChange: () => setMode("custom") }),
|
|
3044
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3045
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: "Custom" }),
|
|
3046
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mero-cw-sub", children: "Choose exactly what they can do." })
|
|
3047
|
+
] })
|
|
3024
3048
|
] })
|
|
3025
|
-
] })
|
|
3049
|
+
] }),
|
|
3050
|
+
mode === "custom" && readable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mero-cw-caps", children: CAPABILITY_LABELS.map(({ name, label }) => {
|
|
3051
|
+
const bit = meroJs.ORG_CAPABILITIES[name];
|
|
3052
|
+
const mine = (facts.held & bit) !== 0;
|
|
3053
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-cw-cap", "data-disabled": mine ? void 0 : "", children: [
|
|
3054
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
3055
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: mine && (bits & bit) !== 0, disabled: !mine, "aria-describedby": mine ? void 0 : `${ids[1]}-${name}`, onChange: (e) => setPicked(e.target.checked ? bits | bit : bits & ~bit) }),
|
|
3056
|
+
label
|
|
3057
|
+
] }),
|
|
3058
|
+
!mine && /* @__PURE__ */ jsxRuntime.jsx("span", { id: `${ids[1]}-${name}`, className: "mero-cw-hint", children: "You don't have this" })
|
|
3059
|
+
] }, name);
|
|
3060
|
+
}) })
|
|
3061
|
+
] }),
|
|
3062
|
+
expiryOptions && expiryOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-cw-field", children: [
|
|
3063
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: ids[2], children: "Expires after" }),
|
|
3064
|
+
/* @__PURE__ */ jsxRuntime.jsx("select", { id: ids[2], value: ttl, onChange: (e) => setExpiry(Number(e.target.value)), children: expiryOptions.map((secs) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: secs, children: describeDuration(secs) }, secs)) })
|
|
3026
3065
|
] }),
|
|
3027
|
-
mode === "custom" && readable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mero-cw-caps", children: CAPABILITY_LABELS.map(({ name, label }) => {
|
|
3028
|
-
const bit = meroJs.ORG_CAPABILITIES[name];
|
|
3029
|
-
const mine = (facts.held & bit) !== 0;
|
|
3030
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mero-cw-cap", "data-disabled": mine ? void 0 : "", children: [
|
|
3031
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
3032
|
-
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: mine && (bits & bit) !== 0, disabled: !mine, "aria-describedby": mine ? void 0 : `${ids[1]}-${name}`, onChange: (e) => setPicked(e.target.checked ? bits | bit : bits & ~bit) }),
|
|
3033
|
-
label
|
|
3034
|
-
] }),
|
|
3035
|
-
!mine && /* @__PURE__ */ jsxRuntime.jsx("span", { id: `${ids[1]}-${name}`, className: "mero-cw-hint", children: "You don't have this" })
|
|
3036
|
-
] }, name);
|
|
3037
|
-
}) }),
|
|
3038
3066
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3039
3067
|
"button",
|
|
3040
3068
|
{
|
|
3041
3069
|
type: "button",
|
|
3042
3070
|
className: "mero-cw-btn mero-cw-btn--primary mero-cw-btn--full",
|
|
3043
3071
|
disabled: !flow.ready || flow.phase !== "idle" || mode === "custom" && !readable,
|
|
3044
|
-
onClick: () => flow.create({ org, role, teams, ...mode === "custom" ? { capabilities: bits } : {} }),
|
|
3072
|
+
onClick: () => flow.create({ org, role, teams, uses, ttlSecs: ttl, allApps, ...mode === "custom" ? { capabilities: bits } : {} }),
|
|
3045
3073
|
children: flow.phase === "creating" ? "Creating\u2026" : text.next
|
|
3046
3074
|
}
|
|
3047
3075
|
)
|
|
@@ -3049,38 +3077,80 @@ function Dialog2({ open, onClose, org, teams, role = "member", appName, labels,
|
|
|
3049
3077
|
}
|
|
3050
3078
|
return /* @__PURE__ */ jsxRuntime.jsx(DialogShell, { label: text.title, locked: approving, onClose: () => approving ? flow.cancel() : close(), children: body });
|
|
3051
3079
|
}
|
|
3080
|
+
function useMembership(org, active) {
|
|
3081
|
+
const { client } = useMero();
|
|
3082
|
+
const [state, setState] = react.useState(null);
|
|
3083
|
+
react.useEffect(() => {
|
|
3084
|
+
if (!org || !active || !client) return;
|
|
3085
|
+
let live = true;
|
|
3086
|
+
client.auth.me().then(
|
|
3087
|
+
(me) => {
|
|
3088
|
+
const found = me.orgs?.find((o) => o.orgId === org);
|
|
3089
|
+
if (live) setState({ org, value: found ? { name: found.name ?? "" } : "no" });
|
|
3090
|
+
},
|
|
3091
|
+
() => live && setState({ org, value: "no" })
|
|
3092
|
+
);
|
|
3093
|
+
return () => {
|
|
3094
|
+
live = false;
|
|
3095
|
+
};
|
|
3096
|
+
}, [client, org, active]);
|
|
3097
|
+
if (!org) return "no";
|
|
3098
|
+
return state?.org === org ? state.value : "checking";
|
|
3099
|
+
}
|
|
3100
|
+
var article = (noun) => /^[aeiou]/i.test(noun) ? "an" : "a";
|
|
3052
3101
|
function AcceptInviteDialog({ client, passkey, ...props }) {
|
|
3053
3102
|
return /* @__PURE__ */ jsxRuntime.jsx(WithClient, { client, passkey, children: /* @__PURE__ */ jsxRuntime.jsx(Dialog3, { ...props }) });
|
|
3054
3103
|
}
|
|
3055
|
-
function Dialog3({ open, onClose, token, appName, onJoined, returnTo }) {
|
|
3056
|
-
const
|
|
3057
|
-
const
|
|
3104
|
+
function Dialog3({ open, onClose, token, org, appName, labels, onJoined, onError, returnTo }) {
|
|
3105
|
+
const noun = labels?.noun ?? "workspace";
|
|
3106
|
+
const text = {
|
|
3107
|
+
title: labels?.title ?? `Join ${noun}`,
|
|
3108
|
+
body: labels?.body ?? `You were invited to ${article(noun)} ${noun}${appName ? ` in ${appName}` : ""}. Join it with your account.`,
|
|
3109
|
+
join: labels?.join ?? "Join"
|
|
3110
|
+
};
|
|
3111
|
+
const flow = useInviteAccept({ returnTo: returnTo ?? `${typeof window === "undefined" ? "" : window.location.origin}/`, noun, onJoined, onError });
|
|
3112
|
+
const resume = useAcceptResume({ noun, onJoined });
|
|
3113
|
+
const member = useMembership(org, open);
|
|
3058
3114
|
const [dismissed, setDismissed] = react.useState(null);
|
|
3059
3115
|
const notice = resume.message && dismissed !== resume.message ? resume.message : null;
|
|
3060
3116
|
const redirecting = flow.phase === "redirect";
|
|
3061
3117
|
const approving = flow.phase === "approving" || redirecting;
|
|
3062
3118
|
if (!open && !notice) return null;
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3119
|
+
const already = typeof member === "object" ? member : null;
|
|
3120
|
+
const name = already?.name || `this ${noun}`;
|
|
3121
|
+
let body;
|
|
3122
|
+
if (approving) {
|
|
3123
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(ApprovalCard, { redirecting, code: flow.code, onCancel: flow.cancel, onProceed: flow.proceed, onReopen: flow.reopen });
|
|
3124
|
+
} else if (already && org) {
|
|
3125
|
+
body = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3126
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mero-cw-title", children: `You're already in ${name}` }),
|
|
3127
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mero-cw-sub", children: `The invitation was for ${name}, and you are already a member, so there is nothing to accept. It is still unused for the person it was meant for.` }),
|
|
3128
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "mero-cw-btn mero-cw-btn--primary mero-cw-btn--full", onClick: () => onJoined({ org }), children: "Continue" })
|
|
3129
|
+
] });
|
|
3130
|
+
} else {
|
|
3131
|
+
body = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3132
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mero-cw-title", children: text.title }),
|
|
3133
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mero-cw-sub", children: text.body }),
|
|
3134
|
+
[notice, flow.error].filter(Boolean).map((message) => /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mero-cw-error", role: "alert", children: [
|
|
3135
|
+
message,
|
|
3136
|
+
message === notice && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3137
|
+
" ",
|
|
3138
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "mero-cw-link", onClick: () => setDismissed(message), children: "Dismiss" })
|
|
3139
|
+
] })
|
|
3140
|
+
] }, message)),
|
|
3141
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3142
|
+
"button",
|
|
3143
|
+
{
|
|
3144
|
+
type: "button",
|
|
3145
|
+
className: "mero-cw-btn mero-cw-btn--primary mero-cw-btn--full",
|
|
3146
|
+
disabled: !flow.ready || flow.phase !== "idle" || member === "checking",
|
|
3147
|
+
onClick: () => flow.accept(token),
|
|
3148
|
+
children: flow.phase === "creating" ? "Joining\u2026" : text.join
|
|
3149
|
+
}
|
|
3150
|
+
)
|
|
3151
|
+
] });
|
|
3152
|
+
}
|
|
3153
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DialogShell, { label: already ? `You're already in ${name}` : text.title, locked: approving, onClose: () => approving ? flow.cancel() : onClose(), children: body });
|
|
3084
3154
|
}
|
|
3085
3155
|
|
|
3086
3156
|
Object.defineProperty(exports, "MeroContext", {
|