@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,8 +1,7 @@
1
- import { isGuidedTourIntent, pickGuidedTour, withoutGuidedTourIntent, isCreateIntent, decideMissingWorkflow } from './chunk-YGBDZ424.js';
2
- import { useInstalledNodes, buildNodeCheck, FlowBuilderPage, buildRequiredNodeTypes } from './chunk-DUIUT2TB.js';
3
- import { QuotaExhaustedDialog } from './chunk-OD2XBMS6.js';
1
+ import { isGuidedTourIntent, pickGuidedTour, withoutGuidedTourIntent, isCreateIntent, CreateWorkflowRefusalDialog, decideMissingWorkflow, blankWorkflowCreateInput, classifyCreateRefusal } from './chunk-7XBCGNUG.js';
2
+ import { useInstalledNodes, buildNodeCheck, FlowBuilderPage, buildRequiredNodeTypes } from './chunk-JG7UFL5M.js';
4
3
  import { useLazyWorkflowDefinition, useCreateWorkflow } from './chunk-J3XDX5HG.js';
5
- import { useFlowStore, refetchStoreNodes, BILLING_PLANS_PATH, mergeStickyNotes, isQuotaExhaustedFailure } from './chunk-MR4OTF7D.js';
4
+ import { useFlowStore, refetchStoreNodes, BILLING_PLANS_PATH, mergeStickyNotes } from './chunk-MR4OTF7D.js';
6
5
  import { useTr } from './chunk-UULVIT25.js';
7
6
  import { useLocation, useNavigate, useParams } from 'react-router';
8
7
  import { toast } from 'sonner';
@@ -82,7 +81,7 @@ function WorkflowItem({
82
81
  const [workflow, setWorkflow] = useState(null);
83
82
  const [isLoading, setIsLoading] = useState(true);
84
83
  const [loadError, setLoadError] = useState(null);
85
- const [createQuotaExhausted, setCreateQuotaExhausted] = useState(false);
84
+ const [createRefusal, setCreateRefusal] = useState(null);
86
85
  const upgradingRef = useRef(false);
87
86
  const resetWorkflow = useFlowStore((s) => s.actions.resetWorkflow);
88
87
  const { getWorkflow } = useLazyWorkflowDefinition();
@@ -326,60 +325,34 @@ function WorkflowItem({
326
325
  }
327
326
  if (!creatingRef.current) {
328
327
  creatingRef.current = true;
329
- const initialDefinitionJson = {
330
- key: id,
331
- name: newWorkflow.name,
332
- description: newWorkflow.name,
333
- workflow_type: "query-conditional",
334
- data: {
335
- ...newWorkflow
336
- },
337
- meta: {
338
- creator: "api_create",
339
- version
340
- },
341
- tags: []
342
- };
328
+ let reported = null;
329
+ let created = null;
343
330
  try {
344
- const refusal = { quotaExhausted: false };
345
- const created = await createWorkflow(
346
- {
347
- workflowKey: id,
348
- version,
349
- name: newWorkflow.name,
350
- description: newWorkflow.name,
351
- definitionJson: initialDefinitionJson
352
- },
331
+ created = await createWorkflow(
332
+ blankWorkflowCreateInput(id, version),
353
333
  {
354
334
  onError: (createError) => {
355
- refusal.quotaExhausted = isQuotaExhaustedFailure(createError);
335
+ reported = createError;
356
336
  }
357
337
  }
358
338
  );
359
- if (!created && refusal.quotaExhausted) {
360
- if (mounted) setCreateQuotaExhausted(true);
361
- return;
362
- }
363
- if (created && mounted) {
364
- setWorkflow({
365
- ...newWorkflow,
366
- id: created.workflowKey,
367
- workflowKey: created.workflowKey,
368
- version: created.version,
369
- dbId: created.id,
370
- status: created.status ?? "DRAFT"
371
- });
372
- } else if (mounted) {
373
- setWorkflow(newWorkflow);
374
- }
375
339
  } catch (createError) {
376
- console.error(
377
- "[WorkflowItem] Error creating workflow:",
378
- createError
379
- );
380
- if (mounted) {
381
- setWorkflow(fetchedWorkflowRef.current ?? newWorkflow);
382
- }
340
+ reported = createError;
341
+ created = null;
342
+ }
343
+ if (!created) {
344
+ if (mounted) setCreateRefusal(classifyCreateRefusal(reported));
345
+ return;
346
+ }
347
+ if (mounted) {
348
+ setWorkflow({
349
+ ...newWorkflow,
350
+ id: created.workflowKey,
351
+ workflowKey: created.workflowKey,
352
+ version: created.version,
353
+ dbId: created.id,
354
+ status: created.status ?? "DRAFT"
355
+ });
383
356
  }
384
357
  }
385
358
  }
@@ -455,6 +428,50 @@ function WorkflowItem({
455
428
  /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground/60", children: "Loading workflow..." })
456
429
  ] }) })
457
430
  );
431
+ if (createRefusal?.kind === "failed")
432
+ return /* @__PURE__ */ jsxs(
433
+ "div",
434
+ {
435
+ role: "alert",
436
+ className: "flex h-full min-h-[60vh] w-full flex-col items-center justify-center gap-3 p-6 text-center",
437
+ children: [
438
+ /* @__PURE__ */ jsx("p", { className: "text-base font-medium text-foreground", children: tr(
439
+ "fluidgrids.builder.workflowNotCreated.title",
440
+ "Workflow not created"
441
+ ) }),
442
+ /* @__PURE__ */ jsx("p", { className: "max-w-md text-sm text-foreground/60", children: tr(
443
+ "fluidgrids.builder.workflowNotCreated.description",
444
+ "The new workflow could not be created, so there is nothing to edit yet."
445
+ ) }),
446
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
447
+ /* @__PURE__ */ jsx(
448
+ "button",
449
+ {
450
+ type: "button",
451
+ className: "rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground",
452
+ onClick: () => {
453
+ setCreateRefusal(null);
454
+ setRetryNonce((n) => n + 1);
455
+ },
456
+ children: tr("fluidgrids.builder.workflowNotFound.retry", "Try again")
457
+ }
458
+ ),
459
+ /* @__PURE__ */ jsx(
460
+ "button",
461
+ {
462
+ type: "button",
463
+ className: "rounded-md border px-4 py-2 text-sm font-medium text-foreground",
464
+ onClick: () => navigate("../list", { replace: true }),
465
+ children: tr(
466
+ "fluidgrids.builder.workflowNotFound.back",
467
+ "Back to Workflows"
468
+ )
469
+ }
470
+ )
471
+ ] })
472
+ ]
473
+ }
474
+ );
458
475
  if (notFound)
459
476
  return /* @__PURE__ */ jsxs(
460
477
  "div",
@@ -516,19 +533,17 @@ function WorkflowItem({
516
533
  }
517
534
  ) }),
518
535
  /* @__PURE__ */ jsx(
519
- QuotaExhaustedDialog,
536
+ CreateWorkflowRefusalDialog,
520
537
  {
521
538
  surface: "builder-create",
522
- open: createQuotaExhausted,
523
- onOpenChange: (open) => {
524
- if (open) return;
525
- setCreateQuotaExhausted(false);
539
+ refusal: createRefusal,
540
+ onClose: () => {
541
+ setCreateRefusal(null);
526
542
  if (upgradingRef.current) return;
527
543
  navigate("../list", { replace: true });
528
544
  },
529
545
  onUpgrade: () => {
530
546
  upgradingRef.current = true;
531
- setCreateQuotaExhausted(false);
532
547
  navigate(BILLING_PLANS_PATH);
533
548
  }
534
549
  }