@open-mercato/core 0.6.7-develop.6788.1.c2a1520a30 → 0.6.7-develop.6795.1.8a3f27921c
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/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities.ids.generated.js +1 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/modules/customers/cli.js +17 -7
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/search.js +50 -29
- package/dist/modules/customers/search.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/[id]/route.js +22 -9
- package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/route.js +13 -4
- package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +7 -2
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/api/run.js +7 -2
- package/dist/modules/data_sync/api/run.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js +7 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/route.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/runs.js +7 -2
- package/dist/modules/data_sync/api/runs.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/[id]/route.js +19 -6
- package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/route.js +13 -4
- package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
- package/dist/modules/data_sync/api/validate.js +9 -4
- package/dist/modules/data_sync/api/validate.js.map +2 -2
- package/dist/modules/design_system/acl.js +9 -0
- package/dist/modules/design_system/acl.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.js +11 -0
- package/dist/modules/design_system/backend/design-system/page.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js +15 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +52 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +7 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js +63 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js +163 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +7 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js +9 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/banners.js +186 -0
- package/dist/modules/design_system/gallery/entries/banners.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/buttons.js +361 -0
- package/dist/modules/design_system/gallery/entries/buttons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/charts.js +457 -0
- package/dist/modules/design_system/gallery/entries/charts.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/dates.js +306 -0
- package/dist/modules/design_system/gallery/entries/dates.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/detail.js +358 -0
- package/dist/modules/design_system/gallery/entries/detail.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/display.js +785 -0
- package/dist/modules/design_system/gallery/entries/display.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/feedback.js +658 -0
- package/dist/modules/design_system/gallery/entries/feedback.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/filters.js +505 -0
- package/dist/modules/design_system/gallery/entries/filters.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/foundations.js +453 -0
- package/dist/modules/design_system/gallery/entries/foundations.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/icons.js +140 -0
- package/dist/modules/design_system/gallery/entries/icons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/inputs.js +1217 -0
- package/dist/modules/design_system/gallery/entries/inputs.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/messages.js +334 -0
- package/dist/modules/design_system/gallery/entries/messages.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/navigation.js +475 -0
- package/dist/modules/design_system/gallery/entries/navigation.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/notifications.js +257 -0
- package/dist/modules/design_system/gallery/entries/notifications.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/overlays.js +576 -0
- package/dist/modules/design_system/gallery/entries/overlays.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js +378 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/schedule.js +297 -0
- package/dist/modules/design_system/gallery/entries/schedule.js.map +7 -0
- package/dist/modules/design_system/gallery/registry.js +139 -0
- package/dist/modules/design_system/gallery/registry.js.map +7 -0
- package/dist/modules/design_system/gallery/types.js +1 -0
- package/dist/modules/design_system/gallery/types.js.map +7 -0
- package/dist/modules/design_system/index.js +9 -0
- package/dist/modules/design_system/index.js.map +7 -0
- package/dist/modules/design_system/setup.js +14 -0
- package/dist/modules/design_system/setup.js.map +7 -0
- package/dist/modules/inbox_ops/search.js +15 -4
- package/dist/modules/inbox_ops/search.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +11 -5
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/health/route.js +6 -3
- package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/route.js +6 -3
- package/dist/modules/integrations/api/[id]/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/state/route.js +6 -3
- package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/version/route.js +6 -3
- package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
- package/dist/modules/integrations/api/logs/route.js +6 -3
- package/dist/modules/integrations/api/logs/route.js.map +2 -2
- package/dist/modules/integrations/api/route.js +6 -3
- package/dist/modules/integrations/api/route.js.map +2 -2
- package/dist/modules/integrations/api/umes-read.js +2 -2
- package/dist/modules/integrations/api/umes-read.js.map +2 -2
- package/dist/modules/integrations/lib/organization-scope.js +2 -9
- package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
- package/dist/modules/messages/search.js +10 -5
- package/dist/modules/messages/search.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +2 -1
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +32 -50
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +17 -0
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +7 -0
- package/generated/entities.ids.generated.ts +1 -0
- package/package.json +16 -16
- package/src/modules/customers/cli.ts +17 -7
- package/src/modules/customers/i18n/de.json +17 -0
- package/src/modules/customers/i18n/en.json +17 -0
- package/src/modules/customers/i18n/es.json +17 -0
- package/src/modules/customers/i18n/pl.json +17 -0
- package/src/modules/customers/search.ts +59 -27
- package/src/modules/data_sync/AGENTS.md +1 -0
- package/src/modules/data_sync/api/mappings/[id]/route.ts +22 -9
- package/src/modules/data_sync/api/mappings/route.ts +13 -4
- package/src/modules/data_sync/api/options.ts +7 -2
- package/src/modules/data_sync/api/run.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +8 -3
- package/src/modules/data_sync/api/runs/[id]/retry.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/route.ts +8 -3
- package/src/modules/data_sync/api/runs.ts +7 -2
- package/src/modules/data_sync/api/schedules/[id]/route.ts +19 -6
- package/src/modules/data_sync/api/schedules/route.ts +13 -4
- package/src/modules/data_sync/api/validate.ts +9 -4
- package/src/modules/design_system/AGENTS.md +34 -0
- package/src/modules/design_system/acl.ts +5 -0
- package/src/modules/design_system/backend/design-system/page.meta.ts +11 -0
- package/src/modules/design_system/backend/design-system/page.tsx +14 -0
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +55 -0
- package/src/modules/design_system/gallery/components/EntryCard.tsx +95 -0
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +206 -0
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +15 -0
- package/src/modules/design_system/gallery/entries/banners.tsx +226 -0
- package/src/modules/design_system/gallery/entries/buttons.tsx +422 -0
- package/src/modules/design_system/gallery/entries/charts.tsx +518 -0
- package/src/modules/design_system/gallery/entries/dates.tsx +325 -0
- package/src/modules/design_system/gallery/entries/detail.tsx +403 -0
- package/src/modules/design_system/gallery/entries/display.tsx +893 -0
- package/src/modules/design_system/gallery/entries/feedback.tsx +746 -0
- package/src/modules/design_system/gallery/entries/filters.tsx +570 -0
- package/src/modules/design_system/gallery/entries/foundations.tsx +529 -0
- package/src/modules/design_system/gallery/entries/icons.tsx +168 -0
- package/src/modules/design_system/gallery/entries/inputs.tsx +1516 -0
- package/src/modules/design_system/gallery/entries/messages.tsx +339 -0
- package/src/modules/design_system/gallery/entries/navigation.tsx +573 -0
- package/src/modules/design_system/gallery/entries/notifications.tsx +285 -0
- package/src/modules/design_system/gallery/entries/overlays.tsx +677 -0
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +430 -0
- package/src/modules/design_system/gallery/entries/schedule.tsx +307 -0
- package/src/modules/design_system/gallery/registry.ts +152 -0
- package/src/modules/design_system/gallery/types.ts +32 -0
- package/src/modules/design_system/i18n/.hardcoded-allowlist.json +71 -0
- package/src/modules/design_system/i18n/de.json +46 -0
- package/src/modules/design_system/i18n/en.json +46 -0
- package/src/modules/design_system/i18n/es.json +46 -0
- package/src/modules/design_system/i18n/pl.json +46 -0
- package/src/modules/design_system/index.ts +7 -0
- package/src/modules/design_system/setup.ts +12 -0
- package/src/modules/inbox_ops/i18n/de.json +3 -0
- package/src/modules/inbox_ops/i18n/en.json +3 -0
- package/src/modules/inbox_ops/i18n/es.json +3 -0
- package/src/modules/inbox_ops/i18n/pl.json +3 -0
- package/src/modules/inbox_ops/search.ts +20 -4
- package/src/modules/integrations/api/[id]/credentials/route.ts +11 -5
- package/src/modules/integrations/api/[id]/health/route.ts +6 -3
- package/src/modules/integrations/api/[id]/route.ts +6 -3
- package/src/modules/integrations/api/[id]/state/route.ts +6 -3
- package/src/modules/integrations/api/[id]/version/route.ts +6 -3
- package/src/modules/integrations/api/logs/route.ts +6 -3
- package/src/modules/integrations/api/route.ts +6 -3
- package/src/modules/integrations/api/umes-read.ts +2 -2
- package/src/modules/integrations/lib/organization-scope.ts +5 -25
- package/src/modules/messages/i18n/de.json +2 -0
- package/src/modules/messages/i18n/en.json +2 -0
- package/src/modules/messages/i18n/es.json +2 -0
- package/src/modules/messages/i18n/pl.json +2 -0
- package/src/modules/messages/search.ts +11 -5
- package/src/modules/query_index/data/entities.ts +7 -0
- package/src/modules/query_index/lib/engine.ts +40 -63
- package/src/modules/query_index/migrations/.snapshot-open-mercato.json +12 -0
- package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +35 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
1
2
|
import { CUSTOMER_INTERACTION_TASK_SOURCE, EXAMPLE_TODO_SOURCE } from "./lib/interactionCompatibility.js";
|
|
2
3
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
3
4
|
const logger = createLogger("customers");
|
|
@@ -357,12 +358,12 @@ function ensureFallbackLines(lines, record, options = {}) {
|
|
|
357
358
|
}
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
|
-
function resolvePersonPresenter(record, entity, customFields) {
|
|
361
|
+
function resolvePersonPresenter(translate, record, entity, customFields) {
|
|
361
362
|
const fallbackEntityId = resolveCustomerEntityId(record);
|
|
362
363
|
const firstName = record.first_name ?? record.firstName ?? customFields.first_name ?? customFields.firstName ?? "";
|
|
363
364
|
const lastName = record.last_name ?? record.lastName ?? customFields.last_name ?? customFields.lastName ?? "";
|
|
364
365
|
const nameParts = [firstName, lastName].filter(Boolean).join(" ");
|
|
365
|
-
const title = pickValue(entity, "display_name", "displayName") ?? record.preferred_name ?? record.preferredName ?? (nameParts.length ? nameParts : void 0) ?? fallbackEntityId ?? record.id ?? "Person";
|
|
366
|
+
const title = pickValue(entity, "display_name", "displayName") ?? record.preferred_name ?? record.preferredName ?? (nameParts.length ? nameParts : void 0) ?? fallbackEntityId ?? record.id ?? translate("customers.search.fallback.person", "Person");
|
|
366
367
|
const subtitlePieces = [];
|
|
367
368
|
const jobTitle = record.job_title ?? record.jobTitle ?? customFields.job_title ?? customFields.jobTitle;
|
|
368
369
|
if (jobTitle) subtitlePieces.push(String(jobTitle));
|
|
@@ -380,12 +381,12 @@ function resolvePersonPresenter(record, entity, customFields) {
|
|
|
380
381
|
title: String(title),
|
|
381
382
|
subtitle: subtitlePieces.length ? subtitlePieces.join(" \xB7 ") : void 0,
|
|
382
383
|
icon: "user",
|
|
383
|
-
badge: pickValue(entity, "display_name", "displayName") ? "Person" : void 0
|
|
384
|
+
badge: pickValue(entity, "display_name", "displayName") ? translate("customers.search.badge.person", "Person") : void 0
|
|
384
385
|
};
|
|
385
386
|
}
|
|
386
|
-
function resolveCompanyPresenter(record, entity, customFields) {
|
|
387
|
+
function resolveCompanyPresenter(translate, record, entity, customFields) {
|
|
387
388
|
const fallbackEntityId = resolveCustomerEntityId(record);
|
|
388
|
-
const title = pickValue(entity, "display_name", "displayName") ?? customFields.display_name ?? customFields.displayName ?? record.brand_name ?? record.legal_name ?? record.domain ?? record.brandName ?? record.legalName ?? (entity?.id && entity?.display_name ? entity.display_name : void 0) ?? fallbackEntityId ?? record.id ?? "Company";
|
|
389
|
+
const title = pickValue(entity, "display_name", "displayName") ?? customFields.display_name ?? customFields.displayName ?? record.brand_name ?? record.legal_name ?? record.domain ?? record.brandName ?? record.legalName ?? (entity?.id && entity?.display_name ? entity.display_name : void 0) ?? fallbackEntityId ?? record.id ?? translate("customers.search.fallback.company", "Company");
|
|
389
390
|
const subtitlePieces = [];
|
|
390
391
|
const industry = record.industry;
|
|
391
392
|
if (industry) subtitlePieces.push(String(industry));
|
|
@@ -411,7 +412,7 @@ function resolveCompanyPresenter(record, entity, customFields) {
|
|
|
411
412
|
title: String(title),
|
|
412
413
|
subtitle: subtitlePieces.length ? subtitlePieces.join(" \xB7 ") : void 0,
|
|
413
414
|
icon: "building",
|
|
414
|
-
badge: pickValue(entity, "display_name", "displayName") ? "Company" : void 0
|
|
415
|
+
badge: pickValue(entity, "display_name", "displayName") ? translate("customers.search.badge.company", "Company") : void 0
|
|
415
416
|
};
|
|
416
417
|
}
|
|
417
418
|
function logMissingPresenterTitle(kind, record, entity, presenter) {
|
|
@@ -437,6 +438,7 @@ const searchConfig = {
|
|
|
437
438
|
priority: 10,
|
|
438
439
|
buildSource: async (ctx) => {
|
|
439
440
|
assertTenantContext(ctx);
|
|
441
|
+
const { t } = await resolveTranslations();
|
|
440
442
|
const lines = [];
|
|
441
443
|
const record = ctx.record;
|
|
442
444
|
appendLine(lines, "Preferred name", record.preferred_name ?? record.preferredName ?? ctx.customFields.preferred_name);
|
|
@@ -471,9 +473,9 @@ const searchConfig = {
|
|
|
471
473
|
recordKeys: Object.keys(record)
|
|
472
474
|
});
|
|
473
475
|
}
|
|
474
|
-
const presenter = resolvePersonPresenter(record, entity, ctx.customFields);
|
|
476
|
+
const presenter = resolvePersonPresenter(t, record, entity, ctx.customFields);
|
|
475
477
|
logMissingPresenterTitle("person", record, entity, presenter);
|
|
476
|
-
const presenterLabel = pickLabel(presenter.title) ?? "Open person";
|
|
478
|
+
const presenterLabel = pickLabel(presenter.title) ?? t("customers.search.link.openPerson", "Open person");
|
|
477
479
|
const links = [];
|
|
478
480
|
if (entityId) {
|
|
479
481
|
const href = buildCustomerUrl("person", entityId);
|
|
@@ -495,19 +497,21 @@ const searchConfig = {
|
|
|
495
497
|
},
|
|
496
498
|
formatResult: async (ctx) => {
|
|
497
499
|
assertTenantContext(ctx);
|
|
500
|
+
const { t } = await resolveTranslations();
|
|
498
501
|
const entity = await getCustomerEntity(ctx, resolveCustomerEntityId(ctx.record));
|
|
499
|
-
return resolvePersonPresenter(ctx.record, entity, ctx.customFields);
|
|
502
|
+
return resolvePersonPresenter(t, ctx.record, entity, ctx.customFields);
|
|
500
503
|
},
|
|
501
504
|
resolveUrl: async (ctx) => {
|
|
502
505
|
const entityId = resolveCustomerEntityId(ctx.record);
|
|
503
506
|
return buildCustomerUrl("person", entityId);
|
|
504
507
|
},
|
|
505
508
|
resolveLinks: async (ctx) => {
|
|
509
|
+
const { t } = await resolveTranslations();
|
|
506
510
|
const entityId = resolveCustomerEntityId(ctx.record);
|
|
507
511
|
if (!entityId) return null;
|
|
508
512
|
const href = buildCustomerUrl("person", entityId);
|
|
509
513
|
if (!href) return null;
|
|
510
|
-
return [{ href: `${href}/edit`, label: "Edit", kind: "secondary" }];
|
|
514
|
+
return [{ href: `${href}/edit`, label: t("customers.search.link.edit", "Edit"), kind: "secondary" }];
|
|
511
515
|
},
|
|
512
516
|
fieldPolicy: {
|
|
513
517
|
searchable: [
|
|
@@ -535,6 +539,7 @@ const searchConfig = {
|
|
|
535
539
|
priority: 10,
|
|
536
540
|
buildSource: async (ctx) => {
|
|
537
541
|
assertTenantContext(ctx);
|
|
542
|
+
const { t } = await resolveTranslations();
|
|
538
543
|
const lines = [];
|
|
539
544
|
const record = ctx.record;
|
|
540
545
|
appendLine(lines, "Legal name", record.legal_name ?? record.legalName ?? ctx.customFields.legal_name);
|
|
@@ -552,9 +557,9 @@ const searchConfig = {
|
|
|
552
557
|
appendCustomerEntityLines(lines, entity, "Primary");
|
|
553
558
|
ensureFallbackLines(lines, record);
|
|
554
559
|
if (!lines.length) return null;
|
|
555
|
-
const presenter = resolveCompanyPresenter(record, entity, ctx.customFields);
|
|
560
|
+
const presenter = resolveCompanyPresenter(t, record, entity, ctx.customFields);
|
|
556
561
|
logMissingPresenterTitle("company", record, entity, presenter);
|
|
557
|
-
const primaryLabel = pickLabel(presenter.title) ?? "Open company";
|
|
562
|
+
const primaryLabel = pickLabel(presenter.title) ?? t("customers.search.link.openCompany", "Open company");
|
|
558
563
|
const links = [];
|
|
559
564
|
if (entityId) {
|
|
560
565
|
const href = buildCustomerUrl("company", entityId);
|
|
@@ -576,19 +581,21 @@ const searchConfig = {
|
|
|
576
581
|
},
|
|
577
582
|
formatResult: async (ctx) => {
|
|
578
583
|
assertTenantContext(ctx);
|
|
584
|
+
const { t } = await resolveTranslations();
|
|
579
585
|
const entity = await getCustomerEntity(ctx, resolveCustomerEntityId(ctx.record));
|
|
580
|
-
return resolveCompanyPresenter(ctx.record, entity, ctx.customFields);
|
|
586
|
+
return resolveCompanyPresenter(t, ctx.record, entity, ctx.customFields);
|
|
581
587
|
},
|
|
582
588
|
resolveUrl: async (ctx) => {
|
|
583
589
|
const entityId = resolveCustomerEntityId(ctx.record);
|
|
584
590
|
return buildCustomerUrl("company", entityId);
|
|
585
591
|
},
|
|
586
592
|
resolveLinks: async (ctx) => {
|
|
593
|
+
const { t } = await resolveTranslations();
|
|
587
594
|
const entityId = resolveCustomerEntityId(ctx.record);
|
|
588
595
|
if (!entityId) return null;
|
|
589
596
|
const href = buildCustomerUrl("company", entityId);
|
|
590
597
|
if (!href) return null;
|
|
591
|
-
return [{ href: `${href}/edit`, label: "Edit", kind: "secondary" }];
|
|
598
|
+
return [{ href: `${href}/edit`, label: t("customers.search.link.edit", "Edit"), kind: "secondary" }];
|
|
592
599
|
},
|
|
593
600
|
fieldPolicy: {
|
|
594
601
|
searchable: [
|
|
@@ -638,8 +645,9 @@ const searchConfig = {
|
|
|
638
645
|
},
|
|
639
646
|
formatResult: async (ctx) => {
|
|
640
647
|
assertTenantContext(ctx);
|
|
648
|
+
const { t } = await resolveTranslations();
|
|
641
649
|
const parent = await getCustomerEntity(ctx, ctx.record.entity_id ?? ctx.record.entityId);
|
|
642
|
-
const title = parent?.display_name ?? "Customer note";
|
|
650
|
+
const title = parent?.display_name ?? t("customers.search.fallback.customerNote", "Customer note");
|
|
643
651
|
return {
|
|
644
652
|
title,
|
|
645
653
|
subtitle: snippet(ctx.record.body),
|
|
@@ -654,15 +662,16 @@ const searchConfig = {
|
|
|
654
662
|
},
|
|
655
663
|
resolveLinks: async (ctx) => {
|
|
656
664
|
assertTenantContext(ctx);
|
|
665
|
+
const { t } = await resolveTranslations();
|
|
657
666
|
const links = [];
|
|
658
667
|
const parent = await getCustomerEntity(ctx, ctx.record.entity_id ?? ctx.record.entityId);
|
|
659
668
|
const parentUrl = buildCustomerUrl(parent?.kind ?? null, parent?.id ?? ctx.record.entity_id ?? ctx.record.entityId);
|
|
660
669
|
if (parentUrl) {
|
|
661
|
-
links.push({ href: parentUrl, label: parent?.display_name ?? "View customer", kind: "primary" });
|
|
670
|
+
links.push({ href: parentUrl, label: parent?.display_name ?? t("customers.search.link.viewCustomer", "View customer"), kind: "primary" });
|
|
662
671
|
}
|
|
663
672
|
if (ctx.record.deal_id) {
|
|
664
673
|
const dealUrl = `/backend/customers/deals/${encodeURIComponent(ctx.record.deal_id)}`;
|
|
665
|
-
links.push({ href: dealUrl, label: "Open deal", kind: "secondary" });
|
|
674
|
+
links.push({ href: dealUrl, label: t("customers.search.link.openDeal", "Open deal"), kind: "secondary" });
|
|
666
675
|
}
|
|
667
676
|
return links.length ? links : null;
|
|
668
677
|
},
|
|
@@ -681,6 +690,7 @@ const searchConfig = {
|
|
|
681
690
|
enabled: true,
|
|
682
691
|
priority: 8,
|
|
683
692
|
buildSource: async (ctx) => {
|
|
693
|
+
const { t } = await resolveTranslations();
|
|
684
694
|
const lines = [];
|
|
685
695
|
const record = ctx.record;
|
|
686
696
|
appendLine(lines, "Title", record.title);
|
|
@@ -697,10 +707,10 @@ const searchConfig = {
|
|
|
697
707
|
return {
|
|
698
708
|
text: lines,
|
|
699
709
|
presenter: {
|
|
700
|
-
title: String(record.title ?? "Deal"),
|
|
710
|
+
title: String(record.title ?? t("customers.search.fallback.deal", "Deal")),
|
|
701
711
|
subtitle: subtitleParts.join(" \xB7 ") || void 0,
|
|
702
712
|
icon: "briefcase",
|
|
703
|
-
badge: "Deal"
|
|
713
|
+
badge: t("customers.search.badge.deal", "Deal")
|
|
704
714
|
},
|
|
705
715
|
checksumSource: {
|
|
706
716
|
title: record.title,
|
|
@@ -711,8 +721,9 @@ const searchConfig = {
|
|
|
711
721
|
};
|
|
712
722
|
},
|
|
713
723
|
formatResult: async (ctx) => {
|
|
724
|
+
const { t } = await resolveTranslations();
|
|
714
725
|
const { record } = ctx;
|
|
715
|
-
const title = pickString(record.title, "Deal");
|
|
726
|
+
const title = pickString(record.title, t("customers.search.fallback.deal", "Deal"));
|
|
716
727
|
const subtitleParts = [];
|
|
717
728
|
if (record.pipeline_stage) subtitleParts.push(String(record.pipeline_stage));
|
|
718
729
|
if (record.status) subtitleParts.push(String(record.status));
|
|
@@ -722,10 +733,10 @@ const searchConfig = {
|
|
|
722
733
|
subtitleParts.push(currency ? `${amount} ${currency}` : String(amount));
|
|
723
734
|
}
|
|
724
735
|
return {
|
|
725
|
-
title: title ?? "Deal",
|
|
736
|
+
title: title ?? t("customers.search.fallback.deal", "Deal"),
|
|
726
737
|
subtitle: subtitleParts.length ? subtitleParts.join(" \xB7 ") : void 0,
|
|
727
738
|
icon: "briefcase",
|
|
728
|
-
badge: "Deal"
|
|
739
|
+
badge: t("customers.search.badge.deal", "Deal")
|
|
729
740
|
};
|
|
730
741
|
},
|
|
731
742
|
resolveUrl: async (ctx) => {
|
|
@@ -734,12 +745,13 @@ const searchConfig = {
|
|
|
734
745
|
return `/backend/customers/deals/${encodeURIComponent(String(id))}`;
|
|
735
746
|
},
|
|
736
747
|
resolveLinks: async (ctx) => {
|
|
748
|
+
const { t } = await resolveTranslations();
|
|
737
749
|
const id = ctx.record.id;
|
|
738
750
|
if (!id) return null;
|
|
739
751
|
return [
|
|
740
752
|
{
|
|
741
753
|
href: `/backend/customers/deals/${encodeURIComponent(String(id))}/edit`,
|
|
742
|
-
label: "Edit",
|
|
754
|
+
label: t("customers.search.link.edit", "Edit"),
|
|
743
755
|
kind: "secondary"
|
|
744
756
|
}
|
|
745
757
|
];
|
|
@@ -760,6 +772,7 @@ const searchConfig = {
|
|
|
760
772
|
priority: 5,
|
|
761
773
|
buildSource: async (ctx) => {
|
|
762
774
|
assertTenantContext(ctx);
|
|
775
|
+
const { t } = await resolveTranslations();
|
|
763
776
|
const parent = await getCustomerEntity(ctx, ctx.record.entity_id ?? ctx.record.entityId);
|
|
764
777
|
const lines = [];
|
|
765
778
|
if (parent?.display_name) lines.push(`Customer: ${parent.display_name}`);
|
|
@@ -767,7 +780,9 @@ const searchConfig = {
|
|
|
767
780
|
if (ctx.record.subject) lines.push(`Subject: ${ctx.record.subject}`);
|
|
768
781
|
if (ctx.record.body) lines.push(`Body: ${ctx.record.body}`);
|
|
769
782
|
const presenter = {
|
|
770
|
-
title: ctx.record.subject ? String(ctx.record.subject) :
|
|
783
|
+
title: ctx.record.subject ? String(ctx.record.subject) : t("customers.search.fallback.activity", "Activity: {{type}}", {
|
|
784
|
+
type: String(ctx.record.activity_type ?? t("customers.search.fallback.activityUpdate", "update"))
|
|
785
|
+
}),
|
|
771
786
|
subtitle: parent?.display_name ?? snippet(ctx.record.body),
|
|
772
787
|
icon: "bolt"
|
|
773
788
|
};
|
|
@@ -784,12 +799,15 @@ const searchConfig = {
|
|
|
784
799
|
},
|
|
785
800
|
formatResult: async (ctx) => {
|
|
786
801
|
assertTenantContext(ctx);
|
|
802
|
+
const { t } = await resolveTranslations();
|
|
787
803
|
const parent = await getCustomerEntity(ctx, ctx.record.entity_id ?? ctx.record.entityId);
|
|
788
804
|
return {
|
|
789
|
-
title: ctx.record.subject ? String(ctx.record.subject) :
|
|
805
|
+
title: ctx.record.subject ? String(ctx.record.subject) : t("customers.search.fallback.activity", "Activity: {{type}}", {
|
|
806
|
+
type: String(ctx.record.activity_type ?? t("customers.search.fallback.activityUpdate", "update"))
|
|
807
|
+
}),
|
|
790
808
|
subtitle: parent?.display_name ?? snippet(ctx.record.body),
|
|
791
809
|
icon: "bolt",
|
|
792
|
-
badge: "Activity"
|
|
810
|
+
badge: t("customers.search.badge.activity", "Activity")
|
|
793
811
|
};
|
|
794
812
|
},
|
|
795
813
|
resolveUrl: async (ctx) => {
|
|
@@ -799,11 +817,12 @@ const searchConfig = {
|
|
|
799
817
|
return base ? `${base}#activity-${ctx.record.id ?? ctx.record.activity_id ?? ""}` : null;
|
|
800
818
|
},
|
|
801
819
|
resolveLinks: async (ctx) => {
|
|
820
|
+
const { t } = await resolveTranslations();
|
|
802
821
|
const links = [];
|
|
803
822
|
if (ctx.record.deal_id) {
|
|
804
823
|
links.push({
|
|
805
824
|
href: `/backend/customers/deals/${encodeURIComponent(ctx.record.deal_id)}`,
|
|
806
|
-
label: "Open deal",
|
|
825
|
+
label: t("customers.search.link.openDeal", "Open deal"),
|
|
807
826
|
kind: "secondary"
|
|
808
827
|
});
|
|
809
828
|
}
|
|
@@ -844,10 +863,11 @@ const searchConfig = {
|
|
|
844
863
|
},
|
|
845
864
|
formatResult: async (ctx) => {
|
|
846
865
|
assertTenantContext(ctx);
|
|
866
|
+
const { t } = await resolveTranslations();
|
|
847
867
|
const todo = await getLinkedTodo(ctx);
|
|
848
868
|
const parent = await getCustomerEntity(ctx, ctx.record.entity_id ?? ctx.record.entityId);
|
|
849
869
|
return {
|
|
850
|
-
title: todo?.title ?? "Customer task",
|
|
870
|
+
title: todo?.title ?? t("customers.search.fallback.customerTask", "Customer task"),
|
|
851
871
|
subtitle: parent?.display_name,
|
|
852
872
|
icon: "check-square"
|
|
853
873
|
};
|
|
@@ -859,11 +879,12 @@ const searchConfig = {
|
|
|
859
879
|
return base ? `${base}#tasks` : null;
|
|
860
880
|
},
|
|
861
881
|
resolveLinks: async (ctx) => {
|
|
882
|
+
const { t } = await resolveTranslations();
|
|
862
883
|
const todoId = ctx.record.todo_id ?? ctx.record.todoId;
|
|
863
884
|
if (!todoId) return null;
|
|
864
885
|
return [{
|
|
865
886
|
href: `/backend/todos/${encodeURIComponent(todoId)}/edit`,
|
|
866
|
-
label: "Open todo",
|
|
887
|
+
label: t("customers.search.link.openTodo", "Open todo"),
|
|
867
888
|
kind: "secondary"
|
|
868
889
|
}];
|
|
869
890
|
},
|