@manta-eu/react 0.1.4 → 0.1.5
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/README.md +4 -8
- package/dist/components/audience-phase-badge/index.d.ts +1 -1
- package/dist/components/audience-phase-badge/index.d.ts.map +1 -1
- package/dist/components/audience-phase-badge/index.js +3 -0
- package/dist/components/authenticated-chat/index.d.ts.map +1 -1
- package/dist/components/authenticated-chat/index.js +0 -5
- package/dist/components/chat-view/Chat.d.ts +6 -0
- package/dist/components/chat-view/Chat.d.ts.map +1 -1
- package/dist/components/chat-view/Chat.js +6 -6
- package/dist/components/chat-view/ChatHeaders.d.ts.map +1 -1
- package/dist/components/chat-view/ChatHeaders.js +3 -2
- package/dist/components/embedded-chat/EmbeddedDatastorePicker.d.ts +1 -0
- package/dist/components/embedded-chat/EmbeddedDatastorePicker.d.ts.map +1 -1
- package/dist/components/embedded-chat/EmbeddedDatastorePicker.js +9 -3
- package/dist/components/embedded-chat/index.d.ts.map +1 -1
- package/dist/components/embedded-chat/index.js +1 -8
- package/dist/components/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/layouts/Sidebar.js +11 -4
- package/dist/components/planning/ActioningView.d.ts.map +1 -1
- package/dist/components/planning/ActioningView.js +11 -6
- package/dist/components/planning/ExecutionSectionItem.d.ts +2 -3
- package/dist/components/planning/ExecutionSectionItem.d.ts.map +1 -1
- package/dist/components/planning/ExecutionSectionItem.js +3 -6
- package/dist/components/planning/ExecutionSections.d.ts +2 -3
- package/dist/components/planning/ExecutionSections.d.ts.map +1 -1
- package/dist/components/planning/ExecutionSections.js +2 -2
- package/dist/components/planning/ManualActionCard.d.ts +3 -4
- package/dist/components/planning/ManualActionCard.d.ts.map +1 -1
- package/dist/components/planning/ManualActionCard.js +24 -6
- package/dist/components/rdf-insights/CampaignChannelMix.js +1 -1
- package/dist/components/rdf-insights/CampaignGrid.d.ts.map +1 -1
- package/dist/components/rdf-insights/CampaignGrid.js +2 -2
- package/dist/components/rdf-insights/DailyPerformance.js +2 -2
- package/dist/components/rdf-insights/KpiDashboard.d.ts +2 -2
- package/dist/components/rdf-insights/KpiDashboard.d.ts.map +1 -1
- package/dist/components/rdf-insights/KpiDashboard.js +33 -53
- package/dist/components/rdf-insights/MetaDailyInsights.js +2 -2
- package/dist/components/rdf-insights/ProductCard.d.ts.map +1 -1
- package/dist/components/rdf-insights/ProductCard.js +1 -1
- package/dist/components/rdf-insights/ProductVariantsTable.js +1 -1
- package/dist/components/rdf-insights/useExtractedInsights.d.ts +1 -1
- package/dist/components/rdf-insights/useExtractedInsights.js +3 -3
- package/dist/datastore-picker/datastore-picker-rows.d.ts +1 -0
- package/dist/datastore-picker/datastore-picker-rows.d.ts.map +1 -1
- package/dist/datastore-picker/datastore-picker-rows.js +6 -2
- package/dist/graph/nodes/GoogleCampaignView.js +2 -2
- package/dist/hooks/use-action-plans-list.js +1 -1
- package/dist/hooks/use-manual-actions.d.ts +11 -1
- package/dist/hooks/use-manual-actions.d.ts.map +1 -1
- package/dist/hooks/use-manual-actions.js +47 -100
- package/dist/hooks/useAuth.d.ts +5 -1
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +4 -0
- package/dist/hooks/useValidateActionPlan.d.ts.map +1 -1
- package/dist/ldo-ui.d.ts +1 -1
- package/dist/ldo-ui.d.ts.map +1 -1
- package/dist/lib/manual-actions.js +1 -1
- package/dist/lib/rdf/index.d.ts +4 -2
- package/dist/lib/rdf/index.d.ts.map +1 -1
- package/dist/lib/rdf/index.js +48 -18
- package/dist/lib/rdf/insights.d.ts +6 -1
- package/dist/lib/rdf/insights.d.ts.map +1 -1
- package/dist/lib/rdf/insights.js +15 -3
- package/dist/lib/rdf/types.d.ts +21 -8
- package/dist/lib/rdf/types.d.ts.map +1 -1
- package/dist/providers/AuthContext.d.ts +1 -1
- package/dist/providers/AuthContext.d.ts.map +1 -1
- package/dist/providers/index.d.ts +4 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -1
- package/dist/routes/datastores/components/DatastoreFormDialog.d.ts +4 -2
- package/dist/routes/datastores/components/DatastoreFormDialog.d.ts.map +1 -1
- package/dist/routes/datastores/components/DatastoreFormDialog.js +7 -4
- package/dist/routes/datastores/components/DatastoresToolbar.d.ts +3 -1
- package/dist/routes/datastores/components/DatastoresToolbar.d.ts.map +1 -1
- package/dist/routes/datastores/components/DatastoresToolbar.js +18 -5
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.d.ts.map +1 -1
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.js +6 -2
- package/dist/routes/datastores/components/ProvisionDatastoreDialog.d.ts +7 -0
- package/dist/routes/datastores/components/ProvisionDatastoreDialog.d.ts.map +1 -0
- package/dist/routes/datastores/components/ProvisionDatastoreDialog.js +10 -0
- package/dist/routes/datastores/flatten.d.ts +4 -0
- package/dist/routes/datastores/flatten.d.ts.map +1 -1
- package/dist/routes/datastores/flatten.js +11 -0
- package/dist/routes/datastores/hooks/useDatastoreColumns.d.ts +4 -1
- package/dist/routes/datastores/hooks/useDatastoreColumns.d.ts.map +1 -1
- package/dist/routes/datastores/hooks/useDatastoreColumns.js +6 -2
- package/dist/routes/datastores/hooks/useTenantOrganizationCheck.d.ts +3 -0
- package/dist/routes/datastores/hooks/useTenantOrganizationCheck.d.ts.map +1 -0
- package/dist/routes/datastores/hooks/useTenantOrganizationCheck.js +21 -0
- package/dist/routes/datastores/index.d.ts.map +1 -1
- package/dist/routes/datastores/index.js +44 -6
- package/dist/routes/datastores/link-provider.d.ts +11 -0
- package/dist/routes/datastores/link-provider.d.ts.map +1 -0
- package/dist/routes/datastores/link-provider.js +34 -0
- package/dist/routes/integrations/components/connect-forms/types.d.ts +1 -0
- package/dist/routes/integrations/components/connect-forms/types.d.ts.map +1 -1
- package/dist/routes/integrations/connection-view.d.ts.map +1 -1
- package/dist/routes/integrations/connection-view.js +19 -6
- package/dist/routes/integrations/types.d.ts +2 -0
- package/dist/routes/integrations/types.d.ts.map +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.d.ts +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.d.ts.map +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.js +3 -3
- package/dist/routes/memories/components/EmptyStates.d.ts +1 -2
- package/dist/routes/memories/components/EmptyStates.d.ts.map +1 -1
- package/dist/routes/memories/components/EmptyStates.js +2 -2
- package/dist/routes/memories/components/MemoriesPanel.d.ts +1 -1
- package/dist/routes/memories/components/MemoriesPanel.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoriesPanel.js +9 -9
- package/dist/routes/memories/components/MemoryActions.d.ts +1 -1
- package/dist/routes/memories/components/MemoryActions.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryActions.js +4 -4
- package/dist/routes/memories/components/MemoryFields.d.ts +1 -1
- package/dist/routes/memories/components/MemoryFields.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFields.js +2 -2
- package/dist/routes/memories/components/MemoryFormDialog.d.ts +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.js +2 -2
- package/dist/routes/memories/components/TeamPicker.d.ts +1 -1
- package/dist/routes/memories/components/TeamPicker.d.ts.map +1 -1
- package/dist/routes/memories/components/TeamPicker.js +2 -2
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts.map +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.js +3 -3
- package/dist/routes/memories/index.d.ts.map +1 -1
- package/dist/routes/memories/index.js +21 -21
- package/package.json +7 -6
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
2
|
+
import { toast } from "sonner";
|
|
3
|
+
// Only an explicit false means the realm links nothing; null is a call that never reached the provider.
|
|
4
|
+
export function linkProviderOutcome(response) {
|
|
5
|
+
if (response.linkEnabled === false)
|
|
6
|
+
return "linkDisabled";
|
|
7
|
+
return response.linked || response.mirrored === true ? "linked" : "failed";
|
|
8
|
+
}
|
|
9
|
+
export function tenantOrganizationHint(tenant, pushEnabled) {
|
|
10
|
+
if (!isPresent(tenant.slug)) {
|
|
11
|
+
return "This name carries no character the identity provider accepts, so no organization can be created there for it.";
|
|
12
|
+
}
|
|
13
|
+
if (isPresent(tenant.mirroredBy)) {
|
|
14
|
+
return `The identity provider's "${tenant.slug}" already belongs to "${tenant.mirroredBy}", so this organization can't be linked to it — choose another name.`;
|
|
15
|
+
}
|
|
16
|
+
if (pushEnabled) {
|
|
17
|
+
return tenant.exists
|
|
18
|
+
? `The identity provider already has "${tenant.slug}" — creating this organization links to it rather than creating another.`
|
|
19
|
+
: `The identity provider has no "${tenant.slug}" yet; creating this organization creates it there too.`;
|
|
20
|
+
}
|
|
21
|
+
return tenant.exists
|
|
22
|
+
? `The identity provider already has "${tenant.slug}" — once this organization exists, "Link to identity provider" reuses it.`
|
|
23
|
+
: `The identity provider has no "${tenant.slug}" yet; once this organization exists, "Link to identity provider" creates it.`;
|
|
24
|
+
}
|
|
25
|
+
export function tenantOrganizationCheck(tenant, pushEnabled) {
|
|
26
|
+
if (!tenant)
|
|
27
|
+
return { blocked: false };
|
|
28
|
+
return { hint: tenantOrganizationHint(tenant, pushEnabled), blocked: isPresent(tenant.mirroredBy) };
|
|
29
|
+
}
|
|
30
|
+
export function toastProviderWarning(providerWarning) {
|
|
31
|
+
if (!isPresent(providerWarning))
|
|
32
|
+
return;
|
|
33
|
+
toast.warning("The organization isn't linked to the identity provider", { description: providerWarning });
|
|
34
|
+
}
|
|
@@ -7,6 +7,7 @@ import type { ProviderPresentation } from "#routes/integrations/types";
|
|
|
7
7
|
export type ProviderSetupInstructions = Readonly<{
|
|
8
8
|
identifier?: FieldInstruction;
|
|
9
9
|
apiKey?: FieldInstruction;
|
|
10
|
+
settings?: FieldInstruction;
|
|
10
11
|
}>;
|
|
11
12
|
export type InferalConnectFormConfig = {
|
|
12
13
|
setupInstructions?: ProviderSetupInstructions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;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AAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"connection-view.d.ts","sourceRoot":"","sources":["../../../src/routes/integrations/connection-view.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAuD,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEvG;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AA6EF,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,kBAAkB,GAAG,cAAc,CAoB/E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GQLGmailIntegrationStatus, GQLIntegration, GQLRelayIntegrationStatus } from "@manta-eu/client";
|
|
2
2
|
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
-
import { formatDistanceToNow } from "date-fns";
|
|
3
|
+
import { formatDistanceToNow, isValid } from "date-fns";
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
5
|
// Fallback nouns shown until the ontology carries rdfs:labels for these classes (MNT-503).
|
|
6
6
|
// https://linear.app/manta-eu/issue/MNT-503/add-rdfslabel-to-provider-entity-classes-in-the-ontology
|
|
@@ -30,18 +30,30 @@ const statusMap = {
|
|
|
30
30
|
[GQLRelayIntegrationStatus.Deleted]: { label: "Deleted", tone: "neutral" },
|
|
31
31
|
};
|
|
32
32
|
const oauthConnectedStatus = { label: "Connected", tone: "success" };
|
|
33
|
+
const oauthRevokedStatus = { label: "Reconnect needed", tone: "error" };
|
|
33
34
|
// Integrations whose account is limited to what was picked at connect time, so an empty pick reads nothing.
|
|
34
35
|
const oauthIncludedResourcesLabels = {
|
|
35
36
|
[GQLIntegration.Dash]: { label: "Folders", noneLabel: "No folders selected" },
|
|
36
37
|
};
|
|
37
|
-
function
|
|
38
|
+
function connectedLabel(connectedAt) {
|
|
39
|
+
if (!isPresent(connectedAt))
|
|
40
|
+
return undefined;
|
|
41
|
+
const connected = new Date(connectedAt);
|
|
42
|
+
if (!isValid(connected))
|
|
43
|
+
return undefined;
|
|
44
|
+
return `Connected ${formatDistanceToNow(connected, { addSuffix: true })}`;
|
|
45
|
+
}
|
|
46
|
+
function oauthScope({ integration, includedResources, revokedAt, }) {
|
|
47
|
+
const revoked = isPresent(revokedAt);
|
|
48
|
+
const status = revoked ? oauthRevokedStatus : oauthConnectedStatus;
|
|
38
49
|
const labels = oauthIncludedResourcesLabels[integration];
|
|
39
50
|
if (!labels || !includedResources)
|
|
40
|
-
return { status
|
|
41
|
-
if (!isPresent(includedResources))
|
|
42
|
-
return { status: { label: labels.noneLabel, tone: "warning" } };
|
|
51
|
+
return { status };
|
|
52
|
+
if (!isPresent(includedResources)) {
|
|
53
|
+
return { status: revoked ? oauthRevokedStatus : { label: labels.noneLabel, tone: "warning" } };
|
|
54
|
+
}
|
|
43
55
|
return {
|
|
44
|
-
status
|
|
56
|
+
status,
|
|
45
57
|
secondaryLabel: `${labels.label}: ${includedResources.map(({ id, name }) => name ?? id).join(", ")}`,
|
|
46
58
|
};
|
|
47
59
|
}
|
|
@@ -67,6 +79,7 @@ export function toConnectionView(connection) {
|
|
|
67
79
|
id: c.id,
|
|
68
80
|
primaryLabel: isPresent(c.name) ? c.name : `${oauthAccountNoun[c.integration]} ${c.externalId}`,
|
|
69
81
|
...oauthScope(c),
|
|
82
|
+
syncedLabel: connectedLabel(c.connectedAt),
|
|
70
83
|
namedAccount: {
|
|
71
84
|
name: isPresent(c.name) ? c.name : oauthAccountNoun[c.integration],
|
|
72
85
|
noun: isPresent(c.name) ? oauthAccountNoun[c.integration] : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/routes/integrations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,cAAc,EACd,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAO,MAAM,eA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F,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,cAAc,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,IAAI,CAAC;IACV,MAAM,EAAE,yBAAyB,CAAC;IAClC,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,CAAC;AAEvF,MAAM,MAAM,iBAAiB,CAAC,EAAE,SAAS,MAAM,GAAG,UAAU,IAAI;IAC9D,EAAE,EAAE,EAAE,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B,CAAC"}
|
|
@@ -3,7 +3,7 @@ export type ChangeScopeDialogProps = {
|
|
|
3
3
|
open: boolean;
|
|
4
4
|
onOpenChange: (open: boolean) => void;
|
|
5
5
|
memory: GQLMemory;
|
|
6
|
-
|
|
6
|
+
canManageSharedMemories?: boolean;
|
|
7
7
|
onSave: (newScope: GQLMemoryScope, newTeams: string[], supersedesMemoryIris: string[]) => Promise<void>;
|
|
8
8
|
isSaving: boolean;
|
|
9
9
|
currentUserId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeScopeDialog.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/ChangeScopeDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA6B,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiB7F,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,SAAS,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"ChangeScopeDialog.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/ChangeScopeDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA6B,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiB7F,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,SAAS,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,oBAAoB,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxG,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAQF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CA6K9D"}
|
|
@@ -13,7 +13,7 @@ const scopeOptions = [
|
|
|
13
13
|
{ value: GQLMemoryScope.Team, label: "Team" },
|
|
14
14
|
];
|
|
15
15
|
export function ChangeScopeDialog(props) {
|
|
16
|
-
const { open, onOpenChange, memory,
|
|
16
|
+
const { open, onOpenChange, memory, canManageSharedMemories, onSave, isSaving, currentUserId } = props;
|
|
17
17
|
const [scope, setScope] = useState(memory.scope);
|
|
18
18
|
const [teams, setTeams] = useState(memory.teams);
|
|
19
19
|
const [pendingConflicts, setPendingConflicts] = useState([]);
|
|
@@ -75,10 +75,10 @@ export function ChangeScopeDialog(props) {
|
|
|
75
75
|
setPendingState(null);
|
|
76
76
|
}, []);
|
|
77
77
|
return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { text: "Change memory scope" }), _jsxs(DialogDescription, { children: ["Change the scope of \u201C", memory.label, "\u201D memory. All properties remain the same, but visibility changes."] })] }), _jsxs("div", { className: "flex flex-col gap-4 py-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("label", { className: "typography-small text-default-foreground", children: "Scope" }), _jsx("div", { className: "flex gap-2", children: scopeOptions
|
|
78
|
-
.filter(({ value }) => value !== GQLMemoryScope.Company ||
|
|
78
|
+
.filter(({ value }) => value !== GQLMemoryScope.Company || canManageSharedMemories)
|
|
79
79
|
.map(({ value, label }) => (_jsx("button", { type: "button", onClick: () => setScope(value), className: `px-3 py-1.5 rounded-lg typography-small-medium transition-colors ${scope === value
|
|
80
80
|
? "bg-primary text-primary-foreground"
|
|
81
|
-
: "bg-muted text-muted-foreground hover:bg-muted/80"}`, children: label }, value))) })] }), isTeam && _jsx(TeamPicker, { selected: teams, onChange: setTeams,
|
|
81
|
+
: "bg-muted text-muted-foreground hover:bg-muted/80"}`, children: label }, value))) })] }), isTeam && (_jsx(TeamPicker, { selected: teams, onChange: setTeams, canManageSharedMemories: canManageSharedMemories ?? false }))] }), _jsx(DialogFooter, { children: timedOut && pendingState ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "typography-small text-muted-foreground mr-auto", children: "Conflict check timed out. Move without checking?" }), _jsx(Button, { variant: "tertiary", onClick: () => {
|
|
82
82
|
setTimedOut(false);
|
|
83
83
|
setPendingState(null);
|
|
84
84
|
}, disabled: isSaving, children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type MemoriesEmptyStateProps = {
|
|
2
|
-
isOperator?: boolean;
|
|
3
2
|
onAdd: () => void;
|
|
4
3
|
};
|
|
5
4
|
export declare function MemoriesEmptyState(props: MemoriesEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +9,7 @@ type CompanyMemoriesEmptyStateProps = {
|
|
|
10
9
|
export declare function CompanyMemoriesEmptyState(props: CompanyMemoriesEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export declare function CapturedMemoriesEmptyState(): import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export type GroupMemoriesEmptyStateProps = {
|
|
13
|
-
|
|
12
|
+
canManageSharedMemories?: boolean;
|
|
14
13
|
onAdd?: () => void;
|
|
15
14
|
};
|
|
16
15
|
export declare function GroupMemoriesEmptyState(props: GroupMemoriesEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyStates.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/EmptyStates.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,uBAAuB,GAAG;IACpC,
|
|
1
|
+
{"version":3,"file":"EmptyStates.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/EmptyStates.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAchE;AAED,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,2CAmB9E;AAED,wBAAgB,0BAA0B,4CAYzC;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,2CAoB1E"}
|
|
@@ -15,8 +15,8 @@ export function CapturedMemoriesEmptyState() {
|
|
|
15
15
|
return (_jsx(EmptyState, { icon: MessageSquare, title: "No captured memories yet", description: "Manta captures useful context from your conversations automatically. Start chatting and memories will appear here.", children: _jsx(Button, { asChild: true, children: _jsx(Link, { to: "/", children: "Start chatting" }) }) }));
|
|
16
16
|
}
|
|
17
17
|
export function GroupMemoriesEmptyState(props) {
|
|
18
|
-
const {
|
|
19
|
-
return (_jsx(EmptyState, { icon: Users, title: "No team memories yet", description:
|
|
18
|
+
const { canManageSharedMemories, onAdd } = props;
|
|
19
|
+
return (_jsx(EmptyState, { icon: Users, title: "No team memories yet", description: canManageSharedMemories
|
|
20
20
|
? "Add shared context that Manta uses for specific teams in the company."
|
|
21
21
|
: "Your team hasn't added any shared memories yet.", children: onAdd && (_jsx(Button, { onClick: onAdd, icon: Plus, children: "Add team memory" })) }));
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoriesPanel.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoriesPanel.tsx"],"names":[],"mappings":"AA4BA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,
|
|
1
|
+
{"version":3,"file":"MemoriesPanel.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoriesPanel.tsx"],"names":[],"mappings":"AA4BA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA2KtD"}
|
|
@@ -17,7 +17,7 @@ import { Dropdown, DropdownContent, DropdownGroup, DropdownItem, DropdownTrigger
|
|
|
17
17
|
import { Skeleton } from "#components/skeleton/index";
|
|
18
18
|
import { useMantaClient } from "#providers/index";
|
|
19
19
|
export function MemoriesPanel(props) {
|
|
20
|
-
const {
|
|
20
|
+
const { canManageSharedMemories, onClose } = props;
|
|
21
21
|
const { mantaClient } = useMantaClient();
|
|
22
22
|
const queryClient = useQueryClient();
|
|
23
23
|
const { data, isLoading, error: queryError } = useMemoriesQuery(mantaClient);
|
|
@@ -36,7 +36,7 @@ export function MemoriesPanel(props) {
|
|
|
36
36
|
const handleCreate = useCallback(async (form, supersedesMemoryIris) => {
|
|
37
37
|
if (!addDialog)
|
|
38
38
|
return;
|
|
39
|
-
if (!
|
|
39
|
+
if (!canManageSharedMemories && addDialog.scope !== GQLMemoryScope.User)
|
|
40
40
|
return;
|
|
41
41
|
try {
|
|
42
42
|
const result = await createMutation.mutateAsync({
|
|
@@ -52,11 +52,11 @@ export function MemoriesPanel(props) {
|
|
|
52
52
|
const err = parseError(e, "Failed to add memory");
|
|
53
53
|
toast.error(err.message, { description: err.description });
|
|
54
54
|
}
|
|
55
|
-
}, [addDialog, createMutation, invalidate,
|
|
55
|
+
}, [addDialog, createMutation, invalidate, canManageSharedMemories]);
|
|
56
56
|
const handleUpdate = useCallback(async (form, supersedesMemoryIris) => {
|
|
57
57
|
if (!editingMemory)
|
|
58
58
|
return;
|
|
59
|
-
if (!
|
|
59
|
+
if (!canManageSharedMemories && editingMemory.scope !== GQLMemoryScope.User)
|
|
60
60
|
return;
|
|
61
61
|
try {
|
|
62
62
|
const result = await updateMutation.mutateAsync({
|
|
@@ -72,7 +72,7 @@ export function MemoriesPanel(props) {
|
|
|
72
72
|
const err = parseError(e, "Failed to update memory");
|
|
73
73
|
toast.error(err.message, { description: err.description });
|
|
74
74
|
}
|
|
75
|
-
}, [editingMemory, updateMutation, invalidate,
|
|
75
|
+
}, [editingMemory, updateMutation, invalidate, canManageSharedMemories]);
|
|
76
76
|
const handleDelete = useCallback(async (iri) => {
|
|
77
77
|
try {
|
|
78
78
|
await deleteMutation.mutateAsync({ memoryIri: iri });
|
|
@@ -84,7 +84,7 @@ export function MemoriesPanel(props) {
|
|
|
84
84
|
toast.error(err.message, { description: err.description });
|
|
85
85
|
}
|
|
86
86
|
}, [deleteMutation, invalidate]);
|
|
87
|
-
return (_jsxs("div", { className: "flex flex-col h-full", children: [_jsxs("div", { className: "shrink-0 flex items-center justify-between gap-2 px-4 py-3 border-b border-muted-border", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Brain, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "typography-small-medium text-default-foreground", children: "Memories" })] }), _jsxs("div", { className: "flex items-center gap-1", children: [
|
|
87
|
+
return (_jsxs("div", { className: "flex flex-col h-full", children: [_jsxs("div", { className: "shrink-0 flex items-center justify-between gap-2 px-4 py-3 border-b border-muted-border", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Brain, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "typography-small-medium text-default-foreground", children: "Memories" })] }), _jsxs("div", { className: "flex items-center gap-1", children: [canManageSharedMemories && (_jsx(Button, { variant: "ghost", size: "sm", icon: Building2, onClick: () => setAddDialog({ scope: GQLMemoryScope.Company }), children: "Add org" })), _jsx(Button, { size: "sm", icon: Plus, onClick: () => setAddDialog({ scope: GQLMemoryScope.User }), children: "Add" }), _jsx(Button, { variant: "ghost", size: "sm", iconOnly: true, icon: X, "aria-label": "Close memories panel", onClick: onClose })] })] }), _jsxs("div", { className: "flex-1 overflow-auto", children: [isLoading && (_jsx("ul", { className: "divide-y divide-muted-border", children: Array.from({ length: 4 }, (_, i) => (_jsxs("li", { className: "flex items-start gap-3 px-4 py-3", children: [_jsxs("div", { className: "flex-1 min-w-0 flex flex-col gap-1.5", children: [_jsx(Skeleton, { className: "h-4 w-2/3 rounded-md" }), _jsx(Skeleton, { className: "h-3.5 w-full rounded-md" })] }), _jsxs("div", { className: "shrink-0 flex items-center gap-2 pt-0.5", children: [_jsx(Skeleton, { className: "h-5 w-14 rounded-full" }), _jsx(Skeleton, { className: "size-7 rounded-md" })] })] }, `panel-skeleton-${i}`))) })), errorMessage && _jsx(Banner, { label: errorMessage, className: "m-4" }), !isLoading && !errorMessage && !isPresent(memories) && (_jsxs("div", { className: "flex flex-col items-center justify-center gap-3 p-8 text-center", children: [_jsx(Brain, { className: "size-8 text-muted-foreground" }), _jsx("p", { className: "typography-small text-muted-foreground", children: "No memories yet. Add something Manta should always keep in mind." })] })), !isLoading && isPresent(memories) && (_jsx("ul", { className: "divide-y divide-muted-border", children: memories.map((memory) => (_jsx(MemoryListItem, { memory: memory, canManageSharedMemories: canManageSharedMemories, onEdit: () => setEditingMemory(memory), onDelete: () => void handleDelete(memory.iri) }, memory.iri))) }))] }), addDialog && (_jsx(MemoryFormDialog, { open: true, onOpenChange: (open) => {
|
|
88
88
|
if (!open)
|
|
89
89
|
setAddDialog(null);
|
|
90
90
|
}, scope: addDialog.scope, onSave: handleCreate, isSaving: createMutation.isPending })), editingMemory && (_jsx(MemoryFormDialog, { open: true, onOpenChange: (open) => {
|
|
@@ -93,7 +93,7 @@ export function MemoriesPanel(props) {
|
|
|
93
93
|
}, scope: editingMemory.scope, initial: editingMemory, onSave: handleUpdate, isSaving: updateMutation.isPending }))] }));
|
|
94
94
|
}
|
|
95
95
|
function MemoryListItem(props) {
|
|
96
|
-
const { memory,
|
|
97
|
-
const canEdit = memory.scope !== GQLMemoryScope.Company ||
|
|
98
|
-
return (_jsxs("li", { className: "flex items-start gap-3 px-4 py-3", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("p", { className: "typography-caption-medium text-default-foreground truncate", children: memory.label }), _jsx("p", { className: "typography-small text-muted-foreground line-clamp-2 mt-0.5", children: memory.description })] }), _jsxs("div", { className: "shrink-0 flex items-center gap-2 pt-0.5", children: [
|
|
96
|
+
const { memory, canManageSharedMemories, onEdit, onDelete } = props;
|
|
97
|
+
const canEdit = memory.scope !== GQLMemoryScope.Company || canManageSharedMemories;
|
|
98
|
+
return (_jsxs("li", { className: "flex items-start gap-3 px-4 py-3", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("p", { className: "typography-caption-medium text-default-foreground truncate", children: memory.label }), _jsx("p", { className: "typography-small text-muted-foreground line-clamp-2 mt-0.5", children: memory.description })] }), _jsxs("div", { className: "shrink-0 flex items-center gap-2 pt-0.5", children: [canManageSharedMemories && _jsx(ScopeBadge, { scope: memory.scope }), _jsx(KindBadge, { kind: memory.kind }), canEdit && (_jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { asChild: true, children: _jsx(Button, { variant: "tertiary", size: "sm", iconOnly: true, icon: EllipsisIcon, "aria-label": "Memory actions" }) }), _jsx(DropdownContent, { align: "end", className: "z-60", children: _jsxs(DropdownGroup, { children: [_jsxs(DropdownItem, { onSelect: onEdit, children: [_jsx(Pencil, { size: 16 }), "Edit"] }), _jsxs(DropdownItem, { onSelect: onDelete, children: [_jsx(Trash2, { size: 16, className: "text-error-foreground" }), "Delete"] })] }) })] }))] })] }));
|
|
99
99
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GQLMemory } from "@manta-eu/client";
|
|
2
2
|
export type MemoryActionsProps = {
|
|
3
3
|
memory: GQLMemory;
|
|
4
|
-
|
|
4
|
+
canManageSharedMemories?: boolean;
|
|
5
5
|
onEdit: (memory: GQLMemory) => void;
|
|
6
6
|
onDelete: (iri: string) => void;
|
|
7
7
|
onMove?: (memory: GQLMemory) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryActions.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoryActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAkBlE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,SAAS,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"MemoryActions.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoryActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAkBlE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,SAAS,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,kDAsEtD"}
|
|
@@ -8,17 +8,17 @@ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent,
|
|
|
8
8
|
import { Button } from "#components/button/index";
|
|
9
9
|
import { Dropdown, DropdownContent, DropdownGroup, DropdownItem, DropdownTrigger } from "#components/dropdown/index";
|
|
10
10
|
export function MemoryActions(props) {
|
|
11
|
-
const { memory,
|
|
11
|
+
const { memory, canManageSharedMemories, onEdit, onDelete, onMove, onRestore, onReconfirm } = props;
|
|
12
12
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
13
13
|
const isRealm = memory.scope === GQLMemoryScope.Company;
|
|
14
14
|
if (isPresent(memory.supersededBy)) {
|
|
15
|
-
const canRestore =
|
|
15
|
+
const canRestore = canManageSharedMemories || memory.scope === GQLMemoryScope.User;
|
|
16
16
|
if (!canRestore)
|
|
17
17
|
return null;
|
|
18
18
|
return (_jsx("div", { className: "text-right", onClick: (e) => e.stopPropagation(), children: _jsxs(Button, { variant: "tertiary", size: "sm", rounded: "lg", onClick: () => onRestore?.(memory.iri), className: "gap-1.5", children: [_jsx(Undo2, { size: 14 }), "Restore"] }) }));
|
|
19
19
|
}
|
|
20
|
-
if (!isRealm ||
|
|
21
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-right", onClick: (e) => e.stopPropagation(), children: _jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { asChild: true, children: _jsx(Button, { variant: "tertiary", iconOnly: true, icon: EllipsisIcon, "aria-label": "Actions" }) }), _jsx(DropdownContent, { align: "end", className: "z-60 w-44", children: _jsxs(DropdownGroup, { children: [_jsxs(DropdownItem, { onSelect: () => onEdit(memory), children: [_jsx(Pencil, { size: 16 }), "Edit"] }), onReconfirm && needsTrustReview(memory) && (_jsxs(DropdownItem, { onSelect: () => onReconfirm(memory.iri), children: [_jsx(BadgeCheck, { size: 16 }), "Reconfirm"] })), onMove &&
|
|
20
|
+
if (!isRealm || canManageSharedMemories) {
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-right", onClick: (e) => e.stopPropagation(), children: _jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { asChild: true, children: _jsx(Button, { variant: "tertiary", iconOnly: true, icon: EllipsisIcon, "aria-label": "Actions" }) }), _jsx(DropdownContent, { align: "end", className: "z-60 w-44", children: _jsxs(DropdownGroup, { children: [_jsxs(DropdownItem, { onSelect: () => onEdit(memory), children: [_jsx(Pencil, { size: 16 }), "Edit"] }), onReconfirm && needsTrustReview(memory) && (_jsxs(DropdownItem, { onSelect: () => onReconfirm(memory.iri), children: [_jsx(BadgeCheck, { size: 16 }), "Reconfirm"] })), onMove && canManageSharedMemories && (_jsxs(DropdownItem, { onSelect: () => onMove(memory), children: [_jsx(MoveRight, { size: 16 }), "Move to\u2026"] })), _jsxs(DropdownItem, { onSelect: () => setConfirmOpen(true), children: [_jsx(Trash2, { size: 16, className: "text-error-foreground" }), "Delete"] })] }) })] }) }), _jsx(AlertDialog, { open: confirmOpen, onOpenChange: setConfirmOpen, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Delete memory?" }), _jsxs(AlertDialogDescription, { children: ["\"", memory.label, "\" will be permanently deleted."] })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Cancel" }), _jsx(AlertDialogAction, { variant: "destructive", onClick: () => onDelete(memory.iri), children: "Delete" })] })] }) })] }));
|
|
22
22
|
}
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
@@ -17,7 +17,7 @@ export type MemoryFieldsProps = {
|
|
|
17
17
|
form: MemoryFormState;
|
|
18
18
|
errors: FormErrors;
|
|
19
19
|
isTeam: boolean;
|
|
20
|
-
|
|
20
|
+
canManageSharedMemories?: boolean;
|
|
21
21
|
schemas?: GQLMemorySchema[];
|
|
22
22
|
onChange: (next: Partial<MemoryFormState>) => void;
|
|
23
23
|
descriptionPlaceholder?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryFields.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoryFields.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAwBvC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,aAAa,GAAG,OAAO,GAAG,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE3G,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gBAAgB,EAA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AAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACnD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAyHpD"}
|
|
@@ -22,9 +22,9 @@ export const emptyForm = {
|
|
|
22
22
|
importance: 3,
|
|
23
23
|
};
|
|
24
24
|
export function MemoryFields(props) {
|
|
25
|
-
const { form, errors, isTeam,
|
|
25
|
+
const { form, errors, isTeam, canManageSharedMemories = false, schemas, onChange, descriptionPlaceholder, labelPlaceholder, autoFocus = false, onEditProperties, filledPropertyCount = 0, totalPropertyCount = 0, children, } = props;
|
|
26
26
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("label", { className: "typography-small", children: "Importance" }), _jsx(ImportanceSlider, { value: form.importance, onChange: (v) => onChange({ importance: v }) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("label", { className: "typography-small", children: "Kind" }), _jsxs(Select, { value: form.kind, onValueChange: (v) => onChange({ kind: v }), children: [_jsx(SelectTrigger, { label: "Kind", id: "memory-kind", hiddenLabel: true, children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: GQLMemoryKind.Preference, children: "Preference" }), _jsx(SelectItem, { value: GQLMemoryKind.Fact, children: "Fact" }), _jsx(SelectItem, { value: GQLMemoryKind.Objective, children: "Objective" }), _jsx(SelectItem, { value: GQLMemoryKind.Context, children: "Context" })] })] })] }), isPresent(schemas) && (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("label", { className: "typography-small", children: "Schema" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Combobox, { children: [_jsx(ComboboxTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: cn(createSelectClassName({ size: "base" }), "flex-1 min-w-0"), children: [_jsx("span", { className: cn("flex-1 min-w-0 truncate text-left", !form.memorySubclass && "text-placeholder-foreground"), children: form.memorySubclass
|
|
27
27
|
? (schemas.find((s) => s.iri === form.memorySubclass)?.label ??
|
|
28
28
|
formatEntityName(form.memorySubclass))
|
|
29
|
-
: "Default" }), _jsx(ChevronDown, { className: "size-4 shrink-0 text-muted-foreground" })] }) }), _jsxs(ComboboxContent, { align: "start", className: "w-[var(--radix-popover-trigger-width,320px)]", children: [_jsx(ComboboxInput, { placeholder: "Search schemas\u2026" }), _jsxs(ComboboxList, { children: [_jsx(ComboboxEmpty, { children: "No schemas found" }), _jsx(ComboboxItem, { value: "none", selected: form.memorySubclass === null, onSelect: () => onChange({ memorySubclass: null, customProperties: {} }), children: "Default" }), schemas.map((schema) => (_jsx(ComboboxItem, { value: schema.label, selected: form.memorySubclass === schema.iri, onSelect: () => onChange({ memorySubclass: schema.iri, customProperties: {} }), children: schema.label }, schema.iri)))] })] })] }), onEditProperties && totalPropertyCount > 0 && (_jsxs(Button, { type: "button", variant: "tertiary", size: "base", onClick: onEditProperties, className: "shrink-0", children: [filledPropertyCount > 0 ? `${filledPropertyCount}/${totalPropertyCount} filled` : "Edit properties", _jsx(ChevronRight, { className: "size-3.5" })] }))] })] })), _jsx(Input, { id: "memory-label", label: "Label", placeholder: labelPlaceholder, value: form.label, onChange: (e) => onChange({ label: e.target.value }), error: errors.label }), _jsx(Textarea, { id: "memory-description", label: "Description", placeholder: descriptionPlaceholder, value: form.description ?? "", onChange: (e) => onChange({ description: e.target.value }), minRows: 3, maxRows: 8, autoFocus: autoFocus, error: errors.description }), children, isTeam && (_jsx(TeamPicker, { selected: form.teams, onChange: (teams) => onChange({ teams }),
|
|
29
|
+
: "Default" }), _jsx(ChevronDown, { className: "size-4 shrink-0 text-muted-foreground" })] }) }), _jsxs(ComboboxContent, { align: "start", className: "w-[var(--radix-popover-trigger-width,320px)]", children: [_jsx(ComboboxInput, { placeholder: "Search schemas\u2026" }), _jsxs(ComboboxList, { children: [_jsx(ComboboxEmpty, { children: "No schemas found" }), _jsx(ComboboxItem, { value: "none", selected: form.memorySubclass === null, onSelect: () => onChange({ memorySubclass: null, customProperties: {} }), children: "Default" }), schemas.map((schema) => (_jsx(ComboboxItem, { value: schema.label, selected: form.memorySubclass === schema.iri, onSelect: () => onChange({ memorySubclass: schema.iri, customProperties: {} }), children: schema.label }, schema.iri)))] })] })] }), onEditProperties && totalPropertyCount > 0 && (_jsxs(Button, { type: "button", variant: "tertiary", size: "base", onClick: onEditProperties, className: "shrink-0", children: [filledPropertyCount > 0 ? `${filledPropertyCount}/${totalPropertyCount} filled` : "Edit properties", _jsx(ChevronRight, { className: "size-3.5" })] }))] })] })), _jsx(Input, { id: "memory-label", label: "Label", placeholder: labelPlaceholder, value: form.label, onChange: (e) => onChange({ label: e.target.value }), error: errors.label }), _jsx(Textarea, { id: "memory-description", label: "Description", placeholder: descriptionPlaceholder, value: form.description ?? "", onChange: (e) => onChange({ description: e.target.value }), minRows: 3, maxRows: 8, autoFocus: autoFocus, error: errors.description }), children, isTeam && (_jsx(TeamPicker, { selected: form.teams, onChange: (teams) => onChange({ teams }), canManageSharedMemories: canManageSharedMemories, error: errors.teams }))] }));
|
|
30
30
|
}
|
|
@@ -7,7 +7,7 @@ export type MemoryFormDialogProps = {
|
|
|
7
7
|
initial?: GQLMemory;
|
|
8
8
|
onSave: (form: MemoryFormState, supersedesMemoryIris?: string[]) => Promise<void>;
|
|
9
9
|
isSaving: boolean;
|
|
10
|
-
|
|
10
|
+
canManageSharedMemories?: boolean;
|
|
11
11
|
schemas?: GQLMemorySchema[];
|
|
12
12
|
currentUserId?: string;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryFormDialog.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoryFormDialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA6B,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUnH,OAAO,EAA4C,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAuBhG,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,QAAQ,EAAE,OAAO,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"MemoryFormDialog.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/MemoryFormDialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA6B,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUnH,OAAO,EAA4C,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAuBhG,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAsGF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAkf5D"}
|
|
@@ -59,7 +59,7 @@ function MemoryDateField(props) {
|
|
|
59
59
|
return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("label", { htmlFor: id, className: "typography-small", children: label }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", id: id, "aria-invalid": error ? true : undefined, "aria-describedby": error ? errorId : undefined, className: cn(createSelectClassName({ size: "base" }), "flex-1 min-w-0 gap-2"), children: [_jsx(CalendarIcon, { className: "size-4 shrink-0 text-muted-foreground" }), _jsx("span", { className: cn("flex-1 min-w-0 truncate text-left", !value && "text-placeholder-foreground"), children: selected ? format(selected, "MMM d, yyyy") : placeholder })] }) }), _jsx(PopoverContent, { align: "start", className: "w-auto border-0 bg-transparent p-0 shadow-none", children: _jsx(Calendar, { mode: "single", captionLayout: "dropdown", startMonth: new Date(), endMonth: latest ?? addYears(new Date(), 10), selected: selected, defaultMonth: selected, disabled: latest ? { before: startOfTomorrow(), after: latest } : { before: startOfTomorrow() }, onSelect: (date) => onChange(date ? endOfDay(date).toISOString() : null) }) })] }), value && (_jsxs(Button, { type: "button", variant: "tertiary", size: "base", onClick: () => onChange(null), className: "shrink-0", children: [_jsx(X, { className: "size-3.5" }), "Clear"] }))] }), _jsx("p", { className: "typography-small text-muted-foreground", children: hint }), error && (_jsx("p", { id: errorId, className: "typography-small text-error-foreground", children: error }))] }));
|
|
60
60
|
}
|
|
61
61
|
export function MemoryFormDialog(props) {
|
|
62
|
-
const { open, onOpenChange, scope, initial, onSave, isSaving,
|
|
62
|
+
const { open, onOpenChange, scope, initial, onSave, isSaving, canManageSharedMemories = false, schemas, currentUserId, } = props;
|
|
63
63
|
const isEdit = !!initial;
|
|
64
64
|
const isCompany = scope === GQLMemoryScope.Company;
|
|
65
65
|
const isTeam = scope === GQLMemoryScope.Team;
|
|
@@ -288,7 +288,7 @@ export function MemoryFormDialog(props) {
|
|
|
288
288
|
}));
|
|
289
289
|
}
|
|
290
290
|
return (_jsxs("div", { className: "flex flex-col gap-2 rounded-lg bg-faint p-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("label", { htmlFor: hasLargeEnum || (!hasSmallEnum && !isBoolean) ? `prop-${localName}` : undefined, className: "typography-small-medium text-default-foreground flex-1", children: [prop.label, prop.required && _jsx("span", { className: "text-error-foreground ml-1", children: "*" })] }), _jsx("span", { className: "typography-tiny text-muted-foreground bg-card border border-muted-border rounded px-1.5 py-0.5 shrink-0", children: shortDatatype(prop.dataType) })] }), hasSmallEnum ? (_jsx("div", { className: "flex gap-1 flex-wrap", children: prop.allowedValues.map((v) => (_jsx(Button, { type: "button", variant: value === v ? "primary" : "tertiary", size: "sm", rounded: "md", onClick: () => setPropValue(v), children: v }, v))) })) : hasLargeEnum ? (_jsxs(Select, { value: value, onValueChange: setPropValue, children: [_jsx(SelectTrigger, { label: prop.label, id: `prop-${localName}`, hiddenLabel: true, children: _jsx(SelectValue, { placeholder: `Select ${prop.label.toLowerCase()}` }) }), _jsx(SelectContent, { children: prop.allowedValues.map((v) => (_jsx(SelectItem, { value: v, children: v }, v))) })] })) : isBoolean ? (_jsx("div", { className: "flex gap-1", children: ["true", "false"].map((v) => (_jsx(Button, { type: "button", variant: (value || "false") === v ? "primary" : "tertiary", size: "sm", rounded: "md", className: "flex-1", onClick: () => setPropValue(v), children: v === "true" ? "Yes" : "No" }, v))) })) : (_jsx(Input, { id: `prop-${localName}`, type: isNumeric ? "number" : "text", value: value, onChange: (e) => setPropValue(e.target.value), placeholder: `Enter ${prop.label.toLowerCase()}` }))] }, prop.path));
|
|
291
|
-
})) : (_jsxs(MemoryFields, { form: form, errors: errors, isTeam: isTeam,
|
|
291
|
+
})) : (_jsxs(MemoryFields, { form: form, errors: errors, isTeam: isTeam, canManageSharedMemories: canManageSharedMemories, schemas: schemas, onChange: (next) => setForm((prev) => ({ ...prev, ...next })), labelPlaceholder: isEdit ? "e.g. Target ROAS" : "Auto-generated from description", descriptionPlaceholder: getDescriptionPlaceholder(), autoFocus: !isEdit, onEditProperties: hasProperties ? () => setView("properties") : undefined, filledPropertyCount: filledPropertyCount, totalPropertyCount: schemaProperties.length, children: [_jsx(MemoryDateField, { id: "memory-expiry", label: "Valid until", hint: "No longer true after this date, so the agent stops using it. Nothing is deleted. Use it only for a real deadline.", placeholder: "Never expires", value: form.memoryValidUntil, onChange: (memoryValidUntil) => setForm((prev) => ({ ...prev, memoryValidUntil })) }), _jsx(MemoryDateField, { id: "memory-trust-horizon", label: "Trusted until", hint: "Stops pre-loading after this date but stays searchable. Use it for anything that drifts.", placeholder: "Trusted indefinitely", value: form.memoryTrustedUntil, notAfter: form.memoryValidUntil, error: errors.memoryTrustedUntil, onChange: (memoryTrustedUntil) => setForm((prev) => ({ ...prev, memoryTrustedUntil })) })] })) }), _jsx(DialogFooter, { children: view === "conflicts" ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "secondary", onClick: handleSaveWithoutSuperseding, className: "sm:mr-auto", disabled: isSaving, children: "Save & keep both" }), _jsx(Button, { onClick: handleConflictConfirmInline, disabled: conflictChecked.size === 0 || isSaving, children: getReplaceLabel() })] })) : view === "properties" ? (_jsx(Button, { onClick: () => setView("main"), children: "Done" })) : showDiscardConfirm ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "typography-small text-muted-foreground mr-auto", children: "Discard unsaved changes?" }), _jsx(Button, { variant: "tertiary", onClick: () => setShowDiscardConfirm(false), children: "Keep editing" }), _jsx(Button, { variant: "destructive", onClick: () => onOpenChange(false), children: "Discard" })] })) : conflictCheckTimedOut && pendingForm ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "typography-small text-muted-foreground mr-auto", children: "Conflict check timed out. Save without checking?" }), _jsx(Button, { variant: "tertiary", onClick: () => {
|
|
292
292
|
setConflictCheckTimedOut(false);
|
|
293
293
|
setPendingForm(null);
|
|
294
294
|
}, disabled: isSaving, children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type TeamPickerProps = {
|
|
2
2
|
selected: string[];
|
|
3
3
|
onChange: (teams: string[]) => void;
|
|
4
|
-
|
|
4
|
+
canManageSharedMemories: boolean;
|
|
5
5
|
error?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function TeamPicker(props: TeamPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TeamPicker.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/TeamPicker.tsx"],"names":[],"mappings":"AAeA,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,
|
|
1
|
+
{"version":3,"file":"TeamPicker.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/components/TeamPicker.tsx"],"names":[],"mappings":"AAeA,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,uBAAuB,EAAE,OAAO,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAMF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAoEhD"}
|
|
@@ -9,9 +9,9 @@ function getTeamName(path) {
|
|
|
9
9
|
return path.split("/").filter(Boolean).pop() ?? path;
|
|
10
10
|
}
|
|
11
11
|
export function TeamPicker(props) {
|
|
12
|
-
const { selected, onChange,
|
|
12
|
+
const { selected, onChange, canManageSharedMemories, error } = props;
|
|
13
13
|
const { mantaClient } = useMantaClient();
|
|
14
|
-
const { data } = useAvailableTeamsQuery(mantaClient, undefined, { enabled:
|
|
14
|
+
const { data } = useAvailableTeamsQuery(mantaClient, undefined, { enabled: canManageSharedMemories });
|
|
15
15
|
const availableTeams = data?.availableTeams.teams.map((g) => g.name) ?? [];
|
|
16
16
|
function toggle(path) {
|
|
17
17
|
onChange(selected.includes(path) ? selected.filter((t) => t !== path) : [...selected, path]);
|
|
@@ -18,7 +18,7 @@ export declare const memoryColumnLabels: {
|
|
|
18
18
|
};
|
|
19
19
|
export declare const defaultColumnOrder: string[];
|
|
20
20
|
type UseMemoryColumnsArgs = {
|
|
21
|
-
|
|
21
|
+
canManageSharedMemories?: boolean;
|
|
22
22
|
userId: string;
|
|
23
23
|
schemas?: GQLMemorySchema[];
|
|
24
24
|
onEdit: (memory: GQLMemory) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMemoryColumns.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/hooks/useMemoryColumns.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA2BvD,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAGpF,eAAO,MAAM,kBAAkB;;;;;;CAMkB,CAAC;AAElD,eAAO,MAAM,kBAAkB,UAW9B,CAAC;AAyBF,KAAK,oBAAoB,GAAG;IAC1B,
|
|
1
|
+
{"version":3,"file":"useMemoryColumns.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/hooks/useMemoryColumns.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA2BvD,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAGpF,eAAO,MAAM,kBAAkB;;;;;;CAMkB,CAAC;AAElD,eAAO,MAAM,kBAAkB,UAW9B,CAAC;AAyBF,KAAK,oBAAoB,GAAG;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;CAClD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,SAAS,CAAC,SAAS,CAAC,EAAE,CA+PnF"}
|
|
@@ -54,7 +54,7 @@ function MaybeTooltip(props) {
|
|
|
54
54
|
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: children }), _jsx(TooltipContent, { children: tooltip })] }));
|
|
55
55
|
}
|
|
56
56
|
export function useMemoryColumns(args) {
|
|
57
|
-
const {
|
|
57
|
+
const { canManageSharedMemories, userId, schemas, onEdit, onDelete, onMove, onRestore, onReconfirm, duplicates } = args;
|
|
58
58
|
return useMemo(() => {
|
|
59
59
|
const schemaByIri = new Map(schemas?.map((s) => [s.iri, s]) ?? []);
|
|
60
60
|
return [
|
|
@@ -181,8 +181,8 @@ export function useMemoryColumns(args) {
|
|
|
181
181
|
id: memoryColumnIds.actions,
|
|
182
182
|
enableHiding: false,
|
|
183
183
|
enableSorting: false,
|
|
184
|
-
cell: ({ row }) => (_jsx(MemoryActions, { memory: row.original,
|
|
184
|
+
cell: ({ row }) => (_jsx(MemoryActions, { memory: row.original, canManageSharedMemories: canManageSharedMemories, onEdit: onEdit, onDelete: onDelete, onMove: onMove, onRestore: onRestore, onReconfirm: onReconfirm })),
|
|
185
185
|
},
|
|
186
186
|
];
|
|
187
|
-
}, [
|
|
187
|
+
}, [canManageSharedMemories, userId, schemas, onEdit, onDelete, onMove, onRestore, onReconfirm, duplicates]);
|
|
188
188
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/memories/index.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAAkD,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA8FtG,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,OAAO,EACL,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EACL,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KA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