robobyte-front-builder 1.0.21 → 1.0.24

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.
@@ -3,7 +3,7 @@ import { useState, useRef } from 'react'
3
3
  import {
4
4
  DataObjectOutlined, FullscreenExitOutlined, SaveOutlined,
5
5
  AddOutlined, DeleteOutlined, PrintOutlined,
6
- DarkModeOutlined, LightModeOutlined,
6
+ DarkModeOutlined, LightModeOutlined, HistoryOutlined,
7
7
  } from '@mui/icons-material'
8
8
  import Editor from '@monaco-editor/react'
9
9
  import ComponentRenderer from 'views/builder/viewer/ComponentRenderer'
@@ -297,6 +297,8 @@ export default function PrintBuilderViewer({ metaData, onSaved, isDark, onToggle
297
297
  validationErrors, setValidationErrors,
298
298
  dataRef, reportRefs, dialogRefs,
299
299
  openDialog, closeDialog,
300
+ markClean,
301
+ logSchema, openSessionLog,
300
302
  } = useBuilder()
301
303
 
302
304
  const [saveOpen, setSaveOpen] = useState(false)
@@ -424,7 +426,20 @@ export default function PrintBuilderViewer({ metaData, onSaved, isDark, onToggle
424
426
  const response = metaData?.id
425
427
  ? await Services.UpdateService(Endpoints.PrintLayout.Put.Update, true, { id: metaData.id, title, value })
426
428
  : await Services.PostService(Endpoints.PrintLayout.Post.Add, true, { title, value })
427
- if (response) { setSaveOpen(false); onSaved?.(response) }
429
+ if (response) {
430
+ setSaveOpen(false); markClean(); onSaved?.(response)
431
+ // Capture this save as a future training example. Prompt left empty —
432
+ // developers fill it in via the Session Logs dialog.
433
+ try {
434
+ logSchema({
435
+ builder: 'print',
436
+ trigger: 'save',
437
+ title,
438
+ viewMetaData: { id: metaData?.id ?? response?.data?.id, title },
439
+ schema: fullSchema
440
+ })
441
+ } catch (e) { console.warn('[sessionLog] log on save failed:', e) }
442
+ }
428
443
  } catch { toast.error('Failed to save') }
429
444
  finally { setIsSaving(false) }
430
445
  }
@@ -464,6 +479,11 @@ export default function PrintBuilderViewer({ metaData, onSaved, isDark, onToggle
464
479
  </Tooltip>
465
480
  )}
466
481
 
482
+ <Tooltip title='Session Logs (training data)'>
483
+ <IconButton size='small' onClick={openSessionLog} sx={{ color: 'text.secondary' }}>
484
+ <HistoryOutlined fontSize='small' />
485
+ </IconButton>
486
+ </Tooltip>
467
487
  <Tooltip title='Preview Schema (JSON)'>
468
488
  <IconButton size='small' onClick={() => setSchemaOpen(true)}>
469
489
  <DataObjectOutlined fontSize='small' />