Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
import { buildAdminSalesDataManagementVM } from "@hivegrid/view-models";
|
||||
import { renderAdminSalesDataMock } from "@hivegrid/ui-mock";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { adminSalesDataAdapter } from "./adminSalesData.js";
|
||||
|
||||
const vm = buildAdminSalesDataManagementVM({
|
||||
source: {
|
||||
companies: [],
|
||||
contacts: [
|
||||
{
|
||||
id: "contact_1",
|
||||
firstName: "Ada",
|
||||
lastName: "Lovelace",
|
||||
email: "ada@example.com",
|
||||
phone: null,
|
||||
locale: "de-DE",
|
||||
company: { name: "Analytical Engines" },
|
||||
tags: [{ id: "tag_1", name: "VIP", color: "#2563eb" }],
|
||||
customFields: [],
|
||||
},
|
||||
],
|
||||
tags: [{ id: "tag_1", name: "VIP", color: "#2563eb" }],
|
||||
customFields: [],
|
||||
importJobs: [],
|
||||
exportJobs: [],
|
||||
},
|
||||
buildContactHref: (id) => `/sales/contacts/${id}`,
|
||||
permissions: { canRead: true, canWrite: true, canExport: true },
|
||||
});
|
||||
|
||||
describe("adminSalesDataAdapter hot-swap", () => {
|
||||
afterEach(() => {
|
||||
vi.doUnmock("@hivegrid/ui-subframe");
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
it("keeps the data-management VM stable for both renderers", () => {
|
||||
const props = adminSalesDataAdapter.toProps(vm);
|
||||
for (const html of [
|
||||
adminSalesDataAdapter.render(vm),
|
||||
adminSalesDataAdapter.render(vm, renderAdminSalesDataMock),
|
||||
]) {
|
||||
expect(html).toContain('data-ui-id="ui.admin.sales.contacts.data"');
|
||||
expect(html).toContain('data-row-id="contact_1"');
|
||||
expect(html).toContain('data-row-count="1"');
|
||||
}
|
||||
expect(props).toEqual(vm);
|
||||
expect(props).not.toBe(vm);
|
||||
});
|
||||
|
||||
it("survives swapping the production renderer package", async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("@hivegrid/ui-subframe", () => ({
|
||||
renderAdminSalesData: renderAdminSalesDataMock,
|
||||
}));
|
||||
const { adminSalesDataAdapter: swapped } = await import("./adminSalesData.js");
|
||||
expect(swapped.render(vm)).toContain('data-ui-impl="mock"');
|
||||
});
|
||||
});
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
import type { AdminSalesDataManagementVM } from "@hivegrid/view-models";
|
||||
import { renderAdminSalesData } from "@hivegrid/ui-subframe";
|
||||
|
||||
import { defineAdapter } from "./defineAdapter.js";
|
||||
|
||||
export function toAdminSalesDataProps(
|
||||
vm: AdminSalesDataManagementVM
|
||||
): AdminSalesDataManagementVM {
|
||||
return {
|
||||
...vm,
|
||||
summary: { ...vm.summary },
|
||||
contacts: vm.contacts.map((contact) => ({
|
||||
...contact,
|
||||
tags: contact.tags.map((tag) => ({ ...tag })),
|
||||
customFields: contact.customFields.map((field) => ({ ...field })),
|
||||
})),
|
||||
tags: vm.tags.map((tag) => ({ ...tag })),
|
||||
customFields: vm.customFields.map((field) => ({
|
||||
...field,
|
||||
options: [...field.options],
|
||||
})),
|
||||
importJobs: vm.importJobs.map((job) => ({ ...job })),
|
||||
exportJobs: vm.exportJobs.map((job) => ({ ...job })),
|
||||
permissions: { ...vm.permissions },
|
||||
};
|
||||
}
|
||||
|
||||
export const adminSalesDataAdapter = defineAdapter({
|
||||
name: "adminSalesData",
|
||||
toProps: toAdminSalesDataProps,
|
||||
defaultRenderer: renderAdminSalesData,
|
||||
});
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { buildAdminDealPipelineVM } from "@hivegrid/view-models";
|
||||
import { renderAdminSalesDealsMock } from "@hivegrid/ui-mock";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { adminSalesDealsAdapter } from "./adminSalesDeals.js";
|
||||
|
||||
const dealTitle = ["Muster", "GmbH"].join(" ");
|
||||
|
||||
const vm = buildAdminDealPipelineVM({
|
||||
now: new Date("2026-07-24T12:00:00.000Z"),
|
||||
locale: "de-DE",
|
||||
pipelines: [{ id: "pipeline_1", name: "SaaS", isDefault: true }],
|
||||
board: {
|
||||
pipeline: { id: "pipeline_1", name: "SaaS", description: null },
|
||||
stages: [
|
||||
{
|
||||
id: "demo",
|
||||
name: "Demo",
|
||||
kind: "open",
|
||||
probabilityBasisPoints: 3_000,
|
||||
agingThresholdDays: 7,
|
||||
color: null,
|
||||
requiredFields: [],
|
||||
deals: [
|
||||
{
|
||||
id: "deal_1",
|
||||
title: dealTitle,
|
||||
companyName: dealTitle,
|
||||
ownerAdminUserId: "admin_1",
|
||||
amountCents: 100_000,
|
||||
currencyCode: "EUR",
|
||||
probabilityBasisPoints: 3_000,
|
||||
expectedCloseDate: null,
|
||||
nextStep: "Demo",
|
||||
nextStepDueAt: null,
|
||||
stageEnteredAt: new Date("2026-07-20T12:00:00.000Z"),
|
||||
lossReasonLabel: null,
|
||||
contacts: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
lossReasons: [],
|
||||
},
|
||||
buildDealHref: (id) => `/sales/deals/${id}`,
|
||||
permissions: { canRead: true, canWrite: true, canConfigure: true },
|
||||
});
|
||||
|
||||
describe("adminSalesDealsAdapter hot-swap", () => {
|
||||
afterEach(() => {
|
||||
vi.doUnmock("@hivegrid/ui-subframe");
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
it("keeps the route-built VM stable for the interim and mock renderer", () => {
|
||||
const props = adminSalesDealsAdapter.toProps(vm);
|
||||
const defaultHtml = adminSalesDealsAdapter.render(vm);
|
||||
const mockHtml = adminSalesDealsAdapter.render(vm, renderAdminSalesDealsMock);
|
||||
|
||||
expect(props).toEqual(vm);
|
||||
expect(props).not.toBe(vm);
|
||||
expect(defaultHtml).toContain('data-ui-impl="subframe"');
|
||||
expect(mockHtml).toContain('data-ui-impl="mock"');
|
||||
for (const html of [defaultHtml, mockHtml]) {
|
||||
expect(html).toContain('data-ui-id="ui.admin.sales.deals.pipeline"');
|
||||
expect(html).toContain('data-row-id="deal_1"');
|
||||
expect(html).toContain('data-stage-id="demo"');
|
||||
}
|
||||
});
|
||||
|
||||
it("survives replacement of the production renderer package", async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("@hivegrid/ui-subframe", () => ({ renderAdminSalesDeals: renderAdminSalesDealsMock }));
|
||||
|
||||
const { adminSalesDealsAdapter: swapped } = await import("./adminSalesDeals.js");
|
||||
expect(swapped.render(vm)).toContain('data-ui-impl="mock"');
|
||||
expect(swapped.toProps(vm)).toEqual(adminSalesDealsAdapter.toProps(vm));
|
||||
});
|
||||
});
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import type { AdminDealPipelineVM } from "@hivegrid/view-models";
|
||||
import { renderAdminSalesDeals } from "@hivegrid/ui-subframe";
|
||||
|
||||
import { defineAdapter } from "./defineAdapter.js";
|
||||
|
||||
export function toAdminSalesDealsProps(vm: AdminDealPipelineVM): AdminDealPipelineVM {
|
||||
return {
|
||||
...vm,
|
||||
pipelineOptions: vm.pipelineOptions.map((pipeline) => ({ ...pipeline })),
|
||||
columns: vm.columns.map((column) => ({
|
||||
...column,
|
||||
cards: column.cards.map((card) => ({ ...card })),
|
||||
})),
|
||||
stages: vm.stages.map((stage) => ({ ...stage, requiredFields: [...stage.requiredFields] })),
|
||||
lossReasons: vm.lossReasons.map((reason) => ({ ...reason })),
|
||||
summary: { ...vm.summary },
|
||||
permissions: { ...vm.permissions },
|
||||
};
|
||||
}
|
||||
|
||||
export const adminSalesDealsAdapter = defineAdapter({
|
||||
name: "adminSalesDeals",
|
||||
toProps: toAdminSalesDealsProps,
|
||||
defaultRenderer: renderAdminSalesDeals,
|
||||
});
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
import { buildAdminSalesTodayVM } from "@hivegrid/view-models";
|
||||
import { renderAdminSalesTasksMock } from "@hivegrid/ui-mock";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { adminSalesTasksAdapter } from "./adminSalesTasks.js";
|
||||
|
||||
const taskTitle = ["Demo", "nachfassen"].join(" ");
|
||||
|
||||
const vm = buildAdminSalesTodayVM({
|
||||
now: new Date("2026-07-24T12:00:00.000Z"),
|
||||
todayStart: new Date("2026-07-23T22:00:00.000Z"),
|
||||
locale: "de-DE",
|
||||
timeZone: "Europe/Berlin",
|
||||
tasks: [
|
||||
{
|
||||
id: "task_1",
|
||||
title: taskTitle,
|
||||
description: null,
|
||||
contactId: "contact_1",
|
||||
contactName: "Ada Lovelace",
|
||||
dealId: "deal_1",
|
||||
dealTitle: "HiveGrid SaaS",
|
||||
assignedToAdminUserId: "admin_1",
|
||||
dueAt: new Date("2026-07-24T14:00:00.000Z"),
|
||||
timeZone: "Europe/Berlin",
|
||||
reminderAt: null,
|
||||
priority: "high",
|
||||
status: "open",
|
||||
source: "manual",
|
||||
recurrence: null,
|
||||
},
|
||||
],
|
||||
buildContactHref: (id) => `/sales/contacts/${id}`,
|
||||
buildDealHref: (id) => `/sales/deals/${id}`,
|
||||
permissions: { canRead: true, canWrite: true },
|
||||
});
|
||||
|
||||
describe("adminSalesTasksAdapter hot-swap", () => {
|
||||
afterEach(() => {
|
||||
vi.doUnmock("@hivegrid/ui-subframe");
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
it("keeps the task VM stable for interim and mock renderers", () => {
|
||||
const props = adminSalesTasksAdapter.toProps(vm);
|
||||
const defaultHtml = adminSalesTasksAdapter.render(vm);
|
||||
const mockHtml = adminSalesTasksAdapter.render(vm, renderAdminSalesTasksMock);
|
||||
|
||||
expect(props).toEqual(vm);
|
||||
expect(props).not.toBe(vm);
|
||||
for (const html of [defaultHtml, mockHtml]) {
|
||||
expect(html).toContain('data-ui-id="ui.admin.sales.tasks.today"');
|
||||
expect(html).toContain('data-row-id="task_1"');
|
||||
expect(html).toContain('data-row-count="1"');
|
||||
}
|
||||
});
|
||||
|
||||
it("survives replacement of the production renderer package", async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("@hivegrid/ui-subframe", () => ({
|
||||
renderAdminSalesTasks: renderAdminSalesTasksMock,
|
||||
}));
|
||||
|
||||
const { adminSalesTasksAdapter: swapped } = await import("./adminSalesTasks.js");
|
||||
expect(swapped.render(vm)).toContain('data-ui-impl="mock"');
|
||||
expect(swapped.toProps(vm)).toEqual(adminSalesTasksAdapter.toProps(vm));
|
||||
});
|
||||
});
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import type { AdminSalesTodayVM } from "@hivegrid/view-models";
|
||||
import { renderAdminSalesTasks } from "@hivegrid/ui-subframe";
|
||||
|
||||
import { defineAdapter } from "./defineAdapter.js";
|
||||
|
||||
export function toAdminSalesTasksProps(
|
||||
vm: AdminSalesTodayVM
|
||||
): AdminSalesTodayVM {
|
||||
return {
|
||||
...vm,
|
||||
summary: { ...vm.summary },
|
||||
overdue: vm.overdue.map((task) => ({ ...task })),
|
||||
dueToday: vm.dueToday.map((task) => ({ ...task })),
|
||||
permissions: { ...vm.permissions },
|
||||
};
|
||||
}
|
||||
|
||||
export const adminSalesTasksAdapter = defineAdapter({
|
||||
name: "adminSalesTasks",
|
||||
toProps: toAdminSalesTasksProps,
|
||||
defaultRenderer: renderAdminSalesTasks,
|
||||
});
|
||||
+4
-1
@@ -13,6 +13,7 @@ const vm: AuditListData = {
|
||||
rows: [
|
||||
{
|
||||
id: "audit-1",
|
||||
tenantId: null,
|
||||
createdAtIso: "2026-07-06T08:00:00.000Z",
|
||||
actorKind: "user",
|
||||
actorKindLabelKey: "audit.actorKind.user",
|
||||
@@ -30,6 +31,7 @@ const vm: AuditListData = {
|
||||
},
|
||||
{
|
||||
id: "audit-2",
|
||||
tenantId: null,
|
||||
createdAtIso: "2026-07-06T09:00:00.000Z",
|
||||
actorKind: "system",
|
||||
actorKindLabelKey: "audit.actorKind.system",
|
||||
@@ -46,8 +48,9 @@ const vm: AuditListData = {
|
||||
hasDetail: false,
|
||||
},
|
||||
],
|
||||
filter: { from: null, to: null, actorType: null, action: null, outcome: null, targetType: null },
|
||||
filter: { from: null, to: null, tenantId: null, actorType: null, actorId: null, action: null, outcome: null, targetType: null, targetId: null },
|
||||
pagination: { page: 1, pageSize: 25, total: 2, totalPages: 1 },
|
||||
summary: { total: 2, pageRows: 2, failedRows: 0, detailRows: 1, adminRows: 0 },
|
||||
canExport: true,
|
||||
emptyHeadlineKey: "audit.viewer.empty.headline",
|
||||
emptyBodyKey: "audit.viewer.empty.body",
|
||||
|
||||
@@ -9,3 +9,7 @@ export { notificationCenterAdapter, toNotificationCenterProps } from "./notifica
|
||||
export { membersListAdapter, toMembersListProps } from "./membersList.js";
|
||||
export { rolesListAdapter, toRolesListProps } from "./rolesList.js";
|
||||
export { integrationsCatalogAdapter, toIntegrationsCatalogProps } from "./integrationsCatalog.js";
|
||||
export { platformLeadsAdapter, toPlatformLeadsProps } from "./platformLeads.js";
|
||||
export { adminSalesDealsAdapter, toAdminSalesDealsProps } from "./adminSalesDeals.js";
|
||||
export { adminSalesTasksAdapter, toAdminSalesTasksProps } from "./adminSalesTasks.js";
|
||||
export { adminSalesDataAdapter, toAdminSalesDataProps } from "./adminSalesData.js";
|
||||
+3
-3
@@ -13,7 +13,7 @@ const vm: IntegrationCatalogData = buildIntegrationCatalogVM({
|
||||
categoryKey: integrationCategoryKey("erp"),
|
||||
connectionType: "rest_api",
|
||||
connectionCount: 2,
|
||||
detailHref: "/acme/integrations/sample-data-sync",
|
||||
detailHref: "/acme/settings/integrations/sample-data-sync",
|
||||
},
|
||||
{
|
||||
key: "gmail",
|
||||
@@ -22,7 +22,7 @@ const vm: IntegrationCatalogData = buildIntegrationCatalogVM({
|
||||
categoryKey: integrationCategoryKey("communication"),
|
||||
connectionType: "oauth2",
|
||||
connectionCount: 0,
|
||||
detailHref: "/acme/integrations/gmail",
|
||||
detailHref: "/acme/settings/integrations/gmail",
|
||||
},
|
||||
{
|
||||
key: "pandadoc-byok",
|
||||
@@ -31,7 +31,7 @@ const vm: IntegrationCatalogData = buildIntegrationCatalogVM({
|
||||
categoryKey: integrationCategoryKey("signature"),
|
||||
connectionType: "api_key",
|
||||
connectionCount: 1,
|
||||
detailHref: "/acme/integrations/pandadoc-byok",
|
||||
detailHref: "/acme/settings/integrations/pandadoc-byok",
|
||||
},
|
||||
],
|
||||
canConnect: true,
|
||||
|
||||
+2
@@ -16,6 +16,7 @@ const vm: MembersListData = buildMembersListVM({
|
||||
status: "active",
|
||||
mfaEnabled: true,
|
||||
roles: [{ id: "r-1", name: "Monteur", description: "" }],
|
||||
seatType: "office",
|
||||
},
|
||||
{
|
||||
tenantUserId: "tu-2",
|
||||
@@ -27,6 +28,7 @@ const vm: MembersListData = buildMembersListVM({
|
||||
status: "inactive",
|
||||
mfaEnabled: false,
|
||||
roles: [],
|
||||
seatType: "field",
|
||||
},
|
||||
],
|
||||
pendingInvitations: [],
|
||||
|
||||
+6
@@ -27,6 +27,9 @@ const vm: NotificationCenterData = {
|
||||
bounceKey: null,
|
||||
lastErrorRedacted: null,
|
||||
deeplinkHref: DEEPLINK,
|
||||
subjectLabel: null,
|
||||
tagKey: null,
|
||||
tagTone: null,
|
||||
},
|
||||
{
|
||||
id: "delivery-2",
|
||||
@@ -47,6 +50,9 @@ const vm: NotificationCenterData = {
|
||||
bounceKey: "notifications.center.bounce.rateLimited",
|
||||
lastErrorRedacted: null,
|
||||
deeplinkHref: null,
|
||||
subjectLabel: null,
|
||||
tagKey: null,
|
||||
tagTone: null,
|
||||
},
|
||||
],
|
||||
totalCount: 2,
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
import { buildAdminLeadListVM } from "@hivegrid/view-models";
|
||||
import { renderPlatformLeadsMock } from "@hivegrid/ui-mock";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { platformLeadsAdapter } from "./platformLeads.js";
|
||||
|
||||
const sourceDisplayName = ["HiveGrid", "Website"].join(" ");
|
||||
const assigneeDisplayName = ["Haris", "Vertrieb"].join(" ");
|
||||
|
||||
const vm = buildAdminLeadListVM({
|
||||
rows: [
|
||||
{
|
||||
id: "lead_1",
|
||||
firstName: "Petra",
|
||||
lastName: "Muster",
|
||||
email: "petra@example.test",
|
||||
phone: null,
|
||||
company: "Muster GmbH",
|
||||
status: "new",
|
||||
sourceId: "source_1",
|
||||
sourceDisplayName,
|
||||
assignedToAdminUserId: "operator_1",
|
||||
assigneeLabel: assigneeDisplayName,
|
||||
duplicateHintOfLeadId: null,
|
||||
capturedAt: "2026-07-16T00:00:00.000Z",
|
||||
archivedAt: null,
|
||||
},
|
||||
],
|
||||
sourceOptions: [{ id: "source_1", label: sourceDisplayName }],
|
||||
assigneeOptions: [{ id: "operator_1", label: assigneeDisplayName }],
|
||||
permissions: { canCreate: true, canWrite: true, canAdminSources: true },
|
||||
});
|
||||
|
||||
describe("platformLeadsAdapter hot-swap (R-LEADS / M017)", () => {
|
||||
afterEach(() => {
|
||||
vi.doUnmock("@hivegrid/ui-subframe");
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
it("keeps the loader VM stable across the default and mock renderers", () => {
|
||||
const props = platformLeadsAdapter.toProps(vm);
|
||||
const defaultHtml = platformLeadsAdapter.render(vm);
|
||||
const mockHtml = platformLeadsAdapter.render(vm, renderPlatformLeadsMock);
|
||||
|
||||
expect(props).toEqual(vm);
|
||||
expect(props).not.toBe(vm);
|
||||
expect(defaultHtml).toContain('data-ui-impl="subframe"');
|
||||
expect(mockHtml).toContain('data-ui-impl="mock"');
|
||||
expect(defaultHtml).not.toBe(mockHtml);
|
||||
for (const html of [defaultHtml, mockHtml]) {
|
||||
expect(html).toContain('data-ui-id="ui.admin.platformLeads.list"');
|
||||
expect(html).toContain('data-row-id="lead_1"');
|
||||
expect(html).toContain('data-source-id="source_1"');
|
||||
expect(html).toContain('data-assignee-id="operator_1"');
|
||||
}
|
||||
});
|
||||
|
||||
it("uses the mock renderer when the production renderer package is replaced at its module boundary", async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("@hivegrid/ui-subframe", () => ({ renderPlatformLeads: renderPlatformLeadsMock }));
|
||||
|
||||
const { platformLeadsAdapter: swappedAdapter } = await import("./platformLeads.js");
|
||||
const swappedHtml = swappedAdapter.render(vm);
|
||||
|
||||
expect(swappedAdapter.toProps(vm)).toEqual(platformLeadsAdapter.toProps(vm));
|
||||
expect(swappedHtml).toContain('data-ui-impl="mock"');
|
||||
expect(swappedHtml).not.toContain('data-ui-impl="subframe"');
|
||||
expect(swappedHtml).toContain('data-ui-id="ui.admin.platformLeads.list"');
|
||||
expect(swappedHtml).toContain('data-row-count="1"');
|
||||
expect(swappedHtml).toContain('data-row-id="lead_1"');
|
||||
expect(swappedHtml).toContain('data-source-id="source_1"');
|
||||
expect(swappedHtml).toContain('data-assignee-id="operator_1"');
|
||||
});
|
||||
});
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import type { AdminLeadListVM } from "@hivegrid/view-models";
|
||||
import { renderPlatformLeads } from "@hivegrid/ui-subframe";
|
||||
|
||||
import { defineAdapter } from "./defineAdapter.js";
|
||||
|
||||
/**
|
||||
* Copies the loader-built R-LEADS model at the UI boundary. Keeping this
|
||||
* explicit prevents the later Subframe delta from reaching into route data.
|
||||
*/
|
||||
export function toPlatformLeadsProps(vm: AdminLeadListVM): AdminLeadListVM {
|
||||
return {
|
||||
...vm,
|
||||
rows: vm.rows.map((row) => ({ ...row })),
|
||||
sourceOptions: vm.sourceOptions.map((option) => ({ ...option })),
|
||||
assigneeOptions: vm.assigneeOptions.map((option) => ({ ...option })),
|
||||
filters: { ...vm.filters },
|
||||
summary: { ...vm.summary },
|
||||
pagination: { ...vm.pagination },
|
||||
permissions: { ...vm.permissions },
|
||||
};
|
||||
}
|
||||
|
||||
export const platformLeadsAdapter = defineAdapter({
|
||||
name: "platformLeads",
|
||||
toProps: toPlatformLeadsProps,
|
||||
defaultRenderer: renderPlatformLeads,
|
||||
});
|
||||
Reference in new issue
Block a user