PageSourceSearch

https://app.transactency.com/assets/contracts-Lo-kfNsI.js

js transactency.com collected 2026-10-04 03:54:22 UTC 4,968 bytes, 131 lines download raw bytes

1import { j as createSignal, z as createResource, B as createEffect, A as onMount, a as createComponent, w as memo, S as Show } from "./suid-material-beZszf02.js";
2import { u as useAuth, g as useLocation, c as useToast, h as useOrganization, d as apiClient, l as logger, R as RouteLoading } from "./index-D967GsUD.js";
3import { D as Dashboard } from "./Dashboard-DcJeq5SH.js";
4import { p as performanceLogger } from "./performanceLogger-CBSM28jc.js";
5import { h as handleEnvExchangeSupportQuery } from "./Nav-CablUE1w.js";
6import "./suid-icons-BVoj-b7W.js";
7import "./FirstUseModal-n-Arg6Im.js";
8import "./AppIconButton-D7UwNbyJ.js";
9import "./firstUseModalHelpers-C_IqPerG.js";
10import "./helpS3Urls-DQj1Gxwt.js";
11import "./BindDropdowns-DGjmkPlQ.js";
12import "./contentDispositionFilename-BDP-SJLT.js";
13import "./browser.umd-YwivngSI.js";
14import "./CreateContractModal-BXZCDHM6.js";
15import "./index-Ds5MqEm-.js";
16import "./featureFlags-DDJbx1WI.js";
17import "./partyUtils-Bl9jBxI3.js";
18import "./components-B14In4Ni.js";
19import "./logo-CkfnQ46G.js";
20async function loadContracts(page, pageSize, organizationId, includeArchived) {
21  return apiClient.contracts.list(page, pageSize, organizationId, includeArchived);
22}
23async function loadTemplates(page, pageSize) {
24  return apiClient.templates.list(page, pageSize);
25}
26function ContractsPage() {
27  const {
28    user
29  } = useAuth();
30  const location = useLocation();
31  const toast = useToast();
32  const {
33    selectedOrganization
34  } = useOrganization();
35  const [contractsPage, setContractsPage] = createSignal(1);
36  const [templatesPage, setTemplatesPage] = createSignal(1);
37  const [includeArchived, setIncludeArchived] = createSignal(false);
38  const [lastRouteErrorToast, setLastRouteErrorToast] = createSignal(null);
39  const pageSize = 10;
40  const [contracts, {
41    refetch: refetchContracts
42  }] = createResource(() => {
43    var _a;
44    return {
45      page: contractsPage(),
46      pageSize,
47      organizationId: (_a = selectedOrganization()) == null ? void 0 : _a._id,
48      includeArchived: includeArchived()
49    };
50  }, (params) => loadContracts(params.page, params.pageSize, params.organizationId, params.includeArchived));
51  const [templates] = createResource(() => ({
52    page: templatesPage(),
53    pageSize
54  }), (params) => loadTemplates(params.page, params.pageSize));
55  createEffect(() => {
56    var _a;
57    const routeState = location.state;
58    const routeError = (_a = routeState == null ? void 0 : routeState.createContractFromTemplateError) == null ? void 0 : _a.trim();
59    if (!routeError) return;
60    if (lastRouteErrorToast() === routeError) return;
61    toast.showToast("error", routeError, "Contract Creation Error");
62    setLastRouteErrorToast(routeError);
63  });
64  onMount(async () => {
65    performanceLogger.startPageLoad("ContractsPage");
66    handleEnvExchangeSupportQuery((severity, message, title) => {
67      toast.showToast(severity, message, title);
68    });
69    if (typeof window !== "undefined") {
70      try {
71        const pendingContracts = JSON.parse(sessionStorage.getItem("pendingTemplateContracts") || "[]");
72        if (pendingContracts.length > 0) {
73          const remainingContracts = [];
74          for (const contractId of pendingContracts) {
75            try {
76              const cleanupStatus = await apiClient.contracts.deleteIfNoParties(contractId);
77              if (cleanupStatus === 401) {
78                window.location.href = "/";
79                return;
80              }
81              if (cleanupStatus !== 200 && cleanupStatus !== 404) {
82                remainingContracts.push(contractId);
83              }
84            } catch (error) {
85              logger.warn({
86                message: "Error cleaning up pending contract",
87                contractId,
88                error
89              });
90              remainingContracts.push(contractId);
91            }
92          }
93          if (remainingContracts.length > 0) {
94            sessionStorage.setItem("pendingTemplateContracts", JSON.stringify(remainingContracts));
95          } else {
96            sessionStorage.removeItem("pendingTemplateContracts");
97          }
98        }
99      } catch (error) {
100        logger.warn({
101          message: "Error reading pendingTemplateContracts from sessionStorage",
102          error
103        });
104      }
105    }
106    refetchContracts();
107  });
108  return createComponent(Show, {
109    get when() {
110      return memo(() => !!!contracts.loading)() && !templates.loading;
111    },
112    get fallback() {
113      return createComponent(RouteLoading, {});
114    },
115    get children() {
116      return createComponent(Dashboard, {
117        user,
118        contracts: () => contracts(),
119        templates: () => templates(),
120        onContractsPageChange: setContractsPage,
121        onTemplatesPageChange: setTemplatesPage,
122        includeArchived,
123        onToggleArchived: setIncludeArchived,
124        onRefreshContracts: () => refetchContracts()
125      });
126    }
127  });
128}
129export {
130  ContractsPage as default
131};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.