react-autoql 8.37.3 → 8.38.0

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.
Binary file
@@ -1 +1 @@
1
- export*from"autoql-fe-utils";export{bv as AddToReportDialog,bR as AgentMessenger,bm as AppearanceSection,bx as BREAKPOINTS,bk as ChatContent,bd as ConditionBuilder,ba as CustomFilteredAlertModal,aI as Dashboard,bO as DashboardTile,b8 as DataAlertDeleteDialog,b9 as DataAlertListItem,bb as DataAlertModal,b7 as DataAlertRow,b4 as DataAlerts,b6 as DataAlertsList,b5 as DataAlertsTabbed,bP as DataExplorer,bQ as DataMessenger,bT as ExploreQueries,bj as ExpressionBuilder,bV as FilterLockPopover,a2 as Icon,bg as JoinColumnSelectionTable,Z as LoadingDots,M as MAGIC_WAND_BILLING_GATE_MESSAGES,bf as NotificationFeed,be as NotificationIcon,bi as NotificationItem,bS as OptionsToolbar,cd as PUSH_NOTIFICATION_STATUS,cb as PushNotificationsProvider,ce as PushNotificationsToggle,bK as QueryInput,W as QueryOutput,bU as QuerySuggestionList,bs as REPORT_ERROR_CODES,bq as REPORT_SCHEMA_VERSION,bo as ReportBuilder,bp as Reports,aD as ReportsApiError,bW as ReverseTranslation,bc as ScheduleBuilder,bh as SelectableTable,bl as SimpleTable,bn as SlicerChip,bX as SpeechToTextButton,bY as SpeechToTextButtonBrowser,bJ as VizToolbar,bt as appendReportBlock,aj as captureQuestion,bw as captureReportBlock,ca as clearStoredBillingCustomerKey,aP as createEmptyReport,au as createReport,aX as createReportFolder,aW as createReportTag,c5 as currencyInputFromMicros,b1 as deleteReport,a_ as deleteReportFolder,a$ as deleteReportTag,bu as deleteReports,aw as fetchReport,aR as fetchReportFolders,aS as fetchReportTags,b2 as fetchReports,c6 as formatBillingPeriod,c3 as formatMicrosAsCurrency,c7 as getDefaultBillingHistoryRange,u as getMagicWandBillingErrorState,c8 as getStoredBillingCustomerKey,bz as isLandscape,bD as isLg,bC as isMd,bG as isMobile,bH as isMobileLandscape,bL as isResponseFailed,by as isScreenSize,bB as isSm,bN as isTileDirty,bM as isTileFailed,bE as isXl,bA as isXs,bF as isXxl,c4 as microsFromCurrencyInput,b0 as organizeReports,c2 as refreshBillingUsage,aY as renameReportFolder,br as rowsForCapture,av as saveReport,c9 as setStoredBillingCustomerKey,bI as subscribeToScreenSize,aZ as updateReportTag,bZ as useBillingCustomerKey,b_ as useBillingHistory,b$ as useBillingQuotaUpdate,c0 as useBillingUsage,c1 as useMagicWandBillingGate,cc as usePushNotifications}from"./autoql-index-977e385b.esm.js";import"react";import"prop-types";import"uuid";import"lodash.isequal";import"react-device-detect";import"@react-icons/all-files/ai/AiOutlineBook";import"@react-icons/all-files/ai/AiOutlineBulb";import"@react-icons/all-files/ai/AiOutlineDashboard";import"@react-icons/all-files/ai/AiOutlineEdit";import"@react-icons/all-files/ai/AiOutlineFileText";import"@react-icons/all-files/ai/AiOutlineMenu";import"@react-icons/all-files/ai/AiOutlineQuestionCircle";import"@react-icons/all-files/ai/AiOutlineTag";import"@react-icons/all-files/ai/AiOutlineFileSearch";import"@react-icons/all-files/ai/AiOutlineNumber";import"@react-icons/all-files/bi/BiLineChart";import"@react-icons/all-files/bi/BiSearchAlt";import"@react-icons/all-files/bi/BiBookmark";import"@react-icons/all-files/bi/BiBook";import"@react-icons/all-files/bi/BiNote";import"@react-icons/all-files/bi/BiAbacus";import"@react-icons/all-files/bi/BiEnvelope";import"@react-icons/all-files/bi/BiEnvelopeOpen";import"@react-icons/all-files/bi/BiLayerPlus";import"@react-icons/all-files/bi/BiSelectMultiple";import"@react-icons/all-files/bs/BsArrowBarUp";import"@react-icons/all-files/bs/BsArrowBarDown";import"@react-icons/all-files/bs/BsLightning";import"@react-icons/all-files/fa/FaMicrophoneAlt";import"@react-icons/all-files/fi/FiAlertTriangle";import"@react-icons/all-files/fi/FiArrowLeft";import"@react-icons/all-files/fi/FiBell";import"@react-icons/all-files/fi/FiBellOff";import"@react-icons/all-files/fi/FiCalendar";import"@react-icons/all-files/fi/FiCheck";import"@react-icons/all-files/fi/FiDatabase";import"@react-icons/all-files/fi/FiDownload";import"@react-icons/all-files/fi/FiEye";import"@react-icons/all-files/fi/FiLayers";import"@react-icons/all-files/fi/FiMoreHorizontal";import"@react-icons/all-files/fi/FiMoreVertical";import"@react-icons/all-files/fi/FiPauseCircle";import"@react-icons/all-files/fi/FiPlus";import"@react-icons/all-files/fi/FiArrowUp";import"@react-icons/all-files/fi/FiSettings";import"@react-icons/all-files/fi/FiTrash2";import"@react-icons/all-files/fi/FiMaximize";import"@react-icons/all-files/fi/FiMinimize";import"@react-icons/all-files/fi/FiRefreshCw";import"@react-icons/all-files/fi/FiTool";import"@react-icons/all-files/fi/FiMinus";import"react-icons/fi";import"@react-icons/all-files/ri/RiFilterLine";import"@react-icons/all-files/ri/RiFilterOffLine";import"@react-icons/all-files/ri/RiListSettingsLine";import"@react-icons/all-files/ri/RiBroadcastFill";import"@react-icons/all-files/ri/RiDivideFill";import"@react-icons/all-files/go/GoReport";import"react-icons/hi";import"@react-icons/all-files/io/IoIosCloseCircleOutline";import"@react-icons/all-files/io/IoIosGlobe";import"@react-icons/all-files/io/IoIosHourglass";import"@react-icons/all-files/io/IoIosSearch";import"@react-icons/all-files/io/IoIosArrowDown";import"@react-icons/all-files/io/IoIosArrowUp";import"@react-icons/all-files/io/IoIosArrowBack";import"@react-icons/all-files/io/IoIosArrowForward";import"@react-icons/all-files/md/MdClose";import"@react-icons/all-files/md/MdContentCopy";import"@react-icons/all-files/md/MdError";import"@react-icons/all-files/md/MdInfoOutline";import"@react-icons/all-files/md/MdLock";import"@react-icons/all-files/md/MdLockOpen";import"@react-icons/all-files/md/MdPlayCircleOutline";import"@react-icons/all-files/md/MdAttachMoney";import"@react-icons/all-files/md/MdFunctions";import"react-icons/md";import"react-icons/rx";import"react-icons/tfi";import"react-tiny-popover";import"react-dom";import"react-tooltip";import"axios";import"lodash.clonedeep";import"react-autosuggest";import"react-speech-recognition";import"dayjs";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/localizedFormat";import"dayjs/plugin/utc";import"dayjs/plugin/timezone";import"dayjs/plugin/isBetween";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/quarterOfYear";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/isSameOrBefore";import"dayjs/plugin/isToday";import"dayjs/plugin/minMax";import"react-perfect-scrollbar";import"react-perfect-scrollbar/dist/css/styles.css";import"classnames";import"react/jsx-runtime";import"d3-array";import"react-localization";import"react-grid-layout";import"pako";import"react-splitter-layout";import"react-modal";import"lodash.isempty";import"react-dom/server";import"tabulator-tables";import"lodash.throttle";import"tabulator-tables/dist/css/tabulator.min.css";import"tabulator-tables/dist/css/tabulator_bootstrap3.min.css";import"d3-shape";import"d3-selection";import"d3-transition";import"d3-axis";import"d3-scale";import"react-slider";import"jstat";import"d3-force";import"d3-zoom";import"d3-sankey";import"d3-hierarchy";import"lodash.filter";import"sql-formatter";import"parse-num";import"react-toastify";import"react-toastify/dist/ReactToastify.css";import"react-markdown";import"remark-breaks";import"lodash.debounce";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import"rc-drawer";import"react-infinite-scroller";import"lodash.has";import"rc-drawer/assets/index.css";import"recordrtc";
1
+ export*from"autoql-fe-utils";export{c6 as AddToReportDialog,cs as AgentMessenger,bY as AppearanceSection,c8 as BREAKPOINTS,bW as ChatContent,bP as ConditionBuilder,bM as CustomFilteredAlertModal,aO as Dashboard,cp as DashboardTile,bK as DataAlertDeleteDialog,bL as DataAlertListItem,bN as DataAlertModal,bJ as DataAlertRow,bG as DataAlerts,bI as DataAlertsList,bH as DataAlertsTabbed,cq as DataExplorer,cr as DataMessenger,cu as ExploreQueries,bV as ExpressionBuilder,a5 as FilterLockPopover,F as Icon,bS as JoinColumnSelectionTable,a0 as LoadingDots,M as MAGIC_WAND_BILLING_GATE_MESSAGES,bR as NotificationFeed,bQ as NotificationIcon,bU as NotificationItem,ct as OptionsToolbar,cP as PUSH_NOTIFICATION_STATUS,cN as PushNotificationsProvider,cQ as PushNotificationsToggle,cl as QueryInput,Y as QueryOutput,cv as QuerySuggestionList,c2 as REPORT_DATA_STATUSES,c3 as REPORT_ERROR_CODES,c0 as REPORT_SCHEMA_VERSION,b_ as ReportBuilder,b$ as Reports,aI as ReportsApiError,cw as ReverseTranslation,bO as ScheduleBuilder,bT as SelectableTable,bX as SimpleTable,bZ as SlicerChip,cx as SpeechToTextButton,cy as SpeechToTextButtonBrowser,ck as VizToolbar,c4 as appendReportBlock,an as captureQuestion,c7 as captureReportBlock,cM as clearStoredBillingCustomerKey,aZ as createEmptyReport,az as createReport,bq as createReportFolder,bz as createReportFromTemplate,bp as createReportTag,bd as createTemplateCategory,b3 as createTemplateFromReport,cH as currencyInputFromMicros,bA as deleteReport,bt as deleteReportFolder,bu as deleteReportTag,c5 as deleteReports,bc as deleteTemplate,bf as deleteTemplateCategory,bb as discardTemplateDraft,b6 as fetchManagedCategories,b5 as fetchManagedTemplate,bg as fetchManagedTemplates,aB as fetchReport,aW as fetchReportCategories,by as fetchReportDataStatus,bj as fetchReportFolders,bk as fetchReportTags,aX as fetchReportTemplate,aY as fetchReportTemplates,bE as fetchReports,cI as formatBillingPeriod,cF as formatMicrosAsCurrency,cJ as getDefaultBillingHistoryRange,v as getMagicWandBillingErrorState,cK as getStoredBillingCustomerKey,bn as isFillingData,ca as isLandscape,ce as isLg,cd as isMd,ch as isMobile,ci as isMobileLandscape,cm as isResponseFailed,c9 as isScreenSize,cc as isSm,co as isTileDirty,cn as isTileFailed,cf as isXl,cb as isXs,cg as isXxl,b8 as keepsTemplateDrafts,cG as microsFromCurrencyInput,bv as organizeReports,b9 as publishTemplate,cE as refreshBillingUsage,br as renameReportFolder,be as renameTemplateCategory,c1 as rowsForCapture,aA as saveReport,b7 as saveTemplateDraft,cL as setStoredBillingCustomerKey,cj as subscribeToScreenSize,ba as unpublishTemplate,bs as updateReportTag,b4 as updateTemplate,cz as useBillingCustomerKey,cA as useBillingHistory,cB as useBillingQuotaUpdate,cC as useBillingUsage,cD as useMagicWandBillingGate,cO as usePushNotifications}from"./autoql-index-54e71782.esm.js";import"react";import"prop-types";import"uuid";import"lodash.isequal";import"react-device-detect";import"@react-icons/all-files/ai/AiOutlineBook";import"@react-icons/all-files/ai/AiOutlineBulb";import"@react-icons/all-files/ai/AiOutlineDashboard";import"@react-icons/all-files/ai/AiOutlineEdit";import"@react-icons/all-files/ai/AiOutlineFileText";import"@react-icons/all-files/ai/AiOutlineMenu";import"@react-icons/all-files/ai/AiOutlineQuestionCircle";import"@react-icons/all-files/ai/AiOutlineTag";import"@react-icons/all-files/ai/AiOutlineFileSearch";import"@react-icons/all-files/ai/AiOutlineNumber";import"@react-icons/all-files/bi/BiLineChart";import"@react-icons/all-files/bi/BiSearchAlt";import"@react-icons/all-files/bi/BiBookmark";import"@react-icons/all-files/bi/BiBook";import"@react-icons/all-files/bi/BiNote";import"@react-icons/all-files/bi/BiAbacus";import"@react-icons/all-files/bi/BiEnvelope";import"@react-icons/all-files/bi/BiEnvelopeOpen";import"@react-icons/all-files/bi/BiLayerPlus";import"@react-icons/all-files/bi/BiSelectMultiple";import"@react-icons/all-files/bs/BsArrowBarUp";import"@react-icons/all-files/bs/BsArrowBarDown";import"@react-icons/all-files/bs/BsLightning";import"@react-icons/all-files/fa/FaMicrophoneAlt";import"@react-icons/all-files/fi/FiAlertTriangle";import"@react-icons/all-files/fi/FiArrowLeft";import"@react-icons/all-files/fi/FiBell";import"@react-icons/all-files/fi/FiBellOff";import"@react-icons/all-files/fi/FiCalendar";import"@react-icons/all-files/fi/FiCheck";import"@react-icons/all-files/fi/FiDatabase";import"@react-icons/all-files/fi/FiDownload";import"@react-icons/all-files/fi/FiEye";import"@react-icons/all-files/fi/FiLayers";import"@react-icons/all-files/fi/FiMoreHorizontal";import"@react-icons/all-files/fi/FiMoreVertical";import"@react-icons/all-files/fi/FiPauseCircle";import"@react-icons/all-files/fi/FiPlus";import"@react-icons/all-files/fi/FiArrowUp";import"@react-icons/all-files/fi/FiSettings";import"@react-icons/all-files/fi/FiTrash2";import"@react-icons/all-files/fi/FiMaximize";import"@react-icons/all-files/fi/FiMinimize";import"@react-icons/all-files/fi/FiRefreshCw";import"@react-icons/all-files/fi/FiTool";import"@react-icons/all-files/fi/FiMinus";import"react-icons/fi";import"@react-icons/all-files/ri/RiFilterLine";import"@react-icons/all-files/ri/RiFilterOffLine";import"@react-icons/all-files/ri/RiListSettingsLine";import"@react-icons/all-files/ri/RiBroadcastFill";import"@react-icons/all-files/ri/RiDivideFill";import"@react-icons/all-files/go/GoReport";import"react-icons/hi";import"@react-icons/all-files/io/IoIosCloseCircleOutline";import"@react-icons/all-files/io/IoIosGlobe";import"@react-icons/all-files/io/IoIosHourglass";import"@react-icons/all-files/io/IoIosSearch";import"@react-icons/all-files/io/IoIosArrowDown";import"@react-icons/all-files/io/IoIosArrowUp";import"@react-icons/all-files/io/IoIosArrowBack";import"@react-icons/all-files/io/IoIosArrowForward";import"@react-icons/all-files/md/MdClose";import"@react-icons/all-files/md/MdContentCopy";import"@react-icons/all-files/md/MdError";import"@react-icons/all-files/md/MdInfoOutline";import"@react-icons/all-files/md/MdLock";import"@react-icons/all-files/md/MdLockOpen";import"@react-icons/all-files/md/MdPlayCircleOutline";import"@react-icons/all-files/md/MdAttachMoney";import"@react-icons/all-files/md/MdFunctions";import"react-icons/md";import"react-icons/rx";import"react-icons/tfi";import"react-tiny-popover";import"react-dom";import"react-tooltip";import"axios";import"lodash.clonedeep";import"react-autosuggest";import"react-speech-recognition";import"dayjs";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/localizedFormat";import"dayjs/plugin/utc";import"dayjs/plugin/timezone";import"dayjs/plugin/isBetween";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/quarterOfYear";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/isSameOrBefore";import"dayjs/plugin/isToday";import"dayjs/plugin/minMax";import"react-perfect-scrollbar";import"react-perfect-scrollbar/dist/css/styles.css";import"classnames";import"react/jsx-runtime";import"d3-array";import"react-localization";import"react-grid-layout";import"pako";import"react-splitter-layout";import"react-modal";import"lodash.isempty";import"react-dom/server";import"tabulator-tables";import"lodash.throttle";import"tabulator-tables/dist/css/tabulator.min.css";import"tabulator-tables/dist/css/tabulator_bootstrap3.min.css";import"d3-shape";import"d3-selection";import"d3-transition";import"d3-axis";import"d3-scale";import"react-slider";import"jstat";import"d3-force";import"d3-zoom";import"d3-sankey";import"d3-hierarchy";import"lodash.filter";import"sql-formatter";import"parse-num";import"react-toastify";import"react-toastify/dist/ReactToastify.css";import"react-markdown";import"remark-breaks";import"lodash.debounce";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import"rc-drawer";import"react-infinite-scroller";import"lodash.has";import"rc-drawer/assets/index.css";import"recordrtc";
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-autoql",
3
- "version": "8.37.3",
3
+ "version": "8.38.0",
4
4
  "description": "React Widget Library",
5
5
  "main": "dist/autoql.cjs.js",
6
6
  "module": "dist/autoql.esm.js",
package/src/index.d.ts CHANGED
@@ -125,9 +125,7 @@ export interface UseMagicWandBillingGateResult {
125
125
  billingExecutionType?: BillingExecutionType
126
126
  }
127
127
 
128
- export declare function useMagicWandBillingGate(
129
- args?: UseMagicWandBillingGateArgs,
130
- ): UseMagicWandBillingGateResult
128
+ export declare function useMagicWandBillingGate(args?: UseMagicWandBillingGateArgs): UseMagicWandBillingGateResult
131
129
 
132
130
  export declare function getMagicWandBillingErrorState(error: any): MagicWandBillingGateState
133
131
 
@@ -615,13 +613,32 @@ export interface ReportPageSetup {
615
613
  tableOfContents: boolean
616
614
  }
617
615
 
616
+ // A report's filter lock: one AutoQL session filter lock, as the query API takes it in session_filter_locks and
617
+ // FilterLockPopover makes it. Every question in a report that has one is asked with them.
618
+ export interface ReportFilterLock {
619
+ key: string
620
+ value: string | number
621
+ filter_type?: string
622
+ canonical_key?: string
623
+ format_txt?: string
624
+ show_message?: string
625
+ }
626
+
618
627
  export interface Report {
619
628
  schemaVersion: number
620
629
  title: string
621
630
  page: ReportPageSetup
631
+ // What the report is for: a household, say, or several. None asks every question for everything.
632
+ sessionFilterLocks?: ReportFilterLock[]
622
633
  blocks: ReportBlock[]
623
634
  }
624
635
 
636
+ // What the host calls a report's filter lock, and having none: { title: 'Households', none: 'All households' }.
637
+ export interface ReportFilterLockLabels {
638
+ title?: string
639
+ none?: string
640
+ }
641
+
625
642
  export interface ReportDashboard {
626
643
  id: string | number
627
644
  name?: string
@@ -691,7 +708,8 @@ export interface ReportBuilderProps {
691
708
  // Run report: the builder fetches every data block itself. Off by default: blocks show what was
692
709
  // captured when they were added, and runReport() resolves null.
693
710
  enableRunReport?: boolean
694
- // Data blocks can be made in the builder, not only arrive with "Add to Report…". Off by default.
711
+ // Data blocks can be made in the builder, not only arrive with "Add to Report…": a question asked once, kept with a
712
+ // Rerun button, and every such question asked again at once with Rerun all (Report options). Off by default.
695
713
  enableDataBlocks?: boolean
696
714
  // With enableDataBlocks: an empty Data block offers "Pick dashboard tiles…", which calls this. Show your own
697
715
  // picker and resolve with the blocks to put in the empty block's place, in order, or null to leave it.
@@ -704,6 +722,25 @@ export interface ReportBuilderProps {
704
722
  // Your own element for the toolbar, shown just before Preview (and in the preview): whether the report is
705
723
  // saved, say. None by default.
706
724
  toolbarStatus?: React.ReactNode
725
+ // Adds "Save as template…" to the report options menu (⋮), which calls this: the host makes a template from the
726
+ // report. None by default.
727
+ onSaveAsTemplate?: () => void
728
+ // Shows the report as it prints and nothing that changes it (or prints it, or goes back to editing) until it's
729
+ // turned off: while AutoQL fills in its data, say, or to show a template.
730
+ readOnly?: boolean
731
+ // What a Data block with no answer says: in a template ('template'), while AutoQL fills in the report's data
732
+ // ('filling'), or once it has ('filled'), with why it couldn't fill the blocks in `errors`.
733
+ dataFill?: {
734
+ state: 'template' | 'filling' | 'filled'
735
+ errors?: Record<string, { reason: ReportDataError['reason']; message?: string }>
736
+ } | null
737
+ // The report's filter lock (sessionFilterLocks) can be set in the panel when nothing is selected. Off by default; a
738
+ // report that has one is asked with it either way.
739
+ enableFilterLocks?: boolean
740
+ // With enableFilterLocks: the host's values to lock on (its households, say), loaded the first time the picker
741
+ // opens. Without it, the picker searches AutoQL's values.
742
+ loadFilterLockSuggestions?: () => Promise<string[]>
743
+ filterLockLabels?: ReportFilterLockLabels
707
744
  className?: string
708
745
  }
709
746
 
@@ -767,6 +804,34 @@ export declare class ReportsApiError extends Error {
767
804
  details?: Record<string, any>
768
805
  }
769
806
 
807
+ // Where a report made from a template is with its data: AutoQL fills its data blocks in the background (PENDING,
808
+ // then RUNNING; read-only meanwhile) and ends DONE, PARTIAL (some blocks couldn't be filled) or FAILED (none could).
809
+ // NONE: nothing has filled it.
810
+ export type ReportDataStatus = 'NONE' | 'PENDING' | 'RUNNING' | 'DONE' | 'PARTIAL' | 'FAILED'
811
+ export declare const REPORT_DATA_STATUSES: ReportDataStatus[]
812
+ // Whether AutoQL is filling a report's data now (PENDING or RUNNING).
813
+ export declare function isFillingData(dataStatus: ReportDataStatus | string | null | undefined): boolean
814
+
815
+ // Why a fill left a data block unfilled. `message` is the query's own words, when it sent any.
816
+ export interface ReportDataError {
817
+ blockId: string
818
+ reason:
819
+ | 'not_confident'
820
+ | 'access_denied'
821
+ | 'no_data'
822
+ | 'query_failed'
823
+ | 'timeout'
824
+ | 'too_large'
825
+ | 'tile_unavailable'
826
+ | 'no_question'
827
+ | 'unsupported'
828
+ | 'stale_block'
829
+ | 'busy'
830
+ | 'interrupted'
831
+ | string
832
+ message?: string
833
+ }
834
+
770
835
  export interface StoredReportSummary {
771
836
  id: string
772
837
  title: string
@@ -774,15 +839,71 @@ export interface StoredReportSummary {
774
839
  version: number
775
840
  folderId: string | null
776
841
  tagIds: string[]
842
+ // The template it was made from, if it was.
843
+ templateId: string | null
844
+ dataStatus: ReportDataStatus
777
845
  createdAt: string
778
846
  updatedAt: string
779
847
  }
780
848
 
781
849
  export interface StoredReport extends StoredReportSummary {
782
850
  projectId: string
851
+ // Why the last fill left some data blocks unfilled.
852
+ dataErrors: ReportDataError[]
783
853
  report: Report
784
854
  }
785
855
 
856
+ export interface ReportDataProgress {
857
+ dataStatus: ReportDataStatus
858
+ // Moves on with every block filled.
859
+ version: number
860
+ dataUpdatedAt: string | null
861
+ // Moves on after every question the fill asks, failed ones too. Null from a service that doesn't send it.
862
+ dataHeartbeatAt: string | null
863
+ dataErrors: ReportDataError[]
864
+ }
865
+
866
+ // A template to start a report from. INTEGRATOR templates are everyone's, ORGANIZATION ones the organization's.
867
+ export interface ReportTemplate {
868
+ id: string
869
+ scope: 'INTEGRATOR' | 'ORGANIZATION' | string
870
+ organizationId: string | null
871
+ title: string
872
+ description: string
873
+ categoryId: string | null
874
+ tags: string[]
875
+ status: 'DRAFT' | 'PUBLISHED' | string
876
+ databaseModel: string
877
+ sizeBytes: number
878
+ publishedAt: string
879
+ createdAt: string
880
+ updatedAt: string
881
+ // Asked for by id: what a report started from it begins as.
882
+ report?: Report
883
+ // Where the service keeps a published template's changes apart until they're published (RW-361): whether there are
884
+ // any, and, asked for by id from the management API, what they are.
885
+ hasDraft?: boolean
886
+ draftUpdatedAt?: string | null
887
+ draft?: ReportTemplateDraft | null
888
+ }
889
+
890
+ // A published template's changes, kept apart until they're published (RW-361).
891
+ export interface ReportTemplateDraft {
892
+ title: string
893
+ description: string
894
+ categoryId: string | null
895
+ tags: string[]
896
+ report: Report | null
897
+ updatedAt: string
898
+ }
899
+
900
+ export interface ReportTemplateCategory {
901
+ id: string
902
+ scope: 'INTEGRATOR' | 'ORGANIZATION' | string
903
+ organizationId: string | null
904
+ name: string
905
+ }
906
+
786
907
  export interface StoredReportStamp {
787
908
  id: string
788
909
  version: number
@@ -827,6 +948,110 @@ export declare function fetchReport(options: ReportsCall & { id: string; signal?
827
948
  export declare function createReport(
828
949
  options: ReportsCall & { id: string; report: Report; folderId?: string; tagIds?: string[]; keepalive?: boolean },
829
950
  ): Promise<StoredReport & { created: boolean }>
951
+ // A report of the user's own from a published template; AutoQL fills its data blocks in the background, asking in
952
+ // `timeZone` (an IANA name, the browser's say). `sessionFilterLocks` is what it's for (an empty list: everything);
953
+ // left out, it's for what the template is for.
954
+ export declare function createReportFromTemplate(
955
+ options: ReportsCall & {
956
+ id: string
957
+ templateId: string
958
+ folderId?: string
959
+ tagIds?: string[]
960
+ timeZone?: string
961
+ sessionFilterLocks?: ReportFilterLock[]
962
+ },
963
+ ): Promise<StoredReport & { created: boolean }>
964
+ export declare function fetchReportDataStatus(
965
+ options: ReportsCall & { id: string; signal?: AbortSignal },
966
+ ): Promise<ReportDataProgress>
967
+ // The templates published for the token's data source (its organization's and the integrator's, for its data model),
968
+ // without their documents.
969
+ export declare function fetchReportTemplates(
970
+ options: ReportsCall & {
971
+ q?: string
972
+ tags?: string[]
973
+ categoryId?: string
974
+ scope?: 'INTEGRATOR' | 'ORGANIZATION'
975
+ orderBy?: 'updated_at' | 'created_at' | 'title'
976
+ order?: 'asc' | 'desc'
977
+ page?: number
978
+ pageSize?: number
979
+ signal?: AbortSignal
980
+ },
981
+ ): Promise<{ templates: ReportTemplate[]; page: number; pageSize: number; totalPages: number; totalItems: number }>
982
+ export declare function fetchReportTemplate(
983
+ options: ReportsCall & { id: string; signal?: AbortSignal },
984
+ ): Promise<ReportTemplate & { report: Report }>
985
+ export declare function fetchReportCategories(
986
+ options: ReportsCall & { scope?: 'INTEGRATOR' | 'ORGANIZATION'; signal?: AbortSignal },
987
+ ): Promise<ReportTemplateCategory[]>
988
+
989
+ // ─── Report templates, as an organization's admins manage them ───────────────
990
+ // Through AutoQL's management API (/autoql/management/api/v1/reports), which takes the token's management grant for
991
+ // reports. The organization is the one the token's project belongs to.
992
+
993
+ export declare function fetchManagedTemplates(
994
+ options: ReportsCall & {
995
+ q?: string
996
+ tags?: string[]
997
+ categoryId?: string
998
+ status?: 'DRAFT' | 'PUBLISHED'
999
+ orderBy?: 'updated_at' | 'created_at' | 'title'
1000
+ order?: 'asc' | 'desc'
1001
+ page?: number
1002
+ pageSize?: number
1003
+ signal?: AbortSignal
1004
+ },
1005
+ ): Promise<{ templates: ReportTemplate[]; page: number; pageSize: number; totalPages: number; totalItems: number }>
1006
+ // A draft for the organization, made from one of the user's own reports as AutoQL has it (save it first), without the
1007
+ // report's data. Titles, headings, text, questions and an analysis's focus are kept as they are.
1008
+ export declare function createTemplateFromReport(
1009
+ options: ReportsCall & {
1010
+ reportId: string
1011
+ title: string
1012
+ description?: string
1013
+ categoryId?: string
1014
+ tags?: string[]
1015
+ },
1016
+ ): Promise<ReportTemplate>
1017
+ // One managed template, draft or published, with its document as `report` (and its pending changes as `draft`, where
1018
+ // the service keeps those).
1019
+ export declare function fetchManagedTemplate(
1020
+ options: ReportsCall & { id: string; signal?: AbortSignal },
1021
+ ): Promise<ReportTemplate & { report: Report }>
1022
+ // What's left out stays as it is; null takes away a description, a category or the tags. `document` replaces the
1023
+ // template's document, which AutoQL rebuilds as it does one made from a report.
1024
+ export interface ReportTemplateChanges {
1025
+ title?: string
1026
+ description?: string | null
1027
+ categoryId?: string | null
1028
+ tags?: string[] | null
1029
+ document?: Report
1030
+ }
1031
+ export declare function updateTemplate(
1032
+ options: ReportsCall & { id: string } & ReportTemplateChanges,
1033
+ ): Promise<ReportTemplate>
1034
+ // Whether the service keeps a published template's changes apart until they're published (RW-361).
1035
+ export declare function keepsTemplateDrafts(template: ReportTemplate | null | undefined): boolean
1036
+ // Keeps changes to a published template apart until it's published again (RW-361).
1037
+ export declare function saveTemplateDraft(
1038
+ options: ReportsCall & { id: string } & ReportTemplateChanges,
1039
+ ): Promise<ReportTemplate | null>
1040
+ export declare function discardTemplateDraft(options: ReportsCall & { id: string }): Promise<void>
1041
+ export declare function publishTemplate(options: ReportsCall & { id: string }): Promise<ReportTemplate | null>
1042
+ export declare function unpublishTemplate(options: ReportsCall & { id: string }): Promise<ReportTemplate | null>
1043
+ // Reports already made from it keep their copy.
1044
+ export declare function deleteTemplate(options: ReportsCall & { id: string }): Promise<void>
1045
+ // The organization's own categories (templates can also take the integrator's: fetchReportCategories lists both).
1046
+ export declare function fetchManagedCategories(
1047
+ options: ReportsCall & { signal?: AbortSignal },
1048
+ ): Promise<ReportTemplateCategory[]>
1049
+ export declare function createTemplateCategory(options: ReportsCall & { name: string }): Promise<ReportTemplateCategory>
1050
+ export declare function renameTemplateCategory(
1051
+ options: ReportsCall & { id: string; name: string },
1052
+ ): Promise<ReportTemplateCategory>
1053
+ // Its templates stay, without a category.
1054
+ export declare function deleteTemplateCategory(options: ReportsCall & { id: string }): Promise<void>
830
1055
  export declare function saveReport(
831
1056
  options: ReportsCall & { id: string; report: Report; version: number; keepalive?: boolean },
832
1057
  ): Promise<StoredReportStamp>
@@ -892,6 +1117,8 @@ export interface ReportsHomeProps {
892
1117
  notices: ReportsNotice[]
893
1118
  // Opens New report.
894
1119
  newReport: () => void
1120
+ // Opens Manage templates: there with enableTemplates and canManageTemplates, for a button of the host's own.
1121
+ manageTemplates?: () => void
895
1122
 
896
1123
  // The user's folders and tags on the data source, A to Z; null while they load. Each report in `reports` says its
897
1124
  // folder (folderId, null for none) and its tags (tagIds).
@@ -950,6 +1177,19 @@ export interface ReportsProps {
950
1177
  saveDelay?: number
951
1178
  // The folder New report makes reports in, while it's one of the user's: the one the host's home page shows, say.
952
1179
  newReportFolderId?: string | null
1180
+ // New report can start from a template published for the data source; AutoQL fills in its data blocks with the
1181
+ // user's data while the report shows read-only — or, where AutoQL doesn't fill reports in itself, the workspace
1182
+ // asks their questions, all as of when the report was started. Off by default.
1183
+ enableTemplates?: boolean
1184
+ // With enableTemplates: a report can be saved as a template for the organization (Report options › Save as
1185
+ // template…), and its templates and categories managed (Manage templates). That takes AutoQL's management grant
1186
+ // for reports, so say who may: an app's owners and admins, say. Off by default.
1187
+ canManageTemplates?: boolean
1188
+ // A report can be for one value, or several, of what the host's data locks on (its households, say): set in each
1189
+ // report's builder and, with enableTemplates, chosen when a report is started from a template. Off by default.
1190
+ enableFilterLocks?: boolean
1191
+ loadFilterLockSuggestions?: () => Promise<string[]>
1192
+ filterLockLabels?: ReportFilterLockLabels
953
1193
  // Passed on to each report's ReportBuilder.
954
1194
  branding?: ReportBranding
955
1195
  enableBranding?: boolean
@@ -990,17 +1230,21 @@ export interface ReportToolbarOptionExtra {
990
1230
  }
991
1231
 
992
1232
  // The Data block "Add to Report…" adds: the answer or tile as it's shown now, and where it came from (the tile,
993
- // when there is one, else the question). A message to show when it can't be kept.
1233
+ // when there is one, else the question). A message to show when it can't be kept. An answer asked with a filter lock
1234
+ // brings it (sessionFilterLocks), for AddToReportDialog.
994
1235
  export declare function captureReportBlock(options: {
995
1236
  data: ReportToolbarOptionData | null | undefined
996
1237
  extra: ReportToolbarOptionExtra | null | undefined
997
1238
  dashboard?: { id: string; name?: string; tiles?: DashboardTile[] } | null
998
- }): { ok: true; block: ReportDataBlock } | { ok: false; message: string }
1239
+ }): { ok: true; block: ReportDataBlock; sessionFilterLocks?: ReportFilterLock[] } | { ok: false; message: string }
999
1240
 
1000
1241
  export interface AddToReportDialogProps {
1001
1242
  authentication?: Authentication
1002
1243
  // The block to add at the end of the chosen report (captureReportBlock).
1003
1244
  block: ReportBlock
1245
+ // The lock the answer was asked with (captureReportBlock): a new report made for the block is for it too. A report
1246
+ // the block is added to keeps its own.
1247
+ sessionFilterLocks?: ReportFilterLock[]
1004
1248
  onClose: () => void
1005
1249
  // After it's added (before onClose): which report, and whether it was made for this.
1006
1250
  onAdded?: (added: { id: string; title: string; created: boolean }) => void