@langwatch/server 3.1.0-beta.21 → 3.1.0-beta.23
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/langevals/evaluators/topic_clustering/langevals_topic_clustering/__init__.py +36 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/_logger.py +165 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/batch_clustering.py +153 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/build_response.py +77 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/constants.py +7 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/incremental_clustering.py +325 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/topic_naming.py +432 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/types.py +42 -0
- package/langevals/evaluators/topic_clustering/langevals_topic_clustering/utils.py +191 -0
- package/langevals/evaluators/topic_clustering/pyproject.toml +52 -0
- package/langevals/evaluators/topic_clustering/tests/test_topic_clustering.py +239 -0
- package/langevals/evaluators/topic_clustering/tests/test_topic_clustering_integration.py +97 -0
- package/langevals/evaluators/topic_clustering/tests/test_topic_naming.py +72 -0
- package/langevals/langevals/pytest_plugins/pass_rate_plugin.py +7 -1
- package/langevals/langevals/server.py +28 -0
- package/langevals/pyproject.toml +3 -0
- package/langevals/uv.lock +119 -20
- package/langwatch/dist/client/assets/{AnnotationsTable-BDAkYaz6.js → AnnotationsTable-uS_9SQ-g.js} +2 -2
- package/langwatch/dist/client/assets/{BatchEvaluationSummary-DMaQM_VB.js → BatchEvaluationSummary-DtFd8yKJ.js} +2 -2
- package/langwatch/dist/client/assets/{BudgetEditDrawer-CHaqmdIl.js → BudgetEditDrawer-CHEPz0hH.js} +2 -2
- package/langwatch/dist/client/assets/{ChartCard-D14PUg_d.js → ChartCard-s5fMPo7b.js} +2 -2
- package/langwatch/dist/client/assets/{ChatWindow-CRDnlP-Q.js → ChatWindow-C0XSteVJ.js} +2 -2
- package/langwatch/dist/client/assets/ChatWindow-DFEmNXQL.js +1 -0
- package/langwatch/dist/client/assets/{ConfirmDialog-CXIhncvW.js → ConfirmDialog-M94yLNvP.js} +2 -2
- package/langwatch/dist/client/assets/{ContactSalesBlock-CijLBwRC.js → ContactSalesBlock-CnnuZ8iI.js} +2 -2
- package/langwatch/dist/client/assets/{DSPyExperiment-B1YOL2m8.js → DSPyExperiment-CMA6lrlx.js} +2 -2
- package/langwatch/dist/client/assets/{FilterDisplay-BB0xWrLn.js → FilterDisplay-0S3NqCkq.js} +2 -2
- package/langwatch/dist/client/assets/{FormatMoney-w9vr_h0X.js → FormatMoney-CCygtAHg.js} +2 -2
- package/langwatch/dist/client/assets/{FoundryDrawer-CdJDXtpz.js → FoundryDrawer-B35xZ26C.js} +2 -2
- package/langwatch/dist/client/assets/{GatewayErrorPanel-DvE9U2dS.js → GatewayErrorPanel-BsaYQEie.js} +2 -2
- package/langwatch/dist/client/assets/{GatewayLayout-lv1p_6B5.js → GatewayLayout-LvwwrwMf.js} +2 -2
- package/langwatch/dist/client/assets/{GraphsLayout-BJ68J9e-.js → GraphsLayout-DJ-HI9N1.js} +2 -2
- package/langwatch/dist/client/assets/{GroupBindingInputRow-DebZBCnD.js → GroupBindingInputRow-CV-fBkX9.js} +2 -2
- package/langwatch/dist/client/assets/{MessagesTable-B6lYde-x.js → MessagesTable-9taaKCOZ.js} +2 -2
- package/langwatch/dist/client/assets/{NavigationFooter-CiOVzDUh.js → NavigationFooter-Dzvauw3l.js} +2 -2
- package/langwatch/dist/client/assets/{NoDataInfoBlock-quSW_MRm.js → NoDataInfoBlock-CLKl_wlX.js} +2 -2
- package/langwatch/dist/client/assets/{OpsPageShell-DJ1WlI6-.js → OpsPageShell-C_mTziRS.js} +2 -2
- package/langwatch/dist/client/assets/{OptimizationStudio-BlozXjcN.js → OptimizationStudio-D2zpsmJj.js} +8 -12
- package/langwatch/dist/client/assets/{PreconditionsField-BOfcWvmZ.js → PreconditionsField-WXB8kcTK.js} +2 -2
- package/langwatch/dist/client/assets/{SettingsLayout-CLCGxMAe.js → SettingsLayout--1gdEuhv.js} +2 -2
- package/langwatch/dist/client/assets/{SubscriptionPage-J8b2Zaj6.js → SubscriptionPage-B0ox_4kM.js} +2 -2
- package/langwatch/dist/client/assets/{VirtualKeySecretReveal-DR1VDLy7.js → VirtualKeySecretReveal-CRbI1dKQ.js} +2 -2
- package/langwatch/dist/client/assets/{WithPermissionGuard-DD8uo3UK.js → WithPermissionGuard-B4Jo8E5-.js} +2 -2
- package/langwatch/dist/client/assets/{__...path__-BZVaIayJ.js → __...path__-BF2zkD84.js} +2 -2
- package/langwatch/dist/client/assets/{_experiment_-B1aT-wS3.js → _experiment_-D02aoVQk.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-oI_eq-I_.js → _id_-Ch8YmTiM.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-DAqPuO73.js → _id_-D6ZvwHpH.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-DUngklVb.js → _id_-DOC1ZkBm.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-jFDAfbob.js → _id_-DfWwW6_N.js} +2 -2
- package/langwatch/dist/client/assets/{_id_-BKBrWGG0.js → _id_-DxUo4W7J.js} +2 -2
- package/langwatch/dist/client/assets/_not-found-COI3ShsR.js +1 -0
- package/langwatch/dist/client/assets/{_project_-Bt1tayHB.js → _project_-_UUt5Ar9.js} +2 -2
- package/langwatch/dist/client/assets/{_runId_-CfvnDt5H.js → _runId_-Dimwzp48.js} +2 -2
- package/langwatch/dist/client/assets/_slug_-BMvKBwS_.js +2 -0
- package/langwatch/dist/client/assets/{_slug_-DZAdl0QS.js → _slug_-CE6VoDSC.js} +2 -2
- package/langwatch/dist/client/assets/{_slug_-DmoWXjKT.js → _slug_-OiOLG1Mv.js} +2 -2
- package/langwatch/dist/client/assets/{_team_-DL_wKSWK.js → _team_-DKvmwO_5.js} +2 -2
- package/langwatch/dist/client/assets/{_workflow_-DcMXLPUe.js → _workflow_-FkilKiB-.js} +3 -3
- package/langwatch/dist/client/assets/{_workflow_-NI9bac7d.js → _workflow_-gJZppg3h.js} +2 -2
- package/langwatch/dist/client/assets/{access-audit-CFwNwusI.js → access-audit-xcUVYMMT.js} +2 -2
- package/langwatch/dist/client/assets/{agents-Di4XRwcn.js → agents-D32g91cu.js} +2 -2
- package/langwatch/dist/client/assets/{all-C273mlDB.js → all-vnREzDZj.js} +2 -2
- package/langwatch/dist/client/assets/{analytics-CEAcSf6B.js → analytics-DP6Y4Feh.js} +2 -2
- package/langwatch/dist/client/assets/{annotation-scores-CHfn4LQp.js → annotation-scores-CjD4CEB6.js} +2 -2
- package/langwatch/dist/client/assets/{annotations-CHZQrha6.js → annotations-1rVXiDRQ.js} +2 -2
- package/langwatch/dist/client/assets/{api-keys-BT7HExHM.js → api-keys-BJpKyuaz.js} +2 -2
- package/langwatch/dist/client/assets/{audit-log-BGk-51Dt.js → audit-log-BdUdZjxp.js} +2 -2
- package/langwatch/dist/client/assets/{authentication-DvwXfkp-.js → authentication-8mQB00CC.js} +2 -2
- package/langwatch/dist/client/assets/{authorize-tXpHrWyw.js → authorize-BpUueMNW.js} +2 -2
- package/langwatch/dist/client/assets/{authorize-CRu9xlpU.js → authorize-CbNBtmxW.js} +2 -2
- package/langwatch/dist/client/assets/{automations-CjDvz9Ak.js → automations-34KMkRxd.js} +2 -2
- package/langwatch/dist/client/assets/{billing-plans-FUqEPN62.js → billing-plans-BUQp08MI.js} +2 -2
- package/langwatch/dist/client/assets/{budgets-BV6_RHrs.js → budgets-CdelE8Hv.js} +2 -2
- package/langwatch/dist/client/assets/{cache-rules-CtYA79E_.js → cache-rules-D2m1QlNJ.js} +2 -2
- package/langwatch/dist/client/assets/choose-C0LdeUiH.js +2 -0
- package/langwatch/dist/client/assets/{command-bar-CaJygoez.js → command-bar-DUK45yin.js} +7 -9
- package/langwatch/dist/client/assets/custom-hBq2K4FJ.js +1 -0
- package/langwatch/dist/client/assets/{datasets-vLWpH84_.js → datasets-ErNNhmjg.js} +2 -2
- package/langwatch/dist/client/assets/{dejaview-DwVR3RGg.js → dejaview-BaD4_v90.js} +2 -2
- package/langwatch/dist/client/assets/{dist-SwV3YZv3.js → dist-Cds4Mqhj.js} +4 -6
- package/langwatch/dist/client/assets/{edit-CyxsmQmW.js → edit-DpT8ejBV.js} +2 -2
- package/langwatch/dist/client/assets/{evaluations-BfgeZMph.js → evaluations-BdQ2Dm2r.js} +2 -2
- package/langwatch/dist/client/assets/{evaluations-HSQIMvbX.js → evaluations-C90I4VAr.js} +2 -2
- package/langwatch/dist/client/assets/{evaluators-DLHVvnrh.js → evaluators-ig_ugRLt.js} +2 -2
- package/langwatch/dist/client/assets/{foundry-Ckq0WjPU.js → foundry-B-X_80pD.js} +2 -2
- package/langwatch/dist/client/assets/{gateway-CDSYPZ6w.js → gateway-CS_mtJx-.js} +2 -2
- package/langwatch/dist/client/assets/{groups-CCCRUqPj.js → groups-Bp90ChP3.js} +2 -2
- package/langwatch/dist/client/assets/{index-Bm6z2fM9.js → index-BEjGS0kI.js} +5 -5
- package/langwatch/dist/client/assets/{license-CHOarGWr.js → license-CgnlvyuI.js} +2 -2
- package/langwatch/dist/client/assets/{me-CBya_vXs.js → me-DEqhm_KC.js} +2 -2
- package/langwatch/dist/client/assets/{members-lIFLh-rh.js → members-CUJANDtH.js} +2 -2
- package/langwatch/dist/client/assets/{messages-CG9j8Dz8.js → messages-fQBfCjvp.js} +2 -2
- package/langwatch/dist/client/assets/{metrics-C9pzeaI6.js → metrics-DeIxebpD.js} +2 -2
- package/langwatch/dist/client/assets/{model-costs-Bc5uqjkl.js → model-costs-C1RbgK--.js} +2 -2
- package/langwatch/dist/client/assets/{model-providers-B5UjRgS_.js → model-providers-Pv3ML_-t.js} +2 -2
- package/langwatch/dist/client/assets/{my-queue-BkEfiWyR.js → my-queue-BLre2NMr.js} +2 -2
- package/langwatch/dist/client/assets/{ops-Cc-g-CMn.js → ops-CCw-FJaT.js} +2 -2
- package/langwatch/dist/client/assets/{organization-features-CoIKKHkQ.js → organization-features-rqg-75mI.js} +2 -2
- package/langwatch/dist/client/assets/{organizations-DWcQUTzi.js → organizations-DjCzIHVx.js} +2 -2
- package/langwatch/dist/client/assets/{persistence-CTQ44vGL.js → persistence-BPvHS0F6.js} +2 -2
- package/langwatch/dist/client/assets/{plans-Dq3eFg5K.js → plans-Ch2Ol-Fd.js} +2 -2
- package/langwatch/dist/client/assets/{projections-CTNj1QBM.js → projections-it4FOVjm.js} +2 -2
- package/langwatch/dist/client/assets/{projects-BxM7C87h.js → projects-CjWZFLfn.js} +2 -2
- package/langwatch/dist/client/assets/{prompts-DhXnJT6e.js → prompts-DilmFH_s.js} +2 -2
- package/langwatch/dist/client/assets/{providers-DW7VWdqq.js → providers-tlLT_lTF.js} +2 -2
- package/langwatch/dist/client/assets/{reports-D3QFKhNP.js → reports-vlrcTrLs.js} +2 -2
- package/langwatch/dist/client/assets/{roles-B_0t5DWA.js → roles-DNgi-NQ9.js} +2 -2
- package/langwatch/dist/client/assets/{scenarios-BX3XslU0.js → scenarios-BmG_wDkR.js} +2 -2
- package/langwatch/dist/client/assets/{scim-DDsLO39r.js → scim-BKr1_FHt.js} +2 -2
- package/langwatch/dist/client/assets/{secrets-BvEGwDCy.js → secrets-CU8ocTGv.js} +2 -2
- package/langwatch/dist/client/assets/{settings-9giNiAQQ.js → settings-CDzdoYVK.js} +2 -2
- package/langwatch/dist/client/assets/{setup-HxXKoVKG.js → setup-nEvn2rjN.js} +2 -2
- package/langwatch/dist/client/assets/{subscription-DhyswDze.js → subscription-BPNl_6jF.js} +3 -3
- package/langwatch/dist/client/assets/{subscriptions-Dyyau22a.js → subscriptions-D0G-OE5C.js} +2 -2
- package/langwatch/dist/client/assets/{teams-DRmeAxzf.js → teams-DThgDQvB.js} +2 -2
- package/langwatch/dist/client/assets/{textOverflowHeuristic-JibhpzDV.js → textOverflowHeuristic-DTC8-Ffx.js} +2 -2
- package/langwatch/dist/client/assets/{topic-clustering-Bllfw5rZ.js → topic-clustering-BR2Mbpao.js} +2 -2
- package/langwatch/dist/client/assets/{topics-CpiGYxqb.js → topics-CI8GoNqp.js} +2 -2
- package/langwatch/dist/client/assets/{traceExecutor-CiHXJB0V.js → traceExecutor-CDUGyUaw.js} +2 -2
- package/langwatch/dist/client/assets/{usage-BnsstwBY.js → usage-B4mR7ut_.js} +2 -2
- package/langwatch/dist/client/assets/{usage-CoyGtJoI.js → usage-C8fbffYi.js} +2 -2
- package/langwatch/dist/client/assets/{useAdminResource-SPC5iBHM.js → useAdminResource-SmnnHro6.js} +2 -2
- package/langwatch/dist/client/assets/{useAnnotationQueues-2DKZTC7r.js → useAnnotationQueues-CA6Vk--V.js} +2 -2
- package/langwatch/dist/client/assets/{useAvailableEvaluators-HndTl2LV.js → useAvailableEvaluators-hmbmcRQr.js} +2 -2
- package/langwatch/dist/client/assets/{useDeleteDatasetConfirmation-BgWN6Qqb.js → useDeleteDatasetConfirmation-BCK_zUUe.js} +2 -2
- package/langwatch/dist/client/assets/{useWorkflowStore-e1wFCvo2.js → useWorkflowStore-QUJ3J8X9.js} +2 -2
- package/langwatch/dist/client/assets/{users-C6wjliCC.js → users-CfhanCfR.js} +2 -2
- package/langwatch/dist/client/assets/{users-tF6ZKeV1.js → users-HjuN3o6k.js} +2 -2
- package/langwatch/dist/client/assets/{virtual-keys-BL-65S0B.js → virtual-keys-Bj-MhW66.js} +2 -2
- package/langwatch/dist/client/assets/{wizard-faGkpZDT.js → wizard-dRWCVVx6.js} +2 -2
- package/langwatch/dist/client/assets/{workbench-Oj0s_YR-.js → workbench-CuixH3G1.js} +2 -2
- package/langwatch/dist/client/assets/{workflows-Cu9k-Twu.js → workflows-BT6m4Yu9.js} +2 -2
- package/langwatch/dist/client/index.html +3 -3
- package/langwatch/dist/scenario-child-process.js +20 -10
- package/langwatch/package.json +2 -2
- package/langwatch/pnpm-lock.yaml +329 -328
- package/langwatch/scripts/seed-dogfood-password.ts +163 -0
- package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-evaluator.integration.test.ts +458 -0
- package/langwatch/src/app/api/workflows/post_event/__tests__/post-event-routing.test.ts +188 -0
- package/langwatch/src/app/api/workflows/post_event/__tests__/post-event.integration.test.ts +274 -0
- package/langwatch/src/app/api/workflows/post_event/post-event.ts +29 -1
- package/langwatch/src/components/agents/AgentCodeEditorDrawer.tsx +4 -5
- package/langwatch/src/components/agents/__tests__/AgentCodeEditorDrawer.integration.test.tsx +40 -0
- package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/__tests__/code-execution-node.factory.unit.test.ts +47 -0
- package/langwatch/src/components/evaluations/wizard/hooks/evaluation-wizard-store/slices/factories/code-execution-node.factory.ts +2 -4
- package/langwatch/src/components/experiments/BatchEvaluationV2/BatchEvaluationV2EvaluationResults.tsx +6 -1
- package/langwatch/src/hooks/usePostHog.ts +11 -0
- package/langwatch/src/optimization_studio/__tests__/registry.test.ts +29 -1
- package/langwatch/src/optimization_studio/components/Optimize.tsx +17 -3
- package/langwatch/src/optimization_studio/components/properties/AgentPropertiesPanel.tsx +4 -5
- package/langwatch/src/optimization_studio/hooks/workflowStoreCore.ts +17 -6
- package/langwatch/src/optimization_studio/hooks/workflowStoreCore.unit.test.ts +42 -0
- package/langwatch/src/optimization_studio/registry.ts +2 -4
- package/langwatch/src/optimization_studio/server/lambda/index.ts +12 -2
- package/langwatch/src/server/api/routers/workflows.ts +18 -0
- package/langwatch/src/server/evaluations-v3/execution/workflowBuilder.ts +3 -2
- package/langwatch/src/server/evaluations-v3/services/__tests__/experiment-run.service.getRun-null.unit.test.ts +71 -0
- package/langwatch/src/server/evaluations-v3/services/experiment-run.service.ts +18 -9
- package/langwatch/src/server/modelProviders/utils.ts +11 -1
- package/langwatch/src/server/nlpgo/__tests__/nlpgoFetch.integration.test.ts +248 -0
- package/langwatch/src/server/nlpgo/nlpgoFetch.ts +155 -0
- package/langwatch/src/server/routes/__tests__/playground-proxy.integration.test.ts +242 -0
- package/langwatch/src/server/routes/playground.ts +11 -1
- package/langwatch/src/server/routes/workflows.ts +17 -0
- package/langwatch/src/server/topicClustering/topicClustering.ts +33 -8
- package/langwatch/src/server/workflows/runWorkflow.ts +10 -13
- package/langwatch_nlp/langwatch_nlp/studio/execute/execute_component.py +25 -1
- package/langwatch_nlp/langwatch_nlp/studio/parser.py +121 -16
- package/langwatch_nlp/langwatch_nlp/topic_clustering/topic_naming.py +39 -32
- package/langwatch_nlp/scripts/entrypoint.sh +67 -0
- package/langwatch_nlp/tests/studio/test_parse.py +198 -0
- package/mcp-server/pnpm-lock.yaml +15 -21
- package/package.json +1 -1
- package/packages/server/dist/cli.cjs +78 -94
- package/langwatch/dist/client/assets/ChatWindow-DzB-tNlQ.js +0 -1
- package/langwatch/dist/client/assets/_not-found-PEUaWdF3.js +0 -1
- package/langwatch/dist/client/assets/_slug_-C-8AjsjC.js +0 -2
- package/langwatch/dist/client/assets/choose--PBky27o.js +0 -2
- package/langwatch/dist/client/assets/custom-CSiS1liN.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Do as n,Fa as r,Xr as i,_o as a,gs as o,na as s,sc as c,vo as l,ya as u}from"./command-bar-CaJygoez.js";import{j as d,n as f}from"./stack-oJ9iWdbl.js";import{t as p}from"./box-BsM8YLGl.js";import{f as m,p as h}from"./LoadingScreen--vgXk5-2.js";import{t as g}from"./tooltip-AEm0YeiF.js";import{n as _}from"./toaster-C_DYALhL.js";import{an as v}from"./dist-SwV3YZv3.js";import{c as y,d as b,o as x,u as S}from"./tracking-DbhAKeey.js";import{t as C}from"./heading-D90dlSnH.js";import{t as w}from"./text-CwTrMF8x.js";import{a as T,r as E}from"./field-CnUiixMS.js";import{t as D}from"./input-C7emsUCL.js";import{t as O}from"./h-stack-BKLDJ2vg.js";import{n as k,t as A}from"./link-CwZhwOLq.js";import{t as j}from"./spacer-2LJJGbo8.js";import{t as M}from"./v-stack-EOPQ57OZ.js";import{m as N,s as P}from"./auth-client-D3UhxhQi.js";import{t as F}from"./usePublicEnv-1QvVAhAk.js";import{t as I}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as L}from"./upload-KqBaezR7.js";import{t as R}from"./SettingsLayout-CLCGxMAe.js";import{i as z,t as B}from"./constants-BT2q4NNM.js";import{a as ee,i as te,n as V,o as H,s as U,t as W}from"./licenseStatusUtils-UVWlds8s.js";var G=e(t()),K=d();function q({status:e,onRemove:t,isRemoving:n}){let r=ee(e),i=e.valid,a=H(e);return r?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(O,{children:(0,K.jsx)(v,{colorPalette:`red`,fontSize:`sm`,paddingX:2,paddingY:1,children:`Corrupted`})}),(0,K.jsx)(p,{backgroundColor:`red.50`,padding:3,borderRadius:`md`,width:`full`,children:(0,K.jsx)(w,{fontSize:`sm`,color:`red.600`,children:`Your license file is corrupted and cannot be read. Please upload a valid license or contact support.`})}),(0,K.jsxs)(O,{children:[(0,K.jsx)(f,{variant:`outline`,size:`sm`,colorPalette:`red`,onClick:t,loading:n,disabled:n,children:`Remove License`}),(0,K.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,children:(0,K.jsx)(k,{href:B,target:`_blank`,children:`Contact Sales`})})]})]})}):te(e)?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(O,{children:(0,K.jsx)(v,{colorPalette:i?`green`:`red`,fontSize:`sm`,paddingX:2,paddingY:1,children:i?e.plan:a?`Expired`:`Invalid`})}),(0,K.jsxs)(M,{align:`start`,gap:2,width:`full`,children:[(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Plan:`}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:e.planName})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Licensed to:`}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:e.organizationName})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Seats:`}),(0,K.jsxs)(w,{fontSize:`sm`,fontWeight:`medium`,children:[e.currentMembers,` / `,e.maxMembers]})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Expires:`}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,color:a?`red.500`:void 0,children:V(e.expiresAt)})]})]}),!i&&(0,K.jsx)(p,{backgroundColor:`red.50`,padding:3,borderRadius:`md`,width:`full`,children:(0,K.jsx)(w,{fontSize:`sm`,color:`red.600`,children:a?`Your license has expired. Please renew to continue using licensed features.`:`Your license is invalid. Please contact support or upload a valid license.`})}),(0,K.jsxs)(O,{children:[(0,K.jsx)(f,{variant:`outline`,size:`sm`,colorPalette:`red`,onClick:t,loading:n,disabled:n,children:`Remove License`}),(0,K.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,children:(0,K.jsx)(k,{href:B,target:`_blank`,children:`Contact Sales`})})]})]})}):null}var J={type:`PRO`,name:`Pro`,maxMembers:10,maxMembersLite:5,maxTeams:10,maxProjects:20,maxMessagesPerMonth:1e5,evaluationsCredit:0,maxWorkflows:50,maxPrompts:50,maxEvaluators:50,maxScenarios:50,maxAgents:50,maxExperiments:50,maxOnlineEvaluations:50,maxDatasets:50,maxDashboards:50,maxCustomGraphs:50,maxAutomations:50,canPublish:!0,usageUnit:`traces`},Y={type:`ENTERPRISE`,name:`Enterprise`,maxMembers:100,maxMembersLite:50,maxTeams:100,maxProjects:500,maxMessagesPerMonth:1e7,evaluationsCredit:0,maxWorkflows:1e3,maxPrompts:1e3,maxEvaluators:1e3,maxScenarios:1e3,maxAgents:1e3,maxExperiments:1e3,maxOnlineEvaluations:1e3,maxDatasets:1e3,maxDashboards:1e3,maxCustomGraphs:1e3,maxAutomations:1e3,canPublish:!0,usageUnit:`traces`},X={PRO:{maxMembers:J.maxMembers,maxMembersLite:J.maxMembersLite,maxProjects:J.maxProjects,maxMessagesPerMonth:J.maxMessagesPerMonth,maxWorkflows:J.maxWorkflows,maxPrompts:J.maxPrompts,maxEvaluators:J.maxEvaluators,maxScenarios:J.maxScenarios,maxAgents:J.maxAgents,canPublish:J.canPublish,usageUnit:J.usageUnit},ENTERPRISE:{maxMembers:Y.maxMembers,maxMembersLite:Y.maxMembersLite,maxProjects:Y.maxProjects,maxMessagesPerMonth:Y.maxMessagesPerMonth,maxWorkflows:Y.maxWorkflows,maxPrompts:Y.maxPrompts,maxEvaluators:Y.maxEvaluators,maxScenarios:Y.maxScenarios,maxAgents:Y.maxAgents,canPublish:Y.canPublish,usageUnit:Y.usageUnit},CUSTOM:{}};function ne(e){return X[e]}var Z=c({items:[{label:`Pro`,value:`PRO`},{label:`Enterprise`,value:`ENTERPRISE`},{label:`Custom`,value:`CUSTOM`}]}),re=c({items:[{label:`Traces`,value:`traces`},{label:`Events (traces + evaluations + experiments)`,value:`events`}]});function Q(){let e=new Date;return e.setFullYear(e.getFullYear()+1),e.toISOString().split(`T`)[0]??``}var ie={privateKey:``,organizationName:``,email:``,expiresAt:Q(),planType:`ENTERPRISE`,maxMembers:Y.maxMembers,maxMembersLite:Y.maxMembersLite??50,maxTeams:Y.maxTeams??100,maxProjects:Y.maxProjects,maxMessagesPerMonth:Y.maxMessagesPerMonth,maxWorkflows:Y.maxWorkflows,maxPrompts:Y.maxPrompts??1e3,maxEvaluators:Y.maxEvaluators??1e3,maxScenarios:Y.maxScenarios??1e3,maxAgents:Y.maxAgents??1e3,maxExperiments:Y.maxExperiments??1e3,canPublish:Y.canPublish,usageUnit:Y.usageUnit??`events`};function ae(e,t){let n=t.replace(/[\/\\:*?"<>|]/g,`_`),r=new Blob([e],{type:`text/plain`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.langwatch-license`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function $({label:e,value:t,onChange:n}){return(0,K.jsxs)(T,{flex:1,children:[(0,K.jsx)(E,{fontSize:`xs`,color:`fg.muted`,children:e}),(0,K.jsx)(D,{value:t,onChange:e=>n(parseInt(e.target.value)||0),type:`number`})]})}var oe=(0,G.forwardRef)(function({organizationId:e,onGeneratedLicenseChange:t,onFormStateChange:n},r){let[i,c]=(0,G.useState)(ie),[d,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(`file`),[v,C]=(0,G.useState)(null),[k,A]=(0,G.useState)(!1),j=(0,G.useRef)(null),F=P.license.generate.useMutation({onSuccess:e=>{m(e.licenseKey),t?.(!0),ae(e.licenseKey,i.organizationName),_.create({title:`License generated and downloaded`,description:`License saved as ${i.organizationName.replace(/[\/\\:*?"<>|]/g,`_`)}.langwatch-license`,type:`success`})},onError:e=>{N(e)||_.create({title:`Failed to generate license`,description:e.message,type:`error`})}}),I=e=>{let t=ne(e);c(n=>({...n,planType:e,...t}))},R=(e,t)=>{c(n=>({...n,[e]:t}))},z=e=>{g(e),e===`file`||C(null),c(e=>({...e,privateKey:``}))},B=(0,G.useCallback)(e=>{C(e);let t=new FileReader;t.onload=e=>{let t=e.target?.result;c(e=>({...e,privateKey:t}))},t.readAsText(e)},[]),ee=(0,G.useCallback)(e=>{e.preventDefault(),A(!0)},[]),te=(0,G.useCallback)(()=>{A(!1)},[]),V=(0,G.useCallback)(e=>{e.preventDefault(),A(!1);let t=e.dataTransfer.files[0];t&&B(t)},[B]),H=(0,G.useCallback)(()=>{j.current?.click()},[]),U=(0,G.useCallback)(e=>{let t=e.target.files?.[0];t&&B(t)},[B]),q=(0,G.useCallback)(()=>{C(null),c(e=>({...e,privateKey:``})),j.current&&(j.current.value=``)},[]),J=()=>{F.mutate({organizationId:e,privateKey:i.privateKey,organizationName:i.organizationName,email:i.email,expiresAt:new Date(i.expiresAt),planType:i.planType,plan:{maxMembers:i.maxMembers,maxMembersLite:i.maxMembersLite,maxTeams:i.maxTeams,maxProjects:i.maxProjects,maxMessagesPerMonth:i.maxMessagesPerMonth,maxWorkflows:i.maxWorkflows,maxPrompts:i.maxPrompts,maxEvaluators:i.maxEvaluators,maxScenarios:i.maxScenarios,maxAgents:i.maxAgents,maxExperiments:i.maxExperiments,canPublish:i.canPublish,usageUnit:i.usageUnit}})},Y=async()=>{try{await navigator.clipboard.writeText(d),_.create({title:`License copied to clipboard`,type:`success`})}catch{_.create({title:`Failed to copy`,description:`Please copy the license manually.`,type:`error`})}},X=()=>{c(ie),m(``),C(null),g(`file`),j.current&&(j.current.value=``),t?.(!1)},Q=i.privateKey.trim()!==``&&i.organizationName.trim()!==``&&i.email.trim()!==``&&i.expiresAt!==``;if((0,G.useEffect)(()=>{n?.({isGenerating:F.isLoading,isFormValid:Q})},[F.isLoading,Q,n]),(0,G.useImperativeHandle)(r,()=>({handleGenerate:J,isGenerating:F.isLoading,isFormValid:Q,hasGeneratedLicense:!!d})),d){let e=i.organizationName.replace(/[\/\\:*?"<>|]/g,`_`);return(0,K.jsxs)(M,{align:`start`,gap:4,width:`full`,paddingX:6,paddingY:4,children:[(0,K.jsx)(p,{backgroundColor:`green.50`,padding:4,borderRadius:`md`,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:2,children:[(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,color:`green.700`,children:`License generated and downloaded!`}),(0,K.jsxs)(w,{fontSize:`sm`,color:`green.600`,children:[`The license file has been saved as`,` `,(0,K.jsxs)(w,{as:`span`,fontFamily:`mono`,fontWeight:`medium`,children:[e,`.langwatch-license`]})]})]})}),(0,K.jsxs)(O,{children:[(0,K.jsx)(f,{colorPalette:`blue`,size:`sm`,onClick:()=>ae(d,i.organizationName),children:`Download Again`}),(0,K.jsx)(f,{variant:`outline`,size:`sm`,onClick:Y,children:`Copy to Clipboard`}),(0,K.jsx)(f,{variant:`outline`,size:`sm`,onClick:X,children:`Generate Another`})]})]})}return(0,K.jsxs)(M,{align:`start`,gap:4,width:`full`,paddingX:6,paddingY:4,children:[(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Private Key`}),(0,K.jsx)(l,{value:h,onValueChange:e=>z(e.value),disabled:F.isLoading,children:(0,K.jsxs)(O,{gap:4,marginBottom:3,children:[(0,K.jsx)(a,{value:`file`,children:`Upload private key file`}),(0,K.jsx)(a,{value:`key`,children:`Enter private key`})]})}),h===`file`&&(0,K.jsxs)(p,{width:`full`,children:[(0,K.jsx)(`input`,{ref:j,type:`file`,accept:`.pem,.key`,style:{display:`none`},onChange:U}),v?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:4,width:`full`,backgroundColor:`bg.subtle`,children:(0,K.jsxs)(O,{justify:`space-between`,width:`full`,children:[(0,K.jsxs)(O,{gap:3,children:[(0,K.jsx)(L,{size:20}),(0,K.jsxs)(M,{align:`start`,gap:0,children:[(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:v.name}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:W(v.size)})]})]}),(0,K.jsx)(f,{variant:`ghost`,size:`sm`,onClick:q,disabled:F.isLoading,"aria-label":`Remove file`,children:(0,K.jsx)(u,{size:16})})]})}):(0,K.jsx)(p,{borderWidth:`2px`,borderStyle:`dashed`,borderRadius:`lg`,padding:6,width:`full`,cursor:`pointer`,onClick:H,onDragOver:ee,onDragLeave:te,onDrop:V,borderColor:k?`blue.500`:`border`,backgroundColor:k?`blue.50`:`transparent`,transition:`all 0.2s`,_hover:{borderColor:`blue.300`},children:(0,K.jsxs)(M,{gap:2,children:[(0,K.jsx)(L,{size:24,color:`#666`}),(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,textAlign:`center`,children:`Drop your private key file here`}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:`Click to browse (.pem, .key)`})]})})]}),h===`key`&&(0,K.jsx)(o,{value:i.privateKey,onChange:e=>R(`privateKey`,e.target.value),placeholder:`Paste your Private License key`,fontFamily:`mono`,fontSize:`xs`,rows:6,disabled:F.isLoading})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Organization Name`}),(0,K.jsx)(D,{value:i.organizationName,onChange:e=>R(`organizationName`,e.target.value),placeholder:`Acme Corp`})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Email`}),(0,K.jsx)(D,{value:i.email,onChange:e=>R(`email`,e.target.value),placeholder:`admin@acme.corp`,type:`email`})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Expiration Date`}),(0,K.jsx)(D,{value:i.expiresAt,onChange:e=>R(`expiresAt`,e.target.value),type:`date`})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Plan Type`}),(0,K.jsxs)(s.Root,{collection:Z,value:[i.planType],onValueChange:e=>{let t=e.value[0];t&&I(t)},children:[(0,K.jsx)(s.Trigger,{width:`full`,children:(0,K.jsx)(s.ValueText,{placeholder:`Select plan type`})}),(0,K.jsx)(s.Content,{paddingY:2,children:Z.items.map(e=>(0,K.jsx)(s.Item,{item:e,children:e.label},e.value))})]})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Usage Unit`}),(0,K.jsxs)(s.Root,{collection:re,value:[i.usageUnit],onValueChange:e=>{let t=e.value[0];t&&R(`usageUnit`,t)},children:[(0,K.jsx)(s.Trigger,{width:`full`,children:(0,K.jsx)(s.ValueText,{placeholder:`Select usage unit`})}),(0,K.jsx)(s.Content,{paddingY:2,children:re.items.map(e=>(0,K.jsx)(s.Item,{item:e,children:e.label},e.value))})]}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,marginTop:1,children:`Determines how usage is counted against the monthly limit.`})]}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`semibold`,marginBottom:2,children:`Plan Limits`}),(0,K.jsx)(p,{width:`full`,borderWidth:`1px`,borderRadius:`md`,padding:4,children:(0,K.jsxs)(M,{align:`start`,gap:3,children:[(0,K.jsxs)(O,{width:`full`,gap:4,children:[(0,K.jsx)($,{label:`Max Members`,value:i.maxMembers,onChange:e=>R(`maxMembers`,e)}),(0,K.jsx)($,{label:`Max Lite Members`,value:i.maxMembersLite,onChange:e=>R(`maxMembersLite`,e)}),(0,K.jsx)($,{label:`Max Projects`,value:i.maxProjects,onChange:e=>R(`maxProjects`,e)})]}),(0,K.jsxs)(O,{width:`full`,gap:4,children:[(0,K.jsx)($,{label:`Max Messages/Month`,value:i.maxMessagesPerMonth,onChange:e=>R(`maxMessagesPerMonth`,e)}),(0,K.jsx)($,{label:`Max Workflows`,value:i.maxWorkflows,onChange:e=>R(`maxWorkflows`,e)})]}),(0,K.jsxs)(O,{width:`full`,gap:4,children:[(0,K.jsx)($,{label:`Max Prompts`,value:i.maxPrompts,onChange:e=>R(`maxPrompts`,e)}),(0,K.jsx)($,{label:`Max Evaluators`,value:i.maxEvaluators,onChange:e=>R(`maxEvaluators`,e)}),(0,K.jsx)($,{label:`Max Scenarios`,value:i.maxScenarios,onChange:e=>R(`maxScenarios`,e)})]}),(0,K.jsx)(O,{width:`full`,gap:4,children:(0,K.jsx)($,{label:`Max Agents`,value:i.maxAgents,onChange:e=>R(`maxAgents`,e)})}),(0,K.jsxs)(b,{checked:i.canPublish,onCheckedChange:e=>R(`canPublish`,!!e.checked),children:[(0,K.jsx)(y,{}),(0,K.jsx)(x,{}),(0,K.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:`Enabled to publish Workflows publicly`})]})]})})]})});function se({open:e,onClose:t,organizationId:r}){let i=(0,G.useRef)(null),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),d=()=>{i.current?.handleGenerate()},p=(0,G.useCallback)(e=>{c(e.isGenerating),u(e.isFormValid)},[]);return(0,K.jsx)(n.Root,{open:e,onOpenChange:({open:e})=>!e&&t(),size:`lg`,closeOnInteractOutside:!0,modal:!1,children:(0,K.jsxs)(n.Content,{children:[(0,K.jsx)(n.CloseTrigger,{}),(0,K.jsx)(n.Header,{children:(0,K.jsx)(C,{children:`Generate License`})}),(0,K.jsx)(n.Body,{padding:0,children:(0,K.jsx)(oe,{ref:i,organizationId:r,onGeneratedLicenseChange:o,onFormStateChange:p})}),!a&&(0,K.jsx)(n.Footer,{borderTopWidth:`1px`,borderColor:`border`,justifyContent:`flex-end`,children:(0,K.jsx)(f,{colorPalette:`blue`,onClick:d,loading:s,disabled:!l||s,children:`Generate License`})})]})})}function ce(){return(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(m,{height:`24px`,width:`150px`}),(0,K.jsx)(h,{noOfLines:3,gap:2,width:`full`})]})})}function le({licenseKey:e,onLicenseKeyChange:t,onActivate:n,onFileActivate:r,isActivating:i}){let s=F().data?.STRIPE_LICENSE_PAYMENT_LINK_URL??`https://buy.stripe.com/dRm3cwaIDgXs6yK6sX0480f`,[c,d]=(0,G.useState)(`file`),[m,h]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),y=(0,G.useRef)(null),b=e=>{d(e)},x=(0,G.useCallback)(e=>{e.name.endsWith(`.langwatch-license`)&&h(e)},[]),S=(0,G.useCallback)(e=>{e.preventDefault(),v(!0)},[]),C=(0,G.useCallback)(()=>{v(!1)},[]),D=(0,G.useCallback)(e=>{e.preventDefault(),v(!1);let t=e.dataTransfer.files[0];t&&x(t)},[x]),k=(0,G.useCallback)(()=>{y.current?.click()},[]),j=(0,G.useCallback)(e=>{let t=e.target.files?.[0];t&&x(t)},[x]),N=(0,G.useCallback)(()=>{h(null),y.current&&(y.current.value=``)},[]),P=(0,G.useCallback)(()=>{if(c===`file`&&m){let e=new FileReader;e.onload=e=>{let t=e.target?.result;r&&r(t)},e.readAsText(m)}else c===`key`&&n()},[c,m,r,n]),I=i||c===`file`&&!m||c===`key`&&!e.trim();return(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsxs)(M,{align:`start`,gap:1,children:[(0,K.jsx)(w,{fontWeight:`medium`,fontSize:`md`,children:`No license installed`}),(0,K.jsx)(w,{color:`fg.muted`,fontSize:`sm`,children:`Running without a license. Some features may be limited.`})]}),(0,K.jsxs)(M,{align:`start`,gap:3,width:`full`,children:[(0,K.jsx)(w,{fontWeight:`medium`,children:`Activate a license:`}),(0,K.jsx)(l,{value:c,onValueChange:e=>b(e.value),disabled:i,children:(0,K.jsxs)(O,{gap:4,children:[(0,K.jsx)(a,{value:`file`,children:`Upload license file`}),(0,K.jsx)(a,{value:`key`,children:`Enter license key`})]})}),c===`file`&&(0,K.jsxs)(p,{width:`full`,children:[(0,K.jsx)(`input`,{ref:y,type:`file`,accept:`.langwatch-license`,style:{display:`none`},onChange:j}),m?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:4,width:`full`,backgroundColor:`bg.subtle`,children:(0,K.jsxs)(O,{justify:`space-between`,width:`full`,children:[(0,K.jsxs)(O,{gap:3,children:[(0,K.jsx)(L,{size:20}),(0,K.jsxs)(M,{align:`start`,gap:0,children:[(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:m.name}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:W(m.size)})]})]}),(0,K.jsx)(f,{variant:`ghost`,size:`sm`,onClick:N,disabled:i,"aria-label":`Remove file`,children:(0,K.jsx)(u,{size:16})})]})}):(0,K.jsx)(p,{borderWidth:`2px`,borderStyle:`dashed`,borderRadius:`lg`,padding:6,width:`full`,cursor:`pointer`,onClick:k,onDragOver:S,onDragLeave:C,onDrop:D,borderColor:_?`blue.500`:`border`,backgroundColor:_?`blue.50`:`transparent`,transition:`all 0.2s`,_hover:{borderColor:`blue.300`},children:(0,K.jsxs)(M,{gap:2,children:[(0,K.jsx)(L,{size:24,color:`#666`}),(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,textAlign:`center`,children:`Drop your license here`}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:`Click to browse`})]})})]}),c===`key`&&(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{srOnly:!0,children:`License key`}),(0,K.jsx)(o,{value:e,onChange:e=>t(e.target.value),placeholder:`Paste your license key`,rows:4,fontFamily:`mono`,fontSize:`xs`,disabled:i})]}),(0,K.jsxs)(O,{gap:3,children:[(0,K.jsx)(f,{colorPalette:`blue`,variant:`solid`,size:`sm`,onClick:P,loading:i,disabled:I,children:`Activate License`}),s&&(0,K.jsx)(g,{content:`After purchase, your license will be generated and delivered to your email.`,children:(0,K.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,children:(0,K.jsx)(A,{href:s,isExternal:!0,children:`Purchase license`})})}),(0,K.jsx)(A,{href:B,isExternal:!0,color:`blue.fg`,fontSize:`sm`,_hover:{textDecoration:`underline`},children:`Contact sales`})]})]})]})})}function ue({organizationId:e,onUploadSuccess:t,onRemoveSuccess:n}){let r=P.license.upload.useMutation({onSuccess:()=>{_.create({title:`License activated`,description:`Your license has been successfully activated.`,type:`success`}),t(),window.location.reload()},onError:e=>{N(e)||_.create({title:`Failed to activate license`,description:z(e.message),type:`error`})}}),i=P.license.remove.useMutation({onSuccess:()=>{_.create({title:`License removed`,description:`Your organization is now running without a license. Some features may be limited.`,type:`info`}),n(),window.location.reload()},onError:e=>{N(e)||_.create({title:`Failed to remove license`,description:e.message,type:`error`})}});return{upload:t=>{r.mutate({organizationId:e,licenseKey:t})},remove:()=>{i.mutate({organizationId:e})},isUploading:r.isLoading,isRemoving:i.isLoading}}function de({organizationId:e,isGeneratorOpen:t,onGeneratorOpenChange:n}){let[r,i]=(0,G.useState)(``),{data:a,isLoading:o,isError:s,error:c,refetch:l}=P.license.getStatus.useQuery({organizationId:e},{enabled:!!e,refetchOnWindowFocus:!1,staleTime:3e4}),{upload:u,remove:d,isUploading:m,isRemoving:h}=ue({organizationId:e,onUploadSuccess:()=>{i(``),l()},onRemoveSuccess:()=>{l()}});return o?(0,K.jsx)(ce,{}):s?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(w,{fontWeight:`medium`,children:`Unable to load license`}),(0,K.jsx)(w,{color:`fg.muted`,children:`Your license status could not be retrieved. Please try again or contact support if the issue persists.`}),(0,K.jsx)(f,{onClick:()=>void l(),size:`sm`,children:`Retry`})]})}):a?.hasLicense?(0,K.jsxs)(M,{align:`start`,gap:0,width:`full`,children:[(0,K.jsx)(q,{status:a,onRemove:d,isRemoving:h}),(0,K.jsx)(se,{open:t,onClose:()=>n(!1),organizationId:e})]}):(0,K.jsxs)(M,{align:`start`,gap:0,width:`full`,children:[(0,K.jsx)(le,{licenseKey:r,onLicenseKeyChange:i,onActivate:()=>{let e=U(r);e&&u(e)},onFileActivate:e=>{let t=U(e);t&&u(t)},isActivating:m}),(0,K.jsx)(se,{open:t,onClose:()=>n(!1),organizationId:e})]})}function fe(){let{organization:e}=I(),[t,n]=(0,G.useState)(!1),a=F();return(0,K.jsx)(R,{children:(0,K.jsxs)(M,{gap:6,width:`full`,align:`start`,children:[(0,K.jsxs)(O,{width:`full`,children:[(0,K.jsx)(C,{children:`License`}),(0,K.jsx)(j,{}),a.data?.IS_SAAS&&(0,K.jsxs)(i.HeaderButton,{onClick:()=>n(!0),children:[(0,K.jsx)(r,{size:20}),`New License`]})]}),(0,K.jsx)(w,{color:`fg.muted`,children:`Manage your LangWatch license for self-hosted deployments. A valid license is required for commercial use and enables specific plan limits.`}),e?.id?(0,K.jsx)(de,{organizationId:e.id,isGeneratorOpen:t,onGeneratorOpenChange:n}):(0,K.jsx)(w,{children:`Loading...`})]})})}export{fe as default};
|
|
2
|
-
//# sourceMappingURL=license-
|
|
1
|
+
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Do as n,Fa as r,Xr as i,_o as a,gs as o,na as s,sc as c,vo as l,ya as u}from"./command-bar-DUK45yin.js";import{j as d,n as f}from"./stack-oJ9iWdbl.js";import{t as p}from"./box-BsM8YLGl.js";import{f as m,p as h}from"./LoadingScreen--vgXk5-2.js";import{t as g}from"./tooltip-AEm0YeiF.js";import{n as _}from"./toaster-C_DYALhL.js";import{an as v}from"./dist-Cds4Mqhj.js";import{c as y,d as b,o as x,u as S}from"./tracking-DbhAKeey.js";import{t as C}from"./heading-D90dlSnH.js";import{t as w}from"./text-CwTrMF8x.js";import{a as T,r as E}from"./field-CnUiixMS.js";import{t as D}from"./input-C7emsUCL.js";import{t as O}from"./h-stack-BKLDJ2vg.js";import{n as k,t as A}from"./link-CwZhwOLq.js";import{t as j}from"./spacer-2LJJGbo8.js";import{t as M}from"./v-stack-EOPQ57OZ.js";import{m as N,s as P}from"./auth-client-D3UhxhQi.js";import{t as F}from"./usePublicEnv-1QvVAhAk.js";import{t as I}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as L}from"./upload-KqBaezR7.js";import{t as R}from"./SettingsLayout--1gdEuhv.js";import{i as z,t as B}from"./constants-BT2q4NNM.js";import{a as ee,i as te,n as V,o as H,s as U,t as W}from"./licenseStatusUtils-UVWlds8s.js";var G=e(t()),K=d();function q({status:e,onRemove:t,isRemoving:n}){let r=ee(e),i=e.valid,a=H(e);return r?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(O,{children:(0,K.jsx)(v,{colorPalette:`red`,fontSize:`sm`,paddingX:2,paddingY:1,children:`Corrupted`})}),(0,K.jsx)(p,{backgroundColor:`red.50`,padding:3,borderRadius:`md`,width:`full`,children:(0,K.jsx)(w,{fontSize:`sm`,color:`red.600`,children:`Your license file is corrupted and cannot be read. Please upload a valid license or contact support.`})}),(0,K.jsxs)(O,{children:[(0,K.jsx)(f,{variant:`outline`,size:`sm`,colorPalette:`red`,onClick:t,loading:n,disabled:n,children:`Remove License`}),(0,K.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,children:(0,K.jsx)(k,{href:B,target:`_blank`,children:`Contact Sales`})})]})]})}):te(e)?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(O,{children:(0,K.jsx)(v,{colorPalette:i?`green`:`red`,fontSize:`sm`,paddingX:2,paddingY:1,children:i?e.plan:a?`Expired`:`Invalid`})}),(0,K.jsxs)(M,{align:`start`,gap:2,width:`full`,children:[(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Plan:`}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:e.planName})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Licensed to:`}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:e.organizationName})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Seats:`}),(0,K.jsxs)(w,{fontSize:`sm`,fontWeight:`medium`,children:[e.currentMembers,` / `,e.maxMembers]})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,width:`120px`,children:`Expires:`}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,color:a?`red.500`:void 0,children:V(e.expiresAt)})]})]}),!i&&(0,K.jsx)(p,{backgroundColor:`red.50`,padding:3,borderRadius:`md`,width:`full`,children:(0,K.jsx)(w,{fontSize:`sm`,color:`red.600`,children:a?`Your license has expired. Please renew to continue using licensed features.`:`Your license is invalid. Please contact support or upload a valid license.`})}),(0,K.jsxs)(O,{children:[(0,K.jsx)(f,{variant:`outline`,size:`sm`,colorPalette:`red`,onClick:t,loading:n,disabled:n,children:`Remove License`}),(0,K.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,children:(0,K.jsx)(k,{href:B,target:`_blank`,children:`Contact Sales`})})]})]})}):null}var J={type:`PRO`,name:`Pro`,maxMembers:10,maxMembersLite:5,maxTeams:10,maxProjects:20,maxMessagesPerMonth:1e5,evaluationsCredit:0,maxWorkflows:50,maxPrompts:50,maxEvaluators:50,maxScenarios:50,maxAgents:50,maxExperiments:50,maxOnlineEvaluations:50,maxDatasets:50,maxDashboards:50,maxCustomGraphs:50,maxAutomations:50,canPublish:!0,usageUnit:`traces`},Y={type:`ENTERPRISE`,name:`Enterprise`,maxMembers:100,maxMembersLite:50,maxTeams:100,maxProjects:500,maxMessagesPerMonth:1e7,evaluationsCredit:0,maxWorkflows:1e3,maxPrompts:1e3,maxEvaluators:1e3,maxScenarios:1e3,maxAgents:1e3,maxExperiments:1e3,maxOnlineEvaluations:1e3,maxDatasets:1e3,maxDashboards:1e3,maxCustomGraphs:1e3,maxAutomations:1e3,canPublish:!0,usageUnit:`traces`},X={PRO:{maxMembers:J.maxMembers,maxMembersLite:J.maxMembersLite,maxProjects:J.maxProjects,maxMessagesPerMonth:J.maxMessagesPerMonth,maxWorkflows:J.maxWorkflows,maxPrompts:J.maxPrompts,maxEvaluators:J.maxEvaluators,maxScenarios:J.maxScenarios,maxAgents:J.maxAgents,canPublish:J.canPublish,usageUnit:J.usageUnit},ENTERPRISE:{maxMembers:Y.maxMembers,maxMembersLite:Y.maxMembersLite,maxProjects:Y.maxProjects,maxMessagesPerMonth:Y.maxMessagesPerMonth,maxWorkflows:Y.maxWorkflows,maxPrompts:Y.maxPrompts,maxEvaluators:Y.maxEvaluators,maxScenarios:Y.maxScenarios,maxAgents:Y.maxAgents,canPublish:Y.canPublish,usageUnit:Y.usageUnit},CUSTOM:{}};function ne(e){return X[e]}var Z=c({items:[{label:`Pro`,value:`PRO`},{label:`Enterprise`,value:`ENTERPRISE`},{label:`Custom`,value:`CUSTOM`}]}),re=c({items:[{label:`Traces`,value:`traces`},{label:`Events (traces + evaluations + experiments)`,value:`events`}]});function Q(){let e=new Date;return e.setFullYear(e.getFullYear()+1),e.toISOString().split(`T`)[0]??``}var ie={privateKey:``,organizationName:``,email:``,expiresAt:Q(),planType:`ENTERPRISE`,maxMembers:Y.maxMembers,maxMembersLite:Y.maxMembersLite??50,maxTeams:Y.maxTeams??100,maxProjects:Y.maxProjects,maxMessagesPerMonth:Y.maxMessagesPerMonth,maxWorkflows:Y.maxWorkflows,maxPrompts:Y.maxPrompts??1e3,maxEvaluators:Y.maxEvaluators??1e3,maxScenarios:Y.maxScenarios??1e3,maxAgents:Y.maxAgents??1e3,maxExperiments:Y.maxExperiments??1e3,canPublish:Y.canPublish,usageUnit:Y.usageUnit??`events`};function ae(e,t){let n=t.replace(/[\/\\:*?"<>|]/g,`_`),r=new Blob([e],{type:`text/plain`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.langwatch-license`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function $({label:e,value:t,onChange:n}){return(0,K.jsxs)(T,{flex:1,children:[(0,K.jsx)(E,{fontSize:`xs`,color:`fg.muted`,children:e}),(0,K.jsx)(D,{value:t,onChange:e=>n(parseInt(e.target.value)||0),type:`number`})]})}var oe=(0,G.forwardRef)(function({organizationId:e,onGeneratedLicenseChange:t,onFormStateChange:n},r){let[i,c]=(0,G.useState)(ie),[d,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(`file`),[v,C]=(0,G.useState)(null),[k,A]=(0,G.useState)(!1),j=(0,G.useRef)(null),F=P.license.generate.useMutation({onSuccess:e=>{m(e.licenseKey),t?.(!0),ae(e.licenseKey,i.organizationName),_.create({title:`License generated and downloaded`,description:`License saved as ${i.organizationName.replace(/[\/\\:*?"<>|]/g,`_`)}.langwatch-license`,type:`success`})},onError:e=>{N(e)||_.create({title:`Failed to generate license`,description:e.message,type:`error`})}}),I=e=>{let t=ne(e);c(n=>({...n,planType:e,...t}))},R=(e,t)=>{c(n=>({...n,[e]:t}))},z=e=>{g(e),e===`file`||C(null),c(e=>({...e,privateKey:``}))},B=(0,G.useCallback)(e=>{C(e);let t=new FileReader;t.onload=e=>{let t=e.target?.result;c(e=>({...e,privateKey:t}))},t.readAsText(e)},[]),ee=(0,G.useCallback)(e=>{e.preventDefault(),A(!0)},[]),te=(0,G.useCallback)(()=>{A(!1)},[]),V=(0,G.useCallback)(e=>{e.preventDefault(),A(!1);let t=e.dataTransfer.files[0];t&&B(t)},[B]),H=(0,G.useCallback)(()=>{j.current?.click()},[]),U=(0,G.useCallback)(e=>{let t=e.target.files?.[0];t&&B(t)},[B]),q=(0,G.useCallback)(()=>{C(null),c(e=>({...e,privateKey:``})),j.current&&(j.current.value=``)},[]),J=()=>{F.mutate({organizationId:e,privateKey:i.privateKey,organizationName:i.organizationName,email:i.email,expiresAt:new Date(i.expiresAt),planType:i.planType,plan:{maxMembers:i.maxMembers,maxMembersLite:i.maxMembersLite,maxTeams:i.maxTeams,maxProjects:i.maxProjects,maxMessagesPerMonth:i.maxMessagesPerMonth,maxWorkflows:i.maxWorkflows,maxPrompts:i.maxPrompts,maxEvaluators:i.maxEvaluators,maxScenarios:i.maxScenarios,maxAgents:i.maxAgents,maxExperiments:i.maxExperiments,canPublish:i.canPublish,usageUnit:i.usageUnit}})},Y=async()=>{try{await navigator.clipboard.writeText(d),_.create({title:`License copied to clipboard`,type:`success`})}catch{_.create({title:`Failed to copy`,description:`Please copy the license manually.`,type:`error`})}},X=()=>{c(ie),m(``),C(null),g(`file`),j.current&&(j.current.value=``),t?.(!1)},Q=i.privateKey.trim()!==``&&i.organizationName.trim()!==``&&i.email.trim()!==``&&i.expiresAt!==``;if((0,G.useEffect)(()=>{n?.({isGenerating:F.isLoading,isFormValid:Q})},[F.isLoading,Q,n]),(0,G.useImperativeHandle)(r,()=>({handleGenerate:J,isGenerating:F.isLoading,isFormValid:Q,hasGeneratedLicense:!!d})),d){let e=i.organizationName.replace(/[\/\\:*?"<>|]/g,`_`);return(0,K.jsxs)(M,{align:`start`,gap:4,width:`full`,paddingX:6,paddingY:4,children:[(0,K.jsx)(p,{backgroundColor:`green.50`,padding:4,borderRadius:`md`,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:2,children:[(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,color:`green.700`,children:`License generated and downloaded!`}),(0,K.jsxs)(w,{fontSize:`sm`,color:`green.600`,children:[`The license file has been saved as`,` `,(0,K.jsxs)(w,{as:`span`,fontFamily:`mono`,fontWeight:`medium`,children:[e,`.langwatch-license`]})]})]})}),(0,K.jsxs)(O,{children:[(0,K.jsx)(f,{colorPalette:`blue`,size:`sm`,onClick:()=>ae(d,i.organizationName),children:`Download Again`}),(0,K.jsx)(f,{variant:`outline`,size:`sm`,onClick:Y,children:`Copy to Clipboard`}),(0,K.jsx)(f,{variant:`outline`,size:`sm`,onClick:X,children:`Generate Another`})]})]})}return(0,K.jsxs)(M,{align:`start`,gap:4,width:`full`,paddingX:6,paddingY:4,children:[(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Private Key`}),(0,K.jsx)(l,{value:h,onValueChange:e=>z(e.value),disabled:F.isLoading,children:(0,K.jsxs)(O,{gap:4,marginBottom:3,children:[(0,K.jsx)(a,{value:`file`,children:`Upload private key file`}),(0,K.jsx)(a,{value:`key`,children:`Enter private key`})]})}),h===`file`&&(0,K.jsxs)(p,{width:`full`,children:[(0,K.jsx)(`input`,{ref:j,type:`file`,accept:`.pem,.key`,style:{display:`none`},onChange:U}),v?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:4,width:`full`,backgroundColor:`bg.subtle`,children:(0,K.jsxs)(O,{justify:`space-between`,width:`full`,children:[(0,K.jsxs)(O,{gap:3,children:[(0,K.jsx)(L,{size:20}),(0,K.jsxs)(M,{align:`start`,gap:0,children:[(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:v.name}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:W(v.size)})]})]}),(0,K.jsx)(f,{variant:`ghost`,size:`sm`,onClick:q,disabled:F.isLoading,"aria-label":`Remove file`,children:(0,K.jsx)(u,{size:16})})]})}):(0,K.jsx)(p,{borderWidth:`2px`,borderStyle:`dashed`,borderRadius:`lg`,padding:6,width:`full`,cursor:`pointer`,onClick:H,onDragOver:ee,onDragLeave:te,onDrop:V,borderColor:k?`blue.500`:`border`,backgroundColor:k?`blue.50`:`transparent`,transition:`all 0.2s`,_hover:{borderColor:`blue.300`},children:(0,K.jsxs)(M,{gap:2,children:[(0,K.jsx)(L,{size:24,color:`#666`}),(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,textAlign:`center`,children:`Drop your private key file here`}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:`Click to browse (.pem, .key)`})]})})]}),h===`key`&&(0,K.jsx)(o,{value:i.privateKey,onChange:e=>R(`privateKey`,e.target.value),placeholder:`Paste your Private License key`,fontFamily:`mono`,fontSize:`xs`,rows:6,disabled:F.isLoading})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Organization Name`}),(0,K.jsx)(D,{value:i.organizationName,onChange:e=>R(`organizationName`,e.target.value),placeholder:`Acme Corp`})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Email`}),(0,K.jsx)(D,{value:i.email,onChange:e=>R(`email`,e.target.value),placeholder:`admin@acme.corp`,type:`email`})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Expiration Date`}),(0,K.jsx)(D,{value:i.expiresAt,onChange:e=>R(`expiresAt`,e.target.value),type:`date`})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Plan Type`}),(0,K.jsxs)(s.Root,{collection:Z,value:[i.planType],onValueChange:e=>{let t=e.value[0];t&&I(t)},children:[(0,K.jsx)(s.Trigger,{width:`full`,children:(0,K.jsx)(s.ValueText,{placeholder:`Select plan type`})}),(0,K.jsx)(s.Content,{paddingY:2,children:Z.items.map(e=>(0,K.jsx)(s.Item,{item:e,children:e.label},e.value))})]})]}),(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{fontWeight:`medium`,children:`Usage Unit`}),(0,K.jsxs)(s.Root,{collection:re,value:[i.usageUnit],onValueChange:e=>{let t=e.value[0];t&&R(`usageUnit`,t)},children:[(0,K.jsx)(s.Trigger,{width:`full`,children:(0,K.jsx)(s.ValueText,{placeholder:`Select usage unit`})}),(0,K.jsx)(s.Content,{paddingY:2,children:re.items.map(e=>(0,K.jsx)(s.Item,{item:e,children:e.label},e.value))})]}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,marginTop:1,children:`Determines how usage is counted against the monthly limit.`})]}),(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`semibold`,marginBottom:2,children:`Plan Limits`}),(0,K.jsx)(p,{width:`full`,borderWidth:`1px`,borderRadius:`md`,padding:4,children:(0,K.jsxs)(M,{align:`start`,gap:3,children:[(0,K.jsxs)(O,{width:`full`,gap:4,children:[(0,K.jsx)($,{label:`Max Members`,value:i.maxMembers,onChange:e=>R(`maxMembers`,e)}),(0,K.jsx)($,{label:`Max Lite Members`,value:i.maxMembersLite,onChange:e=>R(`maxMembersLite`,e)}),(0,K.jsx)($,{label:`Max Projects`,value:i.maxProjects,onChange:e=>R(`maxProjects`,e)})]}),(0,K.jsxs)(O,{width:`full`,gap:4,children:[(0,K.jsx)($,{label:`Max Messages/Month`,value:i.maxMessagesPerMonth,onChange:e=>R(`maxMessagesPerMonth`,e)}),(0,K.jsx)($,{label:`Max Workflows`,value:i.maxWorkflows,onChange:e=>R(`maxWorkflows`,e)})]}),(0,K.jsxs)(O,{width:`full`,gap:4,children:[(0,K.jsx)($,{label:`Max Prompts`,value:i.maxPrompts,onChange:e=>R(`maxPrompts`,e)}),(0,K.jsx)($,{label:`Max Evaluators`,value:i.maxEvaluators,onChange:e=>R(`maxEvaluators`,e)}),(0,K.jsx)($,{label:`Max Scenarios`,value:i.maxScenarios,onChange:e=>R(`maxScenarios`,e)})]}),(0,K.jsx)(O,{width:`full`,gap:4,children:(0,K.jsx)($,{label:`Max Agents`,value:i.maxAgents,onChange:e=>R(`maxAgents`,e)})}),(0,K.jsxs)(b,{checked:i.canPublish,onCheckedChange:e=>R(`canPublish`,!!e.checked),children:[(0,K.jsx)(y,{}),(0,K.jsx)(x,{}),(0,K.jsx)(S,{fontSize:`xs`,color:`fg.muted`,children:`Enabled to publish Workflows publicly`})]})]})})]})});function se({open:e,onClose:t,organizationId:r}){let i=(0,G.useRef)(null),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),d=()=>{i.current?.handleGenerate()},p=(0,G.useCallback)(e=>{c(e.isGenerating),u(e.isFormValid)},[]);return(0,K.jsx)(n.Root,{open:e,onOpenChange:({open:e})=>!e&&t(),size:`lg`,closeOnInteractOutside:!0,modal:!1,children:(0,K.jsxs)(n.Content,{children:[(0,K.jsx)(n.CloseTrigger,{}),(0,K.jsx)(n.Header,{children:(0,K.jsx)(C,{children:`Generate License`})}),(0,K.jsx)(n.Body,{padding:0,children:(0,K.jsx)(oe,{ref:i,organizationId:r,onGeneratedLicenseChange:o,onFormStateChange:p})}),!a&&(0,K.jsx)(n.Footer,{borderTopWidth:`1px`,borderColor:`border`,justifyContent:`flex-end`,children:(0,K.jsx)(f,{colorPalette:`blue`,onClick:d,loading:s,disabled:!l||s,children:`Generate License`})})]})})}function ce(){return(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(m,{height:`24px`,width:`150px`}),(0,K.jsx)(h,{noOfLines:3,gap:2,width:`full`})]})})}function le({licenseKey:e,onLicenseKeyChange:t,onActivate:n,onFileActivate:r,isActivating:i}){let s=F().data?.STRIPE_LICENSE_PAYMENT_LINK_URL??`https://buy.stripe.com/dRm3cwaIDgXs6yK6sX0480f`,[c,d]=(0,G.useState)(`file`),[m,h]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),y=(0,G.useRef)(null),b=e=>{d(e)},x=(0,G.useCallback)(e=>{e.name.endsWith(`.langwatch-license`)&&h(e)},[]),S=(0,G.useCallback)(e=>{e.preventDefault(),v(!0)},[]),C=(0,G.useCallback)(()=>{v(!1)},[]),D=(0,G.useCallback)(e=>{e.preventDefault(),v(!1);let t=e.dataTransfer.files[0];t&&x(t)},[x]),k=(0,G.useCallback)(()=>{y.current?.click()},[]),j=(0,G.useCallback)(e=>{let t=e.target.files?.[0];t&&x(t)},[x]),N=(0,G.useCallback)(()=>{h(null),y.current&&(y.current.value=``)},[]),P=(0,G.useCallback)(()=>{if(c===`file`&&m){let e=new FileReader;e.onload=e=>{let t=e.target?.result;r&&r(t)},e.readAsText(m)}else c===`key`&&n()},[c,m,r,n]),I=i||c===`file`&&!m||c===`key`&&!e.trim();return(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsxs)(M,{align:`start`,gap:1,children:[(0,K.jsx)(w,{fontWeight:`medium`,fontSize:`md`,children:`No license installed`}),(0,K.jsx)(w,{color:`fg.muted`,fontSize:`sm`,children:`Running without a license. Some features may be limited.`})]}),(0,K.jsxs)(M,{align:`start`,gap:3,width:`full`,children:[(0,K.jsx)(w,{fontWeight:`medium`,children:`Activate a license:`}),(0,K.jsx)(l,{value:c,onValueChange:e=>b(e.value),disabled:i,children:(0,K.jsxs)(O,{gap:4,children:[(0,K.jsx)(a,{value:`file`,children:`Upload license file`}),(0,K.jsx)(a,{value:`key`,children:`Enter license key`})]})}),c===`file`&&(0,K.jsxs)(p,{width:`full`,children:[(0,K.jsx)(`input`,{ref:y,type:`file`,accept:`.langwatch-license`,style:{display:`none`},onChange:j}),m?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:4,width:`full`,backgroundColor:`bg.subtle`,children:(0,K.jsxs)(O,{justify:`space-between`,width:`full`,children:[(0,K.jsxs)(O,{gap:3,children:[(0,K.jsx)(L,{size:20}),(0,K.jsxs)(M,{align:`start`,gap:0,children:[(0,K.jsx)(w,{fontSize:`sm`,fontWeight:`medium`,children:m.name}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:W(m.size)})]})]}),(0,K.jsx)(f,{variant:`ghost`,size:`sm`,onClick:N,disabled:i,"aria-label":`Remove file`,children:(0,K.jsx)(u,{size:16})})]})}):(0,K.jsx)(p,{borderWidth:`2px`,borderStyle:`dashed`,borderRadius:`lg`,padding:6,width:`full`,cursor:`pointer`,onClick:k,onDragOver:S,onDragLeave:C,onDrop:D,borderColor:_?`blue.500`:`border`,backgroundColor:_?`blue.50`:`transparent`,transition:`all 0.2s`,_hover:{borderColor:`blue.300`},children:(0,K.jsxs)(M,{gap:2,children:[(0,K.jsx)(L,{size:24,color:`#666`}),(0,K.jsx)(w,{fontSize:`sm`,color:`fg.muted`,textAlign:`center`,children:`Drop your license here`}),(0,K.jsx)(w,{fontSize:`xs`,color:`fg.muted`,children:`Click to browse`})]})})]}),c===`key`&&(0,K.jsxs)(T,{width:`full`,children:[(0,K.jsx)(E,{srOnly:!0,children:`License key`}),(0,K.jsx)(o,{value:e,onChange:e=>t(e.target.value),placeholder:`Paste your license key`,rows:4,fontFamily:`mono`,fontSize:`xs`,disabled:i})]}),(0,K.jsxs)(O,{gap:3,children:[(0,K.jsx)(f,{colorPalette:`blue`,variant:`solid`,size:`sm`,onClick:P,loading:i,disabled:I,children:`Activate License`}),s&&(0,K.jsx)(g,{content:`After purchase, your license will be generated and delivered to your email.`,children:(0,K.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,children:(0,K.jsx)(A,{href:s,isExternal:!0,children:`Purchase license`})})}),(0,K.jsx)(A,{href:B,isExternal:!0,color:`blue.fg`,fontSize:`sm`,_hover:{textDecoration:`underline`},children:`Contact sales`})]})]})]})})}function ue({organizationId:e,onUploadSuccess:t,onRemoveSuccess:n}){let r=P.license.upload.useMutation({onSuccess:()=>{_.create({title:`License activated`,description:`Your license has been successfully activated.`,type:`success`}),t(),window.location.reload()},onError:e=>{N(e)||_.create({title:`Failed to activate license`,description:z(e.message),type:`error`})}}),i=P.license.remove.useMutation({onSuccess:()=>{_.create({title:`License removed`,description:`Your organization is now running without a license. Some features may be limited.`,type:`info`}),n(),window.location.reload()},onError:e=>{N(e)||_.create({title:`Failed to remove license`,description:e.message,type:`error`})}});return{upload:t=>{r.mutate({organizationId:e,licenseKey:t})},remove:()=>{i.mutate({organizationId:e})},isUploading:r.isLoading,isRemoving:i.isLoading}}function de({organizationId:e,isGeneratorOpen:t,onGeneratorOpenChange:n}){let[r,i]=(0,G.useState)(``),{data:a,isLoading:o,isError:s,error:c,refetch:l}=P.license.getStatus.useQuery({organizationId:e},{enabled:!!e,refetchOnWindowFocus:!1,staleTime:3e4}),{upload:u,remove:d,isUploading:m,isRemoving:h}=ue({organizationId:e,onUploadSuccess:()=>{i(``),l()},onRemoveSuccess:()=>{l()}});return o?(0,K.jsx)(ce,{}):s?(0,K.jsx)(p,{borderWidth:`1px`,borderRadius:`lg`,padding:6,width:`full`,children:(0,K.jsxs)(M,{align:`start`,gap:4,children:[(0,K.jsx)(w,{fontWeight:`medium`,children:`Unable to load license`}),(0,K.jsx)(w,{color:`fg.muted`,children:`Your license status could not be retrieved. Please try again or contact support if the issue persists.`}),(0,K.jsx)(f,{onClick:()=>void l(),size:`sm`,children:`Retry`})]})}):a?.hasLicense?(0,K.jsxs)(M,{align:`start`,gap:0,width:`full`,children:[(0,K.jsx)(q,{status:a,onRemove:d,isRemoving:h}),(0,K.jsx)(se,{open:t,onClose:()=>n(!1),organizationId:e})]}):(0,K.jsxs)(M,{align:`start`,gap:0,width:`full`,children:[(0,K.jsx)(le,{licenseKey:r,onLicenseKeyChange:i,onActivate:()=>{let e=U(r);e&&u(e)},onFileActivate:e=>{let t=U(e);t&&u(t)},isActivating:m}),(0,K.jsx)(se,{open:t,onClose:()=>n(!1),organizationId:e})]})}function fe(){let{organization:e}=I(),[t,n]=(0,G.useState)(!1),a=F();return(0,K.jsx)(R,{children:(0,K.jsxs)(M,{gap:6,width:`full`,align:`start`,children:[(0,K.jsxs)(O,{width:`full`,children:[(0,K.jsx)(C,{children:`License`}),(0,K.jsx)(j,{}),a.data?.IS_SAAS&&(0,K.jsxs)(i.HeaderButton,{onClick:()=>n(!0),children:[(0,K.jsx)(r,{size:20}),`New License`]})]}),(0,K.jsx)(w,{color:`fg.muted`,children:`Manage your LangWatch license for self-hosted deployments. A valid license is required for commercial use and enables specific plan limits.`}),e?.id?(0,K.jsx)(de,{organizationId:e.id,isGeneratorOpen:t,onGeneratorOpenChange:n}):(0,K.jsx)(w,{children:`Loading...`})]})})}export{fe as default};
|
|
2
|
+
//# sourceMappingURL=license-CgnlvyuI.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./stack-oJ9iWdbl.js";import{t}from"./container-Ccm3vB5X.js";import{n}from"./useAnnotationQueues-
|
|
2
|
-
//# sourceMappingURL=me-
|
|
1
|
+
import{j as e}from"./stack-oJ9iWdbl.js";import{t}from"./container-Ccm3vB5X.js";import{n}from"./useAnnotationQueues-CA6Vk--V.js";import{t as r}from"./AnnotationsTable-uS_9SQ-g.js";var i=e();function a(){return(0,i.jsx)(n,{children:(0,i.jsx)(t,{maxWidth:`calc(100vw - 330px)`,padding:0,margin:0,children:(0,i.jsx)(r,{noDataTitle:`No queued annotations for you`,noDataDescription:`You have no annotations assigned to you.`,heading:`My Queue`})})})}export{a as default};
|
|
2
|
+
//# sourceMappingURL=me-DEqhm_KC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Fa as n,Q as r,Ra as i,Ss as a,Xa as o,Xr as s,Z as c,_s as l,bs as u,cc as d,fo as f,ho as p,m,na as h,qi as g,sc as _,vs as v,wa as y,xs as b,ya as x,yo as S,ys as C}from"./command-bar-CaJygoez.js";import{j as w,n as T,r as E}from"./stack-oJ9iWdbl.js";import{t as D}from"./box-BsM8YLGl.js";import{n as O}from"./toaster-C_DYALhL.js";import{an as k,f as A}from"./dist-SwV3YZv3.js";import{t as j}from"./heading-D90dlSnH.js";import{t as M}from"./text-CwTrMF8x.js";import{n as N}from"./code-FF_ibTVI.js";import{a as ee,r as P,t as te}from"./field-CnUiixMS.js";import{t as F}from"./input-C7emsUCL.js";import{t as I}from"./h-stack-BKLDJ2vg.js";import{r as ne,t as re}from"./card-CMtKVPVl.js";import{Pt as L}from"./lu-Bf6j_N19.js";import{t as R}from"./link-CwZhwOLq.js";import{t as z}from"./spacer-2LJJGbo8.js";import{t as B}from"./v-stack-EOPQ57OZ.js";import{t as ie}from"./posthogErrorCapture-50j08Hs1.js";import{c as ae,m as V,s as H}from"./auth-client-D3UhxhQi.js";import{t as oe}from"./usePublicEnv-1QvVAhAk.js";import"./next-router-C6sliiV7.js";import{c as U,t as se}from"./useOrganizationTeamProject-DC0iozx2.js";import{r as ce}from"./useRequiredSession-DE4JSglk.js";import{l as W,o as le,s as ue,t as G}from"./index.esm-X7lxUoP1.js";import{t as de}from"./createLucideIcon-BJKFyRLS.js";import{t as K}from"./SettingsLayout-CLCGxMAe.js";import{t as fe}from"./WithPermissionGuard-DD8uo3UK.js";import{i as q,r as J,t as pe}from"./GroupBindingInputRow-DebZBCnD.js";var Y=de(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),X=U(),Z=e(t()),Q=w();function me({teamOptions:e,organizationId:t,onSubmit:r,isLoading:i=!1,hasEmailProvider:o=!1,onClose:s,onCloseText:c=`Cancel`,isInviterAdmin:d=!0}){let{register:f,control:p,handleSubmit:m,setValue:h,formState:{errors:g}}=ue({defaultValues:{emailsRaw:``,orgRole:X.OrganizationUserRole.MEMBER,teams:e.length>0?[{teamId:e[0]?.value??``,role:X.TeamUserRole.MEMBER}]:[]}}),{fields:_,append:x,remove:w}=le({control:p,name:`teams`}),O=W({control:p,name:`teams`}),k=W({control:p,name:`orgRole`}),A=(0,Z.useRef)(k);(0,Z.useEffect)(()=>{A.current!==k&&O?.length>0&&O.forEach((e,t)=>{e&&(k===X.OrganizationUserRole.EXTERNAL?e.role!==X.TeamUserRole.VIEWER&&(h(`teams.${t}.role`,X.TeamUserRole.VIEWER),h(`teams.${t}.customRoleId`,void 0)):k===X.OrganizationUserRole.MEMBER&&e.role===X.TeamUserRole.VIEWER&&h(`teams.${t}.role`,X.TeamUserRole.MEMBER))}),A.current=k},[k,O,h]);let j=t=>{let n=O?.map((e,n)=>t!==void 0&&n===t?null:e?.teamId).filter(e=>!!e&&e!==``);return e.filter(e=>!n?.includes(e.value))},N=()=>{let e=j();e.length>0&&x({teamId:e[0]?.value??``,role:_e(k)})};return(0,Q.jsx)(`form`,{onSubmit:m(e=>{let t=e.emailsRaw.split(/[\s,;]+/).map(e=>e.trim()).filter(Boolean),n=e.teams.map(t=>e.orgRole===X.OrganizationUserRole.EXTERNAL?{teamId:t.teamId,role:X.TeamUserRole.VIEWER,customRoleId:void 0}:e.orgRole===X.OrganizationUserRole.MEMBER&&t.role===X.TeamUserRole.VIEWER?{...t,role:X.TeamUserRole.MEMBER,customRoleId:void 0}:t);return r({invites:t.map(t=>({email:t,orgRole:e.orgRole,teams:n}))})}),children:(0,Q.jsxs)(B,{align:`start`,gap:4,width:`100%`,children:[(0,Q.jsxs)(I,{gap:4,align:`start`,width:`full`,children:[(0,Q.jsxs)(ee,{flex:`2`,invalid:!!g.emailsRaw,children:[(0,Q.jsx)(P,{children:`Email addresses`}),(0,Q.jsx)(F,{placeholder:`alice@example.com, bob@example.com`,...f(`emailsRaw`,{required:`At least one email is required`,validate:e=>{let t=e.split(/[\s,;]+/).map(e=>e.trim()).filter(Boolean);if(t.length===0)return`At least one email is required`;let n=t.find(e=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e));return n?`Invalid email: ${n}`:!0}})}),(0,Q.jsx)(te,{children:g.emailsRaw?.message})]}),(0,Q.jsx)(D,{flex:`1`,pt:`28px`,children:(0,Q.jsx)(G,{control:p,name:`orgRole`,render:({field:e})=>(0,Q.jsx)(S,{checked:e.value===X.OrganizationUserRole.EXTERNAL,onChange:t=>e.onChange(t.target.checked?X.OrganizationUserRole.EXTERNAL:X.OrganizationUserRole.MEMBER),alignItems:`flex-start`,children:(0,Q.jsxs)(B,{align:`start`,gap:0,children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`medium`,lineHeight:`short`,children:`Lite Member`}),(0,Q.jsx)(M,{fontSize:`xs`,color:`fg.muted`,children:`Can only view projects they are invited to, cannot see costs`})]})})})})]}),_.length>0&&(0,Q.jsxs)(B,{align:`start`,gap:2,width:`100%`,children:[(0,Q.jsxs)(I,{justify:`space-between`,width:`100%`,children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`medium`,color:`fg`,children:`Team Assignments`}),(0,Q.jsxs)(T,{type:`button`,size:`sm`,variant:`ghost`,onClick:N,disabled:j().length===0,children:[(0,Q.jsx)(n,{size:14}),` Add team`]})]}),(0,Q.jsx)(D,{paddingX:4,paddingY:3,backgroundColor:`bg.muted`,borderRadius:`xl`,width:`100%`,children:(0,Q.jsxs)(b,{variant:`ghost`,width:`100%`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(a,{backgroundColor:`transparent`,children:[(0,Q.jsx)(C,{paddingLeft:0,paddingTop:0,children:`Team`}),(0,Q.jsx)(C,{paddingLeft:0,paddingTop:0,children:`Role`}),(0,Q.jsx)(C,{paddingLeft:0,paddingRight:0,paddingTop:0,width:`50px`})]})}),(0,Q.jsx)(l,{children:_.map((e,n)=>(0,Q.jsxs)(a,{backgroundColor:`transparent`,children:[(0,Q.jsx)(v,{paddingLeft:0,children:(0,Q.jsx)(he,{teamIndex:n,control:p,getAvailableTeamOptions:j})}),(0,Q.jsx)(v,{paddingLeft:0,children:(0,Q.jsx)(ve,{teamIndex:n,control:p,organizationId:t,orgRole:k,setValue:h,isInviterAdmin:d})}),(0,Q.jsx)(v,{paddingLeft:0,paddingRight:0,paddingY:2,children:(0,Q.jsx)(T,{type:`button`,size:`sm`,colorPalette:`red`,variant:`ghost`,"aria-label":`Remove team assignment`,onClick:()=>w(n),children:(0,Q.jsx)(y,{size:16})})})]},e.id))})]})})]}),_.length===0&&(0,Q.jsx)(I,{gap:2,children:(0,Q.jsxs)(T,{type:`button`,size:`sm`,variant:`outline`,onClick:N,disabled:j().length===0,children:[(0,Q.jsx)(n,{size:14}),` Add team`]})}),(0,Q.jsxs)(I,{justify:`end`,width:`100%`,marginTop:4,children:[(0,Q.jsx)(T,{type:`button`,variant:`outline`,onClick:s,disabled:i,children:c}),(0,Q.jsx)(T,{colorPalette:i?`gray`:`orange`,type:`submit`,disabled:i,children:(0,Q.jsxs)(I,{children:[i?(0,Q.jsx)(E,{size:`sm`}):(0,Q.jsx)(Y,{size:18}),(0,Q.jsx)(M,{children:o?`Send invites`:`Create invites`})]})})]})]})})}function he({teamIndex:e,control:t,getAvailableTeamOptions:n}){let r=n(e),i=(0,Z.useMemo)(()=>_({items:r}),[r]);return(0,Q.jsx)(G,{control:t,name:`teams.${e}.teamId`,rules:{required:`Team is required`},render:({field:e})=>(0,Q.jsxs)(h.Root,{collection:i,value:[e.value],onValueChange:t=>{let n=t.value[0];n&&e.onChange(n)},children:[(0,Q.jsx)(h.Trigger,{background:`bg`,width:`full`,children:(0,Q.jsx)(h.ValueText,{placeholder:`Select team`})}),(0,Q.jsx)(h.Content,{paddingY:2,children:r.map(e=>(0,Q.jsx)(h.Item,{item:e,children:e.label},e.value))})]})})}function ge(e,t,n){let i=Object.values(r),a=t.map(e=>({label:e.name,value:`custom:${e.id}`,description:e.description??`Custom role`,isCustom:!0,customRoleId:e.id}));return e===X.OrganizationUserRole.EXTERNAL?[r.VIEWER]:e===X.OrganizationUserRole.MEMBER?n?[...i.filter(e=>e.value!==X.TeamUserRole.VIEWER),...a]:[r.MEMBER]:[...i,...a]}function _e(e){return e===X.OrganizationUserRole.EXTERNAL?X.TeamUserRole.VIEWER:X.TeamUserRole.MEMBER}function ve({teamIndex:e,control:t,organizationId:n,orgRole:r,setValue:i,isInviterAdmin:a}){let o=H.role.getAll.useQuery({organizationId:n}),s=(0,Z.useMemo)(()=>ge(r,o.data??[],a),[r,o.data,a]),l=(0,Z.useMemo)(()=>_({items:s}),[s]);return(0,Q.jsx)(G,{control:t,name:`teams.${e}.role`,render:({field:t})=>(0,Q.jsxs)(h.Root,{collection:l,value:[t.value],onValueChange:n=>{let r=n.value[0];r&&(t.onChange(r),r.startsWith(`custom:`)?i(`teams.${e}.customRoleId`,r.replace(`custom:`,``)):i(`teams.${e}.customRoleId`,void 0))},disabled:o.isLoading,children:[(0,Q.jsx)(h.Trigger,{background:`bg`,width:`full`,children:(0,Q.jsx)(h.ValueText,{placeholder:`Select role`})}),(0,Q.jsx)(h.Content,{paddingY:2,width:`320px`,children:s.map(e=>(0,Q.jsx)(h.Item,{item:e,children:(0,Q.jsx)(c,{option:e})},e.value))})]})})}var $=[{label:`Admin`,value:X.OrganizationUserRole.ADMIN,description:`Can manage organization and add or remove members`},{label:`Member`,value:X.OrganizationUserRole.MEMBER,description:`Can manage their own projects and view other projects`},{label:`Lite Member`,value:X.OrganizationUserRole.EXTERNAL,description:`Can only view projects they are invited to, cannot see costs`}];function ye({value:e,onChange:t}){let n=(0,Z.useMemo)(()=>_({items:$}),[]);return(0,Q.jsx)(B,{align:`start`,children:(0,Q.jsx)(I,{gap:6,children:(0,Q.jsxs)(h.Root,{collection:n,value:[e],onValueChange:e=>{let n=e.value[0];n&&t(n)},children:[(0,Q.jsx)(h.Trigger,{width:`200px`,children:(0,Q.jsx)(h.ValueText,{placeholder:`Select role`})}),(0,Q.jsx)(h.Content,{width:`320px`,paddingY:2,children:$.map(e=>(0,Q.jsx)(h.Item,{item:e,children:(0,Q.jsxs)(B,{align:`start`,gap:0,flex:1,children:[(0,Q.jsx)(M,{children:e.label}),(0,Q.jsx)(M,{color:`fg.muted`,fontSize:`13px`,children:e.description})]})},e.value))})]})})})}function be({member:e,organizationId:t,canManage:n,isCurrentUser:r,open:i,onClose:a}){let o=H.useContext(),[s,c]=(0,Z.useState)(e.role),[l,u]=(0,Z.useState)(new Set),[d,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),g=()=>{c(e.role),u(new Set),f([])};(0,Z.useEffect)(()=>{i&&g()},[i,e.userId]);let _=H.roleBinding.listForUser.useQuery({organizationId:t,userId:e.userId},{enabled:i&&n}),v=H.group.listForMember.useQuery({organizationId:t,userId:e.userId},{enabled:i}),y=H.organization.updateMemberRole.useMutation(),b=H.roleBinding.applyMemberBindings.useMutation(),S=l.size>0||d.length>0,C=s!==e.role,w=S||C,j=async()=>{let n=h.current?.flush()??null,r=n?[...d,n]:d,i=l.size>0||r.length>0;m(!0);try{C&&await y.mutateAsync({organizationId:t,userId:e.userId,role:s}),i&&await b.mutateAsync({organizationId:t,userId:e.userId,bindingIdsToDelete:[...l],bindingsToCreate:r.map(e=>({role:e.role,customRoleId:e.customRoleId,scopeType:e.scopeType,scopeId:e.scopeId}))}),await Promise.all([o.roleBinding.listForUser.invalidate(),o.roleBinding.listForOrg.invalidate(),o.organization.getOrganizationWithMembersAndTheirTeams.invalidate(),o.organization.getAll.invalidate()]),O.create({title:`Member updated`,type:`success`}),a()}catch(e){let t=e instanceof Error?e.message:`Failed to save`;O.create({title:t,type:`error`})}finally{m(!1)}},N=_.data??[];return(0,Q.jsx)(A.Root,{open:i,onOpenChange:e=>{e.open||(g(),a())},size:`lg`,children:(0,Q.jsxs)(A.Content,{maxHeight:`90vh`,overflowY:`auto`,children:[(0,Q.jsx)(A.Header,{children:(0,Q.jsx)(A.Title,{children:e.user.name??e.user.email})}),(0,Q.jsx)(A.CloseTrigger,{}),(0,Q.jsx)(A.Body,{pb:6,children:(0,Q.jsxs)(B,{gap:5,align:`stretch`,children:[n&&(0,Q.jsxs)(D,{children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`semibold`,mb:3,children:`Organization role`}),r?(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,fontStyle:`italic`,children:`You cannot change your own organization role.`}):(0,Q.jsx)(ye,{value:s,onChange:c})]}),n&&(0,Q.jsxs)(D,{children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`semibold`,mb:3,children:`Access`}),_.isLoading?(0,Q.jsx)(E,{size:`sm`}):N.length===0&&d.length===0?(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,fontStyle:`italic`,children:`No access configured.`}):(0,Q.jsxs)(B,{gap:2,align:`stretch`,children:[N.map(e=>{let t=l.has(e.id);return(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,opacity:t?.4:1,transition:`opacity 0.15s`,children:[(0,Q.jsx)(k,{colorPalette:J(e.role),size:`sm`,textDecoration:t?`line-through`:void 0,children:e.customRoleName??e.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,textDecoration:t?`line-through`:void 0,children:[q(e.scopeType),` `,e.scopeName??e.scopeId]}),(0,Q.jsx)(z,{}),e.scopeType!==X.RoleBindingScopeType.PROJECT&&(0,Q.jsx)(T,{size:`xs`,variant:`ghost`,color:t?`blue.500`:`fg.muted`,"aria-label":t?`Undo removal`:`Remove binding`,onClick:()=>u(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:(0,Q.jsx)(x,{size:14})})]},e.id)}),d.map((e,t)=>(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,opacity:.7,children:[(0,Q.jsx)(k,{colorPalette:J(e.role),size:`sm`,children:e.customRoleName??e.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,children:[q(e.scopeType),` `,e.scopeName??e.scopeId]}),(0,Q.jsx)(z,{}),(0,Q.jsx)(T,{size:`xs`,variant:`ghost`,color:`fg.muted`,"aria-label":`Undo add`,onClick:()=>f(e=>e.filter((e,n)=>n!==t)),children:(0,Q.jsx)(x,{size:14})})]},t))]}),(0,Q.jsx)(pe,{ref:h,organizationId:t,onAdd:e=>f(t=>[...t,e])})]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`semibold`,mb:3,children:`Group access`}),v.isLoading?(0,Q.jsx)(E,{size:`sm`}):v.data?.length?(0,Q.jsx)(B,{gap:2,align:`stretch`,children:v.data.map(e=>e.bindings.length===0?(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,justifyContent:`space-between`,children:[(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:e.name}),(0,Q.jsx)(R,{href:`/settings/groups`,fontSize:`xs`,color:`blue.400`,children:`No access configured`})]},e.id):e.bindings.map(t=>(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,children:[(0,Q.jsx)(k,{colorPalette:J(t.role),size:`sm`,children:t.customRoleName??t.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,children:[q(t.scopeType),` `,t.scopeName??`—`]}),(0,Q.jsx)(z,{}),(0,Q.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[`via `,e.name]})]},t.id)))}):(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,fontStyle:`italic`,children:`Not a member of any groups.`})]})]})}),n&&(0,Q.jsxs)(A.Footer,{children:[(0,Q.jsx)(T,{variant:`outline`,onClick:()=>{g(),a()},children:`Cancel`}),(0,Q.jsx)(T,{colorPalette:`blue`,disabled:!w,loading:p,onClick:()=>void j(),children:`Save`})]})]})})}function xe({isAdmin:e,inviteId:t,onApprove:n,onReject:r}){return e?(0,Q.jsxs)(I,{gap:2,children:[(0,Q.jsx)(L,{"aria-label":`Approve`,variant:`ghost`,size:`sm`,color:`green.500`,onClick:()=>n(t),children:(0,Q.jsx)(N,{size:16})}),(0,Q.jsx)(L,{"aria-label":`Reject`,variant:`ghost`,size:`sm`,color:`red.500`,onClick:()=>r(t),children:(0,Q.jsx)(x,{size:16})})]}):null}function Se({waitingApprovalInvites:e,sentInvites:t,isAdmin:n,currentUserId:r,teams:i,onApprove:s,onReject:c,onViewInviteLink:d,onDeleteInvite:f}){let m=(0,Z.useMemo)(()=>n?e:e.filter(e=>e.requestedBy===r),[e,n,r]),h=(0,Z.useMemo)(()=>[...m,...t],[m,t]);return h.length===0?null:(0,Q.jsxs)(B,{align:`start`,gap:4,paddingTop:4,width:`full`,children:[(0,Q.jsx)(j,{children:`Invites`}),(0,Q.jsx)(ne,{width:`full`,overflow:`hidden`,children:(0,Q.jsx)(re,{paddingY:0,paddingX:0,children:(0,Q.jsxs)(b,{variant:`line`,size:`md`,width:`full`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(a,{children:[(0,Q.jsx)(C,{width:`56px`}),(0,Q.jsx)(C,{children:`Email`}),(0,Q.jsx)(C,{children:`Status`}),(0,Q.jsx)(C,{children:`Role`}),(0,Q.jsx)(C,{children:`Teams`}),(0,Q.jsx)(C,{width:`60px`})]})}),(0,Q.jsx)(l,{children:h.map(e=>{let t=e.status===`WAITING_APPROVAL`,r=$.find(t=>t.value===e.role)?.label??e.role;return(0,Q.jsxs)(a,{children:[(0,Q.jsx)(v,{children:(0,Q.jsx)(p,{size:`2xs`,name:e.email})}),(0,Q.jsx)(v,{children:e.email}),(0,Q.jsx)(v,{children:t?(0,Q.jsx)(k,{size:`sm`,variant:`surface`,colorPalette:`orange`,children:`Pending Approval`}):(0,Q.jsx)(k,{size:`sm`,variant:`surface`,children:`Invited`})}),(0,Q.jsx)(v,{children:r}),(0,Q.jsx)(v,{children:(0,Q.jsx)(Ce,{teamIds:e.teamIds,teams:i})}),(0,Q.jsx)(v,{children:(0,Q.jsx)(D,{width:`full`,height:`full`,display:`flex`,justifyContent:`end`,children:t?(0,Q.jsx)(xe,{isAdmin:n,inviteId:e.id,onApprove:s,onReject:c}):(0,Q.jsxs)(g.Root,{children:[(0,Q.jsx)(g.Trigger,{asChild:!0,children:(0,Q.jsx)(L,{"aria-label":`Invite actions`,variant:`ghost`,size:`sm`,children:(0,Q.jsx)(o,{size:16})})}),(0,Q.jsxs)(g.Content,{children:[(0,Q.jsxs)(g.Item,{value:`view-link`,onClick:()=>d(e.inviteCode,e.email),children:[(0,Q.jsx)(Y,{size:16}),`View invite link`]}),n&&(0,Q.jsxs)(g.Item,{value:`delete`,color:`red.500`,onClick:()=>f(e.id),children:[(0,Q.jsx)(y,{size:16}),`Delete`]})]})]})})})]},e.id)})})]})})})]})}var Ce=({teamIds:e,teams:t})=>{if(!e)return null;let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length===0?null:(0,Q.jsx)(I,{gap:2,flexWrap:`wrap`,children:n.map(e=>{let n=t.find(t=>t.id===e);return n?(0,Q.jsx)(R,{href:`/settings/teams/${n.slug}`,children:(0,Q.jsx)(k,{size:`sm`,variant:`surface`,children:n.name})},e):null})})};function we({organizationId:e,isAdmin:t,hasEmailProvider:n,onInviteCreated:r,onClose:i,refetchInvites:a,pricingModel:o,activePlanFree:s,activePlanType:c,activePlanSource:l}){let u=f(`members`),d=f(`membersLite`),p=ae(e=>e.openSeats),m=H.useContext(),h=()=>{m.licenseEnforcement.checkLimit.invalidate()},g=H.subscription?.addTeamMemberOrEvents?.useMutation(),_=H.organization.createInvites.useMutation(),v=H.organization.createInviteRequest.useMutation(),y=H.organization.approveInvite.useMutation(),b=H.organization.deleteInvite.useMutation(),x=t=>{_.mutate({organizationId:e,invites:t.invites.map(e=>({email:e.email.toLowerCase(),role:e.orgRole,teams:e.teams.map(e=>({teamId:e.teamId,role:e.role,customRoleId:e.customRoleId}))}))},{onSuccess:e=>{r(e.reduce((e,t)=>(t?.invite&&t.emailNotSent&&e.push({inviteCode:t.invite.inviteCode,email:t.invite.email}),e),[]));let t=e.filter(Boolean).length,o=n?`All invites have been sent.`:`All invites have been created. View invite link under actions menu.`;O.create({title:`${t>1?`Invites`:`Invite`} created successfully`,description:o,type:`success`,duration:2e3,meta:{closable:!0}}),i(),a(),h()},onError:e=>{V(e)||O.create({title:`Sorry, something went wrong`,description:e.message??`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},S=t=>{v.mutate({organizationId:e,invites:t.invites.map(e=>({email:e.email.toLowerCase(),role:e.orgRole===X.OrganizationUserRole.EXTERNAL?`EXTERNAL`:`MEMBER`,teams:e.teams.map(e=>({teamId:e.teamId,role:e.role,customRoleId:e.customRoleId}))}))},{onSuccess:()=>{let e=t.invites.length;O.create({title:e>1?`Invitations sent for approval`:`Invitation sent for approval`,description:`An admin will review your invitation request.`,type:`success`,duration:2e3,meta:{closable:!0}}),i(),a(),h()},onError:e=>{V(e)||O.create({title:`Sorry, something went wrong`,description:e.message??`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})};return{onSubmit:n=>{let r=n.invites.some(e=>e.orgRole!==X.OrganizationUserRole.EXTERNAL),i=n.invites.some(e=>e.orgRole===X.OrganizationUserRole.EXTERNAL),a=n.invites.filter(e=>e.orgRole!==X.OrganizationUserRole.EXTERNAL).length,s=t?x:S,f=()=>{i?d.checkAndProceed(()=>s(n)):s(n)};if(!r){f();return}let m=u.limitInfo;if(!m){f();return}if(m.current+a<=m.max){f();return}if(l===`subscription`&&o===`SEAT_EVENT`&&g){let t=m.current+a;p({organizationId:e,currentSeats:m.max,newSeats:t,onConfirm:async()=>{try{await g.mutateAsync({organizationId:e,plan:c,upgradeMembers:!0,upgradeTraces:!1,totalMembers:t,totalTraces:0}),s(n)}catch(e){O.create({title:`Failed to expand seats`,description:e instanceof Error?e.message:`Please try again`,type:`error`,duration:5e3,meta:{closable:!0}})}}})}else u.checkAndProceed(()=>{})},approveInvite:t=>{y.mutate({inviteId:t,organizationId:e},{onSuccess:()=>{O.create({title:`Invitation approved`,description:`The invitation has been approved and sent.`,type:`success`,duration:5e3,meta:{closable:!0}}),a(),h()},onError:()=>{O.create({title:`Sorry, something went wrong`,description:`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},rejectInvite:t=>{b.mutate({inviteId:t,organizationId:e},{onSuccess:()=>{O.create({title:`Invitation rejected`,description:`The invitation request has been rejected.`,type:`success`,duration:5e3,meta:{closable:!0}}),a(),h()},onError:()=>{O.create({title:`Sorry, something went wrong`,description:`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},deleteInvite:t=>{b.mutate({inviteId:t,organizationId:e},{onSuccess:()=>{O.create({title:`Invite deleted successfully`,description:`The invite has been deleted.`,type:`success`,duration:5e3,meta:{closable:!0}}),a(),h()},onError:e=>{V(e)||O.create({title:`Sorry, something went wrong`,description:e.message??`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},isSubmitting:_.isLoading||v.isLoading}}function Te(){let{organization:e}=se(),t=H.organization.getOrganizationWithMembersAndTheirTeams.useQuery({organizationId:e?.id??``,includeDeactivated:!0},{enabled:!!e}),n=H.plan.getActivePlan.useQuery({organizationId:e?.id??``},{enabled:!!e});return!e||!t.data||!n.data?(0,Q.jsx)(K,{}):(0,Q.jsx)(De,{teams:e.teams,organization:t.data,activePlan:n.data})}var Ee=fe(`organization:view`,{layoutComponent:K})(Te);function De({organization:e,teams:t,activePlan:r}){let{data:c}=ce(),{hasPermission:f}=se(),h=f(`organization:manage`),_=c?.user,x=t.map(e=>({label:e.name,value:e.id})),S=H.useContext(),[w,E]=(0,Z.useState)(null),{open:N,onOpen:ee,onClose:P}=d(),{open:te,onOpen:F,onClose:L}=d(),R=H.organization.getOrganizationPendingInvites.useQuery({organizationId:e?.id??``},{enabled:!!e}),ae=H.organization.deleteMember.useMutation(),[V,U]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{V.length>0&&F()},[V,F]);let W=oe().data?.HAS_EMAIL_PROVIDER_KEY,{onSubmit:le,approveInvite:ue,rejectInvite:G,deleteInvite:de,isSubmitting:fe}=we({organizationId:e.id,isAdmin:h,hasEmailProvider:W??!1,onInviteCreated:U,onClose:P,refetchInvites:()=>void R.refetch(),pricingModel:e.pricingModel,activePlanFree:r.free,activePlanType:r.type,activePlanSource:r.planSource}),q=t=>{ae.mutate({organizationId:e.id,userId:t},{onSuccess:()=>{O.create({title:`Member removed successfully`,description:`The member has been removed from the organization.`,type:`success`,duration:5e3,meta:{closable:!0}}),S.organization.getOrganizationWithMembersAndTheirTeams.invalidate().catch(n=>{ie(n,{tags:{userId:t,organizationId:e.id}})}),S.licenseEnforcement.checkLimit.invalidate()},onError:()=>{O.create({title:`Sorry, something went wrong`,description:`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},J=(e,t)=>{U([{inviteCode:e,email:t}]),F()},pe=()=>{U([]),L()},{data:Y,isLoading:X,isError:he}=H.roleBinding.listForOrg.useQuery({organizationId:e.id},{enabled:!!e.id&&h}),ge=(0,Z.useMemo)(()=>{let e=new Map;for(let t of Y??[]){t.userId&&(e.has(t.userId)||e.set(t.userId,[]),e.get(t.userId).push(t));for(let n of t.memberUserIds)e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[Y]),_e=(0,Z.useMemo)(()=>[...e.members].sort((e,t)=>(e.user.name??e.user.email??``).localeCompare(t.user.name??t.user.email??``)),[e.members]),ve=t=>h&&e.members.length>1&&t!==_?.id,$=(0,Z.useMemo)(()=>(R.data??[]).filter(e=>e.status===`PENDING`),[R.data]),ye=(0,Z.useMemo)(()=>(R.data??[]).filter(e=>e.status===`WAITING_APPROVAL`),[R.data]);return(0,Q.jsxs)(K,{children:[(0,Q.jsxs)(B,{gap:6,width:`full`,align:`start`,children:[(0,Q.jsxs)(I,{width:`full`,children:[(0,Q.jsx)(j,{children:`Organization Members`}),(0,Q.jsx)(z,{}),h&&(0,Q.jsxs)(s.HeaderButton,{onClick:ee,children:[(0,Q.jsx)(n,{size:20}),`Add members`]})]}),(0,Q.jsx)(ne,{width:`full`,overflow:`hidden`,children:(0,Q.jsx)(re,{paddingY:0,paddingX:0,children:(0,Q.jsxs)(b,{variant:`line`,size:`md`,width:`full`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(a,{children:[(0,Q.jsx)(C,{width:`56px`}),(0,Q.jsx)(C,{children:`Name`}),(0,Q.jsx)(C,{children:`Email`}),h&&(0,Q.jsx)(C,{textAlign:`right`,children:`Access`}),(0,Q.jsx)(C,{width:`60px`})]})}),(0,Q.jsx)(l,{children:_e.map(e=>(0,Q.jsxs)(a,{children:[(0,Q.jsx)(v,{children:(0,Q.jsx)(p,{size:`2xs`,name:e.user.name??``})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(I,{children:[(0,Q.jsx)(T,{variant:`plain`,size:`sm`,padding:0,height:`auto`,fontWeight:`normal`,color:`colorPalette.fg`,colorPalette:`blue`,onClick:()=>{E({userId:e.userId,role:e.role,user:{name:e.user.name??null,email:e.user.email??null}})},children:e.user.name}),e.role===`EXTERNAL`&&(0,Q.jsx)(k,{colorPalette:`gray`,size:`sm`,children:`Lite Member`}),e.user.deactivatedAt&&(0,Q.jsx)(k,{colorPalette:`red`,size:`sm`,children:`Deactivated`})]})}),(0,Q.jsx)(v,{children:e.user.email}),h&&(0,Q.jsx)(v,{children:(0,Q.jsx)(Ae,{bindings:ge.get(e.userId)??[],isLoading:X||he})}),(0,Q.jsx)(v,{children:(0,Q.jsx)(D,{width:`full`,height:`full`,display:`flex`,justifyContent:`end`,children:(0,Q.jsxs)(g.Root,{children:[(0,Q.jsx)(g.Trigger,{children:(0,Q.jsx)(o,{size:16})}),(0,Q.jsxs)(g.Content,{children:[(0,Q.jsxs)(g.Item,{value:`edit`,onClick:()=>{E({userId:e.userId,role:e.role,user:{name:e.user.name??null,email:e.user.email??null}})},children:[(0,Q.jsx)(i,{size:16}),`Edit`]}),ve(e.userId)&&(0,Q.jsxs)(g.Item,{value:`delete`,color:`red.500`,onClick:()=>q(e.userId),children:[(0,Q.jsx)(y,{size:16}),`Delete`]})]})]})})})]},e.userId))})]})})}),(0,Q.jsx)(Se,{waitingApprovalInvites:ye,sentInvites:$,isAdmin:h,currentUserId:_?.id??``,teams:t,onApprove:ue,onReject:G,onViewInviteLink:J,onDeleteInvite:de})]}),w&&(0,Q.jsx)(be,{member:w,organizationId:e.id,canManage:h,isCurrentUser:w.userId===_?.id,open:!!w,onClose:()=>E(null)}),(0,Q.jsx)(A.Root,{open:te,onOpenChange:({open:e})=>e?void 0:pe(),children:(0,Q.jsxs)(A.Content,{children:[(0,Q.jsx)(A.Header,{children:(0,Q.jsx)(A.Title,{children:(0,Q.jsx)(j,{children:`Invite Link`})})}),(0,Q.jsx)(A.CloseTrigger,{}),(0,Q.jsx)(A.Body,{paddingBottom:6,children:(0,Q.jsxs)(B,{align:`start`,gap:4,children:[(0,Q.jsx)(M,{children:`Send the link below to the users you want to invite to join the organization.`}),(0,Q.jsx)(B,{align:`start`,gap:4,width:`full`,children:V.map(e=>(0,Q.jsxs)(B,{align:`start`,gap:6,width:`full`,children:[(0,Q.jsx)(M,{fontWeight:`600`,children:e.email}),(0,Q.jsx)(m,{value:`${window.location.origin}/invite/accept?inviteCode=${e.inviteCode}`,label:`Invite Link`,marginTop:0})]},e.inviteCode))})]})})]})}),(0,Q.jsx)(A.Root,{open:N,onOpenChange:({open:e})=>e?ee():P(),children:(0,Q.jsxs)(A.Content,{width:`100%`,maxWidth:`1024px`,children:[(0,Q.jsx)(A.Header,{children:(0,Q.jsx)(A.Title,{children:(0,Q.jsx)(j,{children:`Add members`})})}),(0,Q.jsx)(A.CloseTrigger,{}),(0,Q.jsx)(A.Body,{children:(0,Q.jsx)(me,{teamOptions:x,organizationId:e.id,onSubmit:le,isLoading:fe,hasEmailProvider:W??!1,onClose:P,isInviterAdmin:h})})]})})]})}function Oe(e){return e===X.RoleBindingScopeType.ORGANIZATION?`🏢`:e===X.RoleBindingScopeType.TEAM?`👥`:`📁`}function ke(e){return e===`ADMIN`?`red`:e===`MEMBER`?`blue`:`gray`}function Ae({bindings:e,isLoading:t}){return t?(0,Q.jsx)(M,{fontSize:`xs`,color:`fg.subtle`,textAlign:`right`,children:`—`}):e.length===0?(0,Q.jsx)(M,{fontSize:`xs`,color:`fg.subtle`,textAlign:`right`,children:`No access configured`}):(0,Q.jsx)(B,{gap:1,align:`end`,children:e.map(e=>(0,Q.jsxs)(I,{gap:1,fontSize:`xs`,children:[(0,Q.jsx)(k,{colorPalette:ke(e.role),size:`sm`,children:e.customRoleName??e.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,children:[Oe(e.scopeType),` `,e.scopeName??e.scopeId.slice(0,8)+`…`]}),e.groupId&&(0,Q.jsxs)(M,{color:`fg.subtle`,fontSize:`xs`,title:`via group: ${e.groupName??e.groupId}`,children:[`via `,e.groupName??`group`]})]},e.id))})}export{Ee as default};
|
|
2
|
-
//# sourceMappingURL=members-
|
|
1
|
+
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{Fa as n,Q as r,Ra as i,Ss as a,Xa as o,Xr as s,Z as c,_s as l,bs as u,cc as d,fo as f,ho as p,m,na as h,qi as g,sc as _,vs as v,wa as y,xs as b,ya as x,yo as S,ys as C}from"./command-bar-DUK45yin.js";import{j as w,n as T,r as E}from"./stack-oJ9iWdbl.js";import{t as D}from"./box-BsM8YLGl.js";import{n as O}from"./toaster-C_DYALhL.js";import{an as k,f as A}from"./dist-Cds4Mqhj.js";import{t as j}from"./heading-D90dlSnH.js";import{t as M}from"./text-CwTrMF8x.js";import{n as N}from"./code-FF_ibTVI.js";import{a as ee,r as P,t as te}from"./field-CnUiixMS.js";import{t as F}from"./input-C7emsUCL.js";import{t as I}from"./h-stack-BKLDJ2vg.js";import{r as ne,t as re}from"./card-CMtKVPVl.js";import{Pt as L}from"./lu-Bf6j_N19.js";import{t as R}from"./link-CwZhwOLq.js";import{t as z}from"./spacer-2LJJGbo8.js";import{t as B}from"./v-stack-EOPQ57OZ.js";import{t as ie}from"./posthogErrorCapture-50j08Hs1.js";import{c as ae,m as V,s as H}from"./auth-client-D3UhxhQi.js";import{t as oe}from"./usePublicEnv-1QvVAhAk.js";import"./next-router-C6sliiV7.js";import{c as U,t as se}from"./useOrganizationTeamProject-DC0iozx2.js";import{r as ce}from"./useRequiredSession-DE4JSglk.js";import{l as W,o as le,s as ue,t as G}from"./index.esm-X7lxUoP1.js";import{t as de}from"./createLucideIcon-BJKFyRLS.js";import{t as K}from"./SettingsLayout--1gdEuhv.js";import{t as fe}from"./WithPermissionGuard-B4Jo8E5-.js";import{i as q,r as J,t as pe}from"./GroupBindingInputRow-CV-fBkX9.js";var Y=de(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),X=U(),Z=e(t()),Q=w();function me({teamOptions:e,organizationId:t,onSubmit:r,isLoading:i=!1,hasEmailProvider:o=!1,onClose:s,onCloseText:c=`Cancel`,isInviterAdmin:d=!0}){let{register:f,control:p,handleSubmit:m,setValue:h,formState:{errors:g}}=ue({defaultValues:{emailsRaw:``,orgRole:X.OrganizationUserRole.MEMBER,teams:e.length>0?[{teamId:e[0]?.value??``,role:X.TeamUserRole.MEMBER}]:[]}}),{fields:_,append:x,remove:w}=le({control:p,name:`teams`}),O=W({control:p,name:`teams`}),k=W({control:p,name:`orgRole`}),A=(0,Z.useRef)(k);(0,Z.useEffect)(()=>{A.current!==k&&O?.length>0&&O.forEach((e,t)=>{e&&(k===X.OrganizationUserRole.EXTERNAL?e.role!==X.TeamUserRole.VIEWER&&(h(`teams.${t}.role`,X.TeamUserRole.VIEWER),h(`teams.${t}.customRoleId`,void 0)):k===X.OrganizationUserRole.MEMBER&&e.role===X.TeamUserRole.VIEWER&&h(`teams.${t}.role`,X.TeamUserRole.MEMBER))}),A.current=k},[k,O,h]);let j=t=>{let n=O?.map((e,n)=>t!==void 0&&n===t?null:e?.teamId).filter(e=>!!e&&e!==``);return e.filter(e=>!n?.includes(e.value))},N=()=>{let e=j();e.length>0&&x({teamId:e[0]?.value??``,role:_e(k)})};return(0,Q.jsx)(`form`,{onSubmit:m(e=>{let t=e.emailsRaw.split(/[\s,;]+/).map(e=>e.trim()).filter(Boolean),n=e.teams.map(t=>e.orgRole===X.OrganizationUserRole.EXTERNAL?{teamId:t.teamId,role:X.TeamUserRole.VIEWER,customRoleId:void 0}:e.orgRole===X.OrganizationUserRole.MEMBER&&t.role===X.TeamUserRole.VIEWER?{...t,role:X.TeamUserRole.MEMBER,customRoleId:void 0}:t);return r({invites:t.map(t=>({email:t,orgRole:e.orgRole,teams:n}))})}),children:(0,Q.jsxs)(B,{align:`start`,gap:4,width:`100%`,children:[(0,Q.jsxs)(I,{gap:4,align:`start`,width:`full`,children:[(0,Q.jsxs)(ee,{flex:`2`,invalid:!!g.emailsRaw,children:[(0,Q.jsx)(P,{children:`Email addresses`}),(0,Q.jsx)(F,{placeholder:`alice@example.com, bob@example.com`,...f(`emailsRaw`,{required:`At least one email is required`,validate:e=>{let t=e.split(/[\s,;]+/).map(e=>e.trim()).filter(Boolean);if(t.length===0)return`At least one email is required`;let n=t.find(e=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e));return n?`Invalid email: ${n}`:!0}})}),(0,Q.jsx)(te,{children:g.emailsRaw?.message})]}),(0,Q.jsx)(D,{flex:`1`,pt:`28px`,children:(0,Q.jsx)(G,{control:p,name:`orgRole`,render:({field:e})=>(0,Q.jsx)(S,{checked:e.value===X.OrganizationUserRole.EXTERNAL,onChange:t=>e.onChange(t.target.checked?X.OrganizationUserRole.EXTERNAL:X.OrganizationUserRole.MEMBER),alignItems:`flex-start`,children:(0,Q.jsxs)(B,{align:`start`,gap:0,children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`medium`,lineHeight:`short`,children:`Lite Member`}),(0,Q.jsx)(M,{fontSize:`xs`,color:`fg.muted`,children:`Can only view projects they are invited to, cannot see costs`})]})})})})]}),_.length>0&&(0,Q.jsxs)(B,{align:`start`,gap:2,width:`100%`,children:[(0,Q.jsxs)(I,{justify:`space-between`,width:`100%`,children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`medium`,color:`fg`,children:`Team Assignments`}),(0,Q.jsxs)(T,{type:`button`,size:`sm`,variant:`ghost`,onClick:N,disabled:j().length===0,children:[(0,Q.jsx)(n,{size:14}),` Add team`]})]}),(0,Q.jsx)(D,{paddingX:4,paddingY:3,backgroundColor:`bg.muted`,borderRadius:`xl`,width:`100%`,children:(0,Q.jsxs)(b,{variant:`ghost`,width:`100%`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(a,{backgroundColor:`transparent`,children:[(0,Q.jsx)(C,{paddingLeft:0,paddingTop:0,children:`Team`}),(0,Q.jsx)(C,{paddingLeft:0,paddingTop:0,children:`Role`}),(0,Q.jsx)(C,{paddingLeft:0,paddingRight:0,paddingTop:0,width:`50px`})]})}),(0,Q.jsx)(l,{children:_.map((e,n)=>(0,Q.jsxs)(a,{backgroundColor:`transparent`,children:[(0,Q.jsx)(v,{paddingLeft:0,children:(0,Q.jsx)(he,{teamIndex:n,control:p,getAvailableTeamOptions:j})}),(0,Q.jsx)(v,{paddingLeft:0,children:(0,Q.jsx)(ve,{teamIndex:n,control:p,organizationId:t,orgRole:k,setValue:h,isInviterAdmin:d})}),(0,Q.jsx)(v,{paddingLeft:0,paddingRight:0,paddingY:2,children:(0,Q.jsx)(T,{type:`button`,size:`sm`,colorPalette:`red`,variant:`ghost`,"aria-label":`Remove team assignment`,onClick:()=>w(n),children:(0,Q.jsx)(y,{size:16})})})]},e.id))})]})})]}),_.length===0&&(0,Q.jsx)(I,{gap:2,children:(0,Q.jsxs)(T,{type:`button`,size:`sm`,variant:`outline`,onClick:N,disabled:j().length===0,children:[(0,Q.jsx)(n,{size:14}),` Add team`]})}),(0,Q.jsxs)(I,{justify:`end`,width:`100%`,marginTop:4,children:[(0,Q.jsx)(T,{type:`button`,variant:`outline`,onClick:s,disabled:i,children:c}),(0,Q.jsx)(T,{colorPalette:i?`gray`:`orange`,type:`submit`,disabled:i,children:(0,Q.jsxs)(I,{children:[i?(0,Q.jsx)(E,{size:`sm`}):(0,Q.jsx)(Y,{size:18}),(0,Q.jsx)(M,{children:o?`Send invites`:`Create invites`})]})})]})]})})}function he({teamIndex:e,control:t,getAvailableTeamOptions:n}){let r=n(e),i=(0,Z.useMemo)(()=>_({items:r}),[r]);return(0,Q.jsx)(G,{control:t,name:`teams.${e}.teamId`,rules:{required:`Team is required`},render:({field:e})=>(0,Q.jsxs)(h.Root,{collection:i,value:[e.value],onValueChange:t=>{let n=t.value[0];n&&e.onChange(n)},children:[(0,Q.jsx)(h.Trigger,{background:`bg`,width:`full`,children:(0,Q.jsx)(h.ValueText,{placeholder:`Select team`})}),(0,Q.jsx)(h.Content,{paddingY:2,children:r.map(e=>(0,Q.jsx)(h.Item,{item:e,children:e.label},e.value))})]})})}function ge(e,t,n){let i=Object.values(r),a=t.map(e=>({label:e.name,value:`custom:${e.id}`,description:e.description??`Custom role`,isCustom:!0,customRoleId:e.id}));return e===X.OrganizationUserRole.EXTERNAL?[r.VIEWER]:e===X.OrganizationUserRole.MEMBER?n?[...i.filter(e=>e.value!==X.TeamUserRole.VIEWER),...a]:[r.MEMBER]:[...i,...a]}function _e(e){return e===X.OrganizationUserRole.EXTERNAL?X.TeamUserRole.VIEWER:X.TeamUserRole.MEMBER}function ve({teamIndex:e,control:t,organizationId:n,orgRole:r,setValue:i,isInviterAdmin:a}){let o=H.role.getAll.useQuery({organizationId:n}),s=(0,Z.useMemo)(()=>ge(r,o.data??[],a),[r,o.data,a]),l=(0,Z.useMemo)(()=>_({items:s}),[s]);return(0,Q.jsx)(G,{control:t,name:`teams.${e}.role`,render:({field:t})=>(0,Q.jsxs)(h.Root,{collection:l,value:[t.value],onValueChange:n=>{let r=n.value[0];r&&(t.onChange(r),r.startsWith(`custom:`)?i(`teams.${e}.customRoleId`,r.replace(`custom:`,``)):i(`teams.${e}.customRoleId`,void 0))},disabled:o.isLoading,children:[(0,Q.jsx)(h.Trigger,{background:`bg`,width:`full`,children:(0,Q.jsx)(h.ValueText,{placeholder:`Select role`})}),(0,Q.jsx)(h.Content,{paddingY:2,width:`320px`,children:s.map(e=>(0,Q.jsx)(h.Item,{item:e,children:(0,Q.jsx)(c,{option:e})},e.value))})]})})}var $=[{label:`Admin`,value:X.OrganizationUserRole.ADMIN,description:`Can manage organization and add or remove members`},{label:`Member`,value:X.OrganizationUserRole.MEMBER,description:`Can manage their own projects and view other projects`},{label:`Lite Member`,value:X.OrganizationUserRole.EXTERNAL,description:`Can only view projects they are invited to, cannot see costs`}];function ye({value:e,onChange:t}){let n=(0,Z.useMemo)(()=>_({items:$}),[]);return(0,Q.jsx)(B,{align:`start`,children:(0,Q.jsx)(I,{gap:6,children:(0,Q.jsxs)(h.Root,{collection:n,value:[e],onValueChange:e=>{let n=e.value[0];n&&t(n)},children:[(0,Q.jsx)(h.Trigger,{width:`200px`,children:(0,Q.jsx)(h.ValueText,{placeholder:`Select role`})}),(0,Q.jsx)(h.Content,{width:`320px`,paddingY:2,children:$.map(e=>(0,Q.jsx)(h.Item,{item:e,children:(0,Q.jsxs)(B,{align:`start`,gap:0,flex:1,children:[(0,Q.jsx)(M,{children:e.label}),(0,Q.jsx)(M,{color:`fg.muted`,fontSize:`13px`,children:e.description})]})},e.value))})]})})})}function be({member:e,organizationId:t,canManage:n,isCurrentUser:r,open:i,onClose:a}){let o=H.useContext(),[s,c]=(0,Z.useState)(e.role),[l,u]=(0,Z.useState)(new Set),[d,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),g=()=>{c(e.role),u(new Set),f([])};(0,Z.useEffect)(()=>{i&&g()},[i,e.userId]);let _=H.roleBinding.listForUser.useQuery({organizationId:t,userId:e.userId},{enabled:i&&n}),v=H.group.listForMember.useQuery({organizationId:t,userId:e.userId},{enabled:i}),y=H.organization.updateMemberRole.useMutation(),b=H.roleBinding.applyMemberBindings.useMutation(),S=l.size>0||d.length>0,C=s!==e.role,w=S||C,j=async()=>{let n=h.current?.flush()??null,r=n?[...d,n]:d,i=l.size>0||r.length>0;m(!0);try{C&&await y.mutateAsync({organizationId:t,userId:e.userId,role:s}),i&&await b.mutateAsync({organizationId:t,userId:e.userId,bindingIdsToDelete:[...l],bindingsToCreate:r.map(e=>({role:e.role,customRoleId:e.customRoleId,scopeType:e.scopeType,scopeId:e.scopeId}))}),await Promise.all([o.roleBinding.listForUser.invalidate(),o.roleBinding.listForOrg.invalidate(),o.organization.getOrganizationWithMembersAndTheirTeams.invalidate(),o.organization.getAll.invalidate()]),O.create({title:`Member updated`,type:`success`}),a()}catch(e){let t=e instanceof Error?e.message:`Failed to save`;O.create({title:t,type:`error`})}finally{m(!1)}},N=_.data??[];return(0,Q.jsx)(A.Root,{open:i,onOpenChange:e=>{e.open||(g(),a())},size:`lg`,children:(0,Q.jsxs)(A.Content,{maxHeight:`90vh`,overflowY:`auto`,children:[(0,Q.jsx)(A.Header,{children:(0,Q.jsx)(A.Title,{children:e.user.name??e.user.email})}),(0,Q.jsx)(A.CloseTrigger,{}),(0,Q.jsx)(A.Body,{pb:6,children:(0,Q.jsxs)(B,{gap:5,align:`stretch`,children:[n&&(0,Q.jsxs)(D,{children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`semibold`,mb:3,children:`Organization role`}),r?(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,fontStyle:`italic`,children:`You cannot change your own organization role.`}):(0,Q.jsx)(ye,{value:s,onChange:c})]}),n&&(0,Q.jsxs)(D,{children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`semibold`,mb:3,children:`Access`}),_.isLoading?(0,Q.jsx)(E,{size:`sm`}):N.length===0&&d.length===0?(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,fontStyle:`italic`,children:`No access configured.`}):(0,Q.jsxs)(B,{gap:2,align:`stretch`,children:[N.map(e=>{let t=l.has(e.id);return(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,opacity:t?.4:1,transition:`opacity 0.15s`,children:[(0,Q.jsx)(k,{colorPalette:J(e.role),size:`sm`,textDecoration:t?`line-through`:void 0,children:e.customRoleName??e.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,textDecoration:t?`line-through`:void 0,children:[q(e.scopeType),` `,e.scopeName??e.scopeId]}),(0,Q.jsx)(z,{}),e.scopeType!==X.RoleBindingScopeType.PROJECT&&(0,Q.jsx)(T,{size:`xs`,variant:`ghost`,color:t?`blue.500`:`fg.muted`,"aria-label":t?`Undo removal`:`Remove binding`,onClick:()=>u(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:(0,Q.jsx)(x,{size:14})})]},e.id)}),d.map((e,t)=>(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,opacity:.7,children:[(0,Q.jsx)(k,{colorPalette:J(e.role),size:`sm`,children:e.customRoleName??e.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,children:[q(e.scopeType),` `,e.scopeName??e.scopeId]}),(0,Q.jsx)(z,{}),(0,Q.jsx)(T,{size:`xs`,variant:`ghost`,color:`fg.muted`,"aria-label":`Undo add`,onClick:()=>f(e=>e.filter((e,n)=>n!==t)),children:(0,Q.jsx)(x,{size:14})})]},t))]}),(0,Q.jsx)(pe,{ref:h,organizationId:t,onAdd:e=>f(t=>[...t,e])})]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(M,{fontSize:`sm`,fontWeight:`semibold`,mb:3,children:`Group access`}),v.isLoading?(0,Q.jsx)(E,{size:`sm`}):v.data?.length?(0,Q.jsx)(B,{gap:2,align:`stretch`,children:v.data.map(e=>e.bindings.length===0?(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,justifyContent:`space-between`,children:[(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,children:e.name}),(0,Q.jsx)(R,{href:`/settings/groups`,fontSize:`xs`,color:`blue.400`,children:`No access configured`})]},e.id):e.bindings.map(t=>(0,Q.jsxs)(I,{px:3,py:2,bg:`bg.muted`,borderRadius:`md`,fontSize:`sm`,children:[(0,Q.jsx)(k,{colorPalette:J(t.role),size:`sm`,children:t.customRoleName??t.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,children:[q(t.scopeType),` `,t.scopeName??`—`]}),(0,Q.jsx)(z,{}),(0,Q.jsxs)(M,{fontSize:`xs`,color:`fg.muted`,children:[`via `,e.name]})]},t.id)))}):(0,Q.jsx)(M,{fontSize:`sm`,color:`fg.muted`,fontStyle:`italic`,children:`Not a member of any groups.`})]})]})}),n&&(0,Q.jsxs)(A.Footer,{children:[(0,Q.jsx)(T,{variant:`outline`,onClick:()=>{g(),a()},children:`Cancel`}),(0,Q.jsx)(T,{colorPalette:`blue`,disabled:!w,loading:p,onClick:()=>void j(),children:`Save`})]})]})})}function xe({isAdmin:e,inviteId:t,onApprove:n,onReject:r}){return e?(0,Q.jsxs)(I,{gap:2,children:[(0,Q.jsx)(L,{"aria-label":`Approve`,variant:`ghost`,size:`sm`,color:`green.500`,onClick:()=>n(t),children:(0,Q.jsx)(N,{size:16})}),(0,Q.jsx)(L,{"aria-label":`Reject`,variant:`ghost`,size:`sm`,color:`red.500`,onClick:()=>r(t),children:(0,Q.jsx)(x,{size:16})})]}):null}function Se({waitingApprovalInvites:e,sentInvites:t,isAdmin:n,currentUserId:r,teams:i,onApprove:s,onReject:c,onViewInviteLink:d,onDeleteInvite:f}){let m=(0,Z.useMemo)(()=>n?e:e.filter(e=>e.requestedBy===r),[e,n,r]),h=(0,Z.useMemo)(()=>[...m,...t],[m,t]);return h.length===0?null:(0,Q.jsxs)(B,{align:`start`,gap:4,paddingTop:4,width:`full`,children:[(0,Q.jsx)(j,{children:`Invites`}),(0,Q.jsx)(ne,{width:`full`,overflow:`hidden`,children:(0,Q.jsx)(re,{paddingY:0,paddingX:0,children:(0,Q.jsxs)(b,{variant:`line`,size:`md`,width:`full`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(a,{children:[(0,Q.jsx)(C,{width:`56px`}),(0,Q.jsx)(C,{children:`Email`}),(0,Q.jsx)(C,{children:`Status`}),(0,Q.jsx)(C,{children:`Role`}),(0,Q.jsx)(C,{children:`Teams`}),(0,Q.jsx)(C,{width:`60px`})]})}),(0,Q.jsx)(l,{children:h.map(e=>{let t=e.status===`WAITING_APPROVAL`,r=$.find(t=>t.value===e.role)?.label??e.role;return(0,Q.jsxs)(a,{children:[(0,Q.jsx)(v,{children:(0,Q.jsx)(p,{size:`2xs`,name:e.email})}),(0,Q.jsx)(v,{children:e.email}),(0,Q.jsx)(v,{children:t?(0,Q.jsx)(k,{size:`sm`,variant:`surface`,colorPalette:`orange`,children:`Pending Approval`}):(0,Q.jsx)(k,{size:`sm`,variant:`surface`,children:`Invited`})}),(0,Q.jsx)(v,{children:r}),(0,Q.jsx)(v,{children:(0,Q.jsx)(Ce,{teamIds:e.teamIds,teams:i})}),(0,Q.jsx)(v,{children:(0,Q.jsx)(D,{width:`full`,height:`full`,display:`flex`,justifyContent:`end`,children:t?(0,Q.jsx)(xe,{isAdmin:n,inviteId:e.id,onApprove:s,onReject:c}):(0,Q.jsxs)(g.Root,{children:[(0,Q.jsx)(g.Trigger,{asChild:!0,children:(0,Q.jsx)(L,{"aria-label":`Invite actions`,variant:`ghost`,size:`sm`,children:(0,Q.jsx)(o,{size:16})})}),(0,Q.jsxs)(g.Content,{children:[(0,Q.jsxs)(g.Item,{value:`view-link`,onClick:()=>d(e.inviteCode,e.email),children:[(0,Q.jsx)(Y,{size:16}),`View invite link`]}),n&&(0,Q.jsxs)(g.Item,{value:`delete`,color:`red.500`,onClick:()=>f(e.id),children:[(0,Q.jsx)(y,{size:16}),`Delete`]})]})]})})})]},e.id)})})]})})})]})}var Ce=({teamIds:e,teams:t})=>{if(!e)return null;let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length===0?null:(0,Q.jsx)(I,{gap:2,flexWrap:`wrap`,children:n.map(e=>{let n=t.find(t=>t.id===e);return n?(0,Q.jsx)(R,{href:`/settings/teams/${n.slug}`,children:(0,Q.jsx)(k,{size:`sm`,variant:`surface`,children:n.name})},e):null})})};function we({organizationId:e,isAdmin:t,hasEmailProvider:n,onInviteCreated:r,onClose:i,refetchInvites:a,pricingModel:o,activePlanFree:s,activePlanType:c,activePlanSource:l}){let u=f(`members`),d=f(`membersLite`),p=ae(e=>e.openSeats),m=H.useContext(),h=()=>{m.licenseEnforcement.checkLimit.invalidate()},g=H.subscription?.addTeamMemberOrEvents?.useMutation(),_=H.organization.createInvites.useMutation(),v=H.organization.createInviteRequest.useMutation(),y=H.organization.approveInvite.useMutation(),b=H.organization.deleteInvite.useMutation(),x=t=>{_.mutate({organizationId:e,invites:t.invites.map(e=>({email:e.email.toLowerCase(),role:e.orgRole,teams:e.teams.map(e=>({teamId:e.teamId,role:e.role,customRoleId:e.customRoleId}))}))},{onSuccess:e=>{r(e.reduce((e,t)=>(t?.invite&&t.emailNotSent&&e.push({inviteCode:t.invite.inviteCode,email:t.invite.email}),e),[]));let t=e.filter(Boolean).length,o=n?`All invites have been sent.`:`All invites have been created. View invite link under actions menu.`;O.create({title:`${t>1?`Invites`:`Invite`} created successfully`,description:o,type:`success`,duration:2e3,meta:{closable:!0}}),i(),a(),h()},onError:e=>{V(e)||O.create({title:`Sorry, something went wrong`,description:e.message??`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},S=t=>{v.mutate({organizationId:e,invites:t.invites.map(e=>({email:e.email.toLowerCase(),role:e.orgRole===X.OrganizationUserRole.EXTERNAL?`EXTERNAL`:`MEMBER`,teams:e.teams.map(e=>({teamId:e.teamId,role:e.role,customRoleId:e.customRoleId}))}))},{onSuccess:()=>{let e=t.invites.length;O.create({title:e>1?`Invitations sent for approval`:`Invitation sent for approval`,description:`An admin will review your invitation request.`,type:`success`,duration:2e3,meta:{closable:!0}}),i(),a(),h()},onError:e=>{V(e)||O.create({title:`Sorry, something went wrong`,description:e.message??`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})};return{onSubmit:n=>{let r=n.invites.some(e=>e.orgRole!==X.OrganizationUserRole.EXTERNAL),i=n.invites.some(e=>e.orgRole===X.OrganizationUserRole.EXTERNAL),a=n.invites.filter(e=>e.orgRole!==X.OrganizationUserRole.EXTERNAL).length,s=t?x:S,f=()=>{i?d.checkAndProceed(()=>s(n)):s(n)};if(!r){f();return}let m=u.limitInfo;if(!m){f();return}if(m.current+a<=m.max){f();return}if(l===`subscription`&&o===`SEAT_EVENT`&&g){let t=m.current+a;p({organizationId:e,currentSeats:m.max,newSeats:t,onConfirm:async()=>{try{await g.mutateAsync({organizationId:e,plan:c,upgradeMembers:!0,upgradeTraces:!1,totalMembers:t,totalTraces:0}),s(n)}catch(e){O.create({title:`Failed to expand seats`,description:e instanceof Error?e.message:`Please try again`,type:`error`,duration:5e3,meta:{closable:!0}})}}})}else u.checkAndProceed(()=>{})},approveInvite:t=>{y.mutate({inviteId:t,organizationId:e},{onSuccess:()=>{O.create({title:`Invitation approved`,description:`The invitation has been approved and sent.`,type:`success`,duration:5e3,meta:{closable:!0}}),a(),h()},onError:()=>{O.create({title:`Sorry, something went wrong`,description:`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},rejectInvite:t=>{b.mutate({inviteId:t,organizationId:e},{onSuccess:()=>{O.create({title:`Invitation rejected`,description:`The invitation request has been rejected.`,type:`success`,duration:5e3,meta:{closable:!0}}),a(),h()},onError:()=>{O.create({title:`Sorry, something went wrong`,description:`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},deleteInvite:t=>{b.mutate({inviteId:t,organizationId:e},{onSuccess:()=>{O.create({title:`Invite deleted successfully`,description:`The invite has been deleted.`,type:`success`,duration:5e3,meta:{closable:!0}}),a(),h()},onError:e=>{V(e)||O.create({title:`Sorry, something went wrong`,description:e.message??`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},isSubmitting:_.isLoading||v.isLoading}}function Te(){let{organization:e}=se(),t=H.organization.getOrganizationWithMembersAndTheirTeams.useQuery({organizationId:e?.id??``,includeDeactivated:!0},{enabled:!!e}),n=H.plan.getActivePlan.useQuery({organizationId:e?.id??``},{enabled:!!e});return!e||!t.data||!n.data?(0,Q.jsx)(K,{}):(0,Q.jsx)(De,{teams:e.teams,organization:t.data,activePlan:n.data})}var Ee=fe(`organization:view`,{layoutComponent:K})(Te);function De({organization:e,teams:t,activePlan:r}){let{data:c}=ce(),{hasPermission:f}=se(),h=f(`organization:manage`),_=c?.user,x=t.map(e=>({label:e.name,value:e.id})),S=H.useContext(),[w,E]=(0,Z.useState)(null),{open:N,onOpen:ee,onClose:P}=d(),{open:te,onOpen:F,onClose:L}=d(),R=H.organization.getOrganizationPendingInvites.useQuery({organizationId:e?.id??``},{enabled:!!e}),ae=H.organization.deleteMember.useMutation(),[V,U]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{V.length>0&&F()},[V,F]);let W=oe().data?.HAS_EMAIL_PROVIDER_KEY,{onSubmit:le,approveInvite:ue,rejectInvite:G,deleteInvite:de,isSubmitting:fe}=we({organizationId:e.id,isAdmin:h,hasEmailProvider:W??!1,onInviteCreated:U,onClose:P,refetchInvites:()=>void R.refetch(),pricingModel:e.pricingModel,activePlanFree:r.free,activePlanType:r.type,activePlanSource:r.planSource}),q=t=>{ae.mutate({organizationId:e.id,userId:t},{onSuccess:()=>{O.create({title:`Member removed successfully`,description:`The member has been removed from the organization.`,type:`success`,duration:5e3,meta:{closable:!0}}),S.organization.getOrganizationWithMembersAndTheirTeams.invalidate().catch(n=>{ie(n,{tags:{userId:t,organizationId:e.id}})}),S.licenseEnforcement.checkLimit.invalidate()},onError:()=>{O.create({title:`Sorry, something went wrong`,description:`Please try that again`,type:`error`,duration:5e3,meta:{closable:!0}})}})},J=(e,t)=>{U([{inviteCode:e,email:t}]),F()},pe=()=>{U([]),L()},{data:Y,isLoading:X,isError:he}=H.roleBinding.listForOrg.useQuery({organizationId:e.id},{enabled:!!e.id&&h}),ge=(0,Z.useMemo)(()=>{let e=new Map;for(let t of Y??[]){t.userId&&(e.has(t.userId)||e.set(t.userId,[]),e.get(t.userId).push(t));for(let n of t.memberUserIds)e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[Y]),_e=(0,Z.useMemo)(()=>[...e.members].sort((e,t)=>(e.user.name??e.user.email??``).localeCompare(t.user.name??t.user.email??``)),[e.members]),ve=t=>h&&e.members.length>1&&t!==_?.id,$=(0,Z.useMemo)(()=>(R.data??[]).filter(e=>e.status===`PENDING`),[R.data]),ye=(0,Z.useMemo)(()=>(R.data??[]).filter(e=>e.status===`WAITING_APPROVAL`),[R.data]);return(0,Q.jsxs)(K,{children:[(0,Q.jsxs)(B,{gap:6,width:`full`,align:`start`,children:[(0,Q.jsxs)(I,{width:`full`,children:[(0,Q.jsx)(j,{children:`Organization Members`}),(0,Q.jsx)(z,{}),h&&(0,Q.jsxs)(s.HeaderButton,{onClick:ee,children:[(0,Q.jsx)(n,{size:20}),`Add members`]})]}),(0,Q.jsx)(ne,{width:`full`,overflow:`hidden`,children:(0,Q.jsx)(re,{paddingY:0,paddingX:0,children:(0,Q.jsxs)(b,{variant:`line`,size:`md`,width:`full`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(a,{children:[(0,Q.jsx)(C,{width:`56px`}),(0,Q.jsx)(C,{children:`Name`}),(0,Q.jsx)(C,{children:`Email`}),h&&(0,Q.jsx)(C,{textAlign:`right`,children:`Access`}),(0,Q.jsx)(C,{width:`60px`})]})}),(0,Q.jsx)(l,{children:_e.map(e=>(0,Q.jsxs)(a,{children:[(0,Q.jsx)(v,{children:(0,Q.jsx)(p,{size:`2xs`,name:e.user.name??``})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(I,{children:[(0,Q.jsx)(T,{variant:`plain`,size:`sm`,padding:0,height:`auto`,fontWeight:`normal`,color:`colorPalette.fg`,colorPalette:`blue`,onClick:()=>{E({userId:e.userId,role:e.role,user:{name:e.user.name??null,email:e.user.email??null}})},children:e.user.name}),e.role===`EXTERNAL`&&(0,Q.jsx)(k,{colorPalette:`gray`,size:`sm`,children:`Lite Member`}),e.user.deactivatedAt&&(0,Q.jsx)(k,{colorPalette:`red`,size:`sm`,children:`Deactivated`})]})}),(0,Q.jsx)(v,{children:e.user.email}),h&&(0,Q.jsx)(v,{children:(0,Q.jsx)(Ae,{bindings:ge.get(e.userId)??[],isLoading:X||he})}),(0,Q.jsx)(v,{children:(0,Q.jsx)(D,{width:`full`,height:`full`,display:`flex`,justifyContent:`end`,children:(0,Q.jsxs)(g.Root,{children:[(0,Q.jsx)(g.Trigger,{children:(0,Q.jsx)(o,{size:16})}),(0,Q.jsxs)(g.Content,{children:[(0,Q.jsxs)(g.Item,{value:`edit`,onClick:()=>{E({userId:e.userId,role:e.role,user:{name:e.user.name??null,email:e.user.email??null}})},children:[(0,Q.jsx)(i,{size:16}),`Edit`]}),ve(e.userId)&&(0,Q.jsxs)(g.Item,{value:`delete`,color:`red.500`,onClick:()=>q(e.userId),children:[(0,Q.jsx)(y,{size:16}),`Delete`]})]})]})})})]},e.userId))})]})})}),(0,Q.jsx)(Se,{waitingApprovalInvites:ye,sentInvites:$,isAdmin:h,currentUserId:_?.id??``,teams:t,onApprove:ue,onReject:G,onViewInviteLink:J,onDeleteInvite:de})]}),w&&(0,Q.jsx)(be,{member:w,organizationId:e.id,canManage:h,isCurrentUser:w.userId===_?.id,open:!!w,onClose:()=>E(null)}),(0,Q.jsx)(A.Root,{open:te,onOpenChange:({open:e})=>e?void 0:pe(),children:(0,Q.jsxs)(A.Content,{children:[(0,Q.jsx)(A.Header,{children:(0,Q.jsx)(A.Title,{children:(0,Q.jsx)(j,{children:`Invite Link`})})}),(0,Q.jsx)(A.CloseTrigger,{}),(0,Q.jsx)(A.Body,{paddingBottom:6,children:(0,Q.jsxs)(B,{align:`start`,gap:4,children:[(0,Q.jsx)(M,{children:`Send the link below to the users you want to invite to join the organization.`}),(0,Q.jsx)(B,{align:`start`,gap:4,width:`full`,children:V.map(e=>(0,Q.jsxs)(B,{align:`start`,gap:6,width:`full`,children:[(0,Q.jsx)(M,{fontWeight:`600`,children:e.email}),(0,Q.jsx)(m,{value:`${window.location.origin}/invite/accept?inviteCode=${e.inviteCode}`,label:`Invite Link`,marginTop:0})]},e.inviteCode))})]})})]})}),(0,Q.jsx)(A.Root,{open:N,onOpenChange:({open:e})=>e?ee():P(),children:(0,Q.jsxs)(A.Content,{width:`100%`,maxWidth:`1024px`,children:[(0,Q.jsx)(A.Header,{children:(0,Q.jsx)(A.Title,{children:(0,Q.jsx)(j,{children:`Add members`})})}),(0,Q.jsx)(A.CloseTrigger,{}),(0,Q.jsx)(A.Body,{children:(0,Q.jsx)(me,{teamOptions:x,organizationId:e.id,onSubmit:le,isLoading:fe,hasEmailProvider:W??!1,onClose:P,isInviterAdmin:h})})]})})]})}function Oe(e){return e===X.RoleBindingScopeType.ORGANIZATION?`🏢`:e===X.RoleBindingScopeType.TEAM?`👥`:`📁`}function ke(e){return e===`ADMIN`?`red`:e===`MEMBER`?`blue`:`gray`}function Ae({bindings:e,isLoading:t}){return t?(0,Q.jsx)(M,{fontSize:`xs`,color:`fg.subtle`,textAlign:`right`,children:`—`}):e.length===0?(0,Q.jsx)(M,{fontSize:`xs`,color:`fg.subtle`,textAlign:`right`,children:`No access configured`}):(0,Q.jsx)(B,{gap:1,align:`end`,children:e.map(e=>(0,Q.jsxs)(I,{gap:1,fontSize:`xs`,children:[(0,Q.jsx)(k,{colorPalette:ke(e.role),size:`sm`,children:e.customRoleName??e.role}),(0,Q.jsx)(M,{color:`fg.muted`,children:`on`}),(0,Q.jsxs)(k,{colorPalette:`purple`,size:`sm`,children:[Oe(e.scopeType),` `,e.scopeName??e.scopeId.slice(0,8)+`…`]}),e.groupId&&(0,Q.jsxs)(M,{color:`fg.subtle`,fontSize:`xs`,title:`via group: ${e.groupName??e.groupId}`,children:[`via `,e.groupName??`group`]})]},e.id))})}export{Ee as default};
|
|
2
|
+
//# sourceMappingURL=members-CUJANDtH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$i as n,Qi as r,Qo as i,Xn as a,Xr as o,_o as s,bn as c,cs as l,ea as u,fn as d,g as f,mn as p,p as m,qi as h,un as g,v as _,vn as v,vo as y,yn as ee}from"./command-bar-
|
|
2
|
-
//# sourceMappingURL=messages-
|
|
1
|
+
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$i as n,Qi as r,Qo as i,Xn as a,Xr as o,_o as s,bn as c,cs as l,ea as u,fn as d,g as f,mn as p,p as m,qi as h,un as g,v as _,vn as v,vo as y,yn as ee}from"./command-bar-DUK45yin.js";import{j as b,p as x,y as S}from"./stack-oJ9iWdbl.js";import{t as C}from"./box-BsM8YLGl.js";import{f as w}from"./LoadingScreen--vgXk5-2.js";import{t as T}from"./tooltip-AEm0YeiF.js";import{h as E}from"./terminal-CfM0q99k.js";import{t as D}from"./text-CwTrMF8x.js";import{t as O}from"./h-stack-BKLDJ2vg.js";import{i as k,r as A,t as j}from"./alert-SnQmACl1.js";import{r as M,t as N}from"./card-CMtKVPVl.js";import{J as te,pt as P}from"./lu-Bf6j_N19.js";import{t as F}from"./container-Ccm3vB5X.js";import{t as I}from"./spacer-2LJJGbo8.js";import{t as L}from"./v-stack-EOPQ57OZ.js";import{s as R}from"./auth-client-D3UhxhQi.js";import{t as ne}from"./chevron-up-BC1rnYqD.js";import{r as z}from"./next-router-C6sliiV7.js";import{t as B}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as V}from"./WithPermissionGuard-B4Jo8E5-.js";import{n as H,t as U}from"./NavigationFooter-Dzvauw3l.js";import{t as W}from"./getSingleQueryParam-DjQoQARs.js";import{n as G,t as K}from"./MessagesTable-9taaKCOZ.js";import{t as q}from"./WelcomeLayout-C-NpTCD2.js";var J=b(),Y=e(t(),1);(0,Y.forwardRef)(function(e,t){let{rel:n,className:r,...i}=e;return(0,J.jsx)(x.a,{...i,ref:t,className:S(`chakra-linkbox__overlay`,r),css:[{position:`static`,"&::before":{content:`''`,cursor:`inherit`,display:`block`,position:`absolute`,top:0,left:0,zIndex:0,width:`100%`,height:`100%`}},e.css]})});var X=(0,Y.forwardRef)(function(e,t){let{className:n,...r}=e;return(0,J.jsx)(x.div,{ref:t,position:`relative`,...r,className:S(`chakra-linkbox`,n),css:[{"& a[href]:not(.chakra-linkbox__overlay), abbr[title]":{position:`relative`,zIndex:1}},e.css]})});function re(){let{project:e}=B(),t=z(),[i,a]=(0,Y.useState)(),[s]=$(),{filterParams:c,queryOpts:l}=r(),f=H(),[p,h]=(0,Y.useState)(c.endDate);(0,Y.useEffect)(()=>{h(c.endDate)},[c.endDate]);let _=W(t.query.scrollId),y=R.traces.getAllForProject.useQuery({...c,endDate:p,query:W(t.query.query),groupBy:s,pageOffset:f.pageOffset,pageSize:f.pageSize,scrollId:_},l);f.useUpdateTotalHits(y);let b=G(y.isLoading||y.isRefetching),x=y.data?.groups.flatMap(e=>e.map(e=>e.trace_id))??[],S=R.traces.getEvaluationsMultiple.useQuery({projectId:e?.id??``,traceIds:x},{enabled:x.length>0,refetchInterval:i,refetchOnWindowFocus:!1}),{period:{startDate:w,endDate:E},setPeriod:D}=u();(0,Y.useEffect)(()=>{S.data&&(Object.values(S.data).flatMap(e=>e).filter(e=>(e.status==`scheduled`||e.status==`in_progress`)&&(e.timestamps.inserted_at??0)>new Date().getTime()-1e3*60*60*1).length>0?a(5e3):a(void 0))},[S.data]);let M=(0,Y.useRef)(y.data);return M.current=y.data,m({projectId:e?.id??``,onTraceSummaryUpdated:e=>{let t=new Set(M.current?.groups.flatMap(e=>e.map(e=>e.trace_id))??[]);(e.length===0||e.some(e=>t.has(e)))&&y.refetch()},enabled:!!e,pageOffset:f.pageOffset,cursorPageNumber:f.cursorPageNumber}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(o.Header,{children:[(0,J.jsx)(o.Heading,{children:`Traces`}),(0,J.jsx)(T,{content:`Refresh`,children:(0,J.jsx)(o.HeaderButton,{variant:`ghost`,onClick:()=>h(Date.now()),children:(0,J.jsx)(P,{className:b?`refresh-icon animation-spinning`:`refresh-icon`})})}),(0,J.jsx)(I,{}),(0,J.jsx)(ee,{}),(0,J.jsx)(ae,{}),(0,J.jsx)(n,{period:{startDate:w,endDate:E},setPeriod:D}),(0,J.jsx)(d,{defaultShowFilters:!0}),(0,J.jsx)(v,{})]}),(0,J.jsx)(F,{maxW:`calc(min(1440px, 100vw - 200px))`,padding:6,children:(0,J.jsxs)(O,{align:`start`,gap:8,children:[(0,J.jsxs)(L,{gap:6,width:`full`,children:[e&&y.data&&y.data.groups.length>0?(0,J.jsx)(ie,{project:e,traceGroups:y.data.groups,checksMap:S.data}):y.data?(0,J.jsxs)(k,{status:`info`,children:[(0,J.jsx)(A,{}),(0,J.jsx)(j,{children:`No messages found`})]}):y.isError?(0,J.jsxs)(k,{status:`error`,children:[(0,J.jsx)(A,{}),(0,J.jsx)(j,{children:`An error has occurred trying to load the messages`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{}),(0,J.jsx)(Z,{}),(0,J.jsx)(Z,{})]}),(0,J.jsx)(U,{...f,scrollId:y.data?.scrollId}),(0,J.jsx)(C,{height:`32px`,flexShrink:0})]}),(0,J.jsx)(g,{defaultShowFilters:!0})]})})]})}var ie=Y.memo(function({project:e,traceGroups:t,checksMap:n}){let[r,o]=(0,Y.useState)({}),s=e=>{o(t=>({...t,[e]:!t[e]}))},[c,l]=(0,Y.useState)({}),u=(t??[]).map(()=>(0,Y.createRef)()),[d]=$(),[p,m]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let e={};u.forEach((t,n)=>{t.current&&(e[n]=t.current.clientHeight)}),l(e),setTimeout(()=>m(!0),100)},[t]),t.map((o,l)=>{let m=!!r[l],h=1e3+t.length-l;return(0,J.jsxs)(L,{gap:0,transition:`all .2s linear`,onClick:e=>{let t=e=>e?e.classList.contains(`card`)||e.classList.contains(`group-title`)?!0:t(e.parentElement):!1;m&&t(e.target)||o.length!==1&&s(l)},...m?{className:`card-stack-content expanded`,background:`bg.muted`,borderRadius:`10px`,padding:`40px`,width:`calc(100% + 80px)`,cursor:`n-resize`}:{background:`transparent`,className:`card-stack-content`,marginBottom:o.length>2?4:o.length>1?2:0,marginLeft:o.length>2?-4:o.length>1?-2:0,cursor:`pointer`,width:`full`,_hover:{transform:`scale(1.04)`,zIndex:h}},children:[m&&(0,J.jsx)(O,{width:`full`,cursor:`n-resize`,justify:`center`,marginTop:`-40px`,paddingY:3,children:(0,J.jsx)(ne,{})}),m&&d===`user_id`&&(0,J.jsx)(C,{className:`group-title`,position:`absolute`,left:`64px`,marginTop:`-22px`,fontSize:`13px`,fontWeight:600,color:`fg.muted`,cursor:`default`,children:(0,J.jsxs)(O,{gap:1,children:[(0,J.jsx)(D,{flexShrink:0,children:`User ID: `}),(0,J.jsx)(D,{children:o[0]?.metadata.user_id??`null`}),(0,J.jsx)(E,{orientation:`vertical`,height:`20px`})]})}),m&&d===`thread_id`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(C,{className:`group-title`,position:`absolute`,left:`64px`,marginTop:`-22px`,fontSize:`13px`,fontWeight:600,color:`fg.muted`,cursor:`default`,children:(0,J.jsxs)(O,{gap:1,children:[(0,J.jsx)(D,{children:`Thread ID:`}),(0,J.jsx)(D,{children:o[0]?.metadata.thread_id??`null`})]})}),(0,J.jsx)(C,{className:`group-title`,position:`absolute`,right:`64px`,marginTop:`-22px`,fontSize:`13px`,fontWeight:600,color:`fg.muted`,cursor:`default`,children:(0,J.jsxs)(O,{gap:1,children:[(0,J.jsx)(D,{children:`Thread duration:`}),(0,J.jsx)(D,{children:(()=>{let e=o[0]?.timestamps.updated_at,t=o.at(-1)?.timestamps.updated_at;if(!e||!t)return`N/A`;let[n,r]=e<t?[e,t]:[t,e];return a(r-n)})()})]})})]}),(0,J.jsx)(L,{width:`full`,gap:6,children:o.slice(0,m?o.length:3).toReversed().map((t,r)=>{let a=m||o.length===1,s=m||r===0;return(0,J.jsx)(X,{asChild:!0,children:(0,J.jsxs)(M,{variant:`elevated`,className:`card`,ref:r===0?u[l]:null,height:s?`auto`:`${c[l]??0}px`,marginTop:s?`0`:`-${(c[l]??0)+24}px`,padding:0,cursor:`pointer`,width:`full`,transition:p?`all .2s linear`:void 0,_hover:a?{transform:`scale(1.04)`}:{},boxShadow:`lg`,borderRadius:`xl`,children:[!a&&(0,J.jsx)(C,{position:`absolute`,right:6,top:6,children:(0,J.jsx)(i,{})}),(0,J.jsx)(N,{padding:7,width:`fill`,children:s&&(0,J.jsx)(f,{linkActive:a,project:e,trace:t,checksMap:n})})]},t.trace_id)},t.trace_id)})})]},o[0]?.trace_id??l)})},(e,t)=>e.project===t.project&&e.traceGroups.flatMap(e=>e.map(e=>e.trace_id)).join()===t.traceGroups.flatMap(e=>e.map(e=>e.trace_id)).join()&&JSON.stringify(e.checksMap)===JSON.stringify(t.checksMap));function Z(){return(0,J.jsx)(M,{width:`full`,padding:0,variant:`elevated`,children:(0,J.jsx)(N,{padding:8,children:(0,J.jsxs)(L,{alignItems:`flex-start`,gap:4,children:[(0,J.jsx)(O,{gap:12,width:`full`,children:(0,J.jsx)(C,{fontSize:`24px`,fontWeight:`bold`,width:`full`,children:(0,J.jsx)(w,{width:`50%`,height:`20px`})})}),(0,J.jsxs)(L,{gap:4,width:`full`,children:[(0,J.jsx)(w,{width:`full`,height:`20px`}),(0,J.jsx)(w,{width:`full`,height:`20px`}),(0,J.jsx)(w,{width:`full`,height:`20px`})]})]})})})}var Q={thread_id:`Thread ID`,user_id:`User ID`,none:`None`},$=()=>{let e=z();return[e.query.group_by??`thread_id`,t=>{e.push({query:{...e.query,group_by:t}},void 0,{shallow:!0})}]};function ae(){let[e,t]=$();return(0,J.jsxs)(h.Root,{children:[(0,J.jsx)(h.Trigger,{asChild:!0,children:(0,J.jsx)(o.HeaderButton,{children:(0,J.jsxs)(O,{gap:2,children:[(0,J.jsx)(te,{}),(0,J.jsx)(C,{children:Q[e]}),(0,J.jsx)(C,{children:(0,J.jsx)(l,{})})]})})}),(0,J.jsxs)(h.Content,{children:[(0,J.jsx)(C,{paddingX:3,paddingY:2,fontWeight:`medium`,color:`fg.muted`,children:`Group by`}),(0,J.jsx)(y,{value:e,onChange:e=>t(e.target.value),children:Object.entries(Q).map(([e,n])=>(0,J.jsx)(h.Item,{value:e,onClick:()=>t(e),children:(0,J.jsxs)(O,{gap:2,children:[(0,J.jsx)(s,{value:e}),(0,J.jsx)(D,{children:n})]})},e))})]})]})}function oe(){let{project:e}=B(),t=R.project.getHasFirstMessage.useQuery({projectId:e?.id??``},{enabled:!!e?.id,staleTime:0}),n=!!t.data?.firstMessage,{isTableView:r}=c();return _(`input`),e&&t.isFetched&&!n?(0,J.jsx)(p,{children:(0,J.jsx)(q,{})}):(0,J.jsx)(p,{children:r?(0,J.jsx)(K,{}):(0,J.jsx)(re,{})})}var se=V(`traces:view`,{layoutComponent:p})(oe);export{se as default};
|
|
2
|
+
//# sourceMappingURL=messages-fQBfCjvp.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Gn as e,un as t}from"./command-bar-
|
|
2
|
-
//# sourceMappingURL=metrics-
|
|
1
|
+
import{Gn as e,un as t}from"./command-bar-DUK45yin.js";import{j as n}from"./stack-oJ9iWdbl.js";import{t as r}from"./box-BsM8YLGl.js";import{t as i}from"./h-stack-BKLDJ2vg.js";import{t as a}from"./simple-grid-C3IW90zo.js";import{t as o}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as s}from"./WithPermissionGuard-B4Jo8E5-.js";import{t as c}from"./GraphsLayout-DJ-HI9N1.js";import{t as l}from"./ChartCard-s5fMPo7b.js";var u=n(),d=1440,f={graphId:`llmMetricsSummary`,graphType:`summary`,series:[{name:`LLM Calls`,metric:`metadata.trace_id`,aggregation:`cardinality`,colorSet:`colors`},{name:`Total cost`,colorSet:`greenTones`,metric:`performance.total_cost`,aggregation:`sum`},{name:`Total tokens`,colorSet:`purpleTones`,metric:`performance.total_tokens`,aggregation:`sum`}],includePrevious:!0,timeScale:d,height:300},p={graphId:`llmPerformanceSummary`,graphType:`summary`,series:[{name:`Average tokens per message`,colorSet:`colors`,metric:`performance.total_tokens`,aggregation:`avg`},{name:`Average cost per message`,colorSet:`greenTones`,metric:`performance.total_cost`,aggregation:`avg`},{name:`90th Percentile time to first token`,colorSet:`cyanTones`,metric:`performance.first_token`,aggregation:`p90`},{name:`90th Percentile completion time`,colorSet:`greenTones`,metric:`performance.completion_time`,aggregation:`p90`}],includePrevious:!0,timeScale:d,height:300},m={graphId:`llmCallsByModel`,graphType:`area`,series:[{name:`LLM Calls`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:d,height:300},h={graphId:`llmSplitByModel`,graphType:`donnut`,series:[{name:`LLM Calls`,colorSet:`colors`,metric:`metadata.span_type`,aggregation:`cardinality`,key:`llm`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:d,height:300},g={graphId:`avgCompletionTimeByModel`,graphType:`horizontal_bar`,series:[{name:`Completion time average`,colorSet:`colors`,metric:`performance.completion_time`,aggregation:`avg`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},_={graphId:`avgCostPerModel`,graphType:`horizontal_bar`,series:[{name:`Average cost per message`,colorSet:`colors`,metric:`performance.total_cost`,aggregation:`avg`,pipeline:{field:`trace_id`,aggregation:`avg`}}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},v={graphId:`avgTokensPerModel`,graphType:`horizontal_bar`,series:[{name:`Average completion tokens per message`,colorSet:`colors`,metric:`performance.completion_tokens`,aggregation:`avg`,pipeline:{field:`trace_id`,aggregation:`avg`}}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},y={graphId:`latencyTrend`,graphType:`line`,series:[{name:`P90 Completion Time`,colorSet:`greenTones`,metric:`performance.completion_time`,aggregation:`p90`},{name:`P90 Time to First Token`,colorSet:`cyanTones`,metric:`performance.first_token`,aggregation:`p90`}],includePrevious:!1,timeScale:d,height:300},b={graphId:`tokensPerSecondByModel`,graphType:`horizontal_bar`,series:[{name:`Average tokens per second`,colorSet:`cyanTones`,metric:`performance.tokens_per_second`,aggregation:`avg`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},x={graphId:`errorRateByModel`,graphType:`horizontal_bar`,series:[{name:`Traces with errors`,colorSet:`orangeTones`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`error.has_error`,includePrevious:!1,timeScale:`full`,height:300};function S(){let{hasPermission:n}=o(),s=n(`cost:view`),d={...f,series:f.series.filter(e=>s||!e.metric?.includes(`total_cost`))},S={...p,series:p.series.filter(e=>s||!e.metric?.includes(`total_cost`))};return(0,u.jsx)(c,{title:`LLM Metrics`,children:(0,u.jsxs)(i,{alignItems:`start`,gap:4,children:[(0,u.jsxs)(a,{templateColumns:`repeat(4, 1fr)`,gap:5,width:`100%`,children:[(0,u.jsx)(l,{title:`LLM Metrics`,colSpan:2,children:(0,u.jsx)(e,{input:d})}),(0,u.jsx)(l,{title:`Summary`,colSpan:2,children:(0,u.jsx)(e,{input:S})}),(0,u.jsx)(l,{title:`LLM Usage`,colSpan:4,children:(0,u.jsx)(e,{input:m})}),(0,u.jsx)(l,{title:`LLM Split`,colSpan:2,children:(0,u.jsx)(e,{input:h})}),(0,u.jsx)(l,{title:`Average Completion Time`,colSpan:2,children:(0,u.jsx)(e,{input:g})}),s&&(0,u.jsx)(l,{title:`Average Cost Per Message`,colSpan:2,children:(0,u.jsx)(e,{input:_})}),(0,u.jsx)(l,{title:`Average Tokens Per Message`,colSpan:2,children:(0,u.jsx)(e,{input:v})}),(0,u.jsx)(l,{title:`Latency Trend`,colSpan:4,children:(0,u.jsx)(e,{input:y})}),(0,u.jsx)(l,{title:`Tokens Per Second`,colSpan:2,children:(0,u.jsx)(e,{input:b})}),(0,u.jsx)(l,{title:`Error Distribution`,colSpan:2,children:(0,u.jsx)(e,{input:x})})]}),(0,u.jsx)(r,{padding:3,children:(0,u.jsx)(t,{hideTopics:!0})})]})})}var C=s(`analytics:view`)(S);export{C as default};
|
|
2
|
+
//# sourceMappingURL=metrics-DeIxebpD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ss as e,Xo as t,Xr as n,_s as r,bs as i,qi as a,r as o,rc as s,vs as c,xs as l,ys as u}from"./command-bar-
|
|
2
|
-
//# sourceMappingURL=model-costs-
|
|
1
|
+
import{Ss as e,Xo as t,Xr as n,_s as r,bs as i,qi as a,r as o,rc as s,vs as c,xs as l,ys as u}from"./command-bar-DUK45yin.js";import{j as d,n as f}from"./stack-oJ9iWdbl.js";import{f as p}from"./LoadingScreen--vgXk5-2.js";import"./tooltip-AEm0YeiF.js";import{n as m}from"./toaster-C_DYALhL.js";import{Qt as h}from"./dist-Cds4Mqhj.js";import{t as g}from"./heading-D90dlSnH.js";import{t as _}from"./text-CwTrMF8x.js";import{t as v}from"./h-stack-BKLDJ2vg.js";import{t as y}from"./spacer-2LJJGbo8.js";import{t as b}from"./v-stack-EOPQ57OZ.js";import{m as x,s as S}from"./auth-client-D3UhxhQi.js";import{t as C}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as w}from"./SettingsLayout--1gdEuhv.js";var T=d();function E(t){let{openDrawer:a}=o(),{hasPermission:d}=C(),f=S.llmModelCost.getAllForProject.useQuery({projectId:t.projectId??``},{enabled:!!t.projectId});return(0,T.jsxs)(b,{gap:0,paddingTop:2,width:`full`,align:`start`,children:[(0,T.jsxs)(n.Header,{withBorder:!1,children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(g,{children:`LLM Model Costs`}),f.data&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(_,{fontSize:`md`,children:`·`}),(0,T.jsxs)(_,{fontSize:`md`,color:`fg.muted`,children:[f.data?.length,` models`]})]})]}),(0,T.jsx)(y,{}),(0,T.jsxs)(n.HeaderButton,{onClick:()=>a(`llmModelCost`,{}),disabled:!d(`project:manage`),children:[(0,T.jsx)(h,{size:20}),(0,T.jsx)(_,{children:`Add New Model`})]})]}),(0,T.jsx)(b,{width:`full`,gap:0,align:`start`,paddingY:4,paddingX:4,paddingBottom:12,children:(0,T.jsxs)(l,{variant:`line`,width:`full`,maxWidth:`100%`,wordBreak:`break-all`,style:{tableLayout:`fixed`},children:[(0,T.jsx)(i,{width:`full`,children:(0,T.jsxs)(e,{width:`full`,children:[(0,T.jsx)(u,{width:`30%`,children:`Model name`}),(0,T.jsx)(u,{width:`30%`,children:`Regex match rule`}),(0,T.jsx)(u,{children:`Input cost`}),(0,T.jsx)(u,{children:`Output cost`}),(0,T.jsx)(u,{width:`64px`,padding:1})]})}),(0,T.jsxs)(r,{width:`full`,children:[f.isLoading&&Array.from({length:3}).map((t,n)=>(0,T.jsxs)(e,{children:[Array.from({length:4}).map((e,t)=>(0,T.jsx)(c,{children:(0,T.jsx)(p,{height:`20px`})},t)),(0,T.jsx)(c,{padding:1})]},n)),f.data?.map(t=>(0,T.jsxs)(e,{width:`full`,children:[(0,T.jsx)(c,{children:(0,T.jsx)(_,{truncate:!0,color:t.updatedAt?`green.500`:void 0,children:t.model})}),(0,T.jsx)(c,{padding:0,children:(0,T.jsx)(v,{justifyContent:`space-between`,paddingX:4,marginX:2,maxWidth:`100%`,children:(0,T.jsx)(s,{truncate:!0,color:t.updatedAt?`green.500`:void 0,height:`32px`,lineHeight:`22px`,borderRadius:`6px`,border:`1px solid`,borderColor:`border`,bg:`bg.subtle`,paddingY:1,paddingX:2,children:t.regex})})}),(0,T.jsx)(c,{padding:0,children:(0,T.jsx)(_,{justifyContent:`space-between`,paddingX:4,marginX:2,color:t.id?`green.500`:void 0,children:t.inputCostPerToken?.toLocaleString(`fullwide`,{useGrouping:!1,maximumSignificantDigits:20})})}),(0,T.jsx)(c,{padding:0,children:(0,T.jsx)(_,{justifyContent:`space-between`,paddingX:4,marginX:2,color:t.id?`green.500`:void 0,children:t.outputCostPerToken?.toLocaleString(`fullwide`,{useGrouping:!1,maximumSignificantDigits:20})})}),(0,T.jsx)(c,{padding:1,children:(0,T.jsx)(D,{id:t.id,model:t.model,projectId:t.projectId})})]},t.model))]})]})})]})}function D({id:e,model:n,projectId:r}){let{openDrawer:i}=o(),s=S.llmModelCost.getAllForProject.useQuery({projectId:r??``},{enabled:!!r}),c=S.llmModelCost.delete.useMutation();return(0,T.jsxs)(a.Root,{children:[(0,T.jsx)(a.Trigger,{minWidth:0,asChild:!0,children:(0,T.jsx)(f,{variant:`ghost`,children:(0,T.jsx)(t,{})})}),(0,T.jsxs)(a.Content,{children:[!e&&(0,T.jsx)(a.Item,{value:`clone`,onClick:e=>{e.stopPropagation(),i(`llmModelCost`,{cloneModel:n})},children:`Clone`}),e&&(0,T.jsx)(a.Item,{value:`edit`,onClick:t=>{t.stopPropagation(),i(`llmModelCost`,{id:e})},children:`Edit`}),e&&(0,T.jsx)(a.Item,{value:`delete`,color:`red.600`,onClick:t=>{t.stopPropagation(),c.mutate({projectId:r??``,id:e},{onSuccess:()=>{m.create({title:`Success`,description:`LLM model cost deleted successfully`,type:`success`,meta:{closable:!0}}),s.refetch()},onError:e=>{x(e)||m.create({title:`Error`,description:`Error deleting LLM model cost`,type:`error`,meta:{closable:!0}})}})},children:`Delete`})]})]})}function O(){let{project:e}=C();return(0,T.jsx)(w,{children:(0,T.jsx)(E,{projectId:e?.id})})}export{O as default};
|
|
2
|
+
//# sourceMappingURL=model-costs-C1RbgK--.js.map
|
package/langwatch/dist/client/assets/{model-providers-B5UjRgS_.js → model-providers-Pv3ML_-t.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$s as n,Da as r,Fa as i,Qs as a,Ss as o,Xa as s,Xr as c,Xs as l,Ys as ee,Zs as u,_s as d,an as f,bi as p,bs as te,gi as m,in as h,on as ne,qi as g,r as _,rn as v,vi as y,vs as b,wa as x,xi as S,xs as C,ys as w}from"./command-bar-
|
|
2
|
-
//# sourceMappingURL=model-providers-
|
|
1
|
+
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{$s as n,Da as r,Fa as i,Qs as a,Ss as o,Xa as s,Xr as c,Xs as l,Ys as ee,Zs as u,_s as d,an as f,bi as p,bs as te,gi as m,in as h,on as ne,qi as g,r as _,rn as v,vi as y,vs as b,wa as x,xi as S,xs as C,ys as w}from"./command-bar-DUK45yin.js";import{j as T,n as E,r as D}from"./stack-oJ9iWdbl.js";import{t as O}from"./box-BsM8YLGl.js";import{t as k}from"./tooltip-AEm0YeiF.js";import{n as A}from"./toaster-C_DYALhL.js";import{an as j,c as M,f as N}from"./dist-Cds4Mqhj.js";import{t as P}from"./heading-D90dlSnH.js";import{t as F}from"./text-CwTrMF8x.js";import{t as I}from"./h-stack-BKLDJ2vg.js";import{r as L,t as re}from"./card-CMtKVPVl.js";import{t as ie}from"./spacer-2LJJGbo8.js";import{t as R}from"./v-stack-EOPQ57OZ.js";import{s as z}from"./auth-client-D3UhxhQi.js";import{t as B}from"./useOrganizationTeamProject-DC0iozx2.js";import{t as V}from"./HorizontalFormControl-BCD7-fcT.js";import{t as H}from"./brain-circuit-GfrhGCkg.js";import{t as U}from"./SettingsLayout--1gdEuhv.js";var W=e(t());function G(e){let{projectId:t,initialValue:n,onSuccess:r,onError:i}=e,[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(!1),l=z.project.updateEmbeddingsModel.useMutation();return{value:a,setValue:o,isSaving:s,update:(0,W.useCallback)(async e=>{c(!0);try{await l.mutateAsync({projectId:t??``,embeddingsModel:e}),A.create({title:`Embeddings Model Updated`,type:`success`,duration:3e3,meta:{closable:!0}}),r?.()}catch(e){i?.(e),A.create({title:`Failed to update embeddings model`,description:String(e),type:`error`,duration:4e3,meta:{closable:!0}})}finally{c(!1)}},[l,i,r,t])}}function K(e){let{projectId:t,initialValue:n,onSuccess:r,onError:i}=e,[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(!1),l=z.project.updateTopicClusteringModel.useMutation();return{value:a,setValue:o,isSaving:s,update:(0,W.useCallback)(async e=>{c(!0);try{await l.mutateAsync({projectId:t??``,topicClusteringModel:e}),A.create({title:`Topic Clustering Model Updated`,type:`success`,duration:3e3,meta:{closable:!0}}),r?.()}catch(e){i?.(e),A.create({title:`Failed to update topic clustering model`,description:String(e),type:`error`,duration:4e3,meta:{closable:!0}})}finally{c(!1)}},[l,i,r,t])}}var q=T();function J(){let{project:e,organization:t,hasPermission:m}=B(),y=m(`project:manage`),{providers:T,isLoading:A,refetch:V}=S({projectId:e?.id}),{openDrawer:G,drawerOpen:K}=_(),J=K(`editModelProvider`),Y=z.modelProvider.update.useMutation(),[X,Z]=(0,W.useState)(null),Q=(0,W.useMemo)(()=>T?Object.values(T).filter(e=>e.enabled):[],[T]),ae=(0,W.useMemo)(()=>Object.keys(M).map(e=>({provider:e,name:M[e]?.name??e,icon:p[e]})),[]),oe=t=>ne({providerKey:t,project:e,enabledProvidersCount:Q.length}),$=t=>h(t,e),se=z.useContext();return(0,W.useEffect)(()=>{J||(V(),se.organization.getAll.invalidate())},[J]),(0,q.jsx)(U,{children:(0,q.jsxs)(R,{gap:6,width:`full`,align:`start`,children:[(0,q.jsxs)(I,{width:`full`,marginTop:2,children:[(0,q.jsx)(P,{as:`h2`,children:`Model Providers`}),(0,q.jsx)(ie,{}),(0,q.jsxs)(g.Root,{children:[(0,q.jsx)(k,{content:`You need model provider manage permissions to add new providers.`,disabled:y,children:(0,q.jsx)(g.Trigger,{asChild:!0,children:(0,q.jsxs)(c.HeaderButton,{disabled:!y,children:[(0,q.jsx)(i,{}),` Add Model Provider`]})})}),(0,q.jsx)(g.Content,{children:ae.map(n=>(0,q.jsx)(g.Item,{value:n.provider,onClick:()=>{e?.id&&G(`editModelProvider`,{projectId:e.id,organizationId:t?.id,providerKey:n.provider,modelProviderId:`new`})},children:(0,q.jsxs)(I,{gap:3,children:[(0,q.jsx)(O,{width:`20px`,height:`20px`,children:n.icon}),(0,q.jsx)(F,{children:n.name})]})},n.provider))})]})]}),A?(0,q.jsx)(D,{}):Q.length===0?(0,q.jsx)(a,{width:`full`,children:(0,q.jsxs)(ee,{children:[(0,q.jsx)(u,{children:(0,q.jsx)(H,{size:24})}),(0,q.jsxs)(R,{textAlign:`center`,children:[(0,q.jsx)(n,{children:`No model providers`}),(0,q.jsx)(l,{children:`Add a model provider to get started`})]})]})}):(0,q.jsx)(L,{width:`full`,overflow:`hidden`,children:(0,q.jsx)(re,{paddingY:0,paddingX:0,children:(0,q.jsxs)(C,{variant:`line`,size:`md`,width:`full`,children:[(0,q.jsx)(te,{children:(0,q.jsxs)(o,{children:[(0,q.jsx)(w,{children:`Provider`}),(0,q.jsx)(w,{children:`Scope`}),(0,q.jsx)(w,{})]})}),(0,q.jsx)(d,{children:Q.map(n=>{let i=p[n.provider],a=M[n.provider];return(0,q.jsxs)(o,{children:[(0,q.jsx)(b,{children:(0,q.jsxs)(I,{gap:3,align:`center`,children:[(0,q.jsx)(O,{width:`24px`,height:`24px`,children:i}),(0,q.jsx)(F,{children:n.name??a?.name??n.provider}),oe(n.provider)&&(0,q.jsx)(j,{colorPalette:`blue`,children:`Default Model`})]})}),(0,q.jsx)(b,{children:(0,q.jsx)(v,{scopes:n.scopes,fallbackScopeType:n.scopeType})}),(0,q.jsx)(b,{textAlign:`right`,children:(0,q.jsxs)(g.Root,{children:[(0,q.jsx)(k,{content:`You need model provider manage permissions to edit or delete providers.`,disabled:y,children:(0,q.jsx)(g.Trigger,{asChild:!0,children:(0,q.jsx)(E,{variant:`ghost`,disabled:!y,children:(0,q.jsx)(s,{})})})}),(0,q.jsxs)(g.Content,{children:[(0,q.jsx)(g.Item,{value:`edit`,onClick:r=>{r.stopPropagation(),G(`editModelProvider`,{projectId:e?.id,organizationId:t?.id,modelProviderId:n.id,providerKey:n.provider})},children:(0,q.jsxs)(O,{display:`flex`,alignItems:`center`,gap:2,children:[(0,q.jsx)(r,{size:14}),`Edit Provider`]})}),(0,q.jsx)(g.Item,{value:`disable`,color:`red`,onClick:e=>{e.stopPropagation(),Z({id:n.id??void 0,provider:n.provider,name:a?.name??n.provider})},children:(0,q.jsxs)(O,{display:`flex`,alignItems:`center`,gap:2,children:[(0,q.jsx)(x,{size:14}),`Delete Provider`]})})]})]})})]},n.id??n.provider)})})]})})}),(0,q.jsx)(N.Root,{open:!!X,onOpenChange:e=>{e.open||Z(null)},children:(0,q.jsxs)(N.Content,{children:[(0,q.jsx)(N.Header,{children:(0,q.jsxs)(N.Title,{children:[`Delete `,X?.name,`?`]})}),(0,q.jsx)(N.Body,{children:X&&$(X.provider)?(0,q.jsxs)(R,{gap:3,align:`start`,children:[(0,q.jsx)(F,{children:`This provider is currently being used for one or more default models and cannot be deleted.`}),(0,q.jsx)(F,{fontWeight:`medium`,children:`Please change the following before deleting:`}),(0,q.jsxs)(R,{gap:2,align:`start`,paddingLeft:4,children:[f(X.provider,e?.defaultModel??null,null,null)&&(0,q.jsx)(F,{children:`• Default Model`}),f(X.provider,null,null,e?.embeddingsModel??null)&&(0,q.jsx)(F,{children:`• Embeddings Model`}),f(X.provider,null,e?.topicClusteringModel??null,null)&&(0,q.jsx)(F,{children:`• Topic Clustering Model`})]})]}):(0,q.jsx)(F,{children:`This provider will no longer be available for use.`})}),(0,q.jsxs)(N.Footer,{children:[(0,q.jsx)(N.ActionTrigger,{asChild:!0,children:(0,q.jsx)(E,{variant:`outline`,children:`Cancel`})}),(0,q.jsx)(E,{colorPalette:`red`,loading:Y.isPending,disabled:X?$(X.provider):!1,onClick:async()=>{X&&e?.id&&(await Y.mutateAsync({id:X.id,projectId:e.id,provider:X.provider,enabled:!1}),Z(null),await V())},children:`Delete`})]}),(0,q.jsx)(N.CloseTrigger,{})]})})]})})}function Y(){let{project:e}=B(),t=K({projectId:e?.id,initialValue:e?.topicClusteringModel??`openai/gpt-5.2`});return(0,q.jsx)(V,{label:`Topic Clustering Model`,helper:`For generating topic names`,paddingY:4,borderBottomWidth:`1px`,children:(0,q.jsxs)(I,{children:[(0,q.jsx)(m,{model:t.value,options:y.filter(e=>e.mode===`chat`).map(e=>e.value),onChange:e=>{t.setValue(e),t.update(e)},mode:`chat`}),t.isSaving&&(0,q.jsx)(D,{size:`sm`,marginRight:2})]})})}function X(){let{project:e}=B(),t=G({projectId:e?.id,initialValue:e?.embeddingsModel??`openai/text-embedding-3-small`});return(0,q.jsx)(V,{label:`Embeddings Model`,helper:`For embeddings to be used in topic clustering and evaluations`,paddingY:4,children:(0,q.jsxs)(I,{children:[(0,q.jsx)(m,{model:t.value,options:y.filter(e=>e.mode===`embedding`).map(e=>e.value),onChange:e=>{t.setValue(e),t.update(e)},mode:`embedding`}),t.isSaving&&(0,q.jsx)(D,{size:`sm`,marginRight:2})]})})}export{X as EmbeddingsModel,Y as TopicClusteringModel,J as default};
|
|
2
|
+
//# sourceMappingURL=model-providers-Pv3ML_-t.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{h as n,ls as r,mn as i,ss as a}from"./command-bar-
|
|
2
|
-
//# sourceMappingURL=my-queue-
|
|
1
|
+
import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-C7JcuhbW.js";import{h as n,ls as r,mn as i,ss as a}from"./command-bar-DUK45yin.js";import{j as o,n as s,r as c}from"./stack-oJ9iWdbl.js";import{t as l}from"./box-BsM8YLGl.js";import{n as u}from"./LoadingScreen--vgXk5-2.js";import{t as d}from"./text-CwTrMF8x.js";import{t as f}from"./h-stack-BKLDJ2vg.js";import{t as p}from"./v-stack-EOPQ57OZ.js";import{s as m}from"./auth-client-D3UhxhQi.js";import{t as h}from"./chevron-left-D0kd9CrF.js";import{n as g,t as _}from"./useAnnotationQueues-CA6Vk--V.js";import{r as v}from"./next-router-C6sliiV7.js";import{t as y}from"./useOrganizationTeamProject-DC0iozx2.js";var b=e(t()),x=o();function S(e){return(0,x.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e.width??564,height:e.height??424,fill:`none`,viewBox:`-40 0 630 424`,children:[(0,x.jsx)(`path`,{fill:`#ECC94B`,d:`M361.835 194.167c0 50.86-41.23 92.09-92.09 92.09-33.367 0-62.597-17.756-78.773-44.352-8.464-13.919-13.317-30.246-13.317-47.738 0-50.861 41.23-92.09 92.09-92.09 26.897 0 51.124 11.549 67.977 29.944 14.972 16.402 24.113 38.22 24.113 62.146`}),(0,x.jsx)(`path`,{fill:`#F6E05E`,d:`M351.039 179.797c0 50.86-41.23 92.09-92.09 92.09-26.935 0-51.124-11.549-67.977-29.944-8.464-13.919-13.317-30.246-13.317-47.738 0-50.86 41.23-92.09 92.09-92.09 26.897 0 51.124 11.549 67.977 29.944 8.464 13.919 13.317 30.245 13.317 47.738`}),(0,x.jsx)(`path`,{fill:`#3C2415`,d:`M272.718 216.024c-10.307 0-18.658-8.69-18.658-19.374 0-1.128.94-2.069 2.069-2.069 1.128 0 2.069.941 2.069 2.069 0 8.389 6.508 15.236 14.52 15.236s14.521-6.847 14.521-15.236c0-1.128.941-2.069 2.069-2.069s2.069.941 2.069 2.069c0 10.684-8.351 19.374-18.659 19.374M241.684 170.731c-6.132 0-11.135-5.192-11.135-11.549 0-.677.564-1.242 1.241-1.242s1.242.565 1.242 1.242c0 5.003 3.874 9.066 8.652 9.066s8.652-4.063 8.652-9.066c0-.677.564-1.242 1.242-1.242.677 0 1.241.565 1.241 1.242 0 6.395-5.003 11.549-11.135 11.549`}),(0,x.jsx)(`path`,{fill:`#3C2415`,stroke:`#3C2415`,strokeMiterlimit:`10`,strokeWidth:`0.295`,d:`M241.683 173.139c-7.448 0-13.542-6.245-13.542-13.957a3.65 3.65 0 0 1 3.649-3.649 3.653 3.653 0 0 1 3.649 3.649c0 3.687 2.783 6.659 6.244 6.659s6.245-3.01 6.245-6.659a3.653 3.653 0 0 1 3.649-3.649 3.653 3.653 0 0 1 3.649 3.649c-.038 7.712-6.094 13.957-13.543 13.957Z`}),(0,x.jsx)(`path`,{fill:`#3C2415`,d:`M307.779 174.831c-7.448 0-13.543-6.245-13.543-13.957a3.653 3.653 0 0 1 3.649-3.649 3.63 3.63 0 0 1 3.649 3.649c0 3.687 2.822 6.659 6.245 6.659 3.461 0 6.245-3.01 6.245-6.659a3.65 3.65 0 0 1 3.649-3.649 3.653 3.653 0 0 1 3.649 3.649c-.038 7.712-6.095 13.957-13.543 13.957`}),(0,x.jsx)(u.path,{id:`sun-flares`,fill:`#F6E05E`,animate:{rotate:360},transition:{duration:20,repeat:1/0,ease:`linear`},style:{transformOrigin:`center`},d:`M269.745 83.192c-2.294 0-4.138-.903-4.138-1.994v-37.58c0-1.092 1.844-1.995 4.138-1.995 2.295 0 4.138.903 4.138 1.994v37.581c.038 1.091-1.843 1.994-4.138 1.994M214.259 98.052c-1.994 1.128-4.026 1.316-4.59.338L190.86 65.85c-.564-.94.602-2.67 2.596-3.8 1.993-1.128 4.025-1.316 4.589-.338l18.809 32.54c.565.94-.602 2.633-2.595 3.8M173.63 138.679c-1.129 1.994-2.859 3.16-3.8 2.596l-32.54-18.809c-.94-.565-.79-2.596.339-4.59 1.128-1.994 2.859-3.16 3.799-2.596l32.54 18.81c.978.526.828 2.595-.338 4.589M158.772 194.166c0 2.295-.903 4.138-1.994 4.138h-37.581c-1.091 0-1.994-1.843-1.994-4.138s.903-4.138 1.994-4.138h37.581c1.091 0 1.994 1.844 1.994 4.138M173.632 249.654c1.128 1.994 1.316 4.025.338 4.589l-32.54 18.81c-.94.564-2.671-.602-3.799-2.596s-1.317-4.025-.339-4.59l32.54-18.809c.941-.527 2.671.64 3.8 2.596M214.259 290.282c1.993 1.128 3.16 2.859 2.595 3.799l-18.809 32.54c-.564.941-2.596.79-4.589-.338s-3.16-2.859-2.596-3.8l18.809-32.54c.564-.94 2.596-.79 4.59.339M269.745 305.179c2.295 0 4.138.903 4.138 1.993v37.581c0 1.091-1.843 1.994-4.138 1.994s-4.138-.903-4.138-1.994v-37.581c0-1.128 1.881-1.993 4.138-1.993M325.271 290.282c1.994-1.129 4.025-1.317 4.59-.339l18.809 32.54c.564.94-.602 2.671-2.596 3.799s-4.025 1.317-4.589.339l-18.81-32.54c-.564-.94.602-2.633 2.596-3.799M365.899 249.654c1.128-1.994 2.859-3.16 3.799-2.596l32.54 18.809c.941.565.79 2.596-.338 4.59s-2.859 3.16-3.8 2.596l-32.54-18.81c-.978-.526-.827-2.595.339-4.589M380.758 194.166c0-2.294.903-4.138 1.994-4.138h37.58c1.091 0 1.994 1.844 1.994 4.138 0 2.295-.903 4.138-1.994 4.138h-37.58c-1.091 0-1.994-1.843-1.994-4.138M365.898 138.679c-1.128-1.994-1.316-4.025-.338-4.589l32.54-18.81c.94-.564 2.671.602 3.799 2.596s1.317 4.025.339 4.59l-32.54 18.809c-.978.526-2.671-.602-3.8-2.596M325.271 98.051c-1.994-1.129-3.16-2.859-2.596-3.8l18.81-32.54c.564-.94 2.595-.79 4.589.34 1.994 1.128 3.16 2.858 2.596 3.799l-18.809 32.54c-.565.94-2.634.79-4.59-.339`}),(0,x.jsx)(u.path,{id:`clouds`,fill:`#BEE3F8`,animate:{x:[-30,30,-30],y:[0,20,0,20,0,20,0,20,0]},transition:{duration:40,repeat:1/0,ease:`easeInOut`},d:`M547.865 67.635c0-17.642-14.314-31.956-31.956-31.956s-31.956 14.314-31.956 31.956v.73c-1.505-.457-3.1-.73-4.741-.73-8.844 0-16.001 7.157-16.001 16s7.157 15.956 16.001 15.956h68.653c8.844 0 15.955-7.157 15.955-15.955 0-8.844-7.157-16.001-15.955-16.001M64.004 332.161c0-13.357-10.805-24.161-24.161-24.161s-24.161 10.804-24.161 24.161v.547a11.7 11.7 0 0 0-3.602-.547c-6.655 0-12.08 5.425-12.08 12.08s5.425 12.081 12.08 12.081h51.924c6.655 0 12.08-5.425 12.08-12.081s-5.38-12.08-12.08-12.08M544.538 361.896c-2.051 0-4.011.319-5.88.912-5.653-7.795-14.771-12.855-25.119-12.855a30.87 30.87 0 0 0-25.118 12.855 19.3 19.3 0 0 0-5.881-.912c-10.53 0-19.055 8.525-19.055 19.055 0 10.531 8.525 19.056 19.055 19.056a19.3 19.3 0 0 0 5.881-.912c5.653 7.795 14.77 12.855 25.118 12.855a30.87 30.87 0 0 0 25.119-12.855c1.869.593 3.829.912 5.88.912 10.531 0 19.055-8.525 19.055-19.056 0-10.53-8.524-19.055-19.055-19.055M55.029 8.087c-1.231 0-2.462.182-3.602.547C47.964 3.847 42.357.747 36.066.747c-6.337 0-11.944 3.1-15.363 7.887a11.7 11.7 0 0 0-3.601-.547c-6.428 0-11.67 5.242-11.67 11.67 0 6.427 5.242 11.67 11.67 11.67 1.23 0 2.462-.183 3.601-.547 3.465 4.786 9.072 7.886 15.363 7.886 6.336 0 11.944-3.1 15.363-7.886 1.14.364 2.324.547 3.6.547 6.429 0 11.671-5.243 11.671-11.67 0-6.428-5.242-11.67-11.67-11.67`})]})}function C(){let{"queue-item":e}=v().query,{assignedQueueItems:t,queuesLoading:r}=_({showQueueAndUser:!0,allQueueItems:!0}),{project:a}=y(),o=m.useContext(),s=(0,b.useMemo)(()=>[...t??[]].filter(e=>!e.doneAt),[t]),c=(0,b.useMemo)(()=>s.map(e=>`${e.id}-${e.doneAt}`).join(`,`),[s]),u=s.find(t=>t.id===e);u||=s[0];let f=async()=>{await o.annotation.getOptimizedAnnotationQueues.invalidate(),await o.annotation.getPendingItemsCount.invalidate(),await o.annotation.getAssignedItemsCount.invalidate(),await o.annotation.getQueueItemsCounts.invalidate()};console.log(`currentQueueItem`,u);let h=m.traces.getById.useQuery({projectId:a?.id??``,traceId:u?.trace?.trace_id??``},{enabled:!!a?.id&&!!u?.trace?.trace_id,refetchOnWindowFocus:!1}),[C,T]=(0,b.useState)(null);return(0,b.useEffect)(()=>{h.data?.metadata.thread_id?T(h.data?.metadata.thread_id):T(null)},[h.data?.metadata.thread_id,u?.id]),r?(0,x.jsx)(g,{}):s.length===0&&!r?(0,x.jsx)(g,{children:(0,x.jsxs)(p,{height:`100%`,width:`full`,justify:`center`,backgroundColor:`gray.100`,marginTop:`-48px`,children:[(0,x.jsx)(S,{}),(0,x.jsx)(d,{fontSize:`xl`,fontWeight:`500`,children:`All tasks complete`}),(0,x.jsx)(d,{children:`Nice work!`})]})}):(0,x.jsx)(i,{display:`flex`,flexDirection:`column`,children:(0,x.jsxs)(p,{height:`100%`,width:`full`,gap:0,alignItems:`stretch`,position:`relative`,flex:`1`,children:[(0,x.jsx)(l,{flex:`1`,overflowY:`auto`,padding:4,paddingBottom:u?.trace?`100px`:4,position:`relative`,children:(0,x.jsx)(n,{threadId:C??``,traceId:u?.trace?.trace_id??``},u?.trace?.trace_id??u?.id)}),u?.trace&&(0,x.jsx)(l,{position:`absolute`,bottom:0,left:0,right:0,width:`full`,backgroundColor:`white`,borderTop:`1px solid`,borderColor:`border`,zIndex:10,children:(0,x.jsx)(w,{queueItems:s,currentQueueItem:u,refetchQueueItems:f},c)})]})})}var w=({queueItems:e,currentQueueItem:t,refetchQueueItems:n})=>{let i=v(),{project:o}=y(),[u,g]=(0,b.useState)(!1),_=e.findIndex(e=>e.id===t.id),S=async(e,t)=>{g(!0);let n=t?`/${o?.slug}/annotations/my-queue?queue-item=${e}&trace=${t}`:`/${o?.slug}/annotations/my-queue?queue-item=${e}`;await i.push(n),setTimeout(()=>g(!1),100)},C=m.annotation.markQueueItemDone.useMutation(),w=async()=>{C.mutate({queueItemId:t.id,projectId:o?.id??``},{onSuccess:async()=>{await n();let t=e[_+1];t?await S(t.id):(g(!0),await i.replace(`/${o?.slug}/annotations/my-queue`),setTimeout(()=>g(!1),100))}})};return(0,x.jsxs)(l,{boxShadow:`0px -3px 10px rgba(0, 0, 0, 0.05)`,padding:5,width:`full`,position:`relative`,children:[u&&(0,x.jsx)(l,{position:`absolute`,top:0,left:0,right:0,bottom:0,backgroundColor:`whiteAlpha.800`,zIndex:20,display:`flex`,alignItems:`center`,justifyContent:`center`,children:(0,x.jsx)(c,{})}),(0,x.jsx)(p,{children:(0,x.jsxs)(f,{gap:8,children:[(0,x.jsxs)(f,{gap:2,children:[(0,x.jsx)(s,{variant:`outline`,disabled:_===0||u,onClick:()=>{let t=e[_-1];t&&S(t.id)},children:(0,x.jsx)(h,{})}),(0,x.jsx)(s,{variant:`outline`,disabled:_===e.length-1||u,onClick:()=>{let t=e[_+1];t&&S(t.id)},children:(0,x.jsx)(a,{})})]}),(0,x.jsxs)(d,{children:[_+1,` of `,e.length]}),(0,x.jsxs)(s,{colorPalette:`blue`,disabled:t.doneAt!==null||C.isLoading||u,onClick:()=>{w()},children:[(0,x.jsx)(r,{}),` Done`]})]})})]})};export{C as default};
|
|
2
|
+
//# sourceMappingURL=my-queue-BLre2NMr.js.map
|