@burdenoff/fluidgrids-fe-sdk 2026.1023.4 → 2026.1023.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.
@@ -1,11 +1,11 @@
1
- export { WorkflowBuilder } from './chunk-IGIZORB3.js';
2
- import './chunk-YGBDZ424.js';
3
- import './chunk-DUIUT2TB.js';
1
+ export { WorkflowBuilder } from './chunk-TRYYDUCJ.js';
2
+ import './chunk-7XBCGNUG.js';
3
+ import './chunk-JG7UFL5M.js';
4
4
  import './chunk-GEMNVFPK.js';
5
5
  import './chunk-IEVSFCFS.js';
6
6
  import './chunk-YXMFRQYV.js';
7
7
  import './chunk-BQXVT32O.js';
8
- import './chunk-OD2XBMS6.js';
8
+ import './chunk-3VF67N3X.js';
9
9
  import './chunk-IULOX3NQ.js';
10
10
  import './chunk-NJZAWUGC.js';
11
11
  import './chunk-J3XDX5HG.js';
@@ -1,8 +1,8 @@
1
- export { WorkflowsList } from './chunk-TP2I5FQJ.js';
2
- import './chunk-YGBDZ424.js';
1
+ export { WorkflowsList } from './chunk-BT3ABHVR.js';
2
+ import './chunk-7XBCGNUG.js';
3
3
  import './chunk-LLPLOWMA.js';
4
4
  import './chunk-QBFAJNUC.js';
5
- import './chunk-OD2XBMS6.js';
5
+ import './chunk-3VF67N3X.js';
6
6
  import './chunk-J3XDX5HG.js';
7
7
  import './chunk-D3UWK7GY.js';
8
8
  import './chunk-PJAWNFJV.js';
@@ -10,17 +10,18 @@ function QuotaExhaustedDialog({
10
10
  onUpgrade,
11
11
  title,
12
12
  description,
13
- surface
13
+ surface,
14
+ limitHit = true
14
15
  }) {
15
16
  const tr = useTr();
16
17
  const { bus, workspaceId } = useFluidGridsAnalytics();
17
18
  const wasOpen = useRef(false);
18
19
  useEffect(() => {
19
- if (open && !wasOpen.current) {
20
+ if (open && !wasOpen.current && limitHit) {
20
21
  emitWorkflowLimitHit(bus, { workspaceId, surface });
21
22
  }
22
23
  wasOpen.current = open;
23
- }, [open, bus, workspaceId, surface]);
24
+ }, [open, bus, workspaceId, surface, limitHit]);
24
25
  const handleUpgrade = () => {
25
26
  emitUpgradeClicked(bus, {
26
27
  workspaceId,
@@ -0,0 +1,184 @@
1
+ import { QuotaExhaustedDialog } from './chunk-3VF67N3X.js';
2
+ import { findQuotaRefusal } from './chunk-MR4OTF7D.js';
3
+ import { useTr } from './chunk-UULVIT25.js';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ // src/utils/create-workflow-first.ts
7
+ var BLANK_WORKFLOW_NAME = "Untitled Workflow";
8
+ var BLANK_WORKFLOW_VERSION = "v1";
9
+ function blankWorkflowCanvas() {
10
+ return {
11
+ name: BLANK_WORKFLOW_NAME,
12
+ edges: [],
13
+ nodes: [],
14
+ sidebar: {
15
+ active: "store-browse",
16
+ panels: {
17
+ nodeProperties: {
18
+ selectedNode: null
19
+ }
20
+ }
21
+ }
22
+ };
23
+ }
24
+ function blankWorkflowCreateInput(key, version = BLANK_WORKFLOW_VERSION) {
25
+ const canvas = blankWorkflowCanvas();
26
+ return {
27
+ workflowKey: key,
28
+ version,
29
+ name: BLANK_WORKFLOW_NAME,
30
+ description: BLANK_WORKFLOW_NAME,
31
+ definitionJson: {
32
+ key,
33
+ name: BLANK_WORKFLOW_NAME,
34
+ description: BLANK_WORKFLOW_NAME,
35
+ workflow_type: "query-conditional",
36
+ data: {
37
+ ...canvas,
38
+ id: key,
39
+ workflowKey: key,
40
+ version
41
+ },
42
+ meta: {
43
+ creator: "api_create",
44
+ version
45
+ },
46
+ tags: []
47
+ }
48
+ };
49
+ }
50
+ function classifyCreateRefusal(error) {
51
+ const quota = findQuotaRefusal(error);
52
+ if (quota?.kind === "exhausted")
53
+ return { kind: "quota-exhausted", quotaName: quota.quotaName };
54
+ if (quota?.kind === "not-provisioned")
55
+ return { kind: "quota-not-provisioned", quotaName: quota.quotaName };
56
+ return { kind: "failed" };
57
+ }
58
+ function builderPathOf(workflow, basePath = "..") {
59
+ const prefix = basePath === "" ? "" : `${basePath.replace(/\/+$/, "")}/`;
60
+ return `${prefix}workflow/${encodeURIComponent(workflow.workflowKey)}/${encodeURIComponent(workflow.version)}`;
61
+ }
62
+ async function createThenOpen(deps, options = {}) {
63
+ const key = deps.mintKey();
64
+ let reported = null;
65
+ let created = null;
66
+ try {
67
+ created = await deps.create(blankWorkflowCreateInput(key), {
68
+ onError: (error) => {
69
+ reported = error;
70
+ }
71
+ });
72
+ } catch (error) {
73
+ reported = error;
74
+ created = null;
75
+ }
76
+ if (!created || !created.workflowKey || !created.version) {
77
+ return { status: "refused", refusal: classifyCreateRefusal(reported) };
78
+ }
79
+ deps.navigate(
80
+ builderPathOf(created, options.basePath ?? ".."),
81
+ options.state === void 0 ? void 0 : { state: options.state }
82
+ );
83
+ return { status: "opened", workflow: created };
84
+ }
85
+ function CreateWorkflowRefusalDialog({
86
+ refusal,
87
+ onClose,
88
+ onUpgrade,
89
+ surface
90
+ }) {
91
+ const tr = useTr();
92
+ const notProvisioned = refusal?.kind === "quota-not-provisioned";
93
+ const open = refusal?.kind === "quota-exhausted" || refusal?.kind === "quota-not-provisioned";
94
+ return /* @__PURE__ */ jsx(
95
+ QuotaExhaustedDialog,
96
+ {
97
+ surface,
98
+ open,
99
+ limitHit: !notProvisioned,
100
+ onOpenChange: (next) => {
101
+ if (!next) onClose();
102
+ },
103
+ onUpgrade: () => {
104
+ onUpgrade();
105
+ onClose();
106
+ },
107
+ ...notProvisioned ? {
108
+ title: tr(
109
+ "fluidgrids.components.createRefusal.notProvisionedTitle",
110
+ "Workflows aren't in this workspace's plan"
111
+ ),
112
+ description: tr(
113
+ "fluidgrids.components.createRefusal.notProvisionedDescription",
114
+ "This workspace has no plan that includes FluidGrids workflows, so no workflow was created. Choose a plan for this workspace, or ask a workspace admin to add one."
115
+ )
116
+ } : {}
117
+ }
118
+ );
119
+ }
120
+
121
+ // src/utils/workflow-open.ts
122
+ var NEW_WORKFLOW_STATE = { createWorkflow: true };
123
+ function isCreateIntent(state) {
124
+ return typeof state === "object" && state !== null && state.createWorkflow === true;
125
+ }
126
+ function decideMissingWorkflow(input) {
127
+ if (input.otherVersionExists) return "open-newest";
128
+ return input.createIntent ? "create" : "not-found";
129
+ }
130
+
131
+ // src/onboarding/firstWorkflow.ts
132
+ var GUIDED_FIRST_WORKFLOW_STATE = {
133
+ ...NEW_WORKFLOW_STATE,
134
+ guidedTour: true
135
+ };
136
+ var GUIDED_FIRST_WORKFLOW_NAV = {
137
+ state: GUIDED_FIRST_WORKFLOW_STATE
138
+ };
139
+ var GUIDED_TOUR_STATE = { guidedTour: true };
140
+ function isGuidedTourIntent(state) {
141
+ return typeof state === "object" && state !== null && state.guidedTour === true;
142
+ }
143
+ function withoutGuidedTourIntent(state) {
144
+ if (typeof state !== "object" || state === null) return state;
145
+ if (!("guidedTour" in state)) return state;
146
+ const rest = {};
147
+ for (const [key, value] of Object.entries(state)) {
148
+ if (key !== "guidedTour") rest[key] = value;
149
+ }
150
+ return Object.keys(rest).length > 0 ? rest : null;
151
+ }
152
+ function byMostRecent(a, b) {
153
+ const at = a.updatedAt ? Date.parse(a.updatedAt) : 0;
154
+ const bt = b.updatedAt ? Date.parse(b.updatedAt) : 0;
155
+ return (Number.isNaN(bt) ? 0 : bt) - (Number.isNaN(at) ? 0 : at);
156
+ }
157
+ function firstWorkflowProgress(workflows, runsTotal) {
158
+ const created = workflows.length > 0;
159
+ const ran = runsTotal !== null && runsTotal > 0;
160
+ const activated = workflows.some((w) => w.status === "ACTIVE");
161
+ const ordered = [...workflows].sort(byMostRecent);
162
+ const runTarget = ordered[0] ?? null;
163
+ const activateTarget = ordered.find((w) => (w.status ?? "DRAFT") === "DRAFT") ?? runTarget;
164
+ const remaining = [created, ran, activated].filter((done) => !done).length;
165
+ return {
166
+ created,
167
+ ran,
168
+ activated,
169
+ complete: remaining === 0,
170
+ remaining,
171
+ runTarget,
172
+ activateTarget
173
+ };
174
+ }
175
+ function builderPathFor(workflow) {
176
+ return `../workflow/${encodeURIComponent(workflow.workflowKey)}/${encodeURIComponent(workflow.version)}`;
177
+ }
178
+ function pickGuidedTour(pageTours, pageId) {
179
+ const playable = pageTours.filter((tour) => (tour.steps?.length ?? 0) > 0).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
180
+ if (!pageId) return null;
181
+ return playable.find((tour) => tour.pageId === pageId) ?? null;
182
+ }
183
+
184
+ export { CreateWorkflowRefusalDialog, GUIDED_FIRST_WORKFLOW_NAV, GUIDED_FIRST_WORKFLOW_STATE, GUIDED_TOUR_STATE, blankWorkflowCreateInput, builderPathFor, classifyCreateRefusal, createThenOpen, decideMissingWorkflow, firstWorkflowProgress, isCreateIntent, isGuidedTourIntent, pickGuidedTour, withoutGuidedTourIntent };