@burdenoff/fluidgrids-fe-sdk 2026.624.2 → 2026.629.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/{TemplateConfigurationModal-FPQR7W4M.js → TemplateConfigurationModal-VU3Q4RFX.js} +73 -24
- package/dist/TemplateConfigurationModal-VU3Q4RFX.js.map +1 -0
- package/dist/{WorkflowBuilder-MITXVIMZ.js → WorkflowBuilder-Q44GW3KQ.js} +7 -9
- package/dist/{WorkflowBuilder-MITXVIMZ.js.map → WorkflowBuilder-Q44GW3KQ.js.map} +1 -1
- package/dist/WorkflowsList-6SIM36LA.js +8 -0
- package/dist/{WorkflowsList-J33J7EIF.js.map → WorkflowsList-6SIM36LA.js.map} +1 -1
- package/dist/{chunk-M2KBI2FX.js → chunk-BK7BS2WU.js} +3 -3
- package/dist/{chunk-M2KBI2FX.js.map → chunk-BK7BS2WU.js.map} +1 -1
- package/dist/{chunk-Z2ZEVYDE.js → chunk-KU64CCSV.js} +15 -2
- package/dist/chunk-KU64CCSV.js.map +1 -0
- package/dist/{chunk-EVUQS7DK.js → chunk-YMHXH7ZK.js} +10805 -341
- package/dist/chunk-YMHXH7ZK.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/TemplateConfigurationModal-FPQR7W4M.js.map +0 -1
- package/dist/WorkflowsList-J33J7EIF.js +0 -8
- package/dist/chunk-2YP4QVEZ.js +0 -9484
- package/dist/chunk-2YP4QVEZ.js.map +0 -1
- package/dist/chunk-EVUQS7DK.js.map +0 -1
- package/dist/chunk-GSJOLO3A.js +0 -251
- package/dist/chunk-GSJOLO3A.js.map +0 -1
- package/dist/chunk-Z2ZEVYDE.js.map +0 -1
- package/dist/useImportWorkflowTemplate-PNE2ANBV.js +0 -11
- package/dist/useImportWorkflowTemplate-PNE2ANBV.js.map +0 -1
- package/dist/useTemplateDetail-NK63V3PC.js +0 -6
- package/dist/useTemplateDetail-NK63V3PC.js.map +0 -1
package/dist/chunk-GSJOLO3A.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { createGlobalStoreClient, getGlobalStoreClient } from './chunk-BQXHJIER.js';
|
|
2
|
-
import { createFluidGridsClient, setFluidGridsClient, resetFluidGridsClient } from './chunk-5BDQNSP3.js';
|
|
3
|
-
import { validateTrustedOrigin, setFluidGridsConfig, resetFluidGridsConfig, getFluidGridsConfig } from './chunk-WWU2O2SR.js';
|
|
4
|
-
import { createContext, useMemo, useEffect, useContext, useState, useCallback } from 'react';
|
|
5
|
-
import { gql } from '@apollo/client/core';
|
|
6
|
-
import { ApolloProvider } from '@apollo/client/react';
|
|
7
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var FluidGridsContext = createContext(
|
|
10
|
-
null
|
|
11
|
-
);
|
|
12
|
-
function FluidGridsProvider({
|
|
13
|
-
apiGatewayUrl,
|
|
14
|
-
globalApiUrl,
|
|
15
|
-
authToken,
|
|
16
|
-
workspaceToken,
|
|
17
|
-
workspaceId,
|
|
18
|
-
trustedOrigins,
|
|
19
|
-
tenantId,
|
|
20
|
-
organizationId,
|
|
21
|
-
workspaceClient: externalWorkspaceClient,
|
|
22
|
-
globalClient: externalGlobalClient,
|
|
23
|
-
apolloClient: legacyClient,
|
|
24
|
-
children
|
|
25
|
-
}) {
|
|
26
|
-
validateTrustedOrigin(trustedOrigins);
|
|
27
|
-
const workspaceClient = useMemo(() => {
|
|
28
|
-
if (externalWorkspaceClient) {
|
|
29
|
-
return externalWorkspaceClient;
|
|
30
|
-
}
|
|
31
|
-
if (legacyClient) {
|
|
32
|
-
return legacyClient;
|
|
33
|
-
}
|
|
34
|
-
if (apiGatewayUrl) {
|
|
35
|
-
return createFluidGridsClient({
|
|
36
|
-
apiGatewayUrl,
|
|
37
|
-
authToken,
|
|
38
|
-
workspaceToken,
|
|
39
|
-
workspaceId,
|
|
40
|
-
tenantId
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
throw new Error(
|
|
44
|
-
"FluidGridsProvider: Either provide workspaceClient or apiGatewayUrl"
|
|
45
|
-
);
|
|
46
|
-
}, [
|
|
47
|
-
apiGatewayUrl,
|
|
48
|
-
authToken,
|
|
49
|
-
workspaceToken,
|
|
50
|
-
workspaceId,
|
|
51
|
-
tenantId,
|
|
52
|
-
externalWorkspaceClient,
|
|
53
|
-
legacyClient
|
|
54
|
-
]);
|
|
55
|
-
const globalClient = useMemo(() => {
|
|
56
|
-
if (externalGlobalClient) {
|
|
57
|
-
return externalGlobalClient;
|
|
58
|
-
}
|
|
59
|
-
if (globalApiUrl) {
|
|
60
|
-
return createGlobalStoreClient({
|
|
61
|
-
globalApiUrl,
|
|
62
|
-
authToken,
|
|
63
|
-
workspaceId,
|
|
64
|
-
tenantId,
|
|
65
|
-
organizationId
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return void 0;
|
|
69
|
-
}, [
|
|
70
|
-
globalApiUrl,
|
|
71
|
-
authToken,
|
|
72
|
-
workspaceId,
|
|
73
|
-
tenantId,
|
|
74
|
-
organizationId,
|
|
75
|
-
externalGlobalClient
|
|
76
|
-
]);
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
setFluidGridsClient(workspaceClient);
|
|
79
|
-
return () => {
|
|
80
|
-
resetFluidGridsClient();
|
|
81
|
-
};
|
|
82
|
-
}, [workspaceClient]);
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
setFluidGridsConfig({
|
|
85
|
-
apiGatewayUrl,
|
|
86
|
-
globalApiUrl,
|
|
87
|
-
authToken,
|
|
88
|
-
workspaceId,
|
|
89
|
-
trustedOrigins,
|
|
90
|
-
tenantId,
|
|
91
|
-
organizationId
|
|
92
|
-
});
|
|
93
|
-
return () => {
|
|
94
|
-
resetFluidGridsConfig();
|
|
95
|
-
};
|
|
96
|
-
}, [
|
|
97
|
-
apiGatewayUrl,
|
|
98
|
-
globalApiUrl,
|
|
99
|
-
authToken,
|
|
100
|
-
workspaceId,
|
|
101
|
-
trustedOrigins,
|
|
102
|
-
tenantId,
|
|
103
|
-
organizationId
|
|
104
|
-
]);
|
|
105
|
-
const contextValue = useMemo(() => {
|
|
106
|
-
return {
|
|
107
|
-
apiGatewayUrl,
|
|
108
|
-
globalApiUrl,
|
|
109
|
-
authToken,
|
|
110
|
-
workspaceId,
|
|
111
|
-
trustedOrigins,
|
|
112
|
-
tenantId,
|
|
113
|
-
organizationId,
|
|
114
|
-
workspaceClient,
|
|
115
|
-
globalClient
|
|
116
|
-
};
|
|
117
|
-
}, [
|
|
118
|
-
apiGatewayUrl,
|
|
119
|
-
globalApiUrl,
|
|
120
|
-
authToken,
|
|
121
|
-
workspaceId,
|
|
122
|
-
trustedOrigins,
|
|
123
|
-
tenantId,
|
|
124
|
-
organizationId,
|
|
125
|
-
workspaceClient,
|
|
126
|
-
globalClient
|
|
127
|
-
]);
|
|
128
|
-
return /* @__PURE__ */ jsx(FluidGridsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(ApolloProvider, { client: workspaceClient, children }) });
|
|
129
|
-
}
|
|
130
|
-
function useFluidGridsContext() {
|
|
131
|
-
const context = useContext(FluidGridsContext);
|
|
132
|
-
if (!context) {
|
|
133
|
-
throw new Error(
|
|
134
|
-
"useFluidGridsContext must be used within FluidGridsProvider"
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
return context;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// src/hooks/store/useGlobalStoreClient.ts
|
|
141
|
-
function useGlobalStoreClient() {
|
|
142
|
-
const context = useContext(FluidGridsContext);
|
|
143
|
-
if (context?.globalClient) {
|
|
144
|
-
return context.globalClient;
|
|
145
|
-
}
|
|
146
|
-
const singletonClient = getGlobalStoreClient();
|
|
147
|
-
if (singletonClient) {
|
|
148
|
-
return singletonClient;
|
|
149
|
-
}
|
|
150
|
-
throw new Error(
|
|
151
|
-
"useGlobalStoreClient: No global client available. Either wrap your component tree with <FluidGridsProvider globalClient={...}> or call setGlobalStoreClient(client) before rendering."
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// src/hooks/store/useTemplateDetail.ts
|
|
156
|
-
var GET_WORKFLOW_TEMPLATE_DETAIL = gql`
|
|
157
|
-
query GetWorkflowTemplateDetail($id: ID!) {
|
|
158
|
-
product(id: $id) {
|
|
159
|
-
id
|
|
160
|
-
name
|
|
161
|
-
slug
|
|
162
|
-
type
|
|
163
|
-
description
|
|
164
|
-
longDescription
|
|
165
|
-
icon
|
|
166
|
-
screenshots
|
|
167
|
-
videoUrls
|
|
168
|
-
rating
|
|
169
|
-
reviewCount
|
|
170
|
-
downloads
|
|
171
|
-
viewCount
|
|
172
|
-
price
|
|
173
|
-
pricingModel
|
|
174
|
-
currency
|
|
175
|
-
featured
|
|
176
|
-
content
|
|
177
|
-
manifest
|
|
178
|
-
manifestVersion
|
|
179
|
-
authorName
|
|
180
|
-
license
|
|
181
|
-
category
|
|
182
|
-
tags
|
|
183
|
-
compatibleProducts
|
|
184
|
-
publisher {
|
|
185
|
-
id
|
|
186
|
-
name
|
|
187
|
-
email
|
|
188
|
-
websiteUrl
|
|
189
|
-
logoUrl
|
|
190
|
-
isVerified
|
|
191
|
-
}
|
|
192
|
-
createdAt
|
|
193
|
-
updatedAt
|
|
194
|
-
publishedAt
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
`;
|
|
198
|
-
function useTemplateDetail() {
|
|
199
|
-
const client = useGlobalStoreClient();
|
|
200
|
-
const [loading, setLoading] = useState(false);
|
|
201
|
-
const [error, setError] = useState(null);
|
|
202
|
-
const context = useContext(FluidGridsContext);
|
|
203
|
-
const workspaceId = context?.workspaceId ?? getFluidGridsConfig().workspaceId;
|
|
204
|
-
const organizationId = context?.organizationId;
|
|
205
|
-
const contextHeaders = useMemo(() => {
|
|
206
|
-
const headers = {};
|
|
207
|
-
if (organizationId) {
|
|
208
|
-
headers["x-organization-id"] = organizationId;
|
|
209
|
-
}
|
|
210
|
-
if (workspaceId) {
|
|
211
|
-
headers["x-workspace-id"] = workspaceId;
|
|
212
|
-
}
|
|
213
|
-
return headers;
|
|
214
|
-
}, [organizationId, workspaceId]);
|
|
215
|
-
const fetchTemplateDetail = useCallback(
|
|
216
|
-
async (templateId) => {
|
|
217
|
-
setLoading(true);
|
|
218
|
-
setError(null);
|
|
219
|
-
try {
|
|
220
|
-
const result = await client.query({
|
|
221
|
-
query: GET_WORKFLOW_TEMPLATE_DETAIL,
|
|
222
|
-
variables: { id: templateId },
|
|
223
|
-
fetchPolicy: "network-only",
|
|
224
|
-
context: Object.keys(contextHeaders).length > 0 ? { headers: contextHeaders } : void 0
|
|
225
|
-
});
|
|
226
|
-
if (result.error) {
|
|
227
|
-
throw result.error;
|
|
228
|
-
}
|
|
229
|
-
const data = result.data;
|
|
230
|
-
return data?.product ?? null;
|
|
231
|
-
} catch (err) {
|
|
232
|
-
const fetchError = err instanceof Error ? err : new Error("Failed to fetch template detail");
|
|
233
|
-
setError(fetchError);
|
|
234
|
-
console.error("[useTemplateDetail] Error:", err);
|
|
235
|
-
return null;
|
|
236
|
-
} finally {
|
|
237
|
-
setLoading(false);
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
[client, contextHeaders]
|
|
241
|
-
);
|
|
242
|
-
return {
|
|
243
|
-
fetchTemplateDetail,
|
|
244
|
-
loading,
|
|
245
|
-
error
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export { FluidGridsContext, FluidGridsProvider, useFluidGridsContext, useGlobalStoreClient, useTemplateDetail };
|
|
250
|
-
//# sourceMappingURL=chunk-GSJOLO3A.js.map
|
|
251
|
-
//# sourceMappingURL=chunk-GSJOLO3A.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/FluidGridsProvider.tsx","../src/hooks/store/useGlobalStoreClient.ts","../src/hooks/store/useTemplateDetail.ts"],"names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A,CAAS,UAAU,CAAA;AACnB,QAAA,OAAA,CAAQ,KAAA,CAAM,8BAA8B,GAAG,CAAA;AAC/C,QAAA,OAAO,IAAA;AAAA,MACT,CAAA,SAAE;AACA,QAAA,UAAA,CAAW,KAAK,CAAA;AAAA,MAClB;AAAA,IACF,CAAA;AAAA,IACA,CAAC,QAAQ,cAAc;AAAA,GACzB;AAEA,EAAA,OAAO;AAAA,IACL,mBAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-GSJOLO3A.js","sourcesContent":["import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n type ReactNode,\n} from \"react\";\nimport { ApolloProvider } from \"@apollo/client/react\";\nimport { type ApolloClient } from \"@apollo/client/core\";\nimport {\n createFluidGridsClient,\n setFluidGridsClient,\n resetFluidGridsClient,\n type FluidGridsClientConfig,\n} from \"../graphql/client\";\nimport { createGlobalStoreClient } from \"../graphql/global-client\";\nimport {\n setFluidGridsConfig,\n resetFluidGridsConfig,\n validateTrustedOrigin,\n} from \"../config\";\n\nexport interface FluidGridsProviderProps {\n /** API Gateway URL (workspace gateway) */\n apiGatewayUrl?: string;\n /** Global API Gateway URL (for store operations) */\n globalApiUrl?: string;\n /** Auth token */\n authToken?: string;\n /** Workspace token for x-workspace-authorization header */\n workspaceToken?: string;\n /** Workspace ID */\n workspaceId: string;\n /** Optional host allowlist for embedded deployments */\n trustedOrigins?: string[];\n /** Tenant ID */\n tenantId?: string;\n /** Organization ID */\n organizationId?: string;\n /** Optional: provide your own workspace Apollo client */\n workspaceClient?: ApolloClient;\n /** Optional: provide your own global Apollo client */\n globalClient?: ApolloClient;\n /** @deprecated Use workspaceClient instead */\n apolloClient?: ApolloClient;\n /** Children */\n children: ReactNode;\n}\n\ninterface FluidGridsContextValue {\n apiGatewayUrl?: string;\n globalApiUrl?: string;\n authToken?: string;\n workspaceId: string;\n trustedOrigins?: string[];\n tenantId?: string;\n organizationId?: string;\n workspaceClient?: ApolloClient;\n globalClient?: ApolloClient;\n}\n\nexport const FluidGridsContext = createContext<FluidGridsContextValue | null>(\n null,\n);\n\nexport function FluidGridsProvider({\n apiGatewayUrl,\n globalApiUrl,\n authToken,\n workspaceToken,\n workspaceId,\n trustedOrigins,\n tenantId,\n organizationId,\n workspaceClient: externalWorkspaceClient,\n globalClient: externalGlobalClient,\n apolloClient: legacyClient,\n children,\n}: FluidGridsProviderProps) {\n validateTrustedOrigin(trustedOrigins);\n\n // Create or use provided workspace Apollo client\n const workspaceClient = useMemo(() => {\n // Priority: workspaceClient > apolloClient (legacy) > create new\n if (externalWorkspaceClient) {\n return externalWorkspaceClient;\n }\n if (legacyClient) {\n return legacyClient;\n }\n if (apiGatewayUrl) {\n return createFluidGridsClient({\n apiGatewayUrl,\n authToken,\n workspaceToken,\n workspaceId,\n tenantId,\n });\n }\n throw new Error(\n \"FluidGridsProvider: Either provide workspaceClient or apiGatewayUrl\",\n );\n }, [\n apiGatewayUrl,\n authToken,\n workspaceToken,\n workspaceId,\n tenantId,\n externalWorkspaceClient,\n legacyClient,\n ]);\n\n // Create or use provided global Apollo client\n const globalClient = useMemo(() => {\n if (externalGlobalClient) {\n return externalGlobalClient;\n }\n // Only create if globalApiUrl is provided\n if (globalApiUrl) {\n return createGlobalStoreClient({\n globalApiUrl,\n authToken,\n workspaceId,\n tenantId,\n organizationId,\n });\n }\n // Return undefined if no global client provided (store features won't work)\n return undefined;\n }, [\n globalApiUrl,\n authToken,\n workspaceId,\n tenantId,\n organizationId,\n externalGlobalClient,\n ]);\n\n // Set the module-level workspace client for hooks that need direct access\n useEffect(() => {\n setFluidGridsClient(workspaceClient);\n return () => {\n resetFluidGridsClient();\n };\n }, [workspaceClient]);\n\n // Configure the SDK settings\n useEffect(() => {\n setFluidGridsConfig({\n apiGatewayUrl,\n globalApiUrl,\n authToken,\n workspaceId,\n trustedOrigins,\n tenantId,\n organizationId,\n });\n return () => {\n resetFluidGridsConfig();\n };\n }, [\n apiGatewayUrl,\n globalApiUrl,\n authToken,\n workspaceId,\n trustedOrigins,\n tenantId,\n organizationId,\n ]);\n\n const contextValue = useMemo(() => {\n return {\n apiGatewayUrl,\n globalApiUrl,\n authToken,\n workspaceId,\n trustedOrigins,\n tenantId,\n organizationId,\n workspaceClient,\n globalClient,\n };\n }, [\n apiGatewayUrl,\n globalApiUrl,\n authToken,\n workspaceId,\n trustedOrigins,\n tenantId,\n organizationId,\n workspaceClient,\n globalClient,\n ]);\n\n return (\n <FluidGridsContext.Provider value={contextValue}>\n <ApolloProvider client={workspaceClient}>{children}</ApolloProvider>\n </FluidGridsContext.Provider>\n );\n}\n\nexport function useFluidGridsContext() {\n const context = useContext(FluidGridsContext);\n if (!context) {\n throw new Error(\n \"useFluidGridsContext must be used within FluidGridsProvider\",\n );\n }\n return context;\n}\n","import { useContext } from \"react\";\nimport { FluidGridsContext } from \"../../components/FluidGridsProvider\";\nimport { getGlobalStoreClient } from \"../../graphql/global-client\";\n\n/**\n * Hook to get the Global Store Apollo client\n *\n * Priority:\n * 1. FluidGridsProvider context (if available)\n * 2. Module-level singleton set via setGlobalStoreClient()\n *\n * @throws Error if no global client is available from either source\n */\nexport function useGlobalStoreClient() {\n const context = useContext(FluidGridsContext);\n\n // Try context first (FluidGridsProvider)\n if (context?.globalClient) {\n return context.globalClient;\n }\n\n // Fallback to module-level singleton\n const singletonClient = getGlobalStoreClient();\n if (singletonClient) {\n return singletonClient;\n }\n\n // No client available from either source\n throw new Error(\n \"useGlobalStoreClient: No global client available. \" +\n \"Either wrap your component tree with <FluidGridsProvider globalClient={...}> \" +\n \"or call setGlobalStoreClient(client) before rendering.\",\n );\n}\n","import { useState, useCallback, useContext, useMemo } from \"react\";\nimport { gql } from \"@apollo/client/core\";\nimport { useGlobalStoreClient } from \"./useGlobalStoreClient\";\nimport type { StoreProduct } from \"../../generated/global-types\";\nimport { FluidGridsContext } from \"../../components/FluidGridsProvider\";\nimport { getFluidGridsConfig } from \"../../config\";\n\n// Inline GraphQL document to avoid dependency on generated types\n// (which requires codegen to be run). Will be replaced by generated\n// import once codegen is executed.\nconst GET_WORKFLOW_TEMPLATE_DETAIL = gql`\n query GetWorkflowTemplateDetail($id: ID!) {\n product(id: $id) {\n id\n name\n slug\n type\n description\n longDescription\n icon\n screenshots\n videoUrls\n rating\n reviewCount\n downloads\n viewCount\n price\n pricingModel\n currency\n featured\n content\n manifest\n manifestVersion\n authorName\n license\n category\n tags\n compatibleProducts\n publisher {\n id\n name\n email\n websiteUrl\n logoUrl\n isVerified\n }\n createdAt\n updatedAt\n publishedAt\n }\n }\n`;\n\n/**\n * Hook to lazily fetch full details of a workflow template from the store.\n *\n * Unlike `useWorkflowTemplates` which fetches browse-level metadata,\n * this hook fetches the full product detail including the `content` field\n * which contains the workflow definitionJson.\n *\n * Uses a manual query (not useQuery) to only fetch when explicitly requested.\n */\nexport function useTemplateDetail() {\n const client = useGlobalStoreClient();\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n // Get workspace and organization context for tenant scoping\n const context = useContext(FluidGridsContext);\n const workspaceId = context?.workspaceId ?? getFluidGridsConfig().workspaceId;\n const organizationId = context?.organizationId;\n\n const contextHeaders = useMemo(() => {\n const headers: Record<string, string> = {};\n if (organizationId) {\n headers[\"x-organization-id\"] = organizationId;\n }\n if (workspaceId) {\n headers[\"x-workspace-id\"] = workspaceId;\n }\n return headers;\n }, [organizationId, workspaceId]);\n\n /**\n * Fetch full template detail including content (definitionJson).\n * Returns the full StoreProduct with content populated.\n */\n const fetchTemplateDetail = useCallback(\n async (templateId: string): Promise<StoreProduct | null> => {\n setLoading(true);\n setError(null);\n try {\n const result = await client.query({\n query: GET_WORKFLOW_TEMPLATE_DETAIL,\n variables: { id: templateId },\n fetchPolicy: \"network-only\",\n context:\n Object.keys(contextHeaders).length > 0\n ? { headers: contextHeaders }\n : undefined,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n const data = result.data as { product?: StoreProduct } | undefined;\n return data?.product ?? null;\n } catch (err) {\n const fetchError =\n err instanceof Error\n ? err\n : new Error(\"Failed to fetch template detail\");\n setError(fetchError);\n console.error(\"[useTemplateDetail] Error:\", err);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, contextHeaders],\n );\n\n return {\n fetchTemplateDetail,\n loading,\n error,\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/builder/stores/flow-store.ts"],"names":[],"mappings":";;;;;AA+IA,IAAM,IAAA,GAAc;AAAA,EAClB,EAAE,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,WAAA,EAAa,OAAO,SAAA,EAAU;AAAA,EAC3D,EAAE,KAAA,EAAO,SAAA,EAAW,KAAA,EAAO,SAAA,EAAW,OAAO,SAAA,EAAU;AAAA,EACvD,EAAE,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ,OAAO,SAAA,EAAU;AAAA,EACjD,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,OAAO,SAAA;AACvC,CAAA;AAEO,IAAM,YAAA,GAAe,MAAA,EAAmB,CAAE,CAAC,KAAK,GAAA,MAAS;AAAA,EAC9D,IAAA,EAAM,IAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACR,IAAI,MAAA,EAAO;AAAA,IACX,WAAA,EAAa,EAAA;AAAA,IACb,IAAA,EAAM,EAAA;AAAA,IACN,OAAA,EAAS,EAAA;AAAA,IACT,KAAA,EAAO,EAAA;AAAA,IACP,OAAO,EAAC;AAAA,IACR,OAAO,EAAC;AAAA,IACR,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,MAAA;AAAA,MACR,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,YAAA,EAAc;AAAA;AAChB;AACF;AACF,GACF;AAAA,EACA,SAAA,EAAW;AAAA,IACT,WAAA,EAAa,KAAA;AAAA,IACb,eAAA,EAAiB,IAAA;AAAA,IACjB,YAAA,EAAc,IAAA;AAAA,IACd,MAAM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A,CAAI,CAAC,KAAA,MAAW;AAAA,UACd,SAAA,EAAW;AAAA,YACT,GAAG,KAAA,CAAM,SAAA;AAAA,YACT,MAAM,EAAC;AAAA,YACP,aAAA,EAAe,IAAA;AAAA,YACf,cAAc,EAAC;AAAA,YACf,gBAAgB;AAAC;AACnB,SACF,CAAE,CAAA;AAAA,MACJ,CAAA;AAAA,MACA,mBAAmB,MAAM;AACvB,QAAA,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,UACd,SAAA,EAAW;AAAA,YACT,GAAG,KAAA,CAAM,SAAA;AAAA,YACT,WAAA,EAAa,KAAA;AAAA,YACb,eAAA,EAAiB;AAAA;AACnB,SACF,CAAE,CAAA;AAAA,MACJ;AAAA;AACF;AAEJ,CAAA,CAAE","file":"chunk-Z2ZEVYDE.js","sourcesContent":["import { nanoid } from \"nanoid/non-secure\";\nimport {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n type Connection,\n type Edge,\n type EdgeChange,\n type Node,\n type NodeChange,\n} from \"@xyflow/react\";\nimport { create } from \"zustand\";\nimport { produce } from \"immer\";\nimport type {\n ExtendedNodeType,\n FlowNode,\n FlowEdge,\n EdgeCondition,\n EdgeMapping,\n} from \"../../types/node\";\nimport type { Tag } from \"../../types/workflow\";\nimport type { ExecutionLog } from \"../../types/execution\";\n\n// Node execution state for visual display\nexport interface NodeExecutionState {\n status: \"idle\" | \"running\" | \"success\" | \"error\";\n itemCount?: number;\n error?: string;\n}\n\n// Execution state for step execution feature\ninterface ExecutionState {\n isExecuting: boolean;\n executingNodeId: string | null;\n currentRunId: string | null;\n logs: ExecutionLog[];\n selectedLogId: string | null;\n panelExpanded: boolean;\n nodeStatuses: Record<string, \"idle\" | \"running\" | \"success\" | \"error\">;\n nodeItemCounts: Record<string, number>;\n}\n\ninterface CustomEdgeProps extends Edge {\n condition?: EdgeCondition;\n mapping?: EdgeMapping;\n}\n\ninterface State {\n nodes: Node[];\n edges: CustomEdgeProps[];\n sidebar: {\n active: \"node-properties\" | \"store-browse\" | \"none\";\n panels: {\n nodeProperties: {\n selectedNode: { id: string; type: ExtendedNodeType } | null | undefined;\n };\n };\n };\n}\n\ninterface Actions {\n actions: {\n saveWorkflow: () => {\n id: string;\n name: string;\n version: string;\n alias?: string;\n dbId?: string;\n status?: string;\n nodes: Node[];\n edges: Edge[];\n };\n setWorkflow: (workflow: Partial<IFlowState[\"workflow\"]>) => void;\n resetWorkflow: () => void;\n nodes: {\n onNodesChange: (changes: NodeChange[]) => void;\n setNodes: (nodes: Node[]) => void;\n deleteNode: (node: Node) => void;\n };\n edges: {\n onEdgesChange: (changes: EdgeChange[]) => void;\n onConnect: (connection: Connection) => void;\n setEdges: (edges: Edge[]) => void;\n deleteEdge: (edge: Edge) => void;\n };\n sidebar: {\n setActivePanel: (\n panel: \"node-properties\" | \"store-browse\" | \"none\",\n ) => void;\n showNodePropertiesOf: (node: {\n id: string;\n type: ExtendedNodeType;\n block?: string;\n }) => void;\n panels: {\n nodeProperties: {\n setSelectedNode: (\n node: { id: string; type: ExtendedNodeType } | undefined | null,\n ) => void;\n };\n tags: {\n setTags: (tags: Tag[]) => void;\n createTag: (tag: Tag) => void;\n deleteTag: (tag: Tag) => void;\n updateTag: (tag: Tag, newTag: Tag) => void;\n };\n };\n };\n };\n}\n\nexport interface IFlowState {\n tags: Tag[];\n workflow: {\n id: string;\n workflowKey: string;\n name: string;\n version: string;\n alias?: string;\n /** Database row ID (used for updateWorkflowDefinition) */\n dbId?: string;\n /** Current workflow status: DRAFT | ACTIVE | ARCHIVED | DEPRECATED */\n status?: string;\n } & State;\n execution: ExecutionState;\n actions: Actions[\"actions\"] & {\n execution: {\n startExecution: (nodeId: string, runId: string) => void;\n addLog: (log: ExecutionLog) => void;\n updateLog: (logId: string, updates: Partial<ExecutionLog>) => void;\n setNodeStatus: (\n nodeId: string,\n status: \"idle\" | \"running\" | \"success\" | \"error\",\n ) => void;\n setNodeItemCount: (nodeId: string, count: number) => void;\n selectLog: (logId: string | null) => void;\n togglePanel: () => void;\n clearLogs: () => void;\n completeExecution: () => void;\n };\n };\n}\n\nconst TAGS: Tag[] = [\n { value: \"marketing\", label: \"Marketing\", color: \"#ef4444\" },\n { value: \"support\", label: \"Support\", color: \"#ef4444\" },\n { value: \"lead\", label: \"Lead\", color: \"#eab308\" },\n { value: \"new\", label: \"New\", color: \"#22c55e\" },\n];\n\nexport const useFlowStore = create<IFlowState>()((set, get) => ({\n tags: TAGS,\n workflow: {\n id: nanoid(),\n workflowKey: \"\",\n name: \"\",\n version: \"\",\n alias: \"\",\n edges: [],\n nodes: [],\n sidebar: {\n active: \"none\",\n panels: {\n nodeProperties: {\n selectedNode: null,\n },\n },\n },\n },\n execution: {\n isExecuting: false,\n executingNodeId: null,\n currentRunId: null,\n logs: [],\n selectedLogId: null,\n panelExpanded: false,\n nodeStatuses: {},\n nodeItemCounts: {},\n },\n actions: {\n saveWorkflow: () => {\n const { workflow } = get();\n const { id, name, version, alias, dbId, status, nodes, edges } = workflow;\n set({ workflow });\n return { id, name, version, alias, dbId, status, nodes, edges };\n },\n setWorkflow: (workflow: Partial<IFlowState[\"workflow\"]>) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n ...workflow,\n },\n }));\n },\n resetWorkflow: () => {\n set(() => ({\n workflow: {\n id: nanoid(),\n workflowKey: \"\",\n name: \"\",\n version: \"\",\n alias: \"\",\n dbId: undefined,\n status: undefined,\n edges: [],\n nodes: [],\n sidebar: {\n active: \"none\",\n panels: {\n nodeProperties: {\n selectedNode: null,\n },\n },\n },\n },\n }));\n },\n sidebar: {\n setActivePanel: (panel: \"node-properties\" | \"store-browse\" | \"none\") =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: { ...state.workflow.sidebar, active: panel },\n },\n })),\n showNodePropertiesOf: (node: { id: string; type: ExtendedNodeType }) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: {\n ...state.workflow.sidebar,\n active: \"node-properties\",\n panels: {\n ...state.workflow.sidebar.panels,\n nodeProperties: {\n ...state.workflow.sidebar.panels.nodeProperties,\n selectedNode: node,\n },\n },\n },\n },\n }));\n },\n panels: {\n nodeProperties: {\n setSelectedNode: (\n node: { id: string; type: ExtendedNodeType } | undefined | null,\n ) =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: {\n ...state.workflow.sidebar,\n panels: {\n ...state.workflow.sidebar.panels,\n nodeProperties: {\n ...state.workflow.sidebar.panels.nodeProperties,\n selectedNode: node,\n },\n },\n },\n },\n })),\n },\n tags: {\n setTags: (tags: Tag[]) => set({ tags }),\n createTag: (tag: Tag) =>\n set((state) => ({\n tags: [...state.tags, tag],\n })),\n updateTag: (tag: Tag, newTag: Tag) =>\n set((state) => ({\n tags: state.tags.map((f) => (f.value === tag.value ? newTag : f)),\n })),\n deleteTag: (tag: Tag) =>\n set((state) => ({\n tags: state.tags.filter((f) => f.value !== tag.value),\n })),\n },\n },\n },\n nodes: {\n onNodesChange: (changes) => {\n set((state) =>\n produce(state, (draft) => {\n const updatedNodes = applyNodeChanges(\n changes,\n draft.workflow.nodes,\n );\n draft.workflow.nodes = updatedNodes;\n }),\n );\n },\n setNodes: (nodes) => {\n set({ workflow: { ...get().workflow, nodes } });\n },\n deleteNode: (node: Node) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: state.workflow.nodes.filter((n) => n.id !== node.id),\n },\n }));\n },\n },\n edges: {\n onEdgesChange: (changes) => {\n set((state) =>\n produce(state, (draft) => {\n const updatedEdges = applyEdgeChanges(\n changes,\n draft.workflow.edges,\n );\n draft.workflow.edges = updatedEdges;\n }),\n );\n },\n onConnect: (connection) => {\n const edge = { ...connection, id: nanoid(), type: \"deletable\" } as Edge;\n set({\n workflow: {\n ...get().workflow,\n edges: addEdge(edge, get().workflow.edges),\n },\n });\n },\n setEdges: (edges) => {\n set({ workflow: { ...get().workflow, edges } });\n },\n deleteEdge: (edge: Edge) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n edges: state.workflow.edges.filter((e) => e.id !== edge.id),\n },\n }));\n },\n },\n execution: {\n startExecution: (nodeId: string, runId: string) => {\n set((state) => ({\n execution: {\n ...state.execution,\n isExecuting: true,\n executingNodeId: nodeId,\n currentRunId: runId,\n panelExpanded: true,\n nodeStatuses: {\n ...state.execution.nodeStatuses,\n [nodeId]: \"running\",\n },\n },\n }));\n },\n addLog: (log: ExecutionLog) => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: [...state.execution.logs, log],\n selectedLogId: log.id,\n },\n }));\n },\n updateLog: (logId: string, updates: Partial<ExecutionLog>) => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: state.execution.logs.map((log) =>\n log.id === logId ? { ...log, ...updates } : log,\n ),\n },\n }));\n },\n setNodeStatus: (\n nodeId: string,\n status: \"idle\" | \"running\" | \"success\" | \"error\",\n ) => {\n set((state) => ({\n execution: {\n ...state.execution,\n nodeStatuses: {\n ...state.execution.nodeStatuses,\n [nodeId]: status,\n },\n },\n }));\n },\n setNodeItemCount: (nodeId: string, count: number) => {\n set((state) => ({\n execution: {\n ...state.execution,\n nodeItemCounts: {\n ...state.execution.nodeItemCounts,\n [nodeId]: count,\n },\n },\n }));\n },\n selectLog: (logId: string | null) => {\n set((state) => ({\n execution: {\n ...state.execution,\n selectedLogId: logId,\n },\n }));\n },\n togglePanel: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n panelExpanded: !state.execution.panelExpanded,\n },\n }));\n },\n clearLogs: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: [],\n selectedLogId: null,\n nodeStatuses: {},\n nodeItemCounts: {},\n },\n }));\n },\n completeExecution: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n isExecuting: false,\n executingNodeId: null,\n },\n }));\n },\n },\n },\n}));\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { useImportWorkflowTemplate } from './chunk-2YP4QVEZ.js';
|
|
2
|
-
import './chunk-Z2ZEVYDE.js';
|
|
3
|
-
import './chunk-FGYVIXQ7.js';
|
|
4
|
-
import './chunk-LUGJJ7LL.js';
|
|
5
|
-
import './chunk-GSJOLO3A.js';
|
|
6
|
-
import './chunk-BQXHJIER.js';
|
|
7
|
-
import './chunk-5BDQNSP3.js';
|
|
8
|
-
import './chunk-WWU2O2SR.js';
|
|
9
|
-
import './chunk-XQP33UJR.js';
|
|
10
|
-
//# sourceMappingURL=useImportWorkflowTemplate-PNE2ANBV.js.map
|
|
11
|
-
//# sourceMappingURL=useImportWorkflowTemplate-PNE2ANBV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"useImportWorkflowTemplate-PNE2ANBV.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"useTemplateDetail-NK63V3PC.js"}
|