PageSourceSearch

https://hunter.io/assets/Show-xmwsx_5w.js

js hunter.io collected 2026-09-24 07:52:30 UTC 16,075 bytes, 325 lines download raw bytes

1(function() {
2	try {
3		var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {};
4		e.SENTRY_RELEASE = { id: "b96dc26" };
5		var n = new e.Error().stack;
6		n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "fbbbecde-ad58-4094-8a93-4e8f2c4c6495", e._sentryDebugIdIdentifier = "sentry-dbid-fbbbecde-ad58-4094-8a93-4e8f2c4c6495");
7	} catch (e) {}
8})();
9import { n as __esmMin } from "./rolldown-runtime-sLwMD6dS.js";
10import { M as init_currency_helper, j as CurrencyHelper } from "./controllers-jdPQjaCB.js";
11import { o as isObject, s as isString } from "./type-guards-DVyG5ljW.js";
12import { i as require_compiler_runtime, t as require_jsx_runtime } from "./jsx-runtime-CHSMGLHp.js";
13import { t as require_react } from "./react-CrLPhuc5.js";
14import { n as init_icon, t as Icon } from "./icon-BNzYbsdJ.js";
15import { r as init_button, t as Button } from "./button-DOiPZHfy.js";
16import { a as init_tooltip, r as TooltipProvider } from "./tooltip-HHfiWInP.js";
17import { a as init_key_value, i as KeyValueTitle, n as KeyValueDescription, r as KeyValueItem, t as KeyValue } from "./key-value-BT2BBBdT.js";
18import { a as init_dist, s as usePage, t as Head_default } from "./dist-ZlUHm0R7.js";
19import { r as init_AppLayout, t as AppLayout } from "./AppLayout-KSwds5qH.js";
20import { n as init_ConfirmDeletionDialog, t as ConfirmDeletionDialog } from "./ConfirmDeletionDialog-SRcPoDPF.js";
21import { n as init_CompaniesListSidebar, t as CompaniesListSidebar } from "./CompaniesListSidebar-Cl-ySDYT.js";
22import { a as ImportProgressBar, i as useCompaniesImportProgress, n as usePersistedImportRefresh, o as init_ImportProgressBar, r as init_useCompaniesImportProgress, t as init_usePersistedImportRefresh } from "./usePersistedImportRefresh-xAW72dUm.js";
23import { n as useFlashMessages, t as init_useFlashMessages } from "./useFlashMessages-CIiIqxbs.js";
24import { n as init_WizardPageHeader, t as WizardPageHeader } from "./WizardPageHeader-C92Thgv0.js";
25import { i as reloadCompaniesSidebar, n as visitCompanyList, r as init_reloadCompaniesSidebar, t as init_visitCompanyList } from "./visitCompanyList-CVUrbqVZ.js";
26//#region app/frontend/pages/CompaniesImports/Show.tsx
27function Show() {
28	const { props } = usePage();
29	const { companiesImport, sharedWorkspace, indexPath, sidebar } = props;
30	useFlashMessages(props.flash);
31	const [errorsVisible, setErrorsVisible] = (0, import_react.useState)(false);
32	const [confirmingDeletion, setConfirmingDeletion] = (0, import_react.useState)(false);
33	const operation = useCompaniesImportProgress({
34		companiesImportId: companiesImport.id,
35		enabled: !companiesImport.finished,
36		initialOperation: companiesImport.operation ?? null
37	});
38	const finished = companiesImport.finished || operation?.status === "finished";
39	const importPersisted = companiesImport.finished;
40	const processedLines = operation && !importPersisted ? operation.processedCount : companiesImport.linesImported;
41	const linesImported = operation && !importPersisted ? operation.successCount : companiesImport.linesImported;
42	const successfulLines = importPersisted ? companiesImport.linesImported : operation?.successCount ?? 0;
43	const failedLines = importPersisted ? companiesImport.notImportedCompaniesCount : operation?.failedCount ?? 0;
44	const errorCsvUrl = companiesImport.errorCsvUrl ?? operation?.errorFileUrl ?? null;
45	const terminal = operation ? TERMINAL_OPERATION_STATUSES.includes(operation.status) : false;
46	const finishedOnMountRef = (0, import_react.useRef)(companiesImport.finished);
47	usePersistedImportRefresh({
48		shouldStart: (companiesImport.finished || terminal) && !finishedOnMountRef.current,
49		keepRefreshing: !companiesImport.finished || companiesImport.notImportedCompaniesCount > 0 && companiesImport.errorCsvUrl === null
50	});
51	const errorLog = (0, import_react.useMemo)(() => parseErrorLog(companiesImport.errorLogJson), [companiesImport.errorLogJson]);
52	const errorRows = Object.entries(errorLog);
53	const title = t("title", {
54		count: linesImported,
55		formatted_count: CurrencyHelper.numberWithDelimiter(linesImported)
56	});
57	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipProvider, { children: [
58		/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Head_default, { title }),
59		/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", {
60			className: "dashboard-main",
61			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
62				className: "dashboard-main__submenu",
63				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompaniesListSidebar, {
64					isCompaniesSurface: false,
65					sidebar,
66					currentListId: null,
67					onListSelect: visitCompanyList,
68					onListCreated: reloadCompaniesSidebar
69				})
70			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
71				className: "dashboard-main__content",
72				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
73					className: "board-box",
74					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WizardPageHeader, {
75						indexPath,
76						breadcrumbLabel: t("import_title"),
77						title
78					}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
79						className: "leads-import-details",
80						children: [
81							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
82								id: "progress-bar-container",
83								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImportProgressBar, {
84									linesImported: processedLines,
85									linesExceptHeaders: companiesImport.linesExceptHeaders,
86									finished,
87									createdAt: companiesImport.createdAt,
88									successfulLines,
89									failedLines,
90									errorCsvDownloadUrl: operation ? errorCsvUrl : null
91								})
92							}),
93							/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
94								className: "mt-6",
95								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
96									className: "fw-medium",
97									children: companiesImport.fileName
98								}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
99									className: "text-size-xs text-hint",
100									children: t("file_info", {
101										rows: CurrencyHelper.numberWithDelimiter(companiesImport.linesExceptHeaders),
102										columns: companiesImport.columnCount
103									})
104								})]
105							}),
106							finished && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
107								className: "leads-import-overview mt-3",
108								children: [
109									/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
110										icon: "check-circle",
111										className: "leads-import-overview__icon green"
112									}),
113									/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
114										className: "leads-import-overview__label",
115										children: t("imported_companies")
116									}),
117									/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
118										className: "leads-import-overview__value",
119										children: CurrencyHelper.numberWithDelimiter(linesImported)
120									})
121								]
122							}),
123							errorRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
124								className: "leads-import-overview",
125								children: [
126									/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
127										icon: "exclamation-circle",
128										className: "leads-import-overview__icon red"
129									}),
130									/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
131										className: "leads-import-overview__label",
132										children: [
133											t("failed_companies"),
134											" ",
135											/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
136												variant: "linkGrey",
137												size: "sm",
138												onClick: () => setErrorsVisible((visible) => !visible),
139												children: errorsVisible ? t("hide_details") : t("see_details")
140											})
141										]
142									}),
143									/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", {
144										className: "leads-import-overview__value",
145										children: [errorCsvUrl !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
146											variant: "linkGrey",
147											size: "sm",
148											className: "me-2",
149											asChild: true,
150											children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
151												href: errorCsvUrl,
152												children: t("download_as_csv")
153											})
154										}), CurrencyHelper.numberWithDelimiter(companiesImport.notImportedCompaniesCount)]
155									})
156								]
157							}), errorsVisible && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
158								className: "leads-import-errors",
159								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
160									className: "leads-import-errors__table",
161									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("row") }
161), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("error") })] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: errorRows.map(([row, errorData]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
162										className: "ff-code",
163										children: row
164									}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatRowErrors(errorData) })] }, row)) })]
165								}), companiesImport.errorLogCount >= ERROR_LOG_DISPLAY_LIMIT && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
166									className: "my-2 mx-5 text-hint",
167									children: t("first_displayed")
168								})]
169							})] }),
170							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
171								className: "fw-medium text-body mt-10 mb-4",
172								children: t("configuration_details")
173							}),
174							/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KeyValue, {
175								inline: true,
176								children: [
177									/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KeyValueItem, {
178										className: "mb-4",
179										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueTitle, { children: t("file_name") }
179), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueDescription, { children: companiesImport.fileName })]
180									}),
181									/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KeyValueItem, {
182										className: "mb-4",
183										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueTitle, { children: t("destination_list") }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueDescription, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DestinationList, { companiesImport }) })]
184									}),
185									companiesImport.companyList !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KeyValueItem, {
186										className: "mb-4",
187										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueTitle, { children: t("existing_companies.title") }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueDescription, { children: t(`existing_companies.${companiesImport.existingCompaniesHandling}`) })]
188									}),
189									/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KeyValueItem, {
190										className: "mb-4",
191										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueTitle, { children: t("created_on") }
191), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueDescription, { children: companiesImport.createdAtLabel })]
192									}),
193									sharedWorkspace && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KeyValueItem, {
194										className: "mb-4",
195										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueTitle, { children: t("created_by") }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueDescription, { children: companiesImport.createdBy })]
196									})
197								]
198							}),
199							companiesImport.canDestroy && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("hr", { className: "mt-10 mb-4" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
200								variant: "dangerLight",
201								size: "sm",
202								onClick: () => setConfirmingDeletion(true),
203								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { icon: "trash-alt" }), t("delete")]
204							})] })
205						]
206					})]
207				})
208			})]
209		}),
210		/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmDeletionDialog, {
211			isOpen: confirmingDeletion,
212			onClose: () => setConfirmingDeletion(false),
213			title: t("confirm_delete_title"),
214			content: t("confirm_delete_description"),
215			buttonLabel: t("delete"),
216			deletePath: companiesImport.path
217		})
218	] });
219}
220/** Three-way destination-list cell, same order as the HAML. */
221function DestinationList(t0) {
222	const $ = (0, import_compiler_runtime.c)(5);
223	const { companiesImport } = t0;
224	if (companiesImport.companyList !== null) {
225		let t1;
226		if ($[0] !== companiesImport.companyList.name || $[1] !== companiesImport.companyList.path) {
227			t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
228				variant: "linkGrey",
229				asChild: true,
230				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
231					href: companiesImport.companyList.path,
232					children: companiesImport.companyList.name
233				})
234			});
235			$[0] = companiesImport.companyList.name;
236			$[1] = companiesImport.companyList.path;
237			$[2] = t1;
238		} else t1 = $[2];
239		return t1;
240	}
241	if (companiesImport.companyListId !== null) {
242		let t1;
243		if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
244			t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
245				className: "text-hint",
246				children: t("not_exists_list")
247			});
248			$[3] = t1;
249		} else t1 = $[3];
250		return t1;
251	}
252	let t1;
253	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
254		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
255			className: "text-hint",
256			children: t("all_companies")
257		});
258		$[4] = t1;
259	} else t1 = $[4];
260	return t1;
261}
262function parseErrorLog(errorLogJson) {
263	if (!errorLogJson) return {};
264	try {
265		const parsed = JSON.parse(errorLogJson);
266		if (!parsed || !isObject(parsed) || Array.isArray(parsed)) return {};
267		return parsed;
268	} catch {
269		return {};
270	}
271}
272/**
273* Flattens one row of the error log the way the HAML did: skip the
274* "original_row" key, then render each attribute's value in whichever of its
275* three shapes it arrived — String, Array<String>, or Array<Hash> carrying
276* "details"/"message". A non-object row renders nothing, like the HAML's
277* missing `else` branch.
278*/
279function formatRowErrors(errorData) {
280	if (!isObject(errorData) || errorData === null) return "";
281	const messages = [];
282	for (const [attribute, errorList] of Object.entries(errorData)) {
283		if (attribute === "original_row") continue;
284		if (Array.isArray(errorList)) {
285			for (const error of errorList) if (isString(error)) messages.push(error);
286			else if (error && isObject(error)) messages.push(error.details || error.message || String(error));
287		} else messages.push(String(errorList));
288	}
289	return messages.join(" ");
290}
291var import_compiler_runtime, import_react, import_jsx_runtime, t, ERROR_LOG_DISPLAY_LIMIT, TERMINAL_OPERATION_STATUSES;
292function init_Show() {
293	return (init_Show = __esmMin((() => {
294		import_compiler_runtime = require_compiler_runtime();
295		init_dist();
296		import_react = require_react();
297		init_AppLayout();
298		init_button();
299		init_currency_helper();
300		init_icon();
301		init_key_value();
302		init_tooltip();
303		init_ConfirmDeletionDialog();
304		init_useFlashMessages();
305		init_CompaniesListSidebar();
306		init_ImportProgressBar();
307		init_WizardPageHeader();
308		init_useCompaniesImportProgress();
309		init_usePersistedImportRefresh();
310		init_reloadCompaniesSidebar();
311		init_visitCompanyList();
312		import_jsx_runtime = require_jsx_runtime();
313		t = (key, options) => i18n.t(`js.companies_imports.show.${key}`, options);
314		ERROR_LOG_DISPLAY_LIMIT = 20;
315		TERMINAL_OPERATION_STATUSES = [
316			"finished",
317			"failed",
318			"canceled"
319		];
320		Show.layout = (page) => (0, import_react.createElement)(AppLayout, { navCollapsed: true }, page);
321	})))();
322}
323//#endregion
324init_Show();
325export { Show as default };

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.