@arbidocs/blocks 0.5.195 → 0.5.197
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-L2ER6N2P.cjs → ConnectedCallDock-CJTL2FDV.cjs} +22 -22
- package/dist/{ConnectedCallDock-L2ER6N2P.cjs.map → ConnectedCallDock-CJTL2FDV.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-R6SHBOKX.cjs → ConnectedCallRoom-DXUZXFZX.cjs} +14 -14
- package/dist/{ConnectedCallRoom-R6SHBOKX.cjs.map → ConnectedCallRoom-DXUZXFZX.cjs.map} +1 -1
- package/dist/ConnectedMailInviteCard-NWVQNVR6.cjs +22 -0
- package/dist/{ConnectedMailInviteCard-DDGB4LLC.cjs.map → ConnectedMailInviteCard-NWVQNVR6.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-JNOAKSPK.cjs → ConnectedNativeDocxComparison-FDBAVRFO.cjs} +19 -19
- package/dist/{ConnectedNativeDocxComparison-JNOAKSPK.cjs.map → ConnectedNativeDocxComparison-FDBAVRFO.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-ZSB7454J.cjs → ConnectedPresentation-VGWCLJKM.cjs} +19 -19
- package/dist/{ConnectedPresentation-ZSB7454J.cjs.map → ConnectedPresentation-VGWCLJKM.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-SHDI7KP6.cjs → ConnectedProductionSetDialog-R7FVJ4X7.cjs} +9 -9
- package/dist/{ConnectedProductionSetDialog-SHDI7KP6.cjs.map → ConnectedProductionSetDialog-R7FVJ4X7.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-LCA3ZX5W.cjs → ConnectedSlidesTab-PCJTMD3W.cjs} +18 -18
- package/dist/{ConnectedSlidesTab-LCA3ZX5W.cjs.map → ConnectedSlidesTab-PCJTMD3W.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-J5HVQMUS.cjs → ConnectedStreamedWordArtifact-JET44WCX.cjs} +19 -19
- package/dist/{ConnectedStreamedWordArtifact-J5HVQMUS.cjs.map → ConnectedStreamedWordArtifact-JET44WCX.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-Q3NKJLSM.cjs → DocumentReviewCard-CJHMIMSM.cjs} +22 -22
- package/dist/{DocumentReviewCard-Q3NKJLSM.cjs.map → DocumentReviewCard-CJHMIMSM.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-O3ZTKELI.cjs → FilesViewerDialog-COHCOFKX.cjs} +47 -45
- package/dist/FilesViewerDialog-COHCOFKX.cjs.map +1 -0
- package/dist/{NativeDocxEditor-JJQJEYQD.cjs → NativeDocxEditor-4ZFDUQIU.cjs} +8 -8
- package/dist/{NativeDocxEditor-JJQJEYQD.cjs.map → NativeDocxEditor-4ZFDUQIU.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-QT63XYII.cjs → WorkspaceTableView-XK7L4MU6.cjs} +9 -9
- package/dist/{WorkspaceTableView-QT63XYII.cjs.map → WorkspaceTableView-XK7L4MU6.cjs.map} +1 -1
- package/dist/agents/index.cjs +201 -201
- package/dist/{ai-I7QIW5OA.cjs → ai-RIR36YJR.cjs} +25 -25
- package/dist/ai-RIR36YJR.cjs.map +1 -0
- package/dist/calls/index.cjs +119 -119
- package/dist/chat/index.cjs +30 -30
- package/dist/{chunk-YPSCG6ZW.cjs → chunk-2FB2TP2R.cjs} +59 -59
- package/dist/{chunk-YPSCG6ZW.cjs.map → chunk-2FB2TP2R.cjs.map} +1 -1
- package/dist/chunk-2JSXBOG2.cjs +199 -0
- package/dist/chunk-2JSXBOG2.cjs.map +1 -0
- package/dist/{chunk-KHT2YJ5N.cjs → chunk-2VHTB6A4.cjs} +11 -11
- package/dist/{chunk-KHT2YJ5N.cjs.map → chunk-2VHTB6A4.cjs.map} +1 -1
- package/dist/{chunk-D4SJT3NG.cjs → chunk-37RTQFWM.cjs} +8 -8
- package/dist/{chunk-D4SJT3NG.cjs.map → chunk-37RTQFWM.cjs.map} +1 -1
- package/dist/{chunk-WHHBEV4G.cjs → chunk-3LPHCJPB.cjs} +4 -4
- package/dist/{chunk-WHHBEV4G.cjs.map → chunk-3LPHCJPB.cjs.map} +1 -1
- package/dist/{chunk-VJNJ4G6Y.cjs → chunk-3VVLI5RM.cjs} +4 -4
- package/dist/{chunk-VJNJ4G6Y.cjs.map → chunk-3VVLI5RM.cjs.map} +1 -1
- package/dist/{chunk-HGQGXY5Q.cjs → chunk-5I2KMQ7A.cjs} +4 -4
- package/dist/{chunk-HGQGXY5Q.cjs.map → chunk-5I2KMQ7A.cjs.map} +1 -1
- package/dist/{chunk-L3MYUPSH.cjs → chunk-5ISSFIVO.cjs} +5 -5
- package/dist/{chunk-L3MYUPSH.cjs.map → chunk-5ISSFIVO.cjs.map} +1 -1
- package/dist/{chunk-7NJKDJVO.cjs → chunk-62HKBJNH.cjs} +6 -6
- package/dist/{chunk-7NJKDJVO.cjs.map → chunk-62HKBJNH.cjs.map} +1 -1
- package/dist/{chunk-C25KF2TM.cjs → chunk-67HUC56R.cjs} +4 -4
- package/dist/{chunk-C25KF2TM.cjs.map → chunk-67HUC56R.cjs.map} +1 -1
- package/dist/{chunk-3GI3UM2T.cjs → chunk-74YFLEIZ.cjs} +72 -72
- package/dist/chunk-74YFLEIZ.cjs.map +1 -0
- package/dist/{chunk-YYK2CCMC.cjs → chunk-75UNBJVM.cjs} +21 -21
- package/dist/{chunk-YYK2CCMC.cjs.map → chunk-75UNBJVM.cjs.map} +1 -1
- package/dist/{chunk-6CXTLIGJ.cjs → chunk-7QFMDMWA.cjs} +6 -6
- package/dist/{chunk-6CXTLIGJ.cjs.map → chunk-7QFMDMWA.cjs.map} +1 -1
- package/dist/{chunk-OO452QD5.cjs → chunk-A27BVBKQ.cjs} +4 -4
- package/dist/{chunk-OO452QD5.cjs.map → chunk-A27BVBKQ.cjs.map} +1 -1
- package/dist/{chunk-J37DOAGN.cjs → chunk-ADJEWEHZ.cjs} +7 -7
- package/dist/{chunk-J37DOAGN.cjs.map → chunk-ADJEWEHZ.cjs.map} +1 -1
- package/dist/{chunk-V5VFRRLL.cjs → chunk-AX26HWDZ.cjs} +26 -26
- package/dist/{chunk-V5VFRRLL.cjs.map → chunk-AX26HWDZ.cjs.map} +1 -1
- package/dist/chunk-CEBEDIP7.cjs +25 -0
- package/dist/chunk-CEBEDIP7.cjs.map +1 -0
- package/dist/{chunk-5WCQ5Y77.cjs → chunk-CJEFHB7M.cjs} +4 -4
- package/dist/{chunk-5WCQ5Y77.cjs.map → chunk-CJEFHB7M.cjs.map} +1 -1
- package/dist/{chunk-ELN3YOXF.cjs → chunk-CV2YOGBW.cjs} +28 -28
- package/dist/{chunk-ELN3YOXF.cjs.map → chunk-CV2YOGBW.cjs.map} +1 -1
- package/dist/{chunk-633ZCYVN.cjs → chunk-DEL7BS25.cjs} +44 -44
- package/dist/{chunk-633ZCYVN.cjs.map → chunk-DEL7BS25.cjs.map} +1 -1
- package/dist/{chunk-HJAI3QNK.cjs → chunk-DHDIFLU4.cjs} +15 -15
- package/dist/{chunk-HJAI3QNK.cjs.map → chunk-DHDIFLU4.cjs.map} +1 -1
- package/dist/{chunk-HHZDURXN.cjs → chunk-E3WRSQ3J.cjs} +4 -4
- package/dist/{chunk-HHZDURXN.cjs.map → chunk-E3WRSQ3J.cjs.map} +1 -1
- package/dist/{chunk-VWSOHZK2.cjs → chunk-EEDKECR7.cjs} +13 -18
- package/dist/chunk-EEDKECR7.cjs.map +1 -0
- package/dist/{chunk-UXGIMOIN.cjs → chunk-EYBLJWR3.cjs} +4 -4
- package/dist/{chunk-UXGIMOIN.cjs.map → chunk-EYBLJWR3.cjs.map} +1 -1
- package/dist/{chunk-ZQQVXRYZ.cjs → chunk-FEM56BGP.cjs} +4 -4
- package/dist/{chunk-ZQQVXRYZ.cjs.map → chunk-FEM56BGP.cjs.map} +1 -1
- package/dist/{chunk-5K6XHSAM.cjs → chunk-FISPQ67U.cjs} +4 -4
- package/dist/{chunk-5K6XHSAM.cjs.map → chunk-FISPQ67U.cjs.map} +1 -1
- package/dist/{chunk-6LNTU7DA.cjs → chunk-G7JESVKJ.cjs} +4 -4
- package/dist/{chunk-6LNTU7DA.cjs.map → chunk-G7JESVKJ.cjs.map} +1 -1
- package/dist/{chunk-6EATJW7T.cjs → chunk-GHEKXPES.cjs} +14 -14
- package/dist/{chunk-6EATJW7T.cjs.map → chunk-GHEKXPES.cjs.map} +1 -1
- package/dist/chunk-GKEZUE4F.cjs +58 -0
- package/dist/chunk-GKEZUE4F.cjs.map +1 -0
- package/dist/{chunk-LNYICHFJ.cjs → chunk-ITOIO24T.cjs} +5 -5
- package/dist/{chunk-LNYICHFJ.cjs.map → chunk-ITOIO24T.cjs.map} +1 -1
- package/dist/{chunk-SYUVP52B.cjs → chunk-JMMDTIWM.cjs} +102 -102
- package/dist/chunk-JMMDTIWM.cjs.map +1 -0
- package/dist/{chunk-SDID4WK7.cjs → chunk-KLEH67QD.cjs} +76 -76
- package/dist/{chunk-SDID4WK7.cjs.map → chunk-KLEH67QD.cjs.map} +1 -1
- package/dist/{chunk-H4ZKASMT.cjs → chunk-L35JYXOP.cjs} +6 -6
- package/dist/{chunk-H4ZKASMT.cjs.map → chunk-L35JYXOP.cjs.map} +1 -1
- package/dist/{chunk-VD3HI5RF.cjs → chunk-L5JY75DC.cjs} +4 -4
- package/dist/{chunk-VD3HI5RF.cjs.map → chunk-L5JY75DC.cjs.map} +1 -1
- package/dist/{chunk-ZON25DCD.cjs → chunk-LONVRLCN.cjs} +5 -5
- package/dist/{chunk-ZON25DCD.cjs.map → chunk-LONVRLCN.cjs.map} +1 -1
- package/dist/{chunk-7VUO4QZH.cjs → chunk-LP2WMB2N.cjs} +4 -4
- package/dist/{chunk-7VUO4QZH.cjs.map → chunk-LP2WMB2N.cjs.map} +1 -1
- package/dist/{chunk-32W2S6DE.cjs → chunk-MAZCQPEE.cjs} +4 -4
- package/dist/{chunk-32W2S6DE.cjs.map → chunk-MAZCQPEE.cjs.map} +1 -1
- package/dist/{chunk-X3SUQFY7.cjs → chunk-N5ILLODM.cjs} +62 -62
- package/dist/{chunk-X3SUQFY7.cjs.map → chunk-N5ILLODM.cjs.map} +1 -1
- package/dist/{chunk-CVPV4I7Z.cjs → chunk-NAVFMFWM.cjs} +3 -2
- package/dist/chunk-NAVFMFWM.cjs.map +1 -0
- package/dist/{chunk-KQJUY2OE.cjs → chunk-NZBPVCQ5.cjs} +10 -10
- package/dist/{chunk-KQJUY2OE.cjs.map → chunk-NZBPVCQ5.cjs.map} +1 -1
- package/dist/{chunk-TNVCTYZI.cjs → chunk-OUBWZM3L.cjs} +6 -6
- package/dist/{chunk-TNVCTYZI.cjs.map → chunk-OUBWZM3L.cjs.map} +1 -1
- package/dist/{chunk-AZUPMHZI.cjs → chunk-PIM7D4BJ.cjs} +4 -4
- package/dist/{chunk-AZUPMHZI.cjs.map → chunk-PIM7D4BJ.cjs.map} +1 -1
- package/dist/{chunk-UNSZLNA4.cjs → chunk-PQQG62C6.cjs} +12 -12
- package/dist/{chunk-UNSZLNA4.cjs.map → chunk-PQQG62C6.cjs.map} +1 -1
- package/dist/{chunk-7D3OMWIZ.cjs → chunk-Q36QKE6K.cjs} +4 -4
- package/dist/{chunk-7D3OMWIZ.cjs.map → chunk-Q36QKE6K.cjs.map} +1 -1
- package/dist/{chunk-QXIWLWR2.cjs → chunk-QPSLGOIH.cjs} +6 -6
- package/dist/{chunk-QXIWLWR2.cjs.map → chunk-QPSLGOIH.cjs.map} +1 -1
- package/dist/{chunk-VDHBLDQC.cjs → chunk-QTNIFFBJ.cjs} +4 -4
- package/dist/{chunk-VDHBLDQC.cjs.map → chunk-QTNIFFBJ.cjs.map} +1 -1
- package/dist/{chunk-LYDSETR7.cjs → chunk-RIGCKOUY.cjs} +23 -240
- package/dist/chunk-RIGCKOUY.cjs.map +1 -0
- package/dist/{chunk-TBDQGSFI.cjs → chunk-RJUQ4PHS.cjs} +4 -4
- package/dist/{chunk-TBDQGSFI.cjs.map → chunk-RJUQ4PHS.cjs.map} +1 -1
- package/dist/{chunk-P5DNNAUY.cjs → chunk-S2QM6AHI.cjs} +74 -74
- package/dist/{chunk-P5DNNAUY.cjs.map → chunk-S2QM6AHI.cjs.map} +1 -1
- package/dist/{chunk-V4XARTJ4.cjs → chunk-SAQ7ZAMK.cjs} +12 -12
- package/dist/{chunk-V4XARTJ4.cjs.map → chunk-SAQ7ZAMK.cjs.map} +1 -1
- package/dist/{chunk-NSL5BCGH.cjs → chunk-SI3YRTW4.cjs} +7 -7
- package/dist/{chunk-NSL5BCGH.cjs.map → chunk-SI3YRTW4.cjs.map} +1 -1
- package/dist/{chunk-SXC4ZIN4.cjs → chunk-SOVYCUML.cjs} +28 -28
- package/dist/{chunk-SXC4ZIN4.cjs.map → chunk-SOVYCUML.cjs.map} +1 -1
- package/dist/{chunk-TLIZD6DV.cjs → chunk-SZF4CR4O.cjs} +6 -6
- package/dist/{chunk-TLIZD6DV.cjs.map → chunk-SZF4CR4O.cjs.map} +1 -1
- package/dist/{chunk-KC3HRFSO.cjs → chunk-T44BYZNJ.cjs} +8 -8
- package/dist/{chunk-KC3HRFSO.cjs.map → chunk-T44BYZNJ.cjs.map} +1 -1
- package/dist/{chunk-VDT7TEAH.cjs → chunk-T6KYE3TR.cjs} +6 -6
- package/dist/{chunk-VDT7TEAH.cjs.map → chunk-T6KYE3TR.cjs.map} +1 -1
- package/dist/{chunk-HN56WWBR.cjs → chunk-UCMUGS6F.cjs} +7 -7
- package/dist/{chunk-HN56WWBR.cjs.map → chunk-UCMUGS6F.cjs.map} +1 -1
- package/dist/{chunk-JTBWI74K.cjs → chunk-ULS5DQTO.cjs} +7 -7
- package/dist/{chunk-JTBWI74K.cjs.map → chunk-ULS5DQTO.cjs.map} +1 -1
- package/dist/{chunk-A7MGQMOV.cjs → chunk-UO2IJNYC.cjs} +11 -11
- package/dist/{chunk-A7MGQMOV.cjs.map → chunk-UO2IJNYC.cjs.map} +1 -1
- package/dist/{chunk-Z574BY3H.cjs → chunk-UXLEHCOW.cjs} +7 -7
- package/dist/{chunk-Z574BY3H.cjs.map → chunk-UXLEHCOW.cjs.map} +1 -1
- package/dist/{chunk-IXCWZ4HC.cjs → chunk-V27N2PTV.cjs} +5 -5
- package/dist/{chunk-IXCWZ4HC.cjs.map → chunk-V27N2PTV.cjs.map} +1 -1
- package/dist/{chunk-EAH7LFJN.cjs → chunk-V4362YKU.cjs} +25 -25
- package/dist/{chunk-EAH7LFJN.cjs.map → chunk-V4362YKU.cjs.map} +1 -1
- package/dist/{chunk-K67VMSOX.cjs → chunk-VJKUADA3.cjs} +7 -7
- package/dist/{chunk-K67VMSOX.cjs.map → chunk-VJKUADA3.cjs.map} +1 -1
- package/dist/{chunk-HQ6SK34T.cjs → chunk-VXCZOQ5R.cjs} +3 -3
- package/dist/{chunk-HQ6SK34T.cjs.map → chunk-VXCZOQ5R.cjs.map} +1 -1
- package/dist/{chunk-J5CBCUQE.cjs → chunk-WDAO4MPC.cjs} +8 -8
- package/dist/{chunk-J5CBCUQE.cjs.map → chunk-WDAO4MPC.cjs.map} +1 -1
- package/dist/chunk-WRYNJNC6.cjs +18 -0
- package/dist/{chunk-HBY5PEMC.cjs.map → chunk-WRYNJNC6.cjs.map} +1 -1
- package/dist/{chunk-3RAW2ZH5.cjs → chunk-XCQDQSZL.cjs} +8 -8
- package/dist/{chunk-3RAW2ZH5.cjs.map → chunk-XCQDQSZL.cjs.map} +1 -1
- package/dist/{chunk-LYJFE37D.cjs → chunk-XE3PKEBU.cjs} +21 -21
- package/dist/{chunk-LYJFE37D.cjs.map → chunk-XE3PKEBU.cjs.map} +1 -1
- package/dist/{chunk-GD5OYIOV.cjs → chunk-XFNBHLVW.cjs} +6 -6
- package/dist/{chunk-GD5OYIOV.cjs.map → chunk-XFNBHLVW.cjs.map} +1 -1
- package/dist/{chunk-XQPJWPWE.cjs → chunk-XKKY2RF2.cjs} +4 -4
- package/dist/{chunk-XQPJWPWE.cjs.map → chunk-XKKY2RF2.cjs.map} +1 -1
- package/dist/{chunk-XYN3RP5W.cjs → chunk-XTRE3X4I.cjs} +36 -18
- package/dist/chunk-XTRE3X4I.cjs.map +1 -0
- package/dist/chunk-XU7SIV2P.cjs +394 -0
- package/dist/chunk-XU7SIV2P.cjs.map +1 -0
- package/dist/{chunk-NYNHFDVW.cjs → chunk-YI26A7SN.cjs} +5 -5
- package/dist/{chunk-NYNHFDVW.cjs.map → chunk-YI26A7SN.cjs.map} +1 -1
- package/dist/{chunk-ZTR3SUN4.cjs → chunk-YKEI4XPI.cjs} +14 -14
- package/dist/{chunk-ZTR3SUN4.cjs.map → chunk-YKEI4XPI.cjs.map} +1 -1
- package/dist/{chunk-SOT7NPIB.cjs → chunk-Z4MZZBTR.cjs} +4 -4
- package/dist/{chunk-SOT7NPIB.cjs.map → chunk-Z4MZZBTR.cjs.map} +1 -1
- package/dist/{chunk-HGH5FLYS.cjs → chunk-ZGT6M5C5.cjs} +14 -14
- package/dist/{chunk-HGH5FLYS.cjs.map → chunk-ZGT6M5C5.cjs.map} +1 -1
- package/dist/{chunk-EFV52SZ6.cjs → chunk-ZINJWTUD.cjs} +4 -4
- package/dist/{chunk-EFV52SZ6.cjs.map → chunk-ZINJWTUD.cjs.map} +1 -1
- package/dist/{chunk-ZLMWMAID.cjs → chunk-ZMGPE43A.cjs} +4 -4
- package/dist/{chunk-ZLMWMAID.cjs.map → chunk-ZMGPE43A.cjs.map} +1 -1
- package/dist/citations/index.cjs +10 -10
- package/dist/collaboration/index.cjs +70 -70
- package/dist/connect/docx.cjs +23 -23
- package/dist/connect/index.cjs +1661 -1653
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +33 -31
- package/dist/connection/ConnectedSignDocumentDialog.d.ts +8 -0
- package/dist/connection/ConnectedSignDocumentDialog.js +14 -0
- package/dist/connection/ConnectedSignDocumentDialog.js.map +7 -0
- package/dist/connection/ConnectionProvider.js +7 -12
- package/dist/connection/ConnectionProvider.js.map +2 -2
- package/dist/connection/WorkflowRunnerDialogs.js +2 -2
- package/dist/connection/WorkflowRunnerDialogs.js.map +2 -2
- package/dist/connection/types.d.ts +2 -2
- package/dist/connection/useSigningIdentity.d.ts +10 -0
- package/dist/connection/useSigningIdentity.js +15 -0
- package/dist/connection/useSigningIdentity.js.map +7 -0
- package/dist/connection/viewer/ConnectedDocumentViewer.js +2 -2
- package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
- package/dist/connection/viewer/ConnectedSharedFileDialog.js +4 -0
- package/dist/connection/viewer/ConnectedSharedFileDialog.js.map +2 -2
- package/dist/connection/viewer/ConnectedSharedFilesPage.js +4 -0
- package/dist/connection/viewer/ConnectedSharedFilesPage.js.map +2 -2
- package/dist/dashboards/index.cjs +20 -20
- package/dist/document-tools/SignDocumentDialog.d.ts +10 -1
- package/dist/document-tools/SignDocumentDialog.js +116 -93
- package/dist/document-tools/SignDocumentDialog.js.map +2 -2
- package/dist/document-tools/index.cjs +28 -27
- package/dist/document-tools/useIdentityGate.d.ts +26 -0
- package/dist/document-tools/useIdentityGate.js +55 -0
- package/dist/document-tools/useIdentityGate.js.map +7 -0
- package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +9 -1
- package/dist/document-tools/viewer/GuidedSigningViewer.js +19 -5
- package/dist/document-tools/viewer/GuidedSigningViewer.js.map +2 -2
- package/dist/document-tools/viewer/SharedFileView.d.ts +5 -1
- package/dist/document-tools/viewer/SharedFileView.js +5 -1
- package/dist/document-tools/viewer/SharedFileView.js.map +2 -2
- package/dist/document-tools/viewer/index.cjs +13 -11
- package/dist/document-tools/viewer/index.cjs.map +1 -1
- package/dist/docx/index.cjs +40 -40
- package/dist/embed/index.cjs +34 -34
- package/dist/facts/index.cjs +42 -42
- package/dist/files/index.cjs +223 -223
- package/dist/home/index.cjs +27 -27
- package/dist/index.cjs +429 -429
- package/dist/pages/index.cjs +42 -42
- package/dist/retrieval/index.cjs +6 -6
- package/dist/settings/IdentityVerification.d.ts +4 -0
- package/dist/settings/IdentityVerification.js +12 -8
- package/dist/settings/IdentityVerification.js.map +2 -2
- package/dist/settings/ModalScaffold.js +1 -0
- package/dist/settings/ModalScaffold.js.map +2 -2
- package/dist/settings/index.cjs +161 -161
- package/dist/shell/index.cjs +42 -42
- package/dist/studio/index.cjs +33 -33
- package/dist/workflow-canvas/index.cjs +54 -52
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workspaces/index.cjs +27 -27
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedMailInviteCard-DDGB4LLC.cjs +0 -22
- package/dist/FilesViewerDialog-O3ZTKELI.cjs.map +0 -1
- package/dist/ai-I7QIW5OA.cjs.map +0 -1
- package/dist/chunk-3GI3UM2T.cjs.map +0 -1
- package/dist/chunk-CVPV4I7Z.cjs.map +0 -1
- package/dist/chunk-HBY5PEMC.cjs +0 -18
- package/dist/chunk-LYDSETR7.cjs.map +0 -1
- package/dist/chunk-OUYBYZ7Y.cjs +0 -176
- package/dist/chunk-OUYBYZ7Y.cjs.map +0 -1
- package/dist/chunk-QQMMCXBP.cjs +0 -173
- package/dist/chunk-QQMMCXBP.cjs.map +0 -1
- package/dist/chunk-SYUVP52B.cjs.map +0 -1
- package/dist/chunk-VWSOHZK2.cjs.map +0 -1
- package/dist/chunk-XYN3RP5W.cjs.map +0 -1
package/dist/connect/viewer.cjs
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkJMMDTIWM_cjs = require('../chunk-JMMDTIWM.cjs');
|
|
5
5
|
require('../chunk-NDRE7LD2.cjs');
|
|
6
6
|
require('../chunk-WVZLAAIZ.cjs');
|
|
7
7
|
require('../chunk-X7ALF4MP.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-XCQDQSZL.cjs');
|
|
9
9
|
require('../chunk-4CIVQWAX.cjs');
|
|
10
10
|
require('../chunk-QWVUBTW3.cjs');
|
|
11
11
|
require('../chunk-JVEDKKNO.cjs');
|
|
12
|
-
var
|
|
13
|
-
require('../chunk-
|
|
14
|
-
require('../chunk-
|
|
15
|
-
require('../chunk-
|
|
16
|
-
require('../chunk-
|
|
17
|
-
require('../chunk-
|
|
18
|
-
require('../chunk-
|
|
12
|
+
var chunkWDAO4MPC_cjs = require('../chunk-WDAO4MPC.cjs');
|
|
13
|
+
require('../chunk-CEBEDIP7.cjs');
|
|
14
|
+
require('../chunk-PIM7D4BJ.cjs');
|
|
15
|
+
require('../chunk-37RTQFWM.cjs');
|
|
16
|
+
require('../chunk-2JSXBOG2.cjs');
|
|
17
|
+
require('../chunk-GKEZUE4F.cjs');
|
|
18
|
+
require('../chunk-UO2IJNYC.cjs');
|
|
19
|
+
require('../chunk-DEL7BS25.cjs');
|
|
20
|
+
require('../chunk-RIGCKOUY.cjs');
|
|
19
21
|
require('../chunk-WJIAA6G3.cjs');
|
|
20
22
|
require('../chunk-JWCVA4LC.cjs');
|
|
21
|
-
require('../chunk-
|
|
22
|
-
require('../chunk-
|
|
23
|
+
require('../chunk-XU7SIV2P.cjs');
|
|
24
|
+
require('../chunk-V4362YKU.cjs');
|
|
23
25
|
require('../chunk-223D4727.cjs');
|
|
24
26
|
require('../chunk-DTMBAFIL.cjs');
|
|
25
|
-
require('../chunk-
|
|
27
|
+
require('../chunk-AX26HWDZ.cjs');
|
|
26
28
|
require('../chunk-4ONPEVTP.cjs');
|
|
27
29
|
require('../chunk-V3KLUWQQ.cjs');
|
|
28
|
-
require('../chunk-
|
|
29
|
-
require('../chunk-
|
|
30
|
-
require('../chunk-
|
|
30
|
+
require('../chunk-62HKBJNH.cjs');
|
|
31
|
+
require('../chunk-Z4MZZBTR.cjs');
|
|
32
|
+
require('../chunk-ZGT6M5C5.cjs');
|
|
31
33
|
require('../chunk-76S6WTEC.cjs');
|
|
32
34
|
require('../chunk-V5P5MRSR.cjs');
|
|
33
35
|
require('../chunk-SNUBQMIS.cjs');
|
|
34
36
|
require('../chunk-LIDXIX36.cjs');
|
|
35
37
|
require('../chunk-34HQO4ZQ.cjs');
|
|
36
38
|
require('../chunk-CT3SLXB7.cjs');
|
|
37
|
-
require('../chunk-
|
|
39
|
+
require('../chunk-NZBPVCQ5.cjs');
|
|
38
40
|
require('../chunk-5E6ZQ5EO.cjs');
|
|
39
41
|
require('../chunk-2RLA6QO2.cjs');
|
|
40
42
|
require('../chunk-MZZ3SBQL.cjs');
|
|
41
|
-
require('../chunk-
|
|
43
|
+
require('../chunk-QTNIFFBJ.cjs');
|
|
42
44
|
require('../chunk-WRTEKOQP.cjs');
|
|
43
|
-
require('../chunk-
|
|
45
|
+
require('../chunk-T6KYE3TR.cjs');
|
|
44
46
|
require('../chunk-WQMR3O2D.cjs');
|
|
45
47
|
require('../chunk-NZNBJF3M.cjs');
|
|
46
48
|
require('../chunk-NWNVWO6L.cjs');
|
|
@@ -51,10 +53,10 @@ require('../chunk-XJEXFEWG.cjs');
|
|
|
51
53
|
require('../chunk-E23H6FJR.cjs');
|
|
52
54
|
require('../chunk-YZSQ7F5K.cjs');
|
|
53
55
|
require('../chunk-KQF7POTG.cjs');
|
|
54
|
-
require('../chunk-MNIQDXM6.cjs');
|
|
55
|
-
require('../chunk-VJNJ4G6Y.cjs');
|
|
56
56
|
require('../chunk-HME72RFP.cjs');
|
|
57
|
-
require('../chunk-
|
|
57
|
+
require('../chunk-MNIQDXM6.cjs');
|
|
58
|
+
require('../chunk-3VVLI5RM.cjs');
|
|
59
|
+
require('../chunk-VXCZOQ5R.cjs');
|
|
58
60
|
require('../chunk-75BNMCUX.cjs');
|
|
59
61
|
require('../chunk-OEJQFPWO.cjs');
|
|
60
62
|
require('../chunk-OYXWQTHF.cjs');
|
|
@@ -64,15 +66,15 @@ require('../chunk-FX3K6LNZ.cjs');
|
|
|
64
66
|
require('../chunk-KD37PODE.cjs');
|
|
65
67
|
require('../chunk-3YEXZX4H.cjs');
|
|
66
68
|
require('../chunk-4PA6VCCR.cjs');
|
|
67
|
-
require('../chunk-
|
|
69
|
+
require('../chunk-T44BYZNJ.cjs');
|
|
68
70
|
require('../chunk-AHDJXIUB.cjs');
|
|
71
|
+
require('../chunk-V27N2PTV.cjs');
|
|
69
72
|
require('../chunk-S3GVFAFB.cjs');
|
|
70
|
-
require('../chunk-IXCWZ4HC.cjs');
|
|
71
73
|
require('../chunk-FSTIAEJW.cjs');
|
|
72
74
|
require('../chunk-VOGIYFNN.cjs');
|
|
73
75
|
require('../chunk-UDSHVNU3.cjs');
|
|
74
76
|
require('../chunk-DKY67DA6.cjs');
|
|
75
|
-
require('../chunk-
|
|
77
|
+
require('../chunk-FEM56BGP.cjs');
|
|
76
78
|
require('../chunk-IPSHAMO2.cjs');
|
|
77
79
|
require('../chunk-6UZC4XVV.cjs');
|
|
78
80
|
require('../chunk-ZVEW3JBT.cjs');
|
|
@@ -84,14 +86,14 @@ require('../chunk-5OD6DRG7.cjs');
|
|
|
84
86
|
require('../chunk-M74FWYNL.cjs');
|
|
85
87
|
require('../chunk-PIKTGP55.cjs');
|
|
86
88
|
require('../chunk-VZOOGA47.cjs');
|
|
87
|
-
require('../chunk-
|
|
88
|
-
require('../chunk-
|
|
89
|
+
require('../chunk-XFNBHLVW.cjs');
|
|
90
|
+
require('../chunk-EEDKECR7.cjs');
|
|
89
91
|
require('../chunk-3YZKDCWY.cjs');
|
|
90
92
|
require('../chunk-SJSGSHIT.cjs');
|
|
91
93
|
require('../chunk-ZW6FPIFC.cjs');
|
|
92
|
-
require('../chunk-
|
|
93
|
-
require('../chunk-
|
|
94
|
-
require('../chunk-
|
|
94
|
+
require('../chunk-UCMUGS6F.cjs');
|
|
95
|
+
require('../chunk-VJKUADA3.cjs');
|
|
96
|
+
require('../chunk-NAVFMFWM.cjs');
|
|
95
97
|
require('../chunk-PPCATBOY.cjs');
|
|
96
98
|
require('../chunk-ZT5MIFLC.cjs');
|
|
97
99
|
require('../chunk-LJJJ6CYH.cjs');
|
|
@@ -101,11 +103,11 @@ require('../chunk-PLIF5CUV.cjs');
|
|
|
101
103
|
|
|
102
104
|
Object.defineProperty(exports, "ConnectedDocumentViewer", {
|
|
103
105
|
enumerable: true,
|
|
104
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkJMMDTIWM_cjs.ConnectedDocumentViewer; }
|
|
105
107
|
});
|
|
106
108
|
Object.defineProperty(exports, "ConnectedDocumentToolsProvider", {
|
|
107
109
|
enumerable: true,
|
|
108
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkWDAO4MPC_cjs.ConnectedDocumentToolsProvider; }
|
|
109
111
|
});
|
|
110
112
|
//# sourceMappingURL=viewer.cjs.map
|
|
111
113
|
//# sourceMappingURL=viewer.cjs.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SignDocumentDialog` bound to the account: when signing is refused until the signer has verified
|
|
3
|
+
* their identity (a workflow signing step can ask for it), the signer runs the ID check from the
|
|
4
|
+
* dialog and goes on signing. Inside the host's account provider.
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactElement } from 'react';
|
|
7
|
+
import { type SignDocumentDialogProps } from '../document-tools/SignDocumentDialog';
|
|
8
|
+
export declare function ConnectedSignDocumentDialog(props: Omit<SignDocumentDialogProps, 'identity' | 'accountName'>): ReactElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
SignDocumentDialog
|
|
5
|
+
} from "../document-tools/SignDocumentDialog.js";
|
|
6
|
+
import { useSigningIdentity } from "./useSigningIdentity.js";
|
|
7
|
+
function ConnectedSignDocumentDialog(props) {
|
|
8
|
+
const { identity, accountName } = useSigningIdentity();
|
|
9
|
+
return /* @__PURE__ */ jsx(SignDocumentDialog, { ...props, identity, accountName });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
ConnectedSignDocumentDialog
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=ConnectedSignDocumentDialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/connection/ConnectedSignDocumentDialog.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * `SignDocumentDialog` bound to the account: when signing is refused until the signer has verified\n * their identity (a workflow signing step can ask for it), the signer runs the ID check from the\n * dialog and goes on signing. Inside the host's account provider.\n */\n\nimport type { ReactElement } from 'react'\nimport {\n SignDocumentDialog,\n type SignDocumentDialogProps,\n} from '../document-tools/SignDocumentDialog'\nimport { useSigningIdentity } from './useSigningIdentity'\n\nexport function ConnectedSignDocumentDialog(\n props: Omit<SignDocumentDialogProps, 'identity' | 'accountName'>\n): ReactElement {\n const { identity, accountName } = useSigningIdentity()\n return <SignDocumentDialog {...props} identity={identity} accountName={accountName} />\n}\n"],
|
|
5
|
+
"mappings": ";AAiBS;AAVT;AAAA,EACE;AAAA,OAEK;AACP,SAAS,0BAA0B;AAE5B,SAAS,4BACd,OACc;AACd,QAAM,EAAE,UAAU,YAAY,IAAI,mBAAmB;AACrD,SAAO,oBAAC,sBAAoB,GAAG,OAAO,UAAoB,aAA0B;AACtF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -119,12 +119,14 @@ function ConnectionProvider({
|
|
|
119
119
|
if (workspaces?.length) {
|
|
120
120
|
const persisted = readPersistedWorkspace(config.apiUrl, storageUserRef.current);
|
|
121
121
|
const preferred = persisted ?? config.workspaceId;
|
|
122
|
-
const target =
|
|
122
|
+
const target = preferred ? workspaces.find((w) => w.external_id === preferred) : void 0;
|
|
123
123
|
if (target) {
|
|
124
124
|
selectWorkspaceId(target.external_id);
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
if (await openSelectedWorkspace()) {
|
|
126
|
+
persistWorkspace(config.apiUrl, storageUserRef.current, target.external_id);
|
|
127
|
+
} else {
|
|
128
|
+
selectWorkspaceId(null);
|
|
129
|
+
}
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
let resolved = { name: email.split("@")[0], email };
|
|
@@ -159,14 +161,7 @@ function ConnectionProvider({
|
|
|
159
161
|
setStatus("error");
|
|
160
162
|
}
|
|
161
163
|
},
|
|
162
|
-
[
|
|
163
|
-
arbi,
|
|
164
|
-
config.workspaceId,
|
|
165
|
-
config.apiUrl,
|
|
166
|
-
config.requireWorkspaceSelection,
|
|
167
|
-
selectWorkspaceId,
|
|
168
|
-
openSelectedWorkspace
|
|
169
|
-
]
|
|
164
|
+
[arbi, config.workspaceId, config.apiUrl, selectWorkspaceId, openSelectedWorkspace]
|
|
170
165
|
);
|
|
171
166
|
const signingIn = useRef(Promise.resolve());
|
|
172
167
|
useEffect(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/connection/ConnectionProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * The demo/live connection layer for a host app. Holds auth + workspace\n * selection state and exposes it via {@link useConnection}, so every surface\n * works identically whether it's talking to a live ARBI backend or the seeded\n * demo workspace. Host-specific values (backend URL, demo identity, default\n * workspace/assistant ids) arrive once through {@link ArbiConnectionConfig}.\n */\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport {\n arbiAccountClient,\n clearSealedDrafts,\n wipeOfflineMail,\n toProfileView,\n useArbi,\n useArbiSessionState,\n useArbiSessionStore,\n useSwitchWorkspace,\n type AccountClient,\n type LoginProfile,\n type ProfileView,\n} from '@arbidocs/react'\nimport { clearChatArtifacts } from '@arbidocs/react/shell'\nimport type { ArbiMode, ArbiUser, ConnectionStatus, ArbiConnectionConfig } from './types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { ArbiHost } from '../provider/host'\nimport { closeAllDialogs } from '../provider/dialog-registry'\n\ninterface ConnectionValue {\n mode: ArbiMode\n status: ConnectionStatus\n user: ArbiUser | null\n /** The selected workspace: the session state's (`useArbiSessionState`), set by `setWorkspace`. */\n workspaceId: string | null\n apiConfigured: boolean\n apiUrl: string\n /**\n * The deployment domain the user's keys are derived for (`arbi.getDeploymentDomain()`), for the\n * document tools' e-signing. `undefined` in demo mode.\n */\n deploymentDomain: string | undefined\n error: string | null\n /** Default assistant config ext_id (for the AI hooks). */\n assistantConfig?: string\n /**\n * The demo's workspace when none is selected. Never set signed in to a live backend: there the\n * selection is the only workspace (none while a switch is in flight), never a remembered one.\n */\n fallbackWorkspaceId?: string\n /** Authenticate. Live login when a backend is configured, otherwise the demo workspace. */\n login: (email: string, password: string) => Promise<void>\n /** One-click demo entry (no backend required). */\n enterDemo: () => void\n logout: () => void\n /**\n * Affirmatively select a workspace: opens it on the server (via the SDK),\n * updates the app-wide state, and persists the choice so it survives future\n * logins. This is the single entry point for \"the user is now in workspace X\".\n */\n setWorkspace: (id: string) => Promise<void>\n /**\n * Re-assert the selected workspace on the server session (idempotent `/open`).\n * Call before a workspace-scoped write when the session may have lost its open\n * workspace (token re-login, backend restart, session expiry) \u2014 the server\n * resolves the workspace from the session, so a dropped `/open` yields\n * \"No active workspace\" until it's re-opened.\n */\n ensureWorkspaceOpen: () => Promise<void>\n}\n\nconst ConnectionContext = createContext<ConnectionValue | null>(null)\n\n/**\n * Persist the affirmatively-selected workspace per backend AND per signed-in user, so a returning\n * user lands back in the workspace they last chose, while the next person on a shared browser\n * never starts from someone else's workspace id. Namespaced by apiUrl so distinct deployments\n * (and the demo workspace) don't clobber each other. Cleared on logout.\n */\nconst WORKSPACE_STORAGE_PREFIX = 'arbi:selectedWorkspace'\nconst normalizeUserKey = (email: string) => email.trim().toLowerCase()\n\n/** Exported for tests. */\nexport const workspaceStorageKey = (apiUrl: string, userKey: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}:${normalizeUserKey(userKey)}`\n\n/** The pre-isolation key (apiUrl only). Never read: removed so it cannot leak across users. */\nconst legacyWorkspaceStorageKey = (apiUrl: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}`\n\nfunction readPersistedWorkspace(apiUrl: string, userKey: string | null): string | null {\n if (!userKey) return null\n try {\n return window.localStorage.getItem(workspaceStorageKey(apiUrl, userKey))\n } catch {\n return null\n }\n}\n\nfunction persistWorkspace(apiUrl: string, userKey: string | null, id: string | null): void {\n if (!userKey) return\n try {\n if (id) window.localStorage.setItem(workspaceStorageKey(apiUrl, userKey), id)\n else window.localStorage.removeItem(workspaceStorageKey(apiUrl, userKey))\n window.localStorage.removeItem(legacyWorkspaceStorageKey(apiUrl))\n } catch {\n // Storage unavailable (private mode, SSR) \u2014 selection stays in-memory only.\n }\n}\n\n/** Shown on the sign-in screen after the session could not be recovered. */\nexport const SESSION_EXPIRED_MESSAGE = 'Your session expired. Sign in again.'\n\n/** The connection user for a profile: its full name, falling back to the email local part. */\nfunction userFromProfile(profile: LoginProfile, externalId?: string): ArbiUser {\n const fullName = [profile.givenName, profile.familyName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ')\n return {\n name: fullName || profile.email.split('@')[0],\n email: profile.email,\n externalId,\n picture: profile.picture,\n }\n}\n\n/**\n * The sign-in layer of a blocks-only site, mounted by its host (`defaultHost`): login, demo mode\n * and the selected workspace, over the host's session state (the selected workspace lives there,\n * so every block reads one value). Its account client is the host's `account` below it.\n */\nexport function ConnectionProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const arbi = useArbi()\n const session = useArbiSessionStore()\n const { switchWorkspace, openSelectedWorkspace, settled } = useSwitchWorkspace()\n const isLiveConfigured = config.apiUrl.length > 0\n const demoWorkspaceId = config.demoWorkspaceId ?? 'demo-workspace'\n\n const [status, setStatus] = useState<ConnectionStatus>(\n isLiveConfigured ? 'connecting' : 'disconnected'\n )\n const [user, setUser] = useState<ArbiUser | null>(null)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const selectWorkspaceId = session.setWorkspaceId\n const [mode, setMode] = useState<ArbiMode>('demo')\n const [error, setError] = useState<string | null>(null)\n // Dialogs belong to the signed-in session. A first signed-out mount may carry an invitation\n // intent, so clear only after an authenticated (or demo) session actually ends. A workspace\n // switch / sign-in can pass through `connecting` without ending that session.\n const hadDialogSession = useRef(false)\n useEffect(() => {\n if (status === 'authenticated' || status === 'demo') {\n hadDialogSession.current = true\n } else if (status !== 'connecting' && hadDialogSession.current) {\n hadDialogSession.current = false\n closeAllDialogs()\n }\n }, [status])\n // Who the persisted workspace belongs to; set at sign-in, cleared at logout.\n const storageUserRef = useRef<string | null>(null)\n // Moves at each logout: a sign-in still finishing from before it does not sign back in.\n const sessionRun = useRef(0)\n\n // The SDK could not recover the session (token refused, workspace not re-openable): drop to\n // 'disconnected' with a plain message, so the host's gate sends the user to sign in instead of\n // every call failing with a raw backend error. The remembered workspace is kept for next login.\n useEffect(\n () =>\n arbi.onSessionExpired?.(() => {\n storageUserRef.current = null\n setUser(null)\n selectWorkspaceId(null)\n setStatus('disconnected')\n setError(SESSION_EXPIRED_MESSAGE)\n }),\n [arbi, selectWorkspaceId]\n )\n\n // A saved name, picture or email reaches every surface reading `useConnection().user`.\n useEffect(\n () =>\n arbi.user.onProfileChange?.((profile) =>\n setUser((current) => (current ? userFromProfile(profile, current.externalId) : current))\n ),\n [arbi]\n )\n\n const enterDemo = useCallback(() => {\n setMode('demo')\n setStatus('demo')\n setError(null)\n setUser({ name: config.demoUser.name, email: config.demoUser.email })\n selectWorkspaceId(demoWorkspaceId)\n }, [config.demoUser.name, config.demoUser.email, demoWorkspaceId, selectWorkspaceId])\n\n /**\n * The session signed in, by whatever path (`login` below, a sign-in page on the host's `Arbi`,\n * a restored session): open the user's workspace and resolve who they are.\n */\n const completeSignIn = useCallback(\n async (email: string) => {\n const run = sessionRun.current\n const signedOut = () => run !== sessionRun.current\n setMode('live')\n setStatus('connecting')\n setError(null)\n try {\n storageUserRef.current = normalizeUserKey(email)\n const workspaces = await arbi.workspaces.list()\n if (workspaces?.length) {\n // Prefer the workspace the user last affirmatively selected (persisted),\n // then the configured workspace (there may be several \u2014 e.g. a\n // marketing/KM workspace), then whichever happens to be first. Ternary\n // (not `&&`) so an empty value can't leak `\"\"` into `target`.\n const persisted = readPersistedWorkspace(config.apiUrl, storageUserRef.current)\n const preferred = persisted ?? config.workspaceId\n const target =\n (preferred ? workspaces.find((w) => w.external_id === preferred) : undefined) ??\n (config.requireWorkspaceSelection ? undefined : workspaces[0])\n if (target) {\n selectWorkspaceId(target.external_id)\n if (!(await openSelectedWorkspace()))\n throw new Error('Could not open your workspace. Try signing in again.')\n persistWorkspace(config.apiUrl, storageUserRef.current, target.external_id)\n }\n }\n // The profile (name + avatar) comes with the login response. A session restored without\n // a login has none, so fall back to finding ourselves in the workspace roster; the email\n // local part is only the last resort, never the answer when a profile name exists.\n let resolved: ArbiUser = { name: email.split('@')[0], email }\n const me = arbi.user.identity()\n const profile = arbi.user.profile?.()\n if (profile) {\n resolved = userFromProfile(profile, me?.externalId)\n } else {\n try {\n const members = await arbi.workspaces.listUsers()\n const self = members.find((m) => m.user.external_id === me?.externalId)?.user\n if (self) {\n const fullName = [self.given_name, self.family_name].filter(Boolean).join(' ').trim()\n resolved = {\n name: fullName || email.split('@')[0],\n email: self.email || email,\n externalId: self.external_id,\n picture: self.picture ?? null,\n }\n } else if (me?.externalId) {\n resolved.externalId = me.externalId\n }\n } catch {\n // Roster not available (e.g. no workspace) \u2014 keep the fallback identity.\n }\n }\n if (signedOut()) return\n setUser(resolved)\n setStatus('authenticated')\n } catch (e) {\n if (signedOut()) return\n // Surface the real error \u2014 no silent fallback to a fake session.\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [\n arbi,\n config.workspaceId,\n config.apiUrl,\n config.requireWorkspaceSelection,\n selectWorkspaceId,\n openSelectedWorkspace,\n ]\n )\n\n // Every sign-in on the host's `Arbi` lands here, whichever page or kit made it.\n const signingIn = useRef<Promise<void>>(Promise.resolve())\n useEffect(\n () =>\n arbi.onSignedIn?.((login) => {\n signingIn.current = completeSignIn(\n login.profile?.email ??\n arbi.session?.getState().userEmail ??\n arbi.user.identity()?.email ??\n ''\n )\n }),\n [arbi, completeSignIn]\n )\n\n /** Authenticate: a live login when a backend is configured, otherwise the demo workspace. */\n const login = useCallback(\n async (email: string, password: string) => {\n setError(null)\n if (!isLiveConfigured) {\n enterDemo()\n return\n }\n setStatus('connecting')\n setMode('live')\n try {\n // Signed in: `completeSignIn` follows (onSignedIn); done once it is.\n await arbi.login(email, password)\n await signingIn.current\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, enterDemo, isLiveConfigured]\n )\n\n // The session kept on this device signs in again (no password; the key stays encrypted on the\n // device). Run once even under StrictMode.\n const restoreStarted = useRef(false)\n useEffect(() => {\n if (restoreStarted.current || !isLiveConfigured) return\n restoreStarted.current = true\n arbi\n .restore()\n .catch(() => false)\n .then(async (restored) => {\n if (restored) await signingIn.current\n else setStatus('disconnected')\n })\n }, [arbi, isLiveConfigured])\n\n // Signing out: resolves once the mail kept on this device is gone too (the account client's\n // `signOut` waits for it); `logout` starts it.\n const signOutConnection = useCallback(async () => {\n sessionRun.current++\n // The SDK stops the session's work (requests, re-logins, opens, the queries in flight) before\n // the server revokes the token.\n if (mode === 'live') {\n void arbi.logout?.()\n }\n // What was typed never outlives the session (it is sealed, but kept for no one now).\n clearSealedDrafts()\n // Nor do the documents its chats were writing in this tab.\n clearChatArtifacts()\n setUser(null)\n selectWorkspaceId(null)\n persistWorkspace(config.apiUrl, storageUserRef.current, null)\n storageUserRef.current = null\n setStatus('disconnected')\n setError(null)\n // Nor does the mail kept on this device (the per-device choices stay, #2187). The sign-out is\n // done once it is gone.\n await wipeOfflineMail().catch(() => {})\n }, [arbi, mode, config.apiUrl, selectWorkspaceId])\n const logout = useCallback(() => {\n void signOutConnection()\n }, [signOutConnection])\n\n // Affirmative selection: the shared workspace switch (live), then remember it so the next\n // login lands there too. This provider IS the host's navigation, so it alone (with sign-in and\n // ensureWorkspaceOpen, which re-open the host's own selection) changes the workspace; kits reach\n // another workspace with `arbi.workspaces.open`.\n const setWorkspace = useCallback(\n async (id: string) => {\n if (mode === 'live' && arbi.isLoggedIn) {\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n } else {\n selectWorkspaceId(id)\n }\n persistWorkspace(config.apiUrl, storageUserRef.current, id)\n },\n [arbi, mode, config.apiUrl, selectWorkspaceId, switchWorkspace]\n )\n\n // Re-open the selected workspace on the session if the server may have dropped it. Idempotent.\n // A switch in flight is waited out first, then only the selection as of then is opened (none:\n // nothing). Never a remembered or configured workspace: kits call this before reading, and\n // opening another workspace than the selected one would leave the server session in it.\n const ensureWorkspaceOpen = useCallback(async () => {\n if (mode !== 'live' || !arbi.isLoggedIn) return\n await settled()\n if (!session.getState().workspaceId) return\n await openSelectedWorkspace()\n }, [arbi, session, mode, settled, openSelectedWorkspace])\n\n const value = useMemo<ConnectionValue>(\n () => ({\n mode,\n status,\n user,\n workspaceId,\n apiConfigured: isLiveConfigured,\n apiUrl: config.apiUrl,\n deploymentDomain: isLiveConfigured ? arbi.getDeploymentDomain() : undefined,\n error,\n assistantConfig: config.assistantConfig,\n fallbackWorkspaceId: mode === 'live' ? undefined : config.workspaceId,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n }),\n [\n mode,\n status,\n user,\n workspaceId,\n isLiveConfigured,\n config.apiUrl,\n arbi,\n config.assistantConfig,\n config.workspaceId,\n error,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n ]\n )\n\n const account = useConnectionAccount(arbi, user, signOutConnection)\n const authenticated = status === 'authenticated'\n const host = useMemo(\n () => ({ account: { client: account, useEnabled: () => authenticated } }),\n [account, authenticated]\n )\n\n return (\n <ConnectionContext.Provider value={value}>\n <ArbiHost config={host}>{children}</ArbiHost>\n </ConnectionContext.Provider>\n )\n}\n\n/**\n * The account client of the settings blocks below: the SDK's, with sign-out going through this\n * connection (so its state is cleared too) and, for a session restored without a login (no SDK\n * profile), the connection user as the profile.\n */\nfunction useConnectionAccount(\n arbi: ReturnType<typeof useArbi>,\n user: ArbiUser | null,\n logout: () => Promise<void>\n): AccountClient {\n const userRef = useRef(user)\n const logoutRef = useRef(logout)\n logoutRef.current = logout\n const listeners = useRef(new Set<() => void>())\n useEffect(() => {\n userRef.current = user\n listeners.current.forEach((listener) => listener())\n }, [user])\n return useMemo(() => {\n const base = arbiAccountClient(arbi)\n return {\n ...base,\n profile: (): ProfileView | null => {\n const own = base.profile()\n const fallback = userRef.current\n if (own || !fallback) return own\n return {\n ...toProfileView({\n givenName: '',\n familyName: null,\n picture: fallback.picture ?? null,\n email: fallback.email,\n isSso: false,\n }),\n fullName: fallback.name,\n }\n },\n onProfileChange: (listener) => {\n listeners.current.add(listener)\n const off = base.onProfileChange(listener)\n return () => {\n listeners.current.delete(listener)\n off()\n }\n },\n signOut: async ({ everywhere } = {}) => {\n try {\n if (everywhere) await arbi.sessions.logoutAll()\n } finally {\n await logoutRef.current()\n }\n },\n }\n }, [arbi])\n}\n\n/** The sign-in layer of `defaultHost`, or null under a host that keeps its own session. */\nexport function useOptionalConnection(): ConnectionValue | null {\n return useContext(ConnectionContext)\n}\n\nexport function useConnection(): ConnectionValue {\n const ctx = useContext(ConnectionContext)\n if (!ctx) throw new Error('useConnection needs the sign-in layer of `defaultHost` above it')\n return ctx\n}\n\n/** The sign-in layer's person (a demo session's identity too); none without `defaultHost`. */\nexport function useConnectionUser(): ArbiUser | null {\n return useContext(ConnectionContext)?.user ?? null\n}\n\nexport const isAuthenticated = (s: ConnectionStatus) => s === 'demo' || s === 'authenticated'\n\n/** The open workspace as the connected kits see it, whoever hosts them. */\nexport interface ConnectedWorkspace {\n /** The selected workspace (the session state's; with a connection, else its fallback). */\n workspaceId: string | null\n /** Signed in to a live backend: workspace-scoped queries may run. */\n live: boolean\n /** The signed-in user (their name and email, e.g. to sign a document). */\n user: ArbiUser | null\n /** The signed-in user's external id. */\n userId: string | undefined\n /** Re-assert the workspace on the server session before a workspace-scoped write. */\n ensureWorkspaceOpen: () => Promise<void>\n /**\n * Go into a workspace: select it (with a connection) and show it (`BlocksEnvironment.\n * openWorkspace`, where a host without a connection also switches its session).\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => Promise<void>\n}\n\nconst keptOpenByHost = async () => {}\n\n/** The signed-in user of a host's own session, from its login profile. */\nfunction sessionUser(arbi: ReturnType<typeof useArbi>): ArbiUser | null {\n if (!arbi.isLoggedIn) return null\n const me = arbi.user.identity()\n const profile = arbi.user.profile()\n if (!me) return null\n return profile\n ? userFromProfile(profile, me.externalId)\n : { name: (me.email ?? '').split('@')[0], email: me.email ?? '', externalId: me.externalId }\n}\n\n/**\n * The workspace for a connected kit: the sign-in layer's (`defaultHost`) when there is one, else the\n * host's own session (an app whose host config has its `arbi` and `session` and keeps its\n * workspace open itself). So a kit runs the same in Clarum and in the ARBI app.\n */\nexport function useConnectedWorkspace(): ConnectedWorkspace {\n const connection = useContext(ConnectionContext)\n const arbi = useArbi()\n const sessionWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const live = connection ? connection.status === 'authenticated' : arbi.isLoggedIn\n const user = connection ? connection.user : live ? sessionUser(arbi) : null\n const userKey = `${user?.externalId ?? ''}|${user?.name ?? ''}|${user?.email ?? ''}`\n const { openWorkspace: showWorkspace } = useBlocksEnvironment()\n return useMemo(\n () => ({\n workspaceId: connection\n ? (connection.workspaceId ?? connection.fallbackWorkspaceId ?? null)\n : sessionWorkspaceId,\n live,\n user,\n userId: user?.externalId,\n ensureWorkspaceOpen: connection?.ensureWorkspaceOpen ?? keptOpenByHost,\n openWorkspace: async (workspaceId: string, options?: { name?: string }) => {\n if (connection) await connection.setWorkspace(workspaceId)\n showWorkspace(workspaceId, options)\n },\n }),\n // `user` is rebuilt each render without a connection: its key says when it changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [connection, sessionWorkspaceId, live, userKey, showWorkspace]\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * The demo/live connection layer for a host app. Holds auth + workspace\n * selection state and exposes it via {@link useConnection}, so every surface\n * works identically whether it's talking to a live ARBI backend or the seeded\n * demo workspace. Host-specific values (backend URL, demo identity, default\n * workspace/assistant ids) arrive once through {@link ArbiConnectionConfig}.\n */\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport {\n arbiAccountClient,\n clearSealedDrafts,\n wipeOfflineMail,\n toProfileView,\n useArbi,\n useArbiSessionState,\n useArbiSessionStore,\n useSwitchWorkspace,\n type AccountClient,\n type LoginProfile,\n type ProfileView,\n} from '@arbidocs/react'\nimport { clearChatArtifacts } from '@arbidocs/react/shell'\nimport type { ArbiMode, ArbiUser, ConnectionStatus, ArbiConnectionConfig } from './types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { ArbiHost } from '../provider/host'\nimport { closeAllDialogs } from '../provider/dialog-registry'\n\ninterface ConnectionValue {\n mode: ArbiMode\n status: ConnectionStatus\n user: ArbiUser | null\n /** The selected workspace: the session state's (`useArbiSessionState`), set by `setWorkspace`. */\n workspaceId: string | null\n apiConfigured: boolean\n apiUrl: string\n /**\n * The deployment domain the user's keys are derived for (`arbi.getDeploymentDomain()`), for the\n * document tools' e-signing. `undefined` in demo mode.\n */\n deploymentDomain: string | undefined\n error: string | null\n /** Default assistant config ext_id (for the AI hooks). */\n assistantConfig?: string\n /**\n * The demo's workspace when none is selected. Never set signed in to a live backend: there the\n * selection is the only workspace (none while a switch is in flight), never a remembered one.\n */\n fallbackWorkspaceId?: string\n /** Authenticate. Live login when a backend is configured, otherwise the demo workspace. */\n login: (email: string, password: string) => Promise<void>\n /** One-click demo entry (no backend required). */\n enterDemo: () => void\n logout: () => void\n /**\n * Affirmatively select a workspace: opens it on the server (via the SDK),\n * updates the app-wide state, and persists the choice so it survives future\n * logins. This is the single entry point for \"the user is now in workspace X\".\n */\n setWorkspace: (id: string) => Promise<void>\n /**\n * Re-assert the selected workspace on the server session (idempotent `/open`).\n * Call before a workspace-scoped write when the session may have lost its open\n * workspace (token re-login, backend restart, session expiry) \u2014 the server\n * resolves the workspace from the session, so a dropped `/open` yields\n * \"No active workspace\" until it's re-opened.\n */\n ensureWorkspaceOpen: () => Promise<void>\n}\n\nconst ConnectionContext = createContext<ConnectionValue | null>(null)\n\n/**\n * Persist the affirmatively-selected workspace per backend AND per signed-in user, so a returning\n * user lands back in the workspace they last chose, while the next person on a shared browser\n * never starts from someone else's workspace id. Namespaced by apiUrl so distinct deployments\n * (and the demo workspace) don't clobber each other. Cleared on logout.\n */\nconst WORKSPACE_STORAGE_PREFIX = 'arbi:selectedWorkspace'\nconst normalizeUserKey = (email: string) => email.trim().toLowerCase()\n\n/** Exported for tests. */\nexport const workspaceStorageKey = (apiUrl: string, userKey: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}:${normalizeUserKey(userKey)}`\n\n/** The pre-isolation key (apiUrl only). Never read: removed so it cannot leak across users. */\nconst legacyWorkspaceStorageKey = (apiUrl: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}`\n\nfunction readPersistedWorkspace(apiUrl: string, userKey: string | null): string | null {\n if (!userKey) return null\n try {\n return window.localStorage.getItem(workspaceStorageKey(apiUrl, userKey))\n } catch {\n return null\n }\n}\n\nfunction persistWorkspace(apiUrl: string, userKey: string | null, id: string | null): void {\n if (!userKey) return\n try {\n if (id) window.localStorage.setItem(workspaceStorageKey(apiUrl, userKey), id)\n else window.localStorage.removeItem(workspaceStorageKey(apiUrl, userKey))\n window.localStorage.removeItem(legacyWorkspaceStorageKey(apiUrl))\n } catch {\n // Storage unavailable (private mode, SSR) \u2014 selection stays in-memory only.\n }\n}\n\n/** Shown on the sign-in screen after the session could not be recovered. */\nexport const SESSION_EXPIRED_MESSAGE = 'Your session expired. Sign in again.'\n\n/** The connection user for a profile: its full name, falling back to the email local part. */\nfunction userFromProfile(profile: LoginProfile, externalId?: string): ArbiUser {\n const fullName = [profile.givenName, profile.familyName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ')\n return {\n name: fullName || profile.email.split('@')[0],\n email: profile.email,\n externalId,\n picture: profile.picture,\n }\n}\n\n/**\n * The sign-in layer of a blocks-only site, mounted by its host (`defaultHost`): login, demo mode\n * and the selected workspace, over the host's session state (the selected workspace lives there,\n * so every block reads one value). Its account client is the host's `account` below it.\n */\nexport function ConnectionProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const arbi = useArbi()\n const session = useArbiSessionStore()\n const { switchWorkspace, openSelectedWorkspace, settled } = useSwitchWorkspace()\n const isLiveConfigured = config.apiUrl.length > 0\n const demoWorkspaceId = config.demoWorkspaceId ?? 'demo-workspace'\n\n const [status, setStatus] = useState<ConnectionStatus>(\n isLiveConfigured ? 'connecting' : 'disconnected'\n )\n const [user, setUser] = useState<ArbiUser | null>(null)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const selectWorkspaceId = session.setWorkspaceId\n const [mode, setMode] = useState<ArbiMode>('demo')\n const [error, setError] = useState<string | null>(null)\n // Dialogs belong to the signed-in session. A first signed-out mount may carry an invitation\n // intent, so clear only after an authenticated (or demo) session actually ends. A workspace\n // switch / sign-in can pass through `connecting` without ending that session.\n const hadDialogSession = useRef(false)\n useEffect(() => {\n if (status === 'authenticated' || status === 'demo') {\n hadDialogSession.current = true\n } else if (status !== 'connecting' && hadDialogSession.current) {\n hadDialogSession.current = false\n closeAllDialogs()\n }\n }, [status])\n // Who the persisted workspace belongs to; set at sign-in, cleared at logout.\n const storageUserRef = useRef<string | null>(null)\n // Moves at each logout: a sign-in still finishing from before it does not sign back in.\n const sessionRun = useRef(0)\n\n // The SDK could not recover the session (token refused, workspace not re-openable): drop to\n // 'disconnected' with a plain message, so the host's gate sends the user to sign in instead of\n // every call failing with a raw backend error. The remembered workspace is kept for next login.\n useEffect(\n () =>\n arbi.onSessionExpired?.(() => {\n storageUserRef.current = null\n setUser(null)\n selectWorkspaceId(null)\n setStatus('disconnected')\n setError(SESSION_EXPIRED_MESSAGE)\n }),\n [arbi, selectWorkspaceId]\n )\n\n // A saved name, picture or email reaches every surface reading `useConnection().user`.\n useEffect(\n () =>\n arbi.user.onProfileChange?.((profile) =>\n setUser((current) => (current ? userFromProfile(profile, current.externalId) : current))\n ),\n [arbi]\n )\n\n const enterDemo = useCallback(() => {\n setMode('demo')\n setStatus('demo')\n setError(null)\n setUser({ name: config.demoUser.name, email: config.demoUser.email })\n selectWorkspaceId(demoWorkspaceId)\n }, [config.demoUser.name, config.demoUser.email, demoWorkspaceId, selectWorkspaceId])\n\n /**\n * The session signed in, by whatever path (`login` below, a sign-in page on the host's `Arbi`,\n * a restored session): open the user's workspace and resolve who they are.\n */\n const completeSignIn = useCallback(\n async (email: string) => {\n const run = sessionRun.current\n const signedOut = () => run !== sessionRun.current\n setMode('live')\n setStatus('connecting')\n setError(null)\n try {\n storageUserRef.current = normalizeUserKey(email)\n const workspaces = await arbi.workspaces.list()\n if (workspaces?.length) {\n // Only a workspace the user chose: the one they last affirmatively selected (persisted),\n // else the configured one (there may be several, e.g. a marketing/KM workspace). Never the\n // first listed: that can be a public workspace this user is not a member of, and opening it\n // fails. Ternary (not `&&`) so an empty value can't leak `\"\"` into `target`.\n const persisted = readPersistedWorkspace(config.apiUrl, storageUserRef.current)\n const preferred = persisted ?? config.workspaceId\n const target = preferred ? workspaces.find((w) => w.external_id === preferred) : undefined\n if (target) {\n selectWorkspaceId(target.external_id)\n if (await openSelectedWorkspace()) {\n persistWorkspace(config.apiUrl, storageUserRef.current, target.external_id)\n } else {\n // The workspace cannot be opened (removed, or access lost): stay signed in with none\n // selected rather than failing the sign-in; the user picks another.\n selectWorkspaceId(null)\n }\n }\n }\n // The profile (name + avatar) comes with the login response. A session restored without\n // a login has none, so fall back to finding ourselves in the workspace roster; the email\n // local part is only the last resort, never the answer when a profile name exists.\n let resolved: ArbiUser = { name: email.split('@')[0], email }\n const me = arbi.user.identity()\n const profile = arbi.user.profile?.()\n if (profile) {\n resolved = userFromProfile(profile, me?.externalId)\n } else {\n try {\n const members = await arbi.workspaces.listUsers()\n const self = members.find((m) => m.user.external_id === me?.externalId)?.user\n if (self) {\n const fullName = [self.given_name, self.family_name].filter(Boolean).join(' ').trim()\n resolved = {\n name: fullName || email.split('@')[0],\n email: self.email || email,\n externalId: self.external_id,\n picture: self.picture ?? null,\n }\n } else if (me?.externalId) {\n resolved.externalId = me.externalId\n }\n } catch {\n // Roster not available (e.g. no workspace) \u2014 keep the fallback identity.\n }\n }\n if (signedOut()) return\n setUser(resolved)\n setStatus('authenticated')\n } catch (e) {\n if (signedOut()) return\n // Surface the real error \u2014 no silent fallback to a fake session.\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, config.workspaceId, config.apiUrl, selectWorkspaceId, openSelectedWorkspace]\n )\n\n // Every sign-in on the host's `Arbi` lands here, whichever page or kit made it.\n const signingIn = useRef<Promise<void>>(Promise.resolve())\n useEffect(\n () =>\n arbi.onSignedIn?.((login) => {\n signingIn.current = completeSignIn(\n login.profile?.email ??\n arbi.session?.getState().userEmail ??\n arbi.user.identity()?.email ??\n ''\n )\n }),\n [arbi, completeSignIn]\n )\n\n /** Authenticate: a live login when a backend is configured, otherwise the demo workspace. */\n const login = useCallback(\n async (email: string, password: string) => {\n setError(null)\n if (!isLiveConfigured) {\n enterDemo()\n return\n }\n setStatus('connecting')\n setMode('live')\n try {\n // Signed in: `completeSignIn` follows (onSignedIn); done once it is.\n await arbi.login(email, password)\n await signingIn.current\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, enterDemo, isLiveConfigured]\n )\n\n // The session kept on this device signs in again (no password; the key stays encrypted on the\n // device). Run once even under StrictMode.\n const restoreStarted = useRef(false)\n useEffect(() => {\n if (restoreStarted.current || !isLiveConfigured) return\n restoreStarted.current = true\n arbi\n .restore()\n .catch(() => false)\n .then(async (restored) => {\n if (restored) await signingIn.current\n else setStatus('disconnected')\n })\n }, [arbi, isLiveConfigured])\n\n // Signing out: resolves once the mail kept on this device is gone too (the account client's\n // `signOut` waits for it); `logout` starts it.\n const signOutConnection = useCallback(async () => {\n sessionRun.current++\n // The SDK stops the session's work (requests, re-logins, opens, the queries in flight) before\n // the server revokes the token.\n if (mode === 'live') {\n void arbi.logout?.()\n }\n // What was typed never outlives the session (it is sealed, but kept for no one now).\n clearSealedDrafts()\n // Nor do the documents its chats were writing in this tab.\n clearChatArtifacts()\n setUser(null)\n selectWorkspaceId(null)\n persistWorkspace(config.apiUrl, storageUserRef.current, null)\n storageUserRef.current = null\n setStatus('disconnected')\n setError(null)\n // Nor does the mail kept on this device (the per-device choices stay, #2187). The sign-out is\n // done once it is gone.\n await wipeOfflineMail().catch(() => {})\n }, [arbi, mode, config.apiUrl, selectWorkspaceId])\n const logout = useCallback(() => {\n void signOutConnection()\n }, [signOutConnection])\n\n // Affirmative selection: the shared workspace switch (live), then remember it so the next\n // login lands there too. This provider IS the host's navigation, so it alone (with sign-in and\n // ensureWorkspaceOpen, which re-open the host's own selection) changes the workspace; kits reach\n // another workspace with `arbi.workspaces.open`.\n const setWorkspace = useCallback(\n async (id: string) => {\n if (mode === 'live' && arbi.isLoggedIn) {\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n } else {\n selectWorkspaceId(id)\n }\n persistWorkspace(config.apiUrl, storageUserRef.current, id)\n },\n [arbi, mode, config.apiUrl, selectWorkspaceId, switchWorkspace]\n )\n\n // Re-open the selected workspace on the session if the server may have dropped it. Idempotent.\n // A switch in flight is waited out first, then only the selection as of then is opened (none:\n // nothing). Never a remembered or configured workspace: kits call this before reading, and\n // opening another workspace than the selected one would leave the server session in it.\n const ensureWorkspaceOpen = useCallback(async () => {\n if (mode !== 'live' || !arbi.isLoggedIn) return\n await settled()\n if (!session.getState().workspaceId) return\n await openSelectedWorkspace()\n }, [arbi, session, mode, settled, openSelectedWorkspace])\n\n const value = useMemo<ConnectionValue>(\n () => ({\n mode,\n status,\n user,\n workspaceId,\n apiConfigured: isLiveConfigured,\n apiUrl: config.apiUrl,\n deploymentDomain: isLiveConfigured ? arbi.getDeploymentDomain() : undefined,\n error,\n assistantConfig: config.assistantConfig,\n fallbackWorkspaceId: mode === 'live' ? undefined : config.workspaceId,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n }),\n [\n mode,\n status,\n user,\n workspaceId,\n isLiveConfigured,\n config.apiUrl,\n arbi,\n config.assistantConfig,\n config.workspaceId,\n error,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n ]\n )\n\n const account = useConnectionAccount(arbi, user, signOutConnection)\n const authenticated = status === 'authenticated'\n const host = useMemo(\n () => ({ account: { client: account, useEnabled: () => authenticated } }),\n [account, authenticated]\n )\n\n return (\n <ConnectionContext.Provider value={value}>\n <ArbiHost config={host}>{children}</ArbiHost>\n </ConnectionContext.Provider>\n )\n}\n\n/**\n * The account client of the settings blocks below: the SDK's, with sign-out going through this\n * connection (so its state is cleared too) and, for a session restored without a login (no SDK\n * profile), the connection user as the profile.\n */\nfunction useConnectionAccount(\n arbi: ReturnType<typeof useArbi>,\n user: ArbiUser | null,\n logout: () => Promise<void>\n): AccountClient {\n const userRef = useRef(user)\n const logoutRef = useRef(logout)\n logoutRef.current = logout\n const listeners = useRef(new Set<() => void>())\n useEffect(() => {\n userRef.current = user\n listeners.current.forEach((listener) => listener())\n }, [user])\n return useMemo(() => {\n const base = arbiAccountClient(arbi)\n return {\n ...base,\n profile: (): ProfileView | null => {\n const own = base.profile()\n const fallback = userRef.current\n if (own || !fallback) return own\n return {\n ...toProfileView({\n givenName: '',\n familyName: null,\n picture: fallback.picture ?? null,\n email: fallback.email,\n isSso: false,\n }),\n fullName: fallback.name,\n }\n },\n onProfileChange: (listener) => {\n listeners.current.add(listener)\n const off = base.onProfileChange(listener)\n return () => {\n listeners.current.delete(listener)\n off()\n }\n },\n signOut: async ({ everywhere } = {}) => {\n try {\n if (everywhere) await arbi.sessions.logoutAll()\n } finally {\n await logoutRef.current()\n }\n },\n }\n }, [arbi])\n}\n\n/** The sign-in layer of `defaultHost`, or null under a host that keeps its own session. */\nexport function useOptionalConnection(): ConnectionValue | null {\n return useContext(ConnectionContext)\n}\n\nexport function useConnection(): ConnectionValue {\n const ctx = useContext(ConnectionContext)\n if (!ctx) throw new Error('useConnection needs the sign-in layer of `defaultHost` above it')\n return ctx\n}\n\n/** The sign-in layer's person (a demo session's identity too); none without `defaultHost`. */\nexport function useConnectionUser(): ArbiUser | null {\n return useContext(ConnectionContext)?.user ?? null\n}\n\nexport const isAuthenticated = (s: ConnectionStatus) => s === 'demo' || s === 'authenticated'\n\n/** The open workspace as the connected kits see it, whoever hosts them. */\nexport interface ConnectedWorkspace {\n /** The selected workspace (the session state's; with a connection, else its fallback). */\n workspaceId: string | null\n /** Signed in to a live backend: workspace-scoped queries may run. */\n live: boolean\n /** The signed-in user (their name and email, e.g. to sign a document). */\n user: ArbiUser | null\n /** The signed-in user's external id. */\n userId: string | undefined\n /** Re-assert the workspace on the server session before a workspace-scoped write. */\n ensureWorkspaceOpen: () => Promise<void>\n /**\n * Go into a workspace: select it (with a connection) and show it (`BlocksEnvironment.\n * openWorkspace`, where a host without a connection also switches its session).\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => Promise<void>\n}\n\nconst keptOpenByHost = async () => {}\n\n/** The signed-in user of a host's own session, from its login profile. */\nfunction sessionUser(arbi: ReturnType<typeof useArbi>): ArbiUser | null {\n if (!arbi.isLoggedIn) return null\n const me = arbi.user.identity()\n const profile = arbi.user.profile()\n if (!me) return null\n return profile\n ? userFromProfile(profile, me.externalId)\n : { name: (me.email ?? '').split('@')[0], email: me.email ?? '', externalId: me.externalId }\n}\n\n/**\n * The workspace for a connected kit: the sign-in layer's (`defaultHost`) when there is one, else the\n * host's own session (an app whose host config has its `arbi` and `session` and keeps its\n * workspace open itself). So a kit runs the same in Clarum and in the ARBI app.\n */\nexport function useConnectedWorkspace(): ConnectedWorkspace {\n const connection = useContext(ConnectionContext)\n const arbi = useArbi()\n const sessionWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const live = connection ? connection.status === 'authenticated' : arbi.isLoggedIn\n const user = connection ? connection.user : live ? sessionUser(arbi) : null\n const userKey = `${user?.externalId ?? ''}|${user?.name ?? ''}|${user?.email ?? ''}`\n const { openWorkspace: showWorkspace } = useBlocksEnvironment()\n return useMemo(\n () => ({\n workspaceId: connection\n ? (connection.workspaceId ?? connection.fallbackWorkspaceId ?? null)\n : sessionWorkspaceId,\n live,\n user,\n userId: user?.externalId,\n ensureWorkspaceOpen: connection?.ensureWorkspaceOpen ?? keptOpenByHost,\n openWorkspace: async (workspaceId: string, options?: { name?: string }) => {\n if (connection) await connection.setWorkspace(workspaceId)\n showWorkspace(workspaceId, options)\n },\n }),\n // `user` is rebuilt each render without a connection: its key says when it changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [connection, sessionWorkspaceId, live, userKey, showWorkspace]\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAkbM;AA3aN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,0BAA0B;AAEnC,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AA4ChC,MAAM,oBAAoB,cAAsC,IAAI;AAQpE,MAAM,2BAA2B;AACjC,MAAM,mBAAmB,CAAC,U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,IACtC,EAAE,OAAO,GAAG,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG,OAAO,GAAG,SAAS,IAAI,YAAY,GAAG,WAAW;AAC/F;AAOO,SAAS,wBAA4C;AAC1D,QAAM,aAAa,WAAW,iBAAiB;AAC/C,QAAM,OAAO,QAAQ;AACrB,QAAM,qBAAqB,oBAAoB,CAAC,MAAM,EAAE,WAAW;AACnE,QAAM,OAAO,aAAa,WAAW,WAAW,kBAAkB,KAAK;AACvE,QAAM,OAAO,aAAa,WAAW,OAAO,OAAO,YAAY,IAAI,IAAI;AACvE,QAAM,UAAU,GAAG,MAAM,cAAc,EAAE,IAAI,MAAM,QAAQ,EAAE,IAAI,MAAM,SAAS,EAAE;AAClF,QAAM,EAAE,eAAe,cAAc,IAAI,qBAAqB;AAC9D,SAAO;AAAA,IACL,OAAO;AAAA,MACL,aAAa,aACR,WAAW,eAAe,WAAW,uBAAuB,OAC7D;AAAA,MACJ;AAAA,MACA;AAAA,MACA,QAAQ,MAAM;AAAA,MACd,qBAAqB,YAAY,uBAAuB;AAAA,MACxD,eAAe,OAAO,aAAqB,YAAgC;AACzE,YAAI,WAAY,OAAM,WAAW,aAAa,WAAW;AACzD,sBAAc,aAAa,OAAO;AAAA,MACpC;AAAA,IACF;AAAA;AAAA;AAAA,IAGA,CAAC,YAAY,oBAAoB,MAAM,SAAS,aAAa;AAAA,EAC/D;AACF;",
|
|
6
6
|
"names": ["login"]
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useOptionalDocumentTools
|
|
9
9
|
} from "@arbidocs/react/document-tools";
|
|
10
10
|
import { Loader2 } from "lucide-react";
|
|
11
|
-
import {
|
|
11
|
+
import { ConnectedSignDocumentDialog } from "./ConnectedSignDocumentDialog.js";
|
|
12
12
|
import { ModalScaffold } from "../settings/ModalScaffold.js";
|
|
13
13
|
import { splitDocRef } from "../agents/workflows/run.js";
|
|
14
14
|
import { ConnectedNativeDocxEditor } from "./docx/ConnectedNativeDocxEditor.js";
|
|
@@ -88,7 +88,7 @@ function WorkflowSignDialog({
|
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
90
|
const dialog = /* @__PURE__ */ jsx(
|
|
91
|
-
|
|
91
|
+
ConnectedSignDocumentDialog,
|
|
92
92
|
{
|
|
93
93
|
open: true,
|
|
94
94
|
onOpenChange: (o) => !o && onClose(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/connection/WorkflowRunnerDialogs.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * What the connected runner opens itself when the host does not take over: the sign flow for a\n * signature step (the blocks `SignDocumentDialog` on the document's PDF), the native Word editor\n * for a tracked-changes version, and a tabular review's grid (its documents by its columns).\n */\n\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport { useArbi, useDocuments, useTags } from '@arbidocs/react'\nimport {\n DocumentToolsProvider,\n fetchDocumentPdf,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport { Loader2 } from 'lucide-react'\nimport { SignDocumentDialog } from '../document-tools/SignDocumentDialog'\nimport { ModalScaffold } from '../settings/ModalScaffold'\nimport { splitDocRef } from '../agents/workflows/run'\nimport { ConnectedNativeDocxEditor } from './docx/ConnectedNativeDocxEditor'\nimport { useConnectedWorkspace } from './ConnectionProvider'\n\nexport interface WorkflowRunnerDialogLabels {\n loadingDocument: string\n preparingDocument: string\n documentFailed: string\n reviewTitle: string\n reviewDescription: string\n document: string\n empty: string\n showMore: string\n showLess: string\n wordTitle: string\n}\n\nexport const DEFAULT_WORKFLOW_RUNNER_DIALOG_LABELS: WorkflowRunnerDialogLabels = {\n loadingDocument: 'Opening the document\u2026',\n preparingDocument: 'The PDF is still being prepared\u2026',\n documentFailed: 'The document could not be opened.',\n reviewTitle: 'Review',\n reviewDescription: 'Each document against each review column.',\n document: 'Document',\n empty: '\u2014',\n showMore: 'Show more',\n showLess: 'Show less',\n wordTitle: 'Tracked changes',\n}\n\n/** How often, and how long apart, the PDF is fetched again while it is still being rendered. */\nconst SIGN_PDF_RETRIES = 4\nexport const SIGN_PDF_RETRY_DELAY_MS = 1500\n\nconst wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * The sign flow on one document version: its PDF is fetched, then the blocks sign dialog.\n *\n * What is signed is the PDF `GET /view?version=` serves (a Word or Markdown document's rendition),\n * never the original's download, so the hash the server checks is of the bytes shown here. A\n * rendition still being written is fetched again a few times; a version superseded since the step\n * was set offers the current one instead.\n */\nexport function WorkflowSignDialog({\n docRef,\n onClose,\n labels,\n}: {\n /** `doc-\u2026` or `doc-\u2026@v3`. */\n docRef: string\n onClose: () => void\n labels: WorkflowRunnerDialogLabels\n}) {\n const arbi = useArbi()\n const { user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const tools = useOptionalDocumentTools()\n const { id, version: stepVersion } = splitDocRef(docRef)\n // The version the step names, until the signer opens the current one instead.\n const [version, setVersion] = useState(stepVersion)\n const [pdf, setPdf] = useState<Blob | null>(null)\n const [preparing, setPreparing] = useState(false)\n const [failed, setFailed] = useState(false)\n useEffect(() => {\n let live = true\n setPdf(null)\n setFailed(false)\n setPreparing(false)\n void (async () => {\n try {\n await ensureWorkspaceOpen()\n const client = arbi.getClient().fetch\n const ref = version ? `${id}@v${version}` : id\n for (let attempt = 0; ; attempt++) {\n try {\n const blob = await fetchDocumentPdf(client, ref)\n if (live) setPdf(blob)\n return\n } catch (err) {\n if (!live || attempt >= SIGN_PDF_RETRIES) throw err\n setPreparing(true)\n await wait(SIGN_PDF_RETRY_DELAY_MS)\n if (!live) return\n }\n }\n } catch {\n if (live) setFailed(true)\n }\n })()\n return () => {\n live = false\n }\n }, [arbi, id, version, ensureWorkspaceOpen])\n\n if (!pdf)\n return (\n <ModalScaffold\n open\n onOpenChange={(o) => !o && onClose()}\n title={labels.loadingDocument}\n size=\"sm\"\n testId=\"workflow-sign-loading\"\n >\n <ModalScaffold.Body>\n <p className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n {failed ? (\n labels.documentFailed\n ) : (\n <>\n <Loader2 className=\"size-4 animate-spin\" />{' '}\n {preparing ? labels.preparingDocument : labels.loadingDocument}\n </>\n )}\n </p>\n </ModalScaffold.Body>\n </ModalScaffold>\n )\n const dialog = (\n <SignDocumentDialog\n // A new PDF is a new signing: the form starts again on it.\n key={version ?? 'current'}\n open\n onOpenChange={(o) => !o && onClose()}\n documentId={id}\n pdfBlob={pdf}\n version={version}\n // Superseded since the step was set: sign the current version, after seeing it.\n onOpenCurrent={() => setVersion(undefined)}\n />\n )\n // A host with its own document tools keeps them (its notices, its document opening).\n return tools ? (\n dialog\n ) : (\n <DocumentToolsProvider\n client={arbi.getClient().fetch}\n user={user ? { name: user.name, email: user.email } : null}\n >\n {dialog}\n </DocumentToolsProvider>\n )\n}\n\n/** A tracked-changes version in the native Word editor. */\nexport function WorkflowWordDialog({\n docRef,\n title,\n onClose,\n labels,\n}: {\n docRef: string\n title?: string\n onClose: () => void\n labels: WorkflowRunnerDialogLabels\n}) {\n const { id } = splitDocRef(docRef)\n return (\n <ModalScaffold\n open\n onOpenChange={(o) => !o && onClose()}\n title={title ?? labels.wordTitle}\n size=\"xl\"\n testId=\"workflow-word-dialog\"\n >\n <ModalScaffold.Body className=\"h-[70dvh] p-0\">\n <ConnectedNativeDocxEditor documentId={id} title={title ?? labels.wordTitle} />\n </ModalScaffold.Body>\n </ModalScaffold>\n )\n}\n\n/** A tabular review's grid: each document (row) against each column (label), with its value. */\nexport function WorkflowReviewGridDialog({\n tags,\n documents,\n onClose,\n onOpenDocument,\n labels,\n}: {\n tags: string[]\n documents: string[]\n onClose: () => void\n onOpenDocument?: (docId: string) => void\n labels: WorkflowRunnerDialogLabels\n}) {\n const { workspaceId } = useConnectedWorkspace()\n const allTags = useTags(workspaceId ?? undefined)\n // The workspace's documents carry their review values (doctags); the review's rows are its own.\n const all = useDocuments(workspaceId ?? undefined)\n // The grid waits for its column names and for documents fetched since it opened: before, its\n // headers would be the raw tag ids and its cells the values cached before the review ran.\n const isLoading =\n allTags.isLoading || all.isLoading || (all.isFetching && !all.isFetchedAfterMount)\n const docs = (all.data ?? []).filter((d) => documents.includes(d.external_id))\n const columns = useMemo(\n () =>\n tags.map((id) => ({\n id,\n name: allTags.data?.find((t) => t.external_id === id)?.name ?? id,\n })),\n [tags, allTags.data]\n )\n return (\n <ModalScaffold\n open\n onOpenChange={(o) => !o && onClose()}\n title={labels.reviewTitle}\n description={labels.reviewDescription}\n showDescription\n size=\"xl\"\n testId=\"workflow-review-grid\"\n >\n <ModalScaffold.Body className=\"overflow-auto\">\n {isLoading ? (\n <p className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Loader2 className=\"size-4 animate-spin\" /> {labels.loadingDocument}\n </p>\n ) : (\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr>\n <th className=\"sticky left-0 z-10 border-b border-border bg-background p-2 text-left align-bottom font-medium\">\n {labels.document}\n </th>\n {columns.map((c) => (\n <th\n key={c.id}\n className=\"border-b border-border p-2 text-left align-bottom font-medium\"\n >\n <div className={`${VALUE_WIDTH} line-clamp-2 break-words`} title={c.name}>\n {c.name}\n </div>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {docs.map((d) => (\n <tr key={d.external_id} data-testid={`workflow-review-grid-row-${d.external_id}`}>\n <td className=\"sticky left-0 z-10 border-b border-border bg-background p-2 align-top\">\n <DocumentName onClick={onOpenDocument && (() => onOpenDocument(d.external_id))}>\n {d.file_name ?? d.external_id}\n </DocumentName>\n </td>\n {columns.map((c) => {\n const note = d.doctags?.find((t) => t.tag_ext_id === c.id)?.note\n return (\n <td\n key={c.id}\n className=\"border-b border-border p-2 align-top text-muted-foreground\"\n >\n <ReviewValue value={note || labels.empty} labels={labels} />\n </td>\n )\n })}\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </ModalScaffold.Body>\n </ModalScaffold>\n )\n}\n\n/*\n * Widths sit on a block inside each cell: an auto-layout table ignores `max-width` on a cell, so a\n * long file name or answer would otherwise widen its column, or (without wrapping) spill into the\n * next one. The grid scrolls sideways when the columns do not fit.\n */\nconst DOCUMENT_WIDTH = 'w-40 sm:w-56'\nconst VALUE_WIDTH = 'min-w-48 max-w-80'\n\n/** The row's document: its name wraps over two lines at most, the full name on hover. */\nfunction DocumentName({ onClick, children }: { onClick?: () => void; children: string }) {\n const className = `${DOCUMENT_WIDTH} line-clamp-2 break-words text-left font-medium`\n return onClick ? (\n <button\n type=\"button\"\n onClick={onClick}\n title={children}\n className={`${className} text-primary hover:underline`}\n >\n {children}\n </button>\n ) : (\n <div title={children} className={className}>\n {children}\n </div>\n )\n}\n\n/** A review value: four lines, then a toggle to read the rest in place. */\nfunction ReviewValue({ value, labels }: { value: string; labels: WorkflowRunnerDialogLabels }) {\n const ref = useRef<HTMLDivElement>(null)\n const [expanded, setExpanded] = useState(false)\n const [clamped, setClamped] = useState(false)\n useLayoutEffect(() => {\n const el = ref.current\n if (el && !expanded) setClamped(el.scrollHeight > el.clientHeight + 1)\n }, [value, expanded])\n return (\n <div className={VALUE_WIDTH}>\n <div\n ref={ref}\n title={clamped && !expanded ? value : undefined}\n className={`whitespace-pre-line break-words ${expanded ? '' : 'line-clamp-4'}`}\n >\n {value}\n </div>\n {(clamped || expanded) && (\n <button\n type=\"button\"\n onClick={() => setExpanded((e) => !e)}\n className=\"mt-1 text-xs font-medium text-primary hover:underline\"\n >\n {expanded ? labels.showLess : labels.showMore}\n </button>\n )}\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AA4Hc,mBACE,KADF;AAtHd,SAAS,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AACtE,SAAS,SAAS,cAAc,eAAe;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * What the connected runner opens itself when the host does not take over: the sign flow for a\n * signature step (the blocks `SignDocumentDialog` on the document's PDF), the native Word editor\n * for a tracked-changes version, and a tabular review's grid (its documents by its columns).\n */\n\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport { useArbi, useDocuments, useTags } from '@arbidocs/react'\nimport {\n DocumentToolsProvider,\n fetchDocumentPdf,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport { Loader2 } from 'lucide-react'\nimport { ConnectedSignDocumentDialog } from './ConnectedSignDocumentDialog'\nimport { ModalScaffold } from '../settings/ModalScaffold'\nimport { splitDocRef } from '../agents/workflows/run'\nimport { ConnectedNativeDocxEditor } from './docx/ConnectedNativeDocxEditor'\nimport { useConnectedWorkspace } from './ConnectionProvider'\n\nexport interface WorkflowRunnerDialogLabels {\n loadingDocument: string\n preparingDocument: string\n documentFailed: string\n reviewTitle: string\n reviewDescription: string\n document: string\n empty: string\n showMore: string\n showLess: string\n wordTitle: string\n}\n\nexport const DEFAULT_WORKFLOW_RUNNER_DIALOG_LABELS: WorkflowRunnerDialogLabels = {\n loadingDocument: 'Opening the document\u2026',\n preparingDocument: 'The PDF is still being prepared\u2026',\n documentFailed: 'The document could not be opened.',\n reviewTitle: 'Review',\n reviewDescription: 'Each document against each review column.',\n document: 'Document',\n empty: '\u2014',\n showMore: 'Show more',\n showLess: 'Show less',\n wordTitle: 'Tracked changes',\n}\n\n/** How often, and how long apart, the PDF is fetched again while it is still being rendered. */\nconst SIGN_PDF_RETRIES = 4\nexport const SIGN_PDF_RETRY_DELAY_MS = 1500\n\nconst wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * The sign flow on one document version: its PDF is fetched, then the blocks sign dialog.\n *\n * What is signed is the PDF `GET /view?version=` serves (a Word or Markdown document's rendition),\n * never the original's download, so the hash the server checks is of the bytes shown here. A\n * rendition still being written is fetched again a few times; a version superseded since the step\n * was set offers the current one instead.\n */\nexport function WorkflowSignDialog({\n docRef,\n onClose,\n labels,\n}: {\n /** `doc-\u2026` or `doc-\u2026@v3`. */\n docRef: string\n onClose: () => void\n labels: WorkflowRunnerDialogLabels\n}) {\n const arbi = useArbi()\n const { user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const tools = useOptionalDocumentTools()\n const { id, version: stepVersion } = splitDocRef(docRef)\n // The version the step names, until the signer opens the current one instead.\n const [version, setVersion] = useState(stepVersion)\n const [pdf, setPdf] = useState<Blob | null>(null)\n const [preparing, setPreparing] = useState(false)\n const [failed, setFailed] = useState(false)\n useEffect(() => {\n let live = true\n setPdf(null)\n setFailed(false)\n setPreparing(false)\n void (async () => {\n try {\n await ensureWorkspaceOpen()\n const client = arbi.getClient().fetch\n const ref = version ? `${id}@v${version}` : id\n for (let attempt = 0; ; attempt++) {\n try {\n const blob = await fetchDocumentPdf(client, ref)\n if (live) setPdf(blob)\n return\n } catch (err) {\n if (!live || attempt >= SIGN_PDF_RETRIES) throw err\n setPreparing(true)\n await wait(SIGN_PDF_RETRY_DELAY_MS)\n if (!live) return\n }\n }\n } catch {\n if (live) setFailed(true)\n }\n })()\n return () => {\n live = false\n }\n }, [arbi, id, version, ensureWorkspaceOpen])\n\n if (!pdf)\n return (\n <ModalScaffold\n open\n onOpenChange={(o) => !o && onClose()}\n title={labels.loadingDocument}\n size=\"sm\"\n testId=\"workflow-sign-loading\"\n >\n <ModalScaffold.Body>\n <p className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n {failed ? (\n labels.documentFailed\n ) : (\n <>\n <Loader2 className=\"size-4 animate-spin\" />{' '}\n {preparing ? labels.preparingDocument : labels.loadingDocument}\n </>\n )}\n </p>\n </ModalScaffold.Body>\n </ModalScaffold>\n )\n const dialog = (\n <ConnectedSignDocumentDialog\n // A new PDF is a new signing: the form starts again on it.\n key={version ?? 'current'}\n open\n onOpenChange={(o) => !o && onClose()}\n documentId={id}\n pdfBlob={pdf}\n version={version}\n // Superseded since the step was set: sign the current version, after seeing it.\n onOpenCurrent={() => setVersion(undefined)}\n />\n )\n // A host with its own document tools keeps them (its notices, its document opening).\n return tools ? (\n dialog\n ) : (\n <DocumentToolsProvider\n client={arbi.getClient().fetch}\n user={user ? { name: user.name, email: user.email } : null}\n >\n {dialog}\n </DocumentToolsProvider>\n )\n}\n\n/** A tracked-changes version in the native Word editor. */\nexport function WorkflowWordDialog({\n docRef,\n title,\n onClose,\n labels,\n}: {\n docRef: string\n title?: string\n onClose: () => void\n labels: WorkflowRunnerDialogLabels\n}) {\n const { id } = splitDocRef(docRef)\n return (\n <ModalScaffold\n open\n onOpenChange={(o) => !o && onClose()}\n title={title ?? labels.wordTitle}\n size=\"xl\"\n testId=\"workflow-word-dialog\"\n >\n <ModalScaffold.Body className=\"h-[70dvh] p-0\">\n <ConnectedNativeDocxEditor documentId={id} title={title ?? labels.wordTitle} />\n </ModalScaffold.Body>\n </ModalScaffold>\n )\n}\n\n/** A tabular review's grid: each document (row) against each column (label), with its value. */\nexport function WorkflowReviewGridDialog({\n tags,\n documents,\n onClose,\n onOpenDocument,\n labels,\n}: {\n tags: string[]\n documents: string[]\n onClose: () => void\n onOpenDocument?: (docId: string) => void\n labels: WorkflowRunnerDialogLabels\n}) {\n const { workspaceId } = useConnectedWorkspace()\n const allTags = useTags(workspaceId ?? undefined)\n // The workspace's documents carry their review values (doctags); the review's rows are its own.\n const all = useDocuments(workspaceId ?? undefined)\n // The grid waits for its column names and for documents fetched since it opened: before, its\n // headers would be the raw tag ids and its cells the values cached before the review ran.\n const isLoading =\n allTags.isLoading || all.isLoading || (all.isFetching && !all.isFetchedAfterMount)\n const docs = (all.data ?? []).filter((d) => documents.includes(d.external_id))\n const columns = useMemo(\n () =>\n tags.map((id) => ({\n id,\n name: allTags.data?.find((t) => t.external_id === id)?.name ?? id,\n })),\n [tags, allTags.data]\n )\n return (\n <ModalScaffold\n open\n onOpenChange={(o) => !o && onClose()}\n title={labels.reviewTitle}\n description={labels.reviewDescription}\n showDescription\n size=\"xl\"\n testId=\"workflow-review-grid\"\n >\n <ModalScaffold.Body className=\"overflow-auto\">\n {isLoading ? (\n <p className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Loader2 className=\"size-4 animate-spin\" /> {labels.loadingDocument}\n </p>\n ) : (\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr>\n <th className=\"sticky left-0 z-10 border-b border-border bg-background p-2 text-left align-bottom font-medium\">\n {labels.document}\n </th>\n {columns.map((c) => (\n <th\n key={c.id}\n className=\"border-b border-border p-2 text-left align-bottom font-medium\"\n >\n <div className={`${VALUE_WIDTH} line-clamp-2 break-words`} title={c.name}>\n {c.name}\n </div>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {docs.map((d) => (\n <tr key={d.external_id} data-testid={`workflow-review-grid-row-${d.external_id}`}>\n <td className=\"sticky left-0 z-10 border-b border-border bg-background p-2 align-top\">\n <DocumentName onClick={onOpenDocument && (() => onOpenDocument(d.external_id))}>\n {d.file_name ?? d.external_id}\n </DocumentName>\n </td>\n {columns.map((c) => {\n const note = d.doctags?.find((t) => t.tag_ext_id === c.id)?.note\n return (\n <td\n key={c.id}\n className=\"border-b border-border p-2 align-top text-muted-foreground\"\n >\n <ReviewValue value={note || labels.empty} labels={labels} />\n </td>\n )\n })}\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </ModalScaffold.Body>\n </ModalScaffold>\n )\n}\n\n/*\n * Widths sit on a block inside each cell: an auto-layout table ignores `max-width` on a cell, so a\n * long file name or answer would otherwise widen its column, or (without wrapping) spill into the\n * next one. The grid scrolls sideways when the columns do not fit.\n */\nconst DOCUMENT_WIDTH = 'w-40 sm:w-56'\nconst VALUE_WIDTH = 'min-w-48 max-w-80'\n\n/** The row's document: its name wraps over two lines at most, the full name on hover. */\nfunction DocumentName({ onClick, children }: { onClick?: () => void; children: string }) {\n const className = `${DOCUMENT_WIDTH} line-clamp-2 break-words text-left font-medium`\n return onClick ? (\n <button\n type=\"button\"\n onClick={onClick}\n title={children}\n className={`${className} text-primary hover:underline`}\n >\n {children}\n </button>\n ) : (\n <div title={children} className={className}>\n {children}\n </div>\n )\n}\n\n/** A review value: four lines, then a toggle to read the rest in place. */\nfunction ReviewValue({ value, labels }: { value: string; labels: WorkflowRunnerDialogLabels }) {\n const ref = useRef<HTMLDivElement>(null)\n const [expanded, setExpanded] = useState(false)\n const [clamped, setClamped] = useState(false)\n useLayoutEffect(() => {\n const el = ref.current\n if (el && !expanded) setClamped(el.scrollHeight > el.clientHeight + 1)\n }, [value, expanded])\n return (\n <div className={VALUE_WIDTH}>\n <div\n ref={ref}\n title={clamped && !expanded ? value : undefined}\n className={`whitespace-pre-line break-words ${expanded ? '' : 'line-clamp-4'}`}\n >\n {value}\n </div>\n {(clamped || expanded) && (\n <button\n type=\"button\"\n onClick={() => setExpanded((e) => !e)}\n className=\"mt-1 text-xs font-medium text-primary hover:underline\"\n >\n {expanded ? labels.showLess : labels.showMore}\n </button>\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA4Hc,mBACE,KADF;AAtHd,SAAS,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AACtE,SAAS,SAAS,cAAc,eAAe;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,mCAAmC;AAC5C,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAe/B,MAAM,wCAAoE;AAAA,EAC/E,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AACb;AAGA,MAAM,mBAAmB;AAClB,MAAM,0BAA0B;AAEvC,MAAM,OAAO,CAAC,OAAe,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAUtE,SAAS,mBAAmB;AAAA,EACjC;AAAA,E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AW,aACX;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;AAAA,QACpC,WAAU;AAAA,QAET,qBAAW,OAAO,WAAW,OAAO;AAAA;AAAA,IACvC;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -49,9 +49,9 @@ export interface ArbiConnectionConfig {
|
|
|
49
49
|
deploymentDomain?: string;
|
|
50
50
|
/** Inert URL used to mount the SDK provider when there's no live backend. */
|
|
51
51
|
demoApiUrl?: string;
|
|
52
|
-
/** Preferred live workspace ext_id
|
|
52
|
+
/** Preferred live workspace ext_id, opened at sign-in when the user has no remembered choice. */
|
|
53
53
|
workspaceId?: string;
|
|
54
|
-
/**
|
|
54
|
+
/** Kept for hosts that set it; sign-in never picks the first workspace whatever this is. */
|
|
55
55
|
requireWorkspaceSelection?: boolean;
|
|
56
56
|
/** Default assistant *configuration* ext_id every agentic run is grounded on. */
|
|
57
57
|
assistantConfig?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ID check for a signing flow, bound to the signed-in account: what `SignDocumentDialog`,
|
|
3
|
+
* `GuidedSigningViewer` and `SharedFileView` take as `identity` and `accountName` to let a signer
|
|
4
|
+
* who must verify their identity do it in place. Inside the host's account provider.
|
|
5
|
+
*/
|
|
6
|
+
import type { IdentityVerificationFlow } from '@arbidocs/react/ui';
|
|
7
|
+
export declare function useSigningIdentity(): {
|
|
8
|
+
identity: IdentityVerificationFlow;
|
|
9
|
+
accountName: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useIdentityVerification, useProfile } from "@arbidocs/react";
|
|
3
|
+
import { useBlocksEnvironment } from "../provider/environment.js";
|
|
4
|
+
function useSigningIdentity() {
|
|
5
|
+
const { notify } = useBlocksEnvironment();
|
|
6
|
+
const { data: profile } = useProfile();
|
|
7
|
+
const identity = useIdentityVerification({
|
|
8
|
+
onVerifiedChange: (verified) => verified && notify("Identity verified", "success")
|
|
9
|
+
});
|
|
10
|
+
return { identity, accountName: profile?.fullName ?? "" };
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
useSigningIdentity
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useSigningIdentity.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/connection/useSigningIdentity.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The ID check for a signing flow, bound to the signed-in account: what `SignDocumentDialog`,\n * `GuidedSigningViewer` and `SharedFileView` take as `identity` and `accountName` to let a signer\n * who must verify their identity do it in place. Inside the host's account provider.\n */\n\nimport { useIdentityVerification, useProfile } from '@arbidocs/react'\nimport type { IdentityVerificationFlow } from '@arbidocs/react/ui'\nimport { useBlocksEnvironment } from '../provider/environment'\n\nexport function useSigningIdentity(): {\n identity: IdentityVerificationFlow\n accountName: string\n} {\n const { notify } = useBlocksEnvironment()\n const { data: profile } = useProfile()\n const identity = useIdentityVerification({\n onVerifiedChange: (verified) => verified && notify('Identity verified', 'success'),\n })\n return { identity, accountName: profile?.fullName ?? '' }\n}\n"],
|
|
5
|
+
"mappings": ";AAMA,SAAS,yBAAyB,kBAAkB;AAEpD,SAAS,4BAA4B;AAE9B,SAAS,qBAGd;AACA,QAAM,EAAE,OAAO,IAAI,qBAAqB;AACxC,QAAM,EAAE,MAAM,QAAQ,IAAI,WAAW;AACrC,QAAM,WAAW,wBAAwB;AAAA,IACvC,kBAAkB,CAAC,aAAa,YAAY,OAAO,qBAAqB,SAAS;AAAA,EACnF,CAAC;AACD,SAAO,EAAE,UAAU,aAAa,SAAS,YAAY,GAAG;AAC1D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -54,12 +54,12 @@ import {
|
|
|
54
54
|
MarkupViewNote,
|
|
55
55
|
PlaceMySignatureMenuItems,
|
|
56
56
|
ShowOriginalButton,
|
|
57
|
-
SignDocumentDialog,
|
|
58
57
|
SignedEditNote,
|
|
59
58
|
SignatureRequestBanner,
|
|
60
59
|
SignatureStatus,
|
|
61
60
|
VersionSnapshotBar
|
|
62
61
|
} from "../../document-tools/index.js";
|
|
62
|
+
import { ConnectedSignDocumentDialog } from "../ConnectedSignDocumentDialog.js";
|
|
63
63
|
import { useViewerClipping } from "../presentation/useViewerClipping.js";
|
|
64
64
|
import { useCleanView } from "./useCleanView.js";
|
|
65
65
|
import {
|
|
@@ -694,7 +694,7 @@ function DocumentViewerContent({
|
|
|
694
694
|
] })
|
|
695
695
|
] }),
|
|
696
696
|
isSignOpen && pdfBlob && pdfVerified && signingScopeMatches && /* @__PURE__ */ jsx(
|
|
697
|
-
|
|
697
|
+
ConnectedSignDocumentDialog,
|
|
698
698
|
{
|
|
699
699
|
open: isSignOpen,
|
|
700
700
|
onOpenChange: setIsSignOpen,
|