@elevasis/ui 2.25.6 → 2.26.1
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/dist/api/index.js +2 -2
- package/dist/app/index.css +15 -5
- package/dist/app/index.d.ts +61 -14
- package/dist/app/index.js +6 -6
- package/dist/charts/index.js +6 -5
- package/dist/chunk-3MEXPLWT.js +265 -0
- package/dist/{chunk-BDKM56TP.js → chunk-4KTLOK7K.js} +1 -1
- package/dist/{chunk-KMAXFJPH.js → chunk-CW3UNAF2.js} +5 -409
- package/dist/{chunk-HKBEURCV.js → chunk-G26INIF3.js} +1 -1
- package/dist/{chunk-7F3IQMLI.js → chunk-G66QFZXD.js} +11 -214
- package/dist/{chunk-QIW6OCEI.js → chunk-HLFFKKT3.js} +27 -373
- package/dist/chunk-JDNEWB5F.js +10 -0
- package/dist/{chunk-L7D6KNHV.js → chunk-JKBGDFX2.js} +890 -749
- package/dist/{chunk-YRKQNPK2.js → chunk-JPGX3533.js} +4 -3
- package/dist/chunk-KEFWANZY.js +155 -0
- package/dist/chunk-LH4GPYDX.js +448 -0
- package/dist/{chunk-JXSBOG2R.js → chunk-LWKZ3BCC.js} +5 -4
- package/dist/chunk-MYEOTM7D.js +92 -0
- package/dist/chunk-OGXKOMUT.js +412 -0
- package/dist/chunk-OHXU5WWK.js +3731 -0
- package/dist/chunk-ONFKASZI.js +2004 -0
- package/dist/{chunk-U36X6NZM.js → chunk-RIFTUOPE.js} +2 -14
- package/dist/{chunk-T6INEVX6.js → chunk-SGS4CQ2B.js} +1 -1
- package/dist/{chunk-C7IBFI5B.js → chunk-UPMX5GJI.js} +5 -5
- package/dist/{chunk-ARJPZ66V.js → chunk-UY5I2KOZ.js} +208 -3124
- package/dist/chunk-W2ZTLH7Y.js +662 -0
- package/dist/{chunk-KNISO652.js → chunk-WUVR4QY6.js} +9 -9
- package/dist/{chunk-Q5BEODAT.js → chunk-X2SUMO3P.js} +2 -1
- package/dist/{chunk-SNHGSCKH.js → chunk-XBMCDGHA.js} +1 -1
- package/dist/{chunk-N55DVMAG.js → chunk-XQQEKWTL.js} +2 -6
- package/dist/{chunk-SBQ4MYQV.js → chunk-XZSEPJZQ.js} +5 -6
- package/dist/{chunk-CPAJXBTL.js → chunk-YHBPR67D.js} +490 -676
- package/dist/{chunk-QARSVM7Q.js → chunk-YO2YORW4.js} +4 -4
- package/dist/{chunk-TAIX4NO3.js → chunk-ZFLM2YVW.js} +2 -2
- package/dist/components/index.css +15 -5
- package/dist/components/index.d.ts +202 -383
- package/dist/components/index.js +43 -429
- package/dist/components/navigation/index.css +25 -15
- package/dist/execution/index.d.ts +0 -73
- package/dist/features/auth/index.css +25 -15
- package/dist/features/crm/index.css +25 -15
- package/dist/features/crm/index.d.ts +49 -49
- package/dist/features/crm/index.js +14 -15
- package/dist/features/dashboard/index.css +25 -15
- package/dist/features/dashboard/index.js +18 -16
- package/dist/features/delivery/index.css +15 -5
- package/dist/features/delivery/index.js +14 -15
- package/dist/features/knowledge/index.css +611 -0
- package/dist/features/knowledge/index.js +375 -72
- package/dist/features/lead-gen/index.css +25 -15
- package/dist/features/lead-gen/index.d.ts +60 -21
- package/dist/features/lead-gen/index.js +16 -16
- package/dist/features/monitoring/index.css +15 -5
- package/dist/features/monitoring/index.js +17 -17
- package/dist/features/monitoring/requests/index.css +25 -15
- package/dist/features/monitoring/requests/index.js +13 -14
- package/dist/features/operations/index.css +25 -15
- package/dist/features/operations/index.d.ts +16 -98
- package/dist/features/operations/index.js +26 -22
- package/dist/features/settings/index.css +25 -15
- package/dist/features/settings/index.d.ts +1 -0
- package/dist/features/settings/index.js +15 -16
- package/dist/hooks/delivery/index.css +25 -15
- package/dist/hooks/delivery/index.js +2 -2
- package/dist/hooks/index.css +15 -5
- package/dist/hooks/index.d.ts +172 -380
- package/dist/hooks/index.js +13 -14
- package/dist/hooks/published.css +15 -5
- package/dist/hooks/published.d.ts +172 -380
- package/dist/hooks/published.js +13 -14
- package/dist/index.css +15 -5
- package/dist/index.d.ts +988 -403
- package/dist/index.js +15 -15
- package/dist/initialization/index.d.ts +1 -0
- package/dist/knowledge/index.d.ts +981 -41
- package/dist/knowledge/index.js +5449 -294
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +3 -2
- package/dist/organization/index.css +25 -15
- package/dist/organization/index.d.ts +1 -0
- package/dist/provider/index.css +25 -15
- package/dist/provider/index.d.ts +818 -26
- package/dist/provider/index.js +11 -11
- package/dist/provider/published.css +25 -15
- package/dist/provider/published.d.ts +817 -25
- package/dist/provider/published.js +8 -9
- package/dist/test-utils/index.js +2 -2
- package/dist/test-utils/setup.js +1 -1
- package/dist/theme/index.js +3 -2
- package/dist/theme/presets/index.d.ts +97 -0
- package/dist/theme/presets/index.js +3 -0
- package/dist/types/index.d.ts +71 -126
- package/dist/utils/index.js +1 -1
- package/dist/vite/index.d.ts +7 -0
- package/dist/vite/index.js +10 -0
- package/dist/vite-plugin-knowledge/index.d.ts +1 -33
- package/dist/vite-plugin-knowledge/index.js +1 -66
- package/package.json +16 -3
- package/src/knowledge/README.md +8 -8
- package/src/theme/presets/README.md +19 -0
- package/dist/chunk-5RLYII6P.js +0 -314
- package/dist/chunk-6U7AIIHF.js +0 -880
- package/dist/chunk-HAEJ4M54.js +0 -94
- package/dist/chunk-LPM7O6XM.js +0 -293
- /package/dist/{chunk-SGXXJE52.js → chunk-QD4X4H5A.js} +0 -0
package/dist/chunk-HAEJ4M54.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { Stack, Text, Group, Badge, UnstyledButton } from '@mantine/core';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
// src/knowledge/KnowledgeTree.tsx
|
|
6
|
-
|
|
7
|
-
// ../core/src/knowledge/queries.ts
|
|
8
|
-
function toGraphNodeId(omNodeId) {
|
|
9
|
-
return `knowledge:${omNodeId}`;
|
|
10
|
-
}
|
|
11
|
-
function buildKnowledgeSourceIdMap(graph) {
|
|
12
|
-
const map = /* @__PURE__ */ new Map();
|
|
13
|
-
for (const node of graph.nodes) {
|
|
14
|
-
if (node.kind === "knowledge" && node.sourceId) {
|
|
15
|
-
map.set(node.id, node.sourceId);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return map;
|
|
19
|
-
}
|
|
20
|
-
function byFeature(graph, featureId, knowledgeNodes) {
|
|
21
|
-
const targetGraphNodeId = `feature:${featureId}`;
|
|
22
|
-
const governingKnowledgeNodeIds = /* @__PURE__ */ new Set();
|
|
23
|
-
for (const edge of graph.edges) {
|
|
24
|
-
if (edge.kind === "governs" && edge.targetId === targetGraphNodeId && edge.sourceId.startsWith("knowledge:")) {
|
|
25
|
-
governingKnowledgeNodeIds.add(edge.sourceId);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const sourceIdMap = buildKnowledgeSourceIdMap(graph);
|
|
29
|
-
const matchingOmIds = /* @__PURE__ */ new Set();
|
|
30
|
-
for (const graphNodeId of governingKnowledgeNodeIds) {
|
|
31
|
-
const omId = sourceIdMap.get(graphNodeId);
|
|
32
|
-
if (omId) matchingOmIds.add(omId);
|
|
33
|
-
}
|
|
34
|
-
return knowledgeNodes.filter((n) => matchingOmIds.has(n.id));
|
|
35
|
-
}
|
|
36
|
-
function governs(graph, nodeId) {
|
|
37
|
-
const graphNodeId = nodeId.startsWith("knowledge:") ? nodeId : toGraphNodeId(nodeId);
|
|
38
|
-
const results = [];
|
|
39
|
-
for (const edge of graph.edges) {
|
|
40
|
-
if (edge.kind === "governs" && edge.sourceId === graphNodeId) {
|
|
41
|
-
results.push(edge.targetId);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return results;
|
|
45
|
-
}
|
|
46
|
-
function governedBy(graph, nodeId) {
|
|
47
|
-
const targetId = nodeId.startsWith("feature:") || nodeId.startsWith("knowledge:") || nodeId.startsWith("resource:") ? nodeId : `feature:${nodeId}`;
|
|
48
|
-
const results = [];
|
|
49
|
-
for (const edge of graph.edges) {
|
|
50
|
-
if (edge.kind === "governs" && edge.targetId === targetId) {
|
|
51
|
-
results.push(edge.sourceId);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return results;
|
|
55
|
-
}
|
|
56
|
-
function KnowledgeTree({ graph, knowledgeNodes, onSelectNode, selectedNodeId }) {
|
|
57
|
-
const groups = useMemo(() => {
|
|
58
|
-
const featureNodes = graph.nodes.filter((n) => n.kind === "feature");
|
|
59
|
-
return featureNodes.map((feature) => {
|
|
60
|
-
const featureId = feature.featureId ?? feature.sourceId ?? feature.id.replace(/^feature:/, "");
|
|
61
|
-
const nodes = byFeature(graph, featureId, knowledgeNodes);
|
|
62
|
-
return { feature, nodes };
|
|
63
|
-
}).filter((group) => group.nodes.length > 0);
|
|
64
|
-
}, [graph, knowledgeNodes]);
|
|
65
|
-
if (groups.length === 0) {
|
|
66
|
-
return /* @__PURE__ */ jsx(Stack, { gap: "xs", style: { padding: "var(--mantine-spacing-md)" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No knowledge nodes governing any feature." }) });
|
|
67
|
-
}
|
|
68
|
-
return /* @__PURE__ */ jsx(Stack, { gap: "md", style: { padding: "var(--mantine-spacing-sm)" }, children: groups.map(({ feature, nodes }) => /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
|
|
69
|
-
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
70
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", fw: 600, tt: "uppercase", c: "dimmed", style: { letterSpacing: "0.05em" }, children: feature.label }),
|
|
71
|
-
/* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "gray", children: nodes.length })
|
|
72
|
-
] }),
|
|
73
|
-
/* @__PURE__ */ jsx(Stack, { gap: 2, children: nodes.map((node) => {
|
|
74
|
-
const isActive = node.id === selectedNodeId;
|
|
75
|
-
return /* @__PURE__ */ jsx(
|
|
76
|
-
UnstyledButton,
|
|
77
|
-
{
|
|
78
|
-
onClick: () => onSelectNode(node),
|
|
79
|
-
style: {
|
|
80
|
-
padding: "6px 10px",
|
|
81
|
-
borderRadius: "var(--mantine-radius-sm)",
|
|
82
|
-
backgroundColor: isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : "transparent",
|
|
83
|
-
width: "100%",
|
|
84
|
-
textAlign: "left"
|
|
85
|
-
},
|
|
86
|
-
children: /* @__PURE__ */ jsx(Text, { size: "sm", c: isActive ? "var(--color-primary)" : void 0, fw: isActive ? 600 : 400, children: node.title })
|
|
87
|
-
},
|
|
88
|
-
node.id
|
|
89
|
-
);
|
|
90
|
-
}) })
|
|
91
|
-
] }, feature.id)) });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { KnowledgeTree, governedBy, governs };
|
package/dist/chunk-LPM7O6XM.js
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import { CRM_DISCOVERY_REPLIED_STATE, CRM_DISCOVERY_LINK_SENT_STATE, CRM_DISCOVERY_NUDGING_STATE, CRM_DISCOVERY_BOOKING_CANCELLED_STATE } from './chunk-5RLYII6P.js';
|
|
2
|
-
import { ApiClientProvider, useApiClient } from './chunk-T6INEVX6.js';
|
|
3
|
-
import { OrganizationProvider } from './chunk-HOIT677G.js';
|
|
4
|
-
import { getErrorInfo, getErrorTitle, formatErrorMessage } from './chunk-SGXXJE52.js';
|
|
5
|
-
import { InitializationProvider } from './chunk-WKJ47GIW.js';
|
|
6
|
-
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
7
|
-
import { ProfileProvider } from './chunk-XTVZFT7U.js';
|
|
8
|
-
import { ElevasisServiceProvider } from './chunk-5WWZXCS5.js';
|
|
9
|
-
import { useAuthContext } from './chunk-BRJ3QZ4E.js';
|
|
10
|
-
import { createContext, lazy, useContext, Suspense, useRef } from 'react';
|
|
11
|
-
import { jsx } from 'react/jsx-runtime';
|
|
12
|
-
import { z } from 'zod';
|
|
13
|
-
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
|
|
14
|
-
|
|
15
|
-
var consoleAdapter = {
|
|
16
|
-
success(title, message) {
|
|
17
|
-
console.log(`[Notification][Success] ${title}: ${message}`);
|
|
18
|
-
},
|
|
19
|
-
error(title, message) {
|
|
20
|
-
console.warn(`[Notification][Error] ${title}: ${message}`);
|
|
21
|
-
},
|
|
22
|
-
info(title, message) {
|
|
23
|
-
console.log(`[Notification][Info] ${title}: ${message}`);
|
|
24
|
-
},
|
|
25
|
-
warning(title, message) {
|
|
26
|
-
console.warn(`[Notification][Warning] ${title}: ${message}`);
|
|
27
|
-
},
|
|
28
|
-
apiError(error) {
|
|
29
|
-
const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
|
|
30
|
-
const title = getErrorTitle(code);
|
|
31
|
-
const formatted = formatErrorMessage(message, requestId, fields, retryAfter);
|
|
32
|
-
console.warn(`[Notification][API Error] ${title}: ${formatted}`);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var NotificationContext = createContext(consoleAdapter);
|
|
36
|
-
function NotificationProvider({ adapter, children }) {
|
|
37
|
-
return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: adapter, children });
|
|
38
|
-
}
|
|
39
|
-
function useNotificationAdapter() {
|
|
40
|
-
return useContext(NotificationContext);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// ../core/src/business/acquisition/deal-ownership.ts
|
|
44
|
-
var INBOUND_EVENT_TYPES = ["reply_received"];
|
|
45
|
-
var OUTBOUND_EVENT_TYPES = [
|
|
46
|
-
"reply_sent_to_lead",
|
|
47
|
-
"booking_nudge_sent",
|
|
48
|
-
"reminder_sent",
|
|
49
|
-
"rebook_sent",
|
|
50
|
-
"followup_email_sent",
|
|
51
|
-
"reply_followup_sent",
|
|
52
|
-
"lead_deferred_next_step"
|
|
53
|
-
];
|
|
54
|
-
var INBOUND_SET = new Set(INBOUND_EVENT_TYPES);
|
|
55
|
-
var OUTBOUND_SET = new Set(OUTBOUND_EVENT_TYPES);
|
|
56
|
-
function getDealOwnership(deal) {
|
|
57
|
-
if (deal.state_key === "closed_won" || deal.state_key === "closed_lost") {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
if (!Array.isArray(deal.activity_log)) return null;
|
|
61
|
-
let latestInboundMs = null;
|
|
62
|
-
let latestOutboundMs = null;
|
|
63
|
-
for (const entry of deal.activity_log) {
|
|
64
|
-
if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
65
|
-
const record = entry;
|
|
66
|
-
const type = typeof record.type === "string" ? record.type : null;
|
|
67
|
-
if (!type) continue;
|
|
68
|
-
const isInbound = INBOUND_SET.has(type);
|
|
69
|
-
const isOutbound = OUTBOUND_SET.has(type);
|
|
70
|
-
if (!isInbound && !isOutbound) continue;
|
|
71
|
-
const occurredAt = resolveTimestamp(record);
|
|
72
|
-
if (occurredAt === null) continue;
|
|
73
|
-
if (isInbound && (latestInboundMs === null || occurredAt > latestInboundMs)) {
|
|
74
|
-
latestInboundMs = occurredAt;
|
|
75
|
-
}
|
|
76
|
-
if (isOutbound && (latestOutboundMs === null || occurredAt > latestOutboundMs)) {
|
|
77
|
-
latestOutboundMs = occurredAt;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (latestInboundMs === null && latestOutboundMs === null) return null;
|
|
81
|
-
if (latestOutboundMs !== null && (latestInboundMs === null || latestOutboundMs >= latestInboundMs)) {
|
|
82
|
-
return "them";
|
|
83
|
-
}
|
|
84
|
-
return "us";
|
|
85
|
-
}
|
|
86
|
-
function resolveTimestamp(record) {
|
|
87
|
-
return parseMs(record.timestamp) ?? parseMs(record.occurredAt) ?? parseMs(record.createdAt) ?? parseMs(record.updatedAt) ?? parseMs(record.sentAt) ?? null;
|
|
88
|
-
}
|
|
89
|
-
function parseMs(value) {
|
|
90
|
-
if (value instanceof Date) {
|
|
91
|
-
const ms2 = value.getTime();
|
|
92
|
-
return Number.isNaN(ms2) ? null : ms2;
|
|
93
|
-
}
|
|
94
|
-
if (typeof value !== "string") return null;
|
|
95
|
-
const ms = new Date(value).getTime();
|
|
96
|
-
return Number.isNaN(ms) ? null : ms;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ../core/src/business/acquisition/derive-actions.ts
|
|
100
|
-
var SendReplyActionPayloadSchema = z.object({
|
|
101
|
-
replyBody: z.string().trim().min(1).max(1e4)
|
|
102
|
-
}).strict();
|
|
103
|
-
var DEFAULT_CRM_ACTIONS = [
|
|
104
|
-
{
|
|
105
|
-
key: "move_to_proposal",
|
|
106
|
-
label: "Move to Proposal",
|
|
107
|
-
isAvailableFor: (deal) => deal.stage_key === "interested",
|
|
108
|
-
workflowId: "move_to_proposal-workflow"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
key: "move_to_closing",
|
|
112
|
-
label: "Move to Closing",
|
|
113
|
-
isAvailableFor: (deal) => deal.stage_key === "proposal",
|
|
114
|
-
workflowId: "move_to_closing-workflow"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
key: "move_to_closed_won",
|
|
118
|
-
label: "Close Won",
|
|
119
|
-
isAvailableFor: (deal) => deal.stage_key === "closing",
|
|
120
|
-
workflowId: "move_to_closed_won-workflow"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
key: "move_to_closed_lost",
|
|
124
|
-
label: "Close Lost",
|
|
125
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
|
|
126
|
-
workflowId: "move_to_closed_lost-workflow"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
key: "move_to_nurturing",
|
|
130
|
-
label: "Move to Nurturing",
|
|
131
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
|
|
132
|
-
workflowId: "move_to_nurturing-workflow"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
key: "send_reply",
|
|
136
|
-
label: "Send Reply",
|
|
137
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" && isOurReplyAction(deal) && (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey || deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey || deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
138
|
-
workflowId: "crm-send-reply-workflow",
|
|
139
|
-
payloadSchema: SendReplyActionPayloadSchema
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
key: "send_link",
|
|
143
|
-
label: "Send Booking Link",
|
|
144
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
|
|
145
|
-
workflowId: "crm-send-booking-link-workflow"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
key: "send_nudge",
|
|
149
|
-
label: "Send Nudge",
|
|
150
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" && (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey || deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
151
|
-
workflowId: "crm-send-nudge-workflow"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
key: "mark_no_show",
|
|
155
|
-
label: "Mark No-Show",
|
|
156
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
|
|
157
|
-
// Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
|
|
158
|
-
// both manual-click and timeout move the deal to closed_lost. The action_taken activity
|
|
159
|
-
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
160
|
-
workflowId: "mark_no_show-workflow"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
key: "rebook",
|
|
164
|
-
label: "Rebook",
|
|
165
|
-
isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
|
|
166
|
-
workflowId: "crm-rebook-workflow"
|
|
167
|
-
}
|
|
168
|
-
];
|
|
169
|
-
function deriveActions(deal, actions = DEFAULT_CRM_ACTIONS) {
|
|
170
|
-
return actions.filter((a) => a.isAvailableFor(deal)).map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }));
|
|
171
|
-
}
|
|
172
|
-
function isOurReplyAction(deal) {
|
|
173
|
-
if (Object.prototype.hasOwnProperty.call(deal, "nextAction")) {
|
|
174
|
-
return deal.nextAction === "send_reply";
|
|
175
|
-
}
|
|
176
|
-
return (deal.ownership ?? getDealOwnership(deal)) === "us";
|
|
177
|
-
}
|
|
178
|
-
var CrmActionsContext = createContext(DEFAULT_CRM_ACTIONS);
|
|
179
|
-
function CrmActionsProvider({ actions, children }) {
|
|
180
|
-
return /* @__PURE__ */ jsx(CrmActionsContext.Provider, { value: actions, children });
|
|
181
|
-
}
|
|
182
|
-
function useCrmActions() {
|
|
183
|
-
return useContext(CrmActionsContext);
|
|
184
|
-
}
|
|
185
|
-
var EMPTY_LIST_ACTIONS = Object.freeze([]);
|
|
186
|
-
var ListActionsContext = createContext(EMPTY_LIST_ACTIONS);
|
|
187
|
-
function ListActionsProvider({
|
|
188
|
-
registry = EMPTY_LIST_ACTIONS,
|
|
189
|
-
children
|
|
190
|
-
}) {
|
|
191
|
-
return /* @__PURE__ */ jsx(ListActionsContext.Provider, { value: registry, children });
|
|
192
|
-
}
|
|
193
|
-
function useListActions() {
|
|
194
|
-
return useContext(ListActionsContext);
|
|
195
|
-
}
|
|
196
|
-
function findListActionByCapability(registry, capabilityKey) {
|
|
197
|
-
return registry.find((action) => action.capabilityKey === capabilityKey);
|
|
198
|
-
}
|
|
199
|
-
function getListActionWorkflowId(action) {
|
|
200
|
-
return action.workflowId ?? action.resourceId;
|
|
201
|
-
}
|
|
202
|
-
var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-QC62UHTZ.js').then((m) => ({ default: m.CoreAuthKitInner })));
|
|
203
|
-
var defaultQueryClient = null;
|
|
204
|
-
function getDefaultQueryClient() {
|
|
205
|
-
if (!defaultQueryClient) {
|
|
206
|
-
defaultQueryClient = new QueryClient({
|
|
207
|
-
defaultOptions: { queries: { retry: 1 } }
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
return defaultQueryClient;
|
|
211
|
-
}
|
|
212
|
-
var consoleNotificationAdapter = {
|
|
213
|
-
success(title, message) {
|
|
214
|
-
console.log(`[Notification][Success] ${title}: ${message}`);
|
|
215
|
-
},
|
|
216
|
-
error(title, message) {
|
|
217
|
-
console.warn(`[Notification][Error] ${title}: ${message}`);
|
|
218
|
-
},
|
|
219
|
-
info(title, message) {
|
|
220
|
-
console.log(`[Notification][Info] ${title}: ${message}`);
|
|
221
|
-
},
|
|
222
|
-
warning(title, message) {
|
|
223
|
-
console.warn(`[Notification][Warning] ${title}: ${message}`);
|
|
224
|
-
},
|
|
225
|
-
apiError(error) {
|
|
226
|
-
console.warn(`[Notification][API Error]`, error);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
function ElevasisCoreProvider({
|
|
230
|
-
auth,
|
|
231
|
-
queryClient,
|
|
232
|
-
apiUrl,
|
|
233
|
-
onError,
|
|
234
|
-
notifications,
|
|
235
|
-
crmActions,
|
|
236
|
-
listActions,
|
|
237
|
-
children
|
|
238
|
-
}) {
|
|
239
|
-
if (auth.mode === "apiKey") {
|
|
240
|
-
throw new Error(
|
|
241
|
-
`ElevasisCoreProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit' mode is supported.`
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
|
|
245
|
-
const resolvedCrmActions = crmActions ?? DEFAULT_CRM_ACTIONS;
|
|
246
|
-
const resolvedListActions = listActions ?? EMPTY_LIST_ACTIONS;
|
|
247
|
-
const content = apiUrl ? /* @__PURE__ */ jsx(ServiceStack, { apiUrl, onError, notifications, children }) : children;
|
|
248
|
-
const AuthInner = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCoreAuthKitInner, { auth, children: content }) });
|
|
249
|
-
return /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: /* @__PURE__ */ jsx(CrmActionsProvider, { actions: resolvedCrmActions, children: /* @__PURE__ */ jsx(ListActionsProvider, { registry: resolvedListActions, children: AuthInner }) }) });
|
|
250
|
-
}
|
|
251
|
-
function ServiceStack({
|
|
252
|
-
apiUrl,
|
|
253
|
-
onError,
|
|
254
|
-
notifications,
|
|
255
|
-
children
|
|
256
|
-
}) {
|
|
257
|
-
const { getAccessToken } = useAuthContext();
|
|
258
|
-
const orgIdRef = useRef(null);
|
|
259
|
-
const getOrganizationId = useRef(() => orgIdRef.current).current;
|
|
260
|
-
return /* @__PURE__ */ jsx(
|
|
261
|
-
ApiClientProvider,
|
|
262
|
-
{
|
|
263
|
-
getAccessToken,
|
|
264
|
-
getOrganizationId,
|
|
265
|
-
isOrganizationReady: false,
|
|
266
|
-
onError,
|
|
267
|
-
children: /* @__PURE__ */ jsx(ServiceStackInner, { apiUrl, orgIdRef, notifications, children })
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
function ServiceStackInner({
|
|
272
|
-
apiUrl,
|
|
273
|
-
orgIdRef,
|
|
274
|
-
notifications,
|
|
275
|
-
children
|
|
276
|
-
}) {
|
|
277
|
-
const { apiRequest } = useApiClient(apiUrl);
|
|
278
|
-
const resolvedNotifications = notifications ?? consoleNotificationAdapter;
|
|
279
|
-
return /* @__PURE__ */ jsx(ProfileProvider, { apiRequest, children: /* @__PURE__ */ jsx(OrganizationProvider, { apiRequest, children: /* @__PURE__ */ jsx(OrgServiceBridge, { orgIdRef, apiRequest, notifications: resolvedNotifications, children }) }) });
|
|
280
|
-
}
|
|
281
|
-
function OrgServiceBridge({
|
|
282
|
-
orgIdRef,
|
|
283
|
-
apiRequest,
|
|
284
|
-
notifications,
|
|
285
|
-
children
|
|
286
|
-
}) {
|
|
287
|
-
const { currentWorkOSOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
288
|
-
orgIdRef.current = currentWorkOSOrganizationId;
|
|
289
|
-
const isReady = !!currentWorkOSOrganizationId && !isInitializing && !isOrgRefreshing;
|
|
290
|
-
return /* @__PURE__ */ jsx(ElevasisServiceProvider, { apiRequest, organizationId: currentWorkOSOrganizationId, isReady, children: /* @__PURE__ */ jsx(NotificationProvider, { adapter: notifications, children: /* @__PURE__ */ jsx(InitializationProvider, { children }) }) });
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export { CrmActionsProvider, EMPTY_LIST_ACTIONS, ElevasisCoreProvider, ListActionsProvider, NotificationProvider, deriveActions, findListActionByCapability, getListActionWorkflowId, useCrmActions, useListActions, useNotificationAdapter };
|
|
File without changes
|