@arbidocs/blocks 0.5.160 → 0.5.162
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/{ConnectedCallDock-SD4DKTMX.cjs → ConnectedCallDock-ML4ZTABN.cjs} +21 -21
- package/dist/{ConnectedCallDock-SD4DKTMX.cjs.map → ConnectedCallDock-ML4ZTABN.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-2FLGH3JB.cjs → ConnectedCallRoom-GBTP2LT2.cjs} +14 -14
- package/dist/{ConnectedCallRoom-2FLGH3JB.cjs.map → ConnectedCallRoom-GBTP2LT2.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-PV3SDVMZ.cjs → ConnectedNativeDocxComparison-EDG5V4ZD.cjs} +15 -15
- package/dist/{ConnectedNativeDocxComparison-PV3SDVMZ.cjs.map → ConnectedNativeDocxComparison-EDG5V4ZD.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-J42JPUVR.cjs → ConnectedPresentation-LTVAUJ7Z.cjs} +19 -19
- package/dist/{ConnectedPresentation-J42JPUVR.cjs.map → ConnectedPresentation-LTVAUJ7Z.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-LB5B7OXR.cjs → ConnectedProductionSetDialog-7J4T3L6U.cjs} +3 -3
- package/dist/{ConnectedProductionSetDialog-LB5B7OXR.cjs.map → ConnectedProductionSetDialog-7J4T3L6U.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-BYS7HFNK.cjs → ConnectedSlidesTab-VLRDE7YI.cjs} +14 -14
- package/dist/{ConnectedSlidesTab-BYS7HFNK.cjs.map → ConnectedSlidesTab-VLRDE7YI.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-T6GE5GME.cjs → ConnectedStreamedWordArtifact-YBJ4R6ZK.cjs} +15 -15
- package/dist/{ConnectedStreamedWordArtifact-T6GE5GME.cjs.map → ConnectedStreamedWordArtifact-YBJ4R6ZK.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-UXGPQNTN.cjs → DocumentReviewCard-DZJP7FXQ.cjs} +15 -15
- package/dist/{DocumentReviewCard-UXGPQNTN.cjs.map → DocumentReviewCard-DZJP7FXQ.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-D6XDCE2U.cjs → FilesViewerDialog-3GFV36JQ.cjs} +45 -45
- package/dist/{FilesViewerDialog-D6XDCE2U.cjs.map → FilesViewerDialog-3GFV36JQ.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-NMERZJZZ.cjs → WorkspaceTableView-CPNVJDSS.cjs} +8 -8
- package/dist/{WorkspaceTableView-NMERZJZZ.cjs.map → WorkspaceTableView-CPNVJDSS.cjs.map} +1 -1
- package/dist/agents/index.cjs +284 -284
- package/dist/{ai-QFY4LYQZ.cjs → ai-NFZHPSS2.cjs} +25 -25
- package/dist/ai-NFZHPSS2.cjs.map +1 -0
- package/dist/calls/index.cjs +120 -120
- package/dist/chat/index.cjs +1 -1
- package/dist/{chunk-VU2MESEX.cjs → chunk-3F2ZZHGC.cjs} +36 -36
- package/dist/{chunk-VU2MESEX.cjs.map → chunk-3F2ZZHGC.cjs.map} +1 -1
- package/dist/{chunk-UJHQ4DA4.cjs → chunk-4GT4JLKS.cjs} +6 -6
- package/dist/{chunk-UJHQ4DA4.cjs.map → chunk-4GT4JLKS.cjs.map} +1 -1
- package/dist/{chunk-6OK7ESTL.cjs → chunk-63FEMB6U.cjs} +20 -8
- package/dist/chunk-63FEMB6U.cjs.map +1 -0
- package/dist/{chunk-MTN6HOY3.cjs → chunk-7KUMSKUX.cjs} +50 -50
- package/dist/{chunk-MTN6HOY3.cjs.map → chunk-7KUMSKUX.cjs.map} +1 -1
- package/dist/{chunk-K4763GD5.cjs → chunk-AIKPZJNI.cjs} +42 -8
- package/dist/chunk-AIKPZJNI.cjs.map +1 -0
- package/dist/{chunk-WQ2KG4LS.cjs → chunk-BCU65RJM.cjs} +3 -3
- package/dist/{chunk-WQ2KG4LS.cjs.map → chunk-BCU65RJM.cjs.map} +1 -1
- package/dist/{chunk-BX3WRCXV.cjs → chunk-C3LSYGSB.cjs} +4 -4
- package/dist/{chunk-BX3WRCXV.cjs.map → chunk-C3LSYGSB.cjs.map} +1 -1
- package/dist/{chunk-7UPEFZCV.cjs → chunk-C6EMTQHQ.cjs} +12 -12
- package/dist/{chunk-7UPEFZCV.cjs.map → chunk-C6EMTQHQ.cjs.map} +1 -1
- package/dist/{chunk-KCTQM3WO.cjs → chunk-DMPNQG4I.cjs} +28 -28
- package/dist/{chunk-KCTQM3WO.cjs.map → chunk-DMPNQG4I.cjs.map} +1 -1
- package/dist/{chunk-TD5V5BZ3.cjs → chunk-DN6VM5M5.cjs} +6 -6
- package/dist/{chunk-TD5V5BZ3.cjs.map → chunk-DN6VM5M5.cjs.map} +1 -1
- package/dist/{chunk-ZC7X4ZIX.cjs → chunk-ENKO65VY.cjs} +15 -15
- package/dist/{chunk-ZC7X4ZIX.cjs.map → chunk-ENKO65VY.cjs.map} +1 -1
- package/dist/{chunk-ZPBTXRMG.cjs → chunk-EOZWMKEJ.cjs} +4 -4
- package/dist/{chunk-ZPBTXRMG.cjs.map → chunk-EOZWMKEJ.cjs.map} +1 -1
- package/dist/{chunk-U4YOVI5D.cjs → chunk-FDIZWCYF.cjs} +6 -6
- package/dist/{chunk-U4YOVI5D.cjs.map → chunk-FDIZWCYF.cjs.map} +1 -1
- package/dist/{chunk-WOVNXJK5.cjs → chunk-GHGMOVQL.cjs} +3 -3
- package/dist/{chunk-WOVNXJK5.cjs.map → chunk-GHGMOVQL.cjs.map} +1 -1
- package/dist/{chunk-UD3LPATQ.cjs → chunk-HKKNHHBB.cjs} +6 -6
- package/dist/{chunk-UD3LPATQ.cjs.map → chunk-HKKNHHBB.cjs.map} +1 -1
- package/dist/{chunk-7G64NNCC.cjs → chunk-J6OMDBRT.cjs} +71 -70
- package/dist/chunk-J6OMDBRT.cjs.map +1 -0
- package/dist/{chunk-XTWHFHEK.cjs → chunk-JL4AL3ZJ.cjs} +4 -4
- package/dist/{chunk-XTWHFHEK.cjs.map → chunk-JL4AL3ZJ.cjs.map} +1 -1
- package/dist/{chunk-6P4U63HO.cjs → chunk-KAKEFIDS.cjs} +13 -13
- package/dist/{chunk-6P4U63HO.cjs.map → chunk-KAKEFIDS.cjs.map} +1 -1
- package/dist/{chunk-ZC6EPBVL.cjs → chunk-KHTM7M6E.cjs} +4 -4
- package/dist/{chunk-ZC6EPBVL.cjs.map → chunk-KHTM7M6E.cjs.map} +1 -1
- package/dist/{chunk-EG3DPKXM.cjs → chunk-L3MYUPSH.cjs} +5 -5
- package/dist/{chunk-EG3DPKXM.cjs.map → chunk-L3MYUPSH.cjs.map} +1 -1
- package/dist/{chunk-G3MRW4WB.cjs → chunk-LK4TQBV6.cjs} +3 -3
- package/dist/{chunk-G3MRW4WB.cjs.map → chunk-LK4TQBV6.cjs.map} +1 -1
- package/dist/{chunk-AHUEBRLX.cjs → chunk-LYDSETR7.cjs} +4 -4
- package/dist/{chunk-AHUEBRLX.cjs.map → chunk-LYDSETR7.cjs.map} +1 -1
- package/dist/{chunk-CYWOL2LS.cjs → chunk-MSFWSDRS.cjs} +3 -3
- package/dist/{chunk-CYWOL2LS.cjs.map → chunk-MSFWSDRS.cjs.map} +1 -1
- package/dist/{chunk-TU46WKTN.cjs → chunk-OIYKKUAN.cjs} +3 -3
- package/dist/{chunk-TU46WKTN.cjs.map → chunk-OIYKKUAN.cjs.map} +1 -1
- package/dist/{chunk-ZVQMCGUK.cjs → chunk-OQGESEWK.cjs} +26 -26
- package/dist/{chunk-ZVQMCGUK.cjs.map → chunk-OQGESEWK.cjs.map} +1 -1
- package/dist/{chunk-73KNWWBW.cjs → chunk-P4KNRU7Y.cjs} +48 -48
- package/dist/{chunk-73KNWWBW.cjs.map → chunk-P4KNRU7Y.cjs.map} +1 -1
- package/dist/{chunk-HIG4DR7Z.cjs → chunk-P6BN2XBX.cjs} +25 -15
- package/dist/chunk-P6BN2XBX.cjs.map +1 -0
- package/dist/{chunk-2EWDPIGO.cjs → chunk-Q5UQF2UZ.cjs} +4 -4
- package/dist/{chunk-2EWDPIGO.cjs.map → chunk-Q5UQF2UZ.cjs.map} +1 -1
- package/dist/{chunk-UWJ63GLD.cjs → chunk-QWRMC7H6.cjs} +7 -7
- package/dist/{chunk-UWJ63GLD.cjs.map → chunk-QWRMC7H6.cjs.map} +1 -1
- package/dist/{chunk-V27WLYTG.cjs → chunk-UEQNTXWV.cjs} +3 -3
- package/dist/{chunk-V27WLYTG.cjs.map → chunk-UEQNTXWV.cjs.map} +1 -1
- package/dist/{chunk-PIWXX2M4.cjs → chunk-UOE6VC36.cjs} +11 -11
- package/dist/{chunk-PIWXX2M4.cjs.map → chunk-UOE6VC36.cjs.map} +1 -1
- package/dist/{chunk-DYIZ7W4P.cjs → chunk-VBSEYTRN.cjs} +3 -3
- package/dist/{chunk-DYIZ7W4P.cjs.map → chunk-VBSEYTRN.cjs.map} +1 -1
- package/dist/{chunk-LLVE5TST.cjs → chunk-VJRO6J37.cjs} +3 -3
- package/dist/{chunk-LLVE5TST.cjs.map → chunk-VJRO6J37.cjs.map} +1 -1
- package/dist/{chunk-CX4VR3ZT.cjs → chunk-W3ZYBEFE.cjs} +64 -64
- package/dist/{chunk-CX4VR3ZT.cjs.map → chunk-W3ZYBEFE.cjs.map} +1 -1
- package/dist/{chunk-GF6AYAMI.cjs → chunk-XBZP5J24.cjs} +7 -7
- package/dist/{chunk-GF6AYAMI.cjs.map → chunk-XBZP5J24.cjs.map} +1 -1
- package/dist/{chunk-JARBYN6Z.cjs → chunk-Y3OI7ZP7.cjs} +3 -3
- package/dist/{chunk-JARBYN6Z.cjs.map → chunk-Y3OI7ZP7.cjs.map} +1 -1
- package/dist/{chunk-35UL4GE7.cjs → chunk-ZBE5O7S3.cjs} +4 -4
- package/dist/{chunk-35UL4GE7.cjs.map → chunk-ZBE5O7S3.cjs.map} +1 -1
- package/dist/{chunk-GS2C25ID.cjs → chunk-ZXXNVW34.cjs} +10 -10
- package/dist/{chunk-GS2C25ID.cjs.map → chunk-ZXXNVW34.cjs.map} +1 -1
- package/dist/connect/docx.cjs +18 -18
- package/dist/connect/index.cjs +1076 -1074
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +33 -33
- package/dist/connection/auth/useLoginActions.js +2 -1
- package/dist/connection/auth/useLoginActions.js.map +2 -2
- package/dist/connection/calendar/arbi-call.d.ts +6 -0
- package/dist/connection/calendar/arbi-call.js +14 -4
- package/dist/connection/calendar/arbi-call.js.map +2 -2
- package/dist/connection/calendar/useConnectedCalendarCalls.js +2 -2
- package/dist/connection/calendar/useConnectedCalendarCalls.js.map +2 -2
- package/dist/connection/messenger/ConnectedChatThread.d.ts +1 -1
- package/dist/connection/messenger/ConnectedChatThread.js +12 -10
- package/dist/connection/messenger/ConnectedChatThread.js.map +2 -2
- package/dist/connection/panels/useSessionPanelMode.d.ts +2 -3
- package/dist/connection/panels/useSessionPanelMode.js +20 -4
- package/dist/connection/panels/useSessionPanelMode.js.map +2 -2
- package/dist/dashboards/index.cjs +1 -1
- package/dist/embed/index.cjs +38 -38
- package/dist/files/index.cjs +228 -228
- package/dist/index.cjs +1746 -1746
- package/dist/pages/index.cjs +24 -24
- package/dist/settings/index.cjs +137 -137
- package/dist/shell/PanelPortal.js +41 -7
- package/dist/shell/PanelPortal.js.map +3 -3
- package/dist/shell/index.cjs +84 -84
- package/dist/studio/index.cjs +28 -28
- package/dist/workflow-canvas/index.cjs +55 -55
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ai-QFY4LYQZ.cjs.map +0 -1
- package/dist/chunk-6OK7ESTL.cjs.map +0 -1
- package/dist/chunk-7G64NNCC.cjs.map +0 -1
- package/dist/chunk-HIG4DR7Z.cjs.map +0 -1
- package/dist/chunk-K4763GD5.cjs.map +0 -1
package/dist/connect/viewer.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkW3ZYBEFE_cjs = require('../chunk-W3ZYBEFE.cjs');
|
|
5
5
|
require('../chunk-JITYC4OS.cjs');
|
|
6
6
|
require('../chunk-WVZLAAIZ.cjs');
|
|
7
7
|
require('../chunk-X7ALF4MP.cjs');
|
|
8
8
|
require('../chunk-4CIVQWAX.cjs');
|
|
9
9
|
require('../chunk-QWVUBTW3.cjs');
|
|
10
10
|
require('../chunk-JVEDKKNO.cjs');
|
|
11
|
-
require('../chunk-
|
|
12
|
-
require('../chunk-
|
|
13
|
-
require('../chunk-
|
|
14
|
-
require('../chunk-
|
|
11
|
+
require('../chunk-ZBE5O7S3.cjs');
|
|
12
|
+
require('../chunk-MSFWSDRS.cjs');
|
|
13
|
+
require('../chunk-3F2ZZHGC.cjs');
|
|
14
|
+
require('../chunk-LYDSETR7.cjs');
|
|
15
15
|
require('../chunk-HYUKPHCT.cjs');
|
|
16
16
|
var chunkDLGYR4JL_cjs = require('../chunk-DLGYR4JL.cjs');
|
|
17
17
|
require('../chunk-JWCVA4LC.cjs');
|
|
18
|
-
require('../chunk-
|
|
18
|
+
require('../chunk-Q5UQF2UZ.cjs');
|
|
19
19
|
require('../chunk-223D4727.cjs');
|
|
20
20
|
require('../chunk-SNUBQMIS.cjs');
|
|
21
|
-
require('../chunk-
|
|
21
|
+
require('../chunk-ZXXNVW34.cjs');
|
|
22
22
|
require('../chunk-4ONPEVTP.cjs');
|
|
23
23
|
require('../chunk-V3KLUWQQ.cjs');
|
|
24
24
|
require('../chunk-5GBM7BQB.cjs');
|
|
25
|
-
require('../chunk-
|
|
25
|
+
require('../chunk-HKKNHHBB.cjs');
|
|
26
26
|
require('../chunk-3RAW2ZH5.cjs');
|
|
27
27
|
require('../chunk-D4SJT3NG.cjs');
|
|
28
28
|
require('../chunk-OUYBYZ7Y.cjs');
|
|
@@ -31,35 +31,47 @@ require('../chunk-DTMBAFIL.cjs');
|
|
|
31
31
|
require('../chunk-7NJKDJVO.cjs');
|
|
32
32
|
require('../chunk-LIDXIX36.cjs');
|
|
33
33
|
require('../chunk-34HQO4ZQ.cjs');
|
|
34
|
-
require('../chunk-
|
|
35
|
-
require('../chunk-
|
|
34
|
+
require('../chunk-CT3SLXB7.cjs');
|
|
35
|
+
require('../chunk-UOE6VC36.cjs');
|
|
36
|
+
require('../chunk-AIKPZJNI.cjs');
|
|
36
37
|
require('../chunk-2RLA6QO2.cjs');
|
|
37
38
|
require('../chunk-MZZ3SBQL.cjs');
|
|
38
|
-
require('../chunk-
|
|
39
|
-
require('../chunk-
|
|
39
|
+
require('../chunk-VJRO6J37.cjs');
|
|
40
|
+
require('../chunk-VBSEYTRN.cjs');
|
|
40
41
|
require('../chunk-WQMR3O2D.cjs');
|
|
41
42
|
require('../chunk-NZNBJF3M.cjs');
|
|
42
43
|
require('../chunk-NWNVWO6L.cjs');
|
|
43
44
|
require('../chunk-WRTEKOQP.cjs');
|
|
44
45
|
require('../chunk-SK6HQ46Q.cjs');
|
|
45
|
-
require('../chunk-
|
|
46
|
-
require('../chunk-
|
|
46
|
+
require('../chunk-DEXUL3T6.cjs');
|
|
47
|
+
require('../chunk-AFQTQC7A.cjs');
|
|
48
|
+
require('../chunk-XJEXFEWG.cjs');
|
|
49
|
+
require('../chunk-Z2XZ2D4N.cjs');
|
|
50
|
+
require('../chunk-YZSQ7F5K.cjs');
|
|
51
|
+
require('../chunk-MCXS6X37.cjs');
|
|
52
|
+
require('../chunk-KQF7POTG.cjs');
|
|
47
53
|
require('../chunk-WCT6FT2K.cjs');
|
|
48
54
|
require('../chunk-LH3PDPJP.cjs');
|
|
55
|
+
require('../chunk-75BNMCUX.cjs');
|
|
49
56
|
require('../chunk-OEJQFPWO.cjs');
|
|
50
57
|
require('../chunk-OYXWQTHF.cjs');
|
|
51
58
|
require('../chunk-S237ORM3.cjs');
|
|
52
59
|
require('../chunk-II2OEXHW.cjs');
|
|
53
|
-
require('../chunk-
|
|
60
|
+
require('../chunk-FX3K6LNZ.cjs');
|
|
61
|
+
require('../chunk-OIYKKUAN.cjs');
|
|
54
62
|
require('../chunk-3YEXZX4H.cjs');
|
|
55
63
|
require('../chunk-4PA6VCCR.cjs');
|
|
56
|
-
require('../chunk-
|
|
64
|
+
require('../chunk-LK4TQBV6.cjs');
|
|
57
65
|
require('../chunk-AHDJXIUB.cjs');
|
|
58
66
|
require('../chunk-S3GVFAFB.cjs');
|
|
59
67
|
require('../chunk-6UZC4XVV.cjs');
|
|
60
68
|
require('../chunk-SLCH5JRI.cjs');
|
|
69
|
+
require('../chunk-Y3GJBLAI.cjs');
|
|
70
|
+
require('../chunk-SQCCQU3K.cjs');
|
|
71
|
+
require('../chunk-UDSHVNU3.cjs');
|
|
61
72
|
require('../chunk-DKY67DA6.cjs');
|
|
62
73
|
require('../chunk-YA6GXWC2.cjs');
|
|
74
|
+
require('../chunk-IPSHAMO2.cjs');
|
|
63
75
|
require('../chunk-ZVEW3JBT.cjs');
|
|
64
76
|
require('../chunk-MHIG6GGS.cjs');
|
|
65
77
|
require('../chunk-VG24E4JJ.cjs');
|
|
@@ -71,33 +83,21 @@ require('../chunk-DWN5AUMH.cjs');
|
|
|
71
83
|
require('../chunk-GB5MN5FC.cjs');
|
|
72
84
|
require('../chunk-3YZKDCWY.cjs');
|
|
73
85
|
require('../chunk-SJSGSHIT.cjs');
|
|
74
|
-
require('../chunk-ZW6FPIFC.cjs');
|
|
75
|
-
require('../chunk-CT3SLXB7.cjs');
|
|
76
|
-
require('../chunk-DEXUL3T6.cjs');
|
|
77
|
-
require('../chunk-AFQTQC7A.cjs');
|
|
78
|
-
require('../chunk-XJEXFEWG.cjs');
|
|
79
|
-
require('../chunk-Z2XZ2D4N.cjs');
|
|
80
|
-
require('../chunk-YZSQ7F5K.cjs');
|
|
81
|
-
require('../chunk-MCXS6X37.cjs');
|
|
82
|
-
require('../chunk-KQF7POTG.cjs');
|
|
83
|
-
require('../chunk-75BNMCUX.cjs');
|
|
84
|
-
require('../chunk-FX3K6LNZ.cjs');
|
|
85
|
-
require('../chunk-Y3GJBLAI.cjs');
|
|
86
|
-
require('../chunk-SQCCQU3K.cjs');
|
|
87
|
-
require('../chunk-UDSHVNU3.cjs');
|
|
88
|
-
require('../chunk-IPSHAMO2.cjs');
|
|
89
86
|
require('../chunk-PPCATBOY.cjs');
|
|
87
|
+
require('../chunk-ZW6FPIFC.cjs');
|
|
88
|
+
require('../chunk-LJJJ6CYH.cjs');
|
|
89
|
+
require('../chunk-MNIQDXM6.cjs');
|
|
90
|
+
require('../chunk-EKFA2OS3.cjs');
|
|
90
91
|
require('../chunk-46LX6EQT.cjs');
|
|
91
92
|
require('../chunk-K67VMSOX.cjs');
|
|
92
93
|
require('../chunk-CVPV4I7Z.cjs');
|
|
93
|
-
require('../chunk-LJJJ6CYH.cjs');
|
|
94
94
|
require('../chunk-PLIF5CUV.cjs');
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
Object.defineProperty(exports, "ConnectedDocumentViewer", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunkW3ZYBEFE_cjs.ConnectedDocumentViewer; }
|
|
101
101
|
});
|
|
102
102
|
Object.defineProperty(exports, "ConnectedDocumentToolsProvider", {
|
|
103
103
|
enumerable: true,
|
|
@@ -24,6 +24,7 @@ function useLoginActions({
|
|
|
24
24
|
const { passwordRules, onRegistered, onUnlockedOffline } = useAuthPages();
|
|
25
25
|
const [isAuthenticating, setIsAuthenticating] = useState(false);
|
|
26
26
|
const [isRequestingCode, setIsRequestingCode] = useState(false);
|
|
27
|
+
const restoring = signInLayer?.status === "connecting";
|
|
27
28
|
const {
|
|
28
29
|
email,
|
|
29
30
|
password,
|
|
@@ -179,7 +180,7 @@ function useLoginActions({
|
|
|
179
180
|
]
|
|
180
181
|
);
|
|
181
182
|
return {
|
|
182
|
-
isAuthenticating,
|
|
183
|
+
isAuthenticating: isAuthenticating || restoring,
|
|
183
184
|
isRequestingCode,
|
|
184
185
|
handleSsoLogin,
|
|
185
186
|
handleLocalLogin,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/auth/useLoginActions.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * What the sign-in page does: local sign-in (or an offline unlock with no network), registration\n * (then straight in), the verification email and the hand-over to SSO. Every sign-in goes through\n * the host's `Arbi` (`arbi.login`), so the SDK opens the identity, stores the keys and signs the\n * session in, and the site's sign-in hooks run around it.\n */\n\nimport { useCallback, useState } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport { parseAuthError } from '../../auth/auth-error'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { backUpOnSignup } from './signup-backup'\nimport { useOptionalConnection } from '../ConnectionProvider'\nimport { useAuthPages, useSsoSignIn } from './support'\nimport type { LoginFormActions, LoginFormState } from './useLoginForm'\n\nconst BAD_CREDENTIALS =\n 'This username/password combination is not valid. Please double-check your credentials and try again.'\n\nexport function useLoginActions({\n formState,\n formActions,\n onError,\n}: {\n formState: LoginFormState\n formActions: LoginFormActions\n /** Show a refusal in the form itself. Default: a notice. */\n onError?: (message: string) => void\n}) {\n const arbi = useArbi()\n const signInLayer = useOptionalConnection()\n const sso = useSsoSignIn()\n const environment = useBlocksEnvironment()\n // Errors go to the form's own place when it has one; everything else is a notice.\n const environmentNotify = environment.notify\n const notify = useCallback<typeof environmentNotify>(\n (...args) =>\n args[1] === 'error' && onError && typeof args[0] === 'string'\n ? onError(args[0])\n : environmentNotify(...args),\n [environmentNotify, onError]\n )\n const { passwordRules, onRegistered, onUnlockedOffline } = useAuthPages()\n\n // True from the moment a login/registration submit starts doing real work until it fails.\n // Deliberately NOT cleared on success: after the API call there is still key setup, session\n // storage and the signed-in app's download before this page is replaced, and the button must not\n // flip back to \"Sign in\" and look idle then.\n const [isAuthenticating, setIsAuthenticating] = useState(false)\n const [isRequestingCode, setIsRequestingCode] = useState(false)\n\n const {\n email,\n password,\n confirmPassword,\n firstName,\n lastName,\n verificationCode,\n cooldownSeconds,\n } = formState\n const { setVerificationSent, setIsRedirecting, startCooldown, validateEmailWithError } =\n formActions\n\n /** Hand over to the SSO provider. */\n const handleSsoLogin = useCallback(\n (connection?: string) => {\n arbi.session?.setSsoMode(true)\n setIsRedirecting(true)\n sso.signIn(connection ? { connection } : undefined).catch((error) => {\n console.error('Error during SSO redirect:', error)\n setIsRedirecting(false)\n notify(\n 'There was a problem connecting to the authentication service. Please try again.',\n 'error'\n )\n })\n },\n [arbi, sso, setIsRedirecting, notify]\n )\n\n /** Send the verification email (a link and a three-word code). */\n const handleRequestVerificationCode = useCallback(async () => {\n if (cooldownSeconds > 0) {\n notify(`Please wait ${cooldownSeconds} seconds before requesting again`, 'warning')\n return\n }\n if (!validateEmailWithError(email)) return\n\n setIsRequestingCode(true)\n try {\n const sent = await arbi.requestVerification(email)\n setVerificationSent(true)\n notify(sent, 'success')\n startCooldown(30)\n } catch (error: unknown) {\n console.error('Verification email error:', error)\n const { detail, message } = error as { detail?: string; message?: string }\n notify(detail || message || 'Unable to send verification email.', 'error')\n } finally {\n setIsRequestingCode(false)\n }\n }, [\n arbi,\n cooldownSeconds,\n email,\n validateEmailWithError,\n setVerificationSent,\n startCooldown,\n notify,\n ])\n\n /** Local (non-SSO) sign-in; offline, an unlock on this device. */\n const handleLocalLogin = useCallback(\n async (opts?: {\n isFreshRegistration?: boolean\n /** Sign in with these, not the form's (a sign-in link's). */\n credentials?: { email: string; password: string }\n }) => {\n arbi.session?.setSsoMode(false)\n const loginEmail = opts?.credentials?.email ?? email\n const loginPassword = opts?.credentials?.password ?? password\n\n if (!loginPassword) {\n notify('Please fill in all required fields.', 'error')\n return\n }\n if (!validateEmailWithError(loginEmail)) return\n\n // Offline: unlock locally from the saved session instead of calling the backend. The\n // password still derives the key client-side; it is the same login box with no\n // /v1/user/login. This is what lets you back in (and back to your offline files) after a\n // \"log out (this device)\" with no network.\n if (typeof navigator !== 'undefined' && !navigator.onLine) {\n try {\n await arbi.unlock(loginEmail, loginPassword)\n onUnlockedOffline?.()\n } catch (err: unknown) {\n notify(\n err instanceof Error && err.message === 'no-session'\n ? 'You need to be online to log in on this device.'\n : BAD_CREDENTIALS,\n 'error'\n )\n }\n return\n }\n\n // A demo site (`defaultHost` with no backend configured) enters its demo workspace.\n if (signInLayer && !signInLayer.apiConfigured) {\n await signInLayer.login(loginEmail, loginPassword)\n return\n }\n\n setIsAuthenticating(true)\n try {\n const login = await arbi.login(loginEmail, loginPassword)\n // The single welcome toast comes with the signed-in app; none here. Where to land is the\n // site's: a fresh registration hands its login over.\n if (opts?.isFreshRegistration) onRegistered?.(login)\n return login\n } catch (error: unknown) {\n setIsAuthenticating(false)\n console.error('Login error:', error)\n notify(\n parseAuthError(error, {\n messageMap: { 'Incorrect username or password': BAD_CREDENTIALS },\n }),\n 'error'\n )\n }\n },\n [\n arbi,\n signInLayer,\n email,\n password,\n validateEmailWithError,\n notify,\n onRegistered,\n onUnlockedOffline,\n ]\n )\n\n /** Registration, then straight in. */\n const handleRegister = useCallback(\n async (saveRecoveryKey = true) => {\n arbi.session?.setSsoMode(false)\n\n if (!password || !confirmPassword || !firstName || !lastName || !verificationCode) {\n notify('Please fill in all required fields.', 'error')\n return\n }\n if (!validateEmailWithError(email)) return\n if (password !== confirmPassword) {\n notify('Passwords do not match. Please ensure both password fields are identical.', 'error')\n return\n }\n const passwordError = passwordRules.error(password)\n if (passwordError) {\n notify(passwordError, 'error')\n return\n }\n\n setIsAuthenticating(true)\n try {\n const { signingPrivateKey } = await arbi.register({\n email,\n password,\n verificationCode: verificationCode.trim(),\n firstName,\n lastName,\n })\n // Password manager save always; recovery key download unless opted out. After the\n // account exists: each attempt generates a new random identity, so a recovery file saved\n // for a failed attempt would recover nothing.\n await backUpOnSignup({ email, password, signingPrivateKey, saveRecoveryKey })\n // No success toast: the button already says \"Creating your account\u2026\", and the next thing\n // the user sees (the site's first landing) is the confirmation.\n await handleLocalLogin({ isFreshRegistration: true })\n } catch (error: unknown) {\n setIsAuthenticating(false)\n console.error('Registration error:', error)\n notify(parseAuthError(error), 'error')\n }\n },\n [\n arbi,\n email,\n password,\n confirmPassword,\n firstName,\n lastName,\n verificationCode,\n validateEmailWithError,\n passwordRules,\n handleLocalLogin,\n notify,\n ]\n )\n\n return {\n isAuthenticating,\n isRequestingCode,\n handleSsoLogin,\n handleLocalLogin,\n handleRegister,\n handleRequestVerificationCode,\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,aAAa,gBAAgB;AACtC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,cAAc,oBAAoB;AAG3C,MAAM,kBACJ;AAEK,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,sBAAsB;AAC1C,QAAM,MAAM,aAAa;AACzB,QAAM,cAAc,qBAAqB;AAEzC,QAAM,oBAAoB,YAAY;AACtC,QAAM,SAAS;AAAA,IACb,IAAI,SACF,KAAK,CAAC,MAAM,WAAW,WAAW,OAAO,KAAK,CAAC,MAAM,WACjD,QAAQ,KAAK,CAAC,CAAC,IACf,kBAAkB,GAAG,IAAI;AAAA,IAC/B,CAAC,mBAAmB,OAAO;AAAA,EAC7B;AACA,QAAM,EAAE,eAAe,cAAc,kBAAkB,IAAI,aAAa;AAMxE,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAC9D,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;
|
|
4
|
+
"sourcesContent": ["/**\n * What the sign-in page does: local sign-in (or an offline unlock with no network), registration\n * (then straight in), the verification email and the hand-over to SSO. Every sign-in goes through\n * the host's `Arbi` (`arbi.login`), so the SDK opens the identity, stores the keys and signs the\n * session in, and the site's sign-in hooks run around it.\n */\n\nimport { useCallback, useState } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport { parseAuthError } from '../../auth/auth-error'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { backUpOnSignup } from './signup-backup'\nimport { useOptionalConnection } from '../ConnectionProvider'\nimport { useAuthPages, useSsoSignIn } from './support'\nimport type { LoginFormActions, LoginFormState } from './useLoginForm'\n\nconst BAD_CREDENTIALS =\n 'This username/password combination is not valid. Please double-check your credentials and try again.'\n\nexport function useLoginActions({\n formState,\n formActions,\n onError,\n}: {\n formState: LoginFormState\n formActions: LoginFormActions\n /** Show a refusal in the form itself. Default: a notice. */\n onError?: (message: string) => void\n}) {\n const arbi = useArbi()\n const signInLayer = useOptionalConnection()\n const sso = useSsoSignIn()\n const environment = useBlocksEnvironment()\n // Errors go to the form's own place when it has one; everything else is a notice.\n const environmentNotify = environment.notify\n const notify = useCallback<typeof environmentNotify>(\n (...args) =>\n args[1] === 'error' && onError && typeof args[0] === 'string'\n ? onError(args[0])\n : environmentNotify(...args),\n [environmentNotify, onError]\n )\n const { passwordRules, onRegistered, onUnlockedOffline } = useAuthPages()\n\n // True from the moment a login/registration submit starts doing real work until it fails.\n // Deliberately NOT cleared on success: after the API call there is still key setup, session\n // storage and the signed-in app's download before this page is replaced, and the button must not\n // flip back to \"Sign in\" and look idle then.\n const [isAuthenticating, setIsAuthenticating] = useState(false)\n const [isRequestingCode, setIsRequestingCode] = useState(false)\n // The session kept on this device is signing in again (or a sign-in is opening its workspace):\n // the form waits, busy, so nothing typed is lost when the page moves on.\n const restoring = signInLayer?.status === 'connecting'\n\n const {\n email,\n password,\n confirmPassword,\n firstName,\n lastName,\n verificationCode,\n cooldownSeconds,\n } = formState\n const { setVerificationSent, setIsRedirecting, startCooldown, validateEmailWithError } =\n formActions\n\n /** Hand over to the SSO provider. */\n const handleSsoLogin = useCallback(\n (connection?: string) => {\n arbi.session?.setSsoMode(true)\n setIsRedirecting(true)\n sso.signIn(connection ? { connection } : undefined).catch((error) => {\n console.error('Error during SSO redirect:', error)\n setIsRedirecting(false)\n notify(\n 'There was a problem connecting to the authentication service. Please try again.',\n 'error'\n )\n })\n },\n [arbi, sso, setIsRedirecting, notify]\n )\n\n /** Send the verification email (a link and a three-word code). */\n const handleRequestVerificationCode = useCallback(async () => {\n if (cooldownSeconds > 0) {\n notify(`Please wait ${cooldownSeconds} seconds before requesting again`, 'warning')\n return\n }\n if (!validateEmailWithError(email)) return\n\n setIsRequestingCode(true)\n try {\n const sent = await arbi.requestVerification(email)\n setVerificationSent(true)\n notify(sent, 'success')\n startCooldown(30)\n } catch (error: unknown) {\n console.error('Verification email error:', error)\n const { detail, message } = error as { detail?: string; message?: string }\n notify(detail || message || 'Unable to send verification email.', 'error')\n } finally {\n setIsRequestingCode(false)\n }\n }, [\n arbi,\n cooldownSeconds,\n email,\n validateEmailWithError,\n setVerificationSent,\n startCooldown,\n notify,\n ])\n\n /** Local (non-SSO) sign-in; offline, an unlock on this device. */\n const handleLocalLogin = useCallback(\n async (opts?: {\n isFreshRegistration?: boolean\n /** Sign in with these, not the form's (a sign-in link's). */\n credentials?: { email: string; password: string }\n }) => {\n arbi.session?.setSsoMode(false)\n const loginEmail = opts?.credentials?.email ?? email\n const loginPassword = opts?.credentials?.password ?? password\n\n if (!loginPassword) {\n notify('Please fill in all required fields.', 'error')\n return\n }\n if (!validateEmailWithError(loginEmail)) return\n\n // Offline: unlock locally from the saved session instead of calling the backend. The\n // password still derives the key client-side; it is the same login box with no\n // /v1/user/login. This is what lets you back in (and back to your offline files) after a\n // \"log out (this device)\" with no network.\n if (typeof navigator !== 'undefined' && !navigator.onLine) {\n try {\n await arbi.unlock(loginEmail, loginPassword)\n onUnlockedOffline?.()\n } catch (err: unknown) {\n notify(\n err instanceof Error && err.message === 'no-session'\n ? 'You need to be online to log in on this device.'\n : BAD_CREDENTIALS,\n 'error'\n )\n }\n return\n }\n\n // A demo site (`defaultHost` with no backend configured) enters its demo workspace.\n if (signInLayer && !signInLayer.apiConfigured) {\n await signInLayer.login(loginEmail, loginPassword)\n return\n }\n\n setIsAuthenticating(true)\n try {\n const login = await arbi.login(loginEmail, loginPassword)\n // The single welcome toast comes with the signed-in app; none here. Where to land is the\n // site's: a fresh registration hands its login over.\n if (opts?.isFreshRegistration) onRegistered?.(login)\n return login\n } catch (error: unknown) {\n setIsAuthenticating(false)\n console.error('Login error:', error)\n notify(\n parseAuthError(error, {\n messageMap: { 'Incorrect username or password': BAD_CREDENTIALS },\n }),\n 'error'\n )\n }\n },\n [\n arbi,\n signInLayer,\n email,\n password,\n validateEmailWithError,\n notify,\n onRegistered,\n onUnlockedOffline,\n ]\n )\n\n /** Registration, then straight in. */\n const handleRegister = useCallback(\n async (saveRecoveryKey = true) => {\n arbi.session?.setSsoMode(false)\n\n if (!password || !confirmPassword || !firstName || !lastName || !verificationCode) {\n notify('Please fill in all required fields.', 'error')\n return\n }\n if (!validateEmailWithError(email)) return\n if (password !== confirmPassword) {\n notify('Passwords do not match. Please ensure both password fields are identical.', 'error')\n return\n }\n const passwordError = passwordRules.error(password)\n if (passwordError) {\n notify(passwordError, 'error')\n return\n }\n\n setIsAuthenticating(true)\n try {\n const { signingPrivateKey } = await arbi.register({\n email,\n password,\n verificationCode: verificationCode.trim(),\n firstName,\n lastName,\n })\n // Password manager save always; recovery key download unless opted out. After the\n // account exists: each attempt generates a new random identity, so a recovery file saved\n // for a failed attempt would recover nothing.\n await backUpOnSignup({ email, password, signingPrivateKey, saveRecoveryKey })\n // No success toast: the button already says \"Creating your account\u2026\", and the next thing\n // the user sees (the site's first landing) is the confirmation.\n await handleLocalLogin({ isFreshRegistration: true })\n } catch (error: unknown) {\n setIsAuthenticating(false)\n console.error('Registration error:', error)\n notify(parseAuthError(error), 'error')\n }\n },\n [\n arbi,\n email,\n password,\n confirmPassword,\n firstName,\n lastName,\n verificationCode,\n validateEmailWithError,\n passwordRules,\n handleLocalLogin,\n notify,\n ]\n )\n\n return {\n isAuthenticating: isAuthenticating || resto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K,CAAC;AAAA,MACtD,SAAS,OAAgB;AACvB,4BAAoB,KAAK;AACzB,gBAAQ,MAAM,uBAAuB,KAAK;AAC1C,eAAO,eAAe,KAAK,GAAG,OAAO;AAAA,MACvC;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,kBAAkB,oBAAoB;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -48,6 +48,12 @@ export declare function parseArbiCallUrl(url: string | null | undefined, origin?
|
|
|
48
48
|
key: Uint8Array;
|
|
49
49
|
linkVersion: number | null;
|
|
50
50
|
} | null;
|
|
51
|
+
/** Resolve links for this signed-in deployment, including its canonical HTTPS address. */
|
|
52
|
+
export declare function parseArbiCallUrlForClient(arbi: Pick<Arbi, 'getDeploymentDomain'>, url: string | null | undefined): {
|
|
53
|
+
callId: string;
|
|
54
|
+
key: Uint8Array;
|
|
55
|
+
linkVersion: number | null;
|
|
56
|
+
} | null;
|
|
51
57
|
/**
|
|
52
58
|
* Create the ARBI call for an event: K sealed to me and to `peers`, the title under K, and its
|
|
53
59
|
* meeting chat with `peers` as members (best effort: without it the chat is made on first use).
|
|
@@ -73,6 +73,15 @@ function parseArbiCallUrl(url, origin = window.location.origin) {
|
|
|
73
73
|
if (!frag) return null;
|
|
74
74
|
return { callId: m[1], key: frag.key, linkVersion: frag.linkVersion };
|
|
75
75
|
}
|
|
76
|
+
function parseArbiCallUrlForClient(arbi, url) {
|
|
77
|
+
const current = parseArbiCallUrl(url);
|
|
78
|
+
if (current) return current;
|
|
79
|
+
try {
|
|
80
|
+
return parseArbiCallUrl(url, new URL(`https://${arbi.getDeploymentDomain()}`).origin);
|
|
81
|
+
} catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
76
85
|
async function createEventCall(arbi, opts) {
|
|
77
86
|
const roles = opts.webinar?.roles;
|
|
78
87
|
const { call, key, title, sealedKeys } = await arbi.calls.start({
|
|
@@ -96,7 +105,7 @@ async function createEventCall(arbi, opts) {
|
|
|
96
105
|
}
|
|
97
106
|
async function shareEventCall(arbi, conference, peers) {
|
|
98
107
|
if (conference?.type !== "arbi" || !peers.length) return 0;
|
|
99
|
-
const parsed =
|
|
108
|
+
const parsed = parseArbiCallUrlForClient(arbi, conference.url);
|
|
100
109
|
if (!parsed) return 0;
|
|
101
110
|
const sealed = await arbi.calls.sealFor(parsed.key, peers);
|
|
102
111
|
if (!Object.keys(sealed).length) return 0;
|
|
@@ -104,7 +113,7 @@ async function shareEventCall(arbi, conference, peers) {
|
|
|
104
113
|
return Object.keys(sealed).length;
|
|
105
114
|
}
|
|
106
115
|
async function loadEventWebinar(arbi, url, attendees) {
|
|
107
|
-
const parsed =
|
|
116
|
+
const parsed = parseArbiCallUrlForClient(arbi, url);
|
|
108
117
|
if (!parsed) return null;
|
|
109
118
|
const call = await arbi.calls.get(parsed.callId);
|
|
110
119
|
if (call.mode !== "webinar") return null;
|
|
@@ -118,7 +127,7 @@ async function loadEventWebinar(arbi, url, attendees) {
|
|
|
118
127
|
return roles;
|
|
119
128
|
}
|
|
120
129
|
async function updateEventWebinarRoles(arbi, url, roles, peers) {
|
|
121
|
-
const parsed =
|
|
130
|
+
const parsed = parseArbiCallUrlForClient(arbi, url);
|
|
122
131
|
if (!parsed) return;
|
|
123
132
|
const call = await arbi.calls.get(parsed.callId);
|
|
124
133
|
const current = new Map((call.invitees ?? []).map((i) => [i.user_ext_id, i.role ?? "attendee"]));
|
|
@@ -136,7 +145,7 @@ async function updateEventWebinarRoles(arbi, url, roles, peers) {
|
|
|
136
145
|
}
|
|
137
146
|
async function joinEventMeeting(arbi, url) {
|
|
138
147
|
if (!url) return;
|
|
139
|
-
const parsed =
|
|
148
|
+
const parsed = parseArbiCallUrlForClient(arbi, url);
|
|
140
149
|
if (parsed) {
|
|
141
150
|
await openCall(arbi, {
|
|
142
151
|
callExtId: parsed.callId,
|
|
@@ -153,6 +162,7 @@ export {
|
|
|
153
162
|
joinEventMeeting,
|
|
154
163
|
loadEventWebinar,
|
|
155
164
|
parseArbiCallUrl,
|
|
165
|
+
parseArbiCallUrlForClient,
|
|
156
166
|
resolveAttendeeUsers,
|
|
157
167
|
resolveAttendeeUsersRemote,
|
|
158
168
|
resolveCallPeers,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/calendar/arbi-call.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Calendar \u2194 ARBI calls. An event's online meeting can be an ARBI call: one `call-\u2026` with a random key K made\n * here, sealed to the organiser and to every ARBI attendee we hold a public key for, the title encrypted\n * under K. The event stores the full link (`https://<host>/call/<id>#k=\u2026&v=\u2026`) inside its encrypted body, so\n * every attendee who can read the event can join; attendees added later get K sealed to them on save.\n *\n * A scheduled call has its meeting chat from the start: an E2E `meeting` chat with the event's ARBI\n * attendees, made right after the call (a recurring event has one link, one call, one chat). External\n * attendees get a personal invite link in their invitation, minted server-side at delivery: an ARBI\n * registration link that lands them in the call once they have an account (no anonymous guests).\n *\n * A webinar is the same call with `mode: 'webinar'`: each ARBI attendee is an invitee with a role (co-host,\n * panelist or attendee; the organiser is the host), and its meeting chat is the team's only (host, co-hosts,\n * panelists). Attendees and external guests get the link exactly as for a call.\n */\nimport { parseCallFragment, type CallPeer } from '@arbidocs/client'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { callLink, openCall } from '@arbidocs/react'\nimport { attendeeKey } from '../../calendar/draft'\nimport type { AttendeeDraft, ConferenceDraft, WebinarRole } from '../../calendar/types'\n\n/** Someone we may seal K to: an ARBI user with an encryption key. */\nexport interface KnownPeer {\n external_id: string\n email?: string | null\n encryption_public_key?: string | null\n is_agent?: boolean\n}\n\ntype AttendeeRef = Pick<AttendeeDraft, 'email' | 'user_id' | 'kind'>\n\n/**\n * The ARBI user behind each attendee we can seal K to (by `attendeeKey`; matched by usr- id or e-mail),\n * without `me`.\n */\nexport function resolveAttendeeUsers(\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): Map<string, CallPeer> {\n const byId = new Map(known.map((u) => [u.external_id, u]))\n const byEmail = new Map(known.filter((u) => u.email).map((u) => [u.email!.toLowerCase(), u]))\n const out = new Map<string, CallPeer>()\n for (const a of attendees) {\n if (a.kind === 'room' || a.kind === 'resource') continue\n const u = (a.user_id && byId.get(a.user_id)) || (a.email && byEmail.get(a.email.toLowerCase()))\n if (!u || u.is_agent || !u.encryption_public_key || u.external_id === me) continue\n out.set(attendeeKey(a), {\n external_id: u.external_id,\n encryption_public_key: u.encryption_public_key,\n })\n }\n return out\n}\n\n/** The distinct ARBI users of a {@link resolveAttendeeUsers} map. */\nexport const distinctPeers = (users: Map<string, CallPeer>): CallPeer[] => [\n ...new Map([...users.values()].map((p) => [p.external_id, p])).values(),\n]\n\n/** The ARBI attendees we can seal K to (matched by usr- id or e-mail), without `me`. */\nexport function resolveCallPeers(\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): CallPeer[] {\n return distinctPeers(resolveAttendeeUsers(attendees, known, me))\n}\n\n/**\n * Like {@link resolveAttendeeUsers}, but asks the server (POST /people/keys) for attendees we don't already\n * know, so people invited by e-mail get K sealed to them too. Falls back to `known` alone if the lookup fails.\n */\nexport async function resolveAttendeeUsersRemote(\n arbi: Arbi,\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): Promise<Map<string, CallPeer>> {\n const people = attendees.filter((a) => a.kind !== 'room' && a.kind !== 'resource')\n const local = resolveAttendeeUsers(people, known, me)\n const have = new Set([...local.values()].map((p) => p.external_id))\n const knownEmails = new Set(\n known.filter((u) => have.has(u.external_id) && u.email).map((u) => u.email!.toLowerCase())\n )\n const emails = people\n .map((a) => a.email?.toLowerCase())\n .filter((e): e is string => !!e && !knownEmails.has(e))\n const userIds = people.map((a) => a.user_id).filter((id): id is string => !!id && !have.has(id))\n if (!emails.length && !userIds.length) return local\n try {\n const found = await arbi.calendar.peopleKeys({ emails, user_ids: userIds })\n const extra = resolveAttendeeUsers(\n people.filter((a) => !local.has(attendeeKey(a))),\n found.map((f) => ({\n external_id: f.user_id,\n email: f.email,\n encryption_public_key: f.encryption_public_key,\n })),\n me\n )\n for (const [key, p] of extra) local.set(key, p)\n } catch {\n /* no lookup: seal to the people we know */\n }\n return local\n}\n\n/** {@link resolveAttendeeUsersRemote} as the distinct peers to seal K to. */\nexport async function resolveCallPeersRemote(\n arbi: Arbi,\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): Promise<CallPeer[]> {\n return distinctPeers(await resolveAttendeeUsersRemote(arbi, attendees, known, me))\n}\n\n/** A webinar's roles (keyed by `attendeeKey`) as `{usr: role}` for the attendees resolved to ARBI users. */\nexport function webinarRolesByUser(\n roles: Record<string, WebinarRole> | null | undefined,\n users: Map<string, CallPeer>\n): Record<string, WebinarRole> {\n const out: Record<string, WebinarRole> = {}\n for (const [key, peer] of users) out[peer.external_id] = roles?.[key] ?? 'attendee'\n return out\n}\n\n/** The team of a webinar: co-hosts and panelists (with the host, who made the call). */\nconst isTeam = (role: WebinarRole | null | undefined) => role === 'cohost' || role === 'panelist'\n\n/** `{callId, key, linkVersion}` from an ARBI call link on this deployment; null for anything else. */\nexport function parseArbiCallUrl(\n url: string | null | undefined,\n origin: string = window.location.origin\n): { callId: string; key: Uint8Array; linkVersion: number | null } | null {\n if (!url) return null\n let u: URL\n try {\n u = new URL(url)\n } catch {\n return null\n }\n if (u.origin !== origin) return null\n const m = /^\\/call\\/(call-[A-Za-z0-9_-]{4,64})\\/?$/.exec(u.pathname)\n if (!m) return null\n const frag = parseCallFragment(u.hash)\n if (!frag) return null\n return { callId: m[1], key: frag.key, linkVersion: frag.linkVersion }\n}\n\n/**\n * Create the ARBI call for an event: K sealed to me and to `peers`, the title under K, and its\n * meeting chat with `peers` as members (best effort: without it the chat is made on first use).\n * A webinar (`webinar.roles`, `{usr: role}`, attendee by default) gives every invitee its role, and only\n * its team (co-hosts, panelists) joins the meeting chat.\n */\nexport async function createEventCall(\n arbi: Arbi,\n opts: {\n title?: string | null\n peers: CallPeer[]\n webinar?: { roles: Record<string, WebinarRole> } | null\n }\n): Promise<{ call_id: string; url: string }> {\n const roles = opts.webinar?.roles\n const { call, key, title, sealedKeys } = await arbi.calls.start({\n title: opts.title,\n invitees: opts.peers,\n mode: roles ? 'webinar' : 'call',\n joinPolicy: 'invited',\n roles,\n })\n const members = opts.peers.filter(\n (p) => p.external_id in sealedKeys && (!roles || isTeam(roles[p.external_id]))\n )\n if (members.length) {\n try {\n await arbi.calls.createChat({ callExtId: call.external_id, callKey: key, title, members })\n } catch (err) {\n console.warn('[calendar] could not create the meeting chat; it is made on first use', err)\n }\n }\n return { call_id: call.external_id, url: callLink(call.external_id, key, call.link_version) }\n}\n\n/**\n * After saving an event with an ARBI call: seal K (from the stored link) to its ARBI attendees, so people\n * added later can join with their own key. Re-sealing someone who already has K is harmless.\n */\nexport async function shareEventCall(\n arbi: Arbi,\n conference: Pick<ConferenceDraft, 'type' | 'url'> | null | undefined,\n peers: CallPeer[]\n): Promise<number> {\n if (conference?.type !== 'arbi' || !peers.length) return 0\n const parsed = parseArbiCallUrl(conference.url)\n if (!parsed) return 0\n const sealed = await arbi.calls.sealFor(parsed.key, peers)\n if (!Object.keys(sealed).length) return 0\n await arbi.calls.update(parsed.callId, { sealed_keys: sealed })\n return Object.keys(sealed).length\n}\n\n/**\n * An event's webinar roles as the editor shows them: the call's roles keyed by the attendee they belong to\n * (every invitee is listed, attendees included). Null when the link is not an ARBI webinar.\n */\nexport async function loadEventWebinar(\n arbi: Arbi,\n url: string | null | undefined,\n attendees: Pick<AttendeeDraft, 'email' | 'user_id'>[]\n): Promise<Record<string, WebinarRole> | null> {\n const parsed = parseArbiCallUrl(url)\n if (!parsed) return null\n const call = await arbi.calls.get(parsed.callId)\n if (call.mode !== 'webinar') return null\n const roles: Record<string, WebinarRole> = {}\n for (const inv of call.invitees ?? []) {\n const a = attendees.find(\n (x) =>\n x.user_id === inv.user_ext_id ||\n (!!x.email && x.email.toLowerCase() === inv.email?.toLowerCase())\n )\n if (a) roles[attendeeKey(a)] = inv.role ?? 'attendee'\n }\n return roles\n}\n\n/**\n * After saving a webinar whose roles changed (`{usr: role}`): PATCH the changed roles of its invitees\n * (people added after the call was made are not invitees: they join by the link, as attendees), then make\n * sure the team has its meeting chat (get-or-create; its members are the team only).\n */\nexport async function updateEventWebinarRoles(\n arbi: Arbi,\n url: string | null | undefined,\n roles: Record<string, WebinarRole>,\n peers: CallPeer[]\n): Promise<void> {\n const parsed = parseArbiCallUrl(url)\n if (!parsed) return\n const call = await arbi.calls.get(parsed.callId)\n const current = new Map((call.invitees ?? []).map((i) => [i.user_ext_id, i.role ?? 'attendee']))\n const changed = Object.fromEntries(\n Object.entries(roles).filter(([usr, role]) => current.has(usr) && current.get(usr) !== role)\n )\n if (Object.keys(changed).length) await arbi.calls.update(parsed.callId, { roles: changed })\n const team = peers.filter((p) => current.has(p.external_id) && isTeam(roles[p.external_id]))\n if (!team.length) return\n try {\n await arbi.calls.createChat({ callExtId: parsed.callId, callKey: parsed.key, members: team })\n } catch (err) {\n console.warn('[calendar] could not create the webinar team chat; it is made on first use', err)\n }\n}\n\n/** Join an event's online meeting: an ARBI call opens in-app (pre-join); anything else in a new tab. */\nexport async function joinEventMeeting(arbi: Arbi, url: string | null | undefined): Promise<void> {\n if (!url) return\n const parsed = parseArbiCallUrl(url)\n if (parsed) {\n await openCall(arbi, {\n callExtId: parsed.callId,\n key: parsed.key,\n linkVersion: parsed.linkVersion,\n })\n return\n }\n if (/^(https?:\\/\\/|tel:)/i.test(url)) window.open(url, '_blank', 'noopener,noreferrer')\n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AMA,eAAsB,eACpB,MACA,YACA,OACiB;AACjB,MAAI,YAAY,SAAS,UAAU,CAAC,MAAM,OAAQ,QAAO;AACzD,QAAM,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * Calendar \u2194 ARBI calls. An event's online meeting can be an ARBI call: one `call-\u2026` with a random key K made\n * here, sealed to the organiser and to every ARBI attendee we hold a public key for, the title encrypted\n * under K. The event stores the full link (`https://<host>/call/<id>#k=\u2026&v=\u2026`) inside its encrypted body, so\n * every attendee who can read the event can join; attendees added later get K sealed to them on save.\n *\n * A scheduled call has its meeting chat from the start: an E2E `meeting` chat with the event's ARBI\n * attendees, made right after the call (a recurring event has one link, one call, one chat). External\n * attendees get a personal invite link in their invitation, minted server-side at delivery: an ARBI\n * registration link that lands them in the call once they have an account (no anonymous guests).\n *\n * A webinar is the same call with `mode: 'webinar'`: each ARBI attendee is an invitee with a role (co-host,\n * panelist or attendee; the organiser is the host), and its meeting chat is the team's only (host, co-hosts,\n * panelists). Attendees and external guests get the link exactly as for a call.\n */\nimport { parseCallFragment, type CallPeer } from '@arbidocs/client'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { callLink, openCall } from '@arbidocs/react'\nimport { attendeeKey } from '../../calendar/draft'\nimport type { AttendeeDraft, ConferenceDraft, WebinarRole } from '../../calendar/types'\n\n/** Someone we may seal K to: an ARBI user with an encryption key. */\nexport interface KnownPeer {\n external_id: string\n email?: string | null\n encryption_public_key?: string | null\n is_agent?: boolean\n}\n\ntype AttendeeRef = Pick<AttendeeDraft, 'email' | 'user_id' | 'kind'>\n\n/**\n * The ARBI user behind each attendee we can seal K to (by `attendeeKey`; matched by usr- id or e-mail),\n * without `me`.\n */\nexport function resolveAttendeeUsers(\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): Map<string, CallPeer> {\n const byId = new Map(known.map((u) => [u.external_id, u]))\n const byEmail = new Map(known.filter((u) => u.email).map((u) => [u.email!.toLowerCase(), u]))\n const out = new Map<string, CallPeer>()\n for (const a of attendees) {\n if (a.kind === 'room' || a.kind === 'resource') continue\n const u = (a.user_id && byId.get(a.user_id)) || (a.email && byEmail.get(a.email.toLowerCase()))\n if (!u || u.is_agent || !u.encryption_public_key || u.external_id === me) continue\n out.set(attendeeKey(a), {\n external_id: u.external_id,\n encryption_public_key: u.encryption_public_key,\n })\n }\n return out\n}\n\n/** The distinct ARBI users of a {@link resolveAttendeeUsers} map. */\nexport const distinctPeers = (users: Map<string, CallPeer>): CallPeer[] => [\n ...new Map([...users.values()].map((p) => [p.external_id, p])).values(),\n]\n\n/** The ARBI attendees we can seal K to (matched by usr- id or e-mail), without `me`. */\nexport function resolveCallPeers(\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): CallPeer[] {\n return distinctPeers(resolveAttendeeUsers(attendees, known, me))\n}\n\n/**\n * Like {@link resolveAttendeeUsers}, but asks the server (POST /people/keys) for attendees we don't already\n * know, so people invited by e-mail get K sealed to them too. Falls back to `known` alone if the lookup fails.\n */\nexport async function resolveAttendeeUsersRemote(\n arbi: Arbi,\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): Promise<Map<string, CallPeer>> {\n const people = attendees.filter((a) => a.kind !== 'room' && a.kind !== 'resource')\n const local = resolveAttendeeUsers(people, known, me)\n const have = new Set([...local.values()].map((p) => p.external_id))\n const knownEmails = new Set(\n known.filter((u) => have.has(u.external_id) && u.email).map((u) => u.email!.toLowerCase())\n )\n const emails = people\n .map((a) => a.email?.toLowerCase())\n .filter((e): e is string => !!e && !knownEmails.has(e))\n const userIds = people.map((a) => a.user_id).filter((id): id is string => !!id && !have.has(id))\n if (!emails.length && !userIds.length) return local\n try {\n const found = await arbi.calendar.peopleKeys({ emails, user_ids: userIds })\n const extra = resolveAttendeeUsers(\n people.filter((a) => !local.has(attendeeKey(a))),\n found.map((f) => ({\n external_id: f.user_id,\n email: f.email,\n encryption_public_key: f.encryption_public_key,\n })),\n me\n )\n for (const [key, p] of extra) local.set(key, p)\n } catch {\n /* no lookup: seal to the people we know */\n }\n return local\n}\n\n/** {@link resolveAttendeeUsersRemote} as the distinct peers to seal K to. */\nexport async function resolveCallPeersRemote(\n arbi: Arbi,\n attendees: AttendeeRef[],\n known: KnownPeer[],\n me?: string | null\n): Promise<CallPeer[]> {\n return distinctPeers(await resolveAttendeeUsersRemote(arbi, attendees, known, me))\n}\n\n/** A webinar's roles (keyed by `attendeeKey`) as `{usr: role}` for the attendees resolved to ARBI users. */\nexport function webinarRolesByUser(\n roles: Record<string, WebinarRole> | null | undefined,\n users: Map<string, CallPeer>\n): Record<string, WebinarRole> {\n const out: Record<string, WebinarRole> = {}\n for (const [key, peer] of users) out[peer.external_id] = roles?.[key] ?? 'attendee'\n return out\n}\n\n/** The team of a webinar: co-hosts and panelists (with the host, who made the call). */\nconst isTeam = (role: WebinarRole | null | undefined) => role === 'cohost' || role === 'panelist'\n\n/** `{callId, key, linkVersion}` from an ARBI call link on this deployment; null for anything else. */\nexport function parseArbiCallUrl(\n url: string | null | undefined,\n origin: string = window.location.origin\n): { callId: string; key: Uint8Array; linkVersion: number | null } | null {\n if (!url) return null\n let u: URL\n try {\n u = new URL(url)\n } catch {\n return null\n }\n if (u.origin !== origin) return null\n const m = /^\\/call\\/(call-[A-Za-z0-9_-]{4,64})\\/?$/.exec(u.pathname)\n if (!m) return null\n const frag = parseCallFragment(u.hash)\n if (!frag) return null\n return { callId: m[1], key: frag.key, linkVersion: frag.linkVersion }\n}\n\n/** Resolve links for this signed-in deployment, including its canonical HTTPS address. */\nexport function parseArbiCallUrlForClient(\n arbi: Pick<Arbi, 'getDeploymentDomain'>,\n url: string | null | undefined\n) {\n const current = parseArbiCallUrl(url)\n if (current) return current\n try {\n return parseArbiCallUrl(url, new URL(`https://${arbi.getDeploymentDomain()}`).origin)\n } catch {\n return null\n }\n}\n\n/**\n * Create the ARBI call for an event: K sealed to me and to `peers`, the title under K, and its\n * meeting chat with `peers` as members (best effort: without it the chat is made on first use).\n * A webinar (`webinar.roles`, `{usr: role}`, attendee by default) gives every invitee its role, and only\n * its team (co-hosts, panelists) joins the meeting chat.\n */\nexport async function createEventCall(\n arbi: Arbi,\n opts: {\n title?: string | null\n peers: CallPeer[]\n webinar?: { roles: Record<string, WebinarRole> } | null\n }\n): Promise<{ call_id: string; url: string }> {\n const roles = opts.webinar?.roles\n const { call, key, title, sealedKeys } = await arbi.calls.start({\n title: opts.title,\n invitees: opts.peers,\n mode: roles ? 'webinar' : 'call',\n joinPolicy: 'invited',\n roles,\n })\n const members = opts.peers.filter(\n (p) => p.external_id in sealedKeys && (!roles || isTeam(roles[p.external_id]))\n )\n if (members.length) {\n try {\n await arbi.calls.createChat({ callExtId: call.external_id, callKey: key, title, members })\n } catch (err) {\n console.warn('[calendar] could not create the meeting chat; it is made on first use', err)\n }\n }\n return { call_id: call.external_id, url: callLink(call.external_id, key, call.link_version) }\n}\n\n/**\n * After saving an event with an ARBI call: seal K (from the stored link) to its ARBI attendees, so people\n * added later can join with their own key. Re-sealing someone who already has K is harmless.\n */\nexport async function shareEventCall(\n arbi: Arbi,\n conference: Pick<ConferenceDraft, 'type' | 'url'> | null | undefined,\n peers: CallPeer[]\n): Promise<number> {\n if (conference?.type !== 'arbi' || !peers.length) return 0\n const parsed = parseArbiCallUrlForClient(arbi, conference.url)\n if (!parsed) return 0\n const sealed = await arbi.calls.sealFor(parsed.key, peers)\n if (!Object.keys(sealed).length) return 0\n await arbi.calls.update(parsed.callId, { sealed_keys: sealed })\n return Object.keys(sealed).length\n}\n\n/**\n * An event's webinar roles as the editor shows them: the call's roles keyed by the attendee they belong to\n * (every invitee is listed, attendees included). Null when the link is not an ARBI webinar.\n */\nexport async function loadEventWebinar(\n arbi: Arbi,\n url: string | null | undefined,\n attendees: Pick<AttendeeDraft, 'email' | 'user_id'>[]\n): Promise<Record<string, WebinarRole> | null> {\n const parsed = parseArbiCallUrlForClient(arbi, url)\n if (!parsed) return null\n const call = await arbi.calls.get(parsed.callId)\n if (call.mode !== 'webinar') return null\n const roles: Record<string, WebinarRole> = {}\n for (const inv of call.invitees ?? []) {\n const a = attendees.find(\n (x) =>\n x.user_id === inv.user_ext_id ||\n (!!x.email && x.email.toLowerCase() === inv.email?.toLowerCase())\n )\n if (a) roles[attendeeKey(a)] = inv.role ?? 'attendee'\n }\n return roles\n}\n\n/**\n * After saving a webinar whose roles changed (`{usr: role}`): PATCH the changed roles of its invitees\n * (people added after the call was made are not invitees: they join by the link, as attendees), then make\n * sure the team has its meeting chat (get-or-create; its members are the team only).\n */\nexport async function updateEventWebinarRoles(\n arbi: Arbi,\n url: string | null | undefined,\n roles: Record<string, WebinarRole>,\n peers: CallPeer[]\n): Promise<void> {\n const parsed = parseArbiCallUrlForClient(arbi, url)\n if (!parsed) return\n const call = await arbi.calls.get(parsed.callId)\n const current = new Map((call.invitees ?? []).map((i) => [i.user_ext_id, i.role ?? 'attendee']))\n const changed = Object.fromEntries(\n Object.entries(roles).filter(([usr, role]) => current.has(usr) && current.get(usr) !== role)\n )\n if (Object.keys(changed).length) await arbi.calls.update(parsed.callId, { roles: changed })\n const team = peers.filter((p) => current.has(p.external_id) && isTeam(roles[p.external_id]))\n if (!team.length) return\n try {\n await arbi.calls.createChat({ callExtId: parsed.callId, callKey: parsed.key, members: team })\n } catch (err) {\n console.warn('[calendar] could not create the webinar team chat; it is made on first use', err)\n }\n}\n\n/** Join an event's online meeting: an ARBI call opens in-app (pre-join); anything else in a new tab. */\nexport async function joinEventMeeting(arbi: Arbi, url: string | null | undefined): Promise<void> {\n if (!url) return\n const parsed = parseArbiCallUrlForClient(arbi, url)\n if (parsed) {\n await openCall(arbi, {\n callExtId: parsed.callId,\n key: parsed.key,\n linkVersion: parsed.linkVersion,\n })\n return\n }\n if (/^(https?:\\/\\/|tel:)/i.test(url)) window.open(url, '_blank', 'noopener,noreferrer')\n}\n"],
|
|
5
|
+
"mappings": ";AAeA,SAAS,yBAAwC;AAEjD,SAAS,UAAU,gBAAgB;AACnC,SAAS,mBAAmB;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
|
shareEventCall,
|
|
@@ -67,7 +67,7 @@ function useConnectedCalendarCalls() {
|
|
|
67
67
|
void joinEventMeeting(arbi, url);
|
|
68
68
|
},
|
|
69
69
|
openChat(url) {
|
|
70
|
-
const parsed =
|
|
70
|
+
const parsed = parseArbiCallUrlForClient(arbi, url);
|
|
71
71
|
if (parsed) void openCallMeetingChat({ callExtId: parsed.callId, callKey: parsed.key });
|
|
72
72
|
}
|
|
73
73
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/calendar/useConnectedCalendarCalls.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * ARBI calls for the connected calendar (`CalendarCallSupport`), on the signed-in session: an\n * event's call is made, shared, joined and given webinar roles through `arbi.calls`. Its key is\n * sealed to the ARBI attendees the people directory knows, or finds by e-mail. Scheduling a call is\n * hosting it (`useCanHostCalls`); joining an event's call link is not gated.\n */\nimport { useMemo } from 'react'\nimport { useArbi, useCanHostCalls, useOpenCallMeetingChat, usePeople } from '@arbidocs/react'\nimport { isAgent } from '@arbidocs/react/ui'\nimport type { AttendeeDraft, EventDraft, WebinarRole } from '../../calendar/types'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport {\n createEventCall,\n distinctPeers,\n joinEventMeeting,\n loadEventWebinar,\n
|
|
5
|
-
"mappings": ";AAMA,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB,wBAAwB,iBAAiB;AAC5E,SAAS,eAAe;AAExB,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAGA,SAAS,4BAAiD;AAC/D,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,gBAAgB;AACpC,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,EAAE,OAAO,WAAW,IAAI,UAAU;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AAM,GAAG;AAAA,MACjC;AAAA,MACA,SAAS,KAAK;AACZ,cAAM,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * ARBI calls for the connected calendar (`CalendarCallSupport`), on the signed-in session: an\n * event's call is made, shared, joined and given webinar roles through `arbi.calls`. Its key is\n * sealed to the ARBI attendees the people directory knows, or finds by e-mail. Scheduling a call is\n * hosting it (`useCanHostCalls`); joining an event's call link is not gated.\n */\nimport { useMemo } from 'react'\nimport { useArbi, useCanHostCalls, useOpenCallMeetingChat, usePeople } from '@arbidocs/react'\nimport { isAgent } from '@arbidocs/react/ui'\nimport type { AttendeeDraft, EventDraft, WebinarRole } from '../../calendar/types'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport {\n createEventCall,\n distinctPeers,\n joinEventMeeting,\n loadEventWebinar,\n parseArbiCallUrlForClient,\n resolveAttendeeUsersRemote,\n resolveCallPeersRemote,\n shareEventCall,\n updateEventWebinarRoles,\n webinarRolesByUser,\n type KnownPeer,\n} from './arbi-call'\nimport type { CalendarCallSupport } from './types'\n\nexport function useConnectedCalendarCalls(): CalendarCallSupport {\n const arbi = useArbi()\n const canSchedule = useCanHostCalls()\n const openCallMeetingChat = useOpenCallMeetingChat()\n const { users: knownUsers } = usePeople()\n const { userId } = useConnectedWorkspace()\n const me = userId ?? null\n const known = useMemo<KnownPeer[]>(\n () =>\n knownUsers.map((u) => ({\n external_id: u.external_id,\n email: u.email,\n encryption_public_key: u.encryption_public_key,\n is_agent: isAgent(u),\n })),\n [knownUsers]\n )\n\n return useMemo<CalendarCallSupport>(() => {\n const users = (attendees: AttendeeDraft[]) =>\n resolveAttendeeUsersRemote(arbi, attendees, known, me)\n return {\n canSchedule,\n async create(draft: EventDraft, webinarRoles?: Record<string, WebinarRole>) {\n const resolved = await users(draft.attendees ?? [])\n return createEventCall(arbi, {\n title: draft.title,\n peers: distinctPeers(resolved),\n webinar: webinarRoles ? { roles: webinarRolesByUser(webinarRoles, resolved) } : null,\n })\n },\n async share(draft) {\n await shareEventCall(\n arbi,\n draft.conference,\n await resolveCallPeersRemote(arbi, draft.attendees ?? [], known, me)\n )\n },\n loadWebinarRoles: (url, attendees) => loadEventWebinar(arbi, url, attendees),\n async saveWebinarRoles(url, roles, attendees) {\n const resolved = await users(attendees)\n await updateEventWebinarRoles(\n arbi,\n url,\n webinarRolesByUser(roles, resolved),\n distinctPeers(resolved)\n )\n },\n async arbiAttendees(attendees) {\n return new Set((await users(attendees)).keys())\n },\n join(url) {\n void joinEventMeeting(arbi, url)\n },\n openChat(url) {\n const parsed = parseArbiCallUrlForClient(arbi, url)\n if (parsed) void openCallMeetingChat({ callExtId: parsed.callId, callKey: parsed.key })\n },\n }\n }, [arbi, canSchedule, openCallMeetingChat, known, me])\n}\n"],
|
|
5
|
+
"mappings": ";AAMA,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB,wBAAwB,iBAAiB;AAC5E,SAAS,eAAe;AAExB,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAGA,SAAS,4BAAiD;AAC/D,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,gBAAgB;AACpC,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,EAAE,OAAO,WAAW,IAAI,UAAU;AACxC,QAAM,EAAE,OAAO,IAAI,sBAAsB;AACzC,QAAM,KAAK,UAAU;AACrB,QAAM,QAAQ;AAAA,IACZ,MACE,WAAW,IAAI,CAAC,OAAO;AAAA,MACrB,aAAa,EAAE;AAAA,MACf,OAAO,EAAE;AAAA,MACT,uBAAuB,EAAE;AAAA,MACzB,UAAU,QAAQ,CAAC;AAAA,IACrB,EAAE;AAAA,IACJ,CAAC,UAAU;AAAA,EACb;AAEA,SAAO,QAA6B,MAAM;AACxC,UAAM,QAAQ,CAAC,cACb,2BAA2B,MAAM,WAAW,OAAO,EAAE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ted under the chat
|
|
5
5
|
* key (`arbi.chats`); files are encrypted with their own keys and travel in a manifest under the
|
|
6
6
|
* same chat key. A chat has no assistant — the one exception is the direct chat with my own agent
|
|
7
|
-
* (the PA chat), which
|
|
7
|
+
* (the PA chat), which runs in the agent’s Home workspace and records browsing changes as
|
|
8
8
|
* context-only notes. A host draws more kinds of message (a call's) with `host.ThreadHistory`.
|
|
9
9
|
*/
|
|
10
10
|
import { type ChatResponse, type DmUser } from '@arbidocs/react';
|
|
@@ -152,11 +152,11 @@ function ConnectedChatThread({
|
|
|
152
152
|
let workspace;
|
|
153
153
|
if (isAgentChat) {
|
|
154
154
|
await contextQueue.current;
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
if (selectedWorkspaceId) {
|
|
156
|
+
if (!await prepareAgentWorkspace(selectedWorkspaceId))
|
|
157
|
+
throw new Error("Could not open the viewed workspace");
|
|
158
|
+
workspace = selectedWorkspaceId;
|
|
159
|
+
}
|
|
160
160
|
}
|
|
161
161
|
await post(textToSend, files, false, workspace);
|
|
162
162
|
if (isAgentChat) setAwaitingAgentReply(true);
|
|
@@ -178,14 +178,14 @@ function ConnectedChatThread({
|
|
|
178
178
|
lastWorkspace.current = { peer: peerId, workspace: selectedWorkspaceId };
|
|
179
179
|
if (!previous || previous.peer !== peerId || previous.workspace === selectedWorkspaceId) return;
|
|
180
180
|
const workspace = selectedWorkspaceId;
|
|
181
|
-
const text = `
|
|
181
|
+
const text = `Now viewing workspace ${workspaceName} (${workspace}).`;
|
|
182
182
|
contextQueue.current = contextQueue.current.catch(() => void 0).then(async () => {
|
|
183
183
|
if (!await prepareAgentWorkspace(workspace))
|
|
184
|
-
throw new Error("Could not
|
|
184
|
+
throw new Error("Could not open the viewed workspace");
|
|
185
185
|
await post(text, [], true, workspace);
|
|
186
186
|
}).catch(
|
|
187
187
|
() => setSendError(
|
|
188
|
-
"Could not record the
|
|
188
|
+
"Could not record the browsing change. Your agent conversation remains in its Home workspace."
|
|
189
189
|
)
|
|
190
190
|
);
|
|
191
191
|
}, [isAgentChat, peerId, selectedWorkspaceId, workspaceName, me, prepareAgentWorkspace, post]);
|
|
@@ -358,8 +358,10 @@ function ConnectedChatThread({
|
|
|
358
358
|
] }),
|
|
359
359
|
composer: /* @__PURE__ */ jsxs("div", { children: [
|
|
360
360
|
isAgentChat && /* @__PURE__ */ jsxs("p", { className: "px-3 pb-1 text-xs text-muted-foreground", children: [
|
|
361
|
-
"
|
|
362
|
-
|
|
361
|
+
"Conversation: ",
|
|
362
|
+
peer?.given_name || "Assistant",
|
|
363
|
+
" Home",
|
|
364
|
+
workspaceName ? ` \xB7 Viewing: ${workspaceName}` : ""
|
|
363
365
|
] }),
|
|
364
366
|
/* @__PURE__ */ jsx(
|
|
365
367
|
DmComposer,
|