pagepilot-visual-editor 1.0.34 → 1.0.35

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/editor/publish/PagePublishDialog.d.ts +2 -0
  3. package/dist/editor-sample/App/InspectorDrawer/LayoutPanel/ChangeDesignFlow.d.ts +4 -0
  4. package/dist/editor-sample/App/InspectorDrawer/LayoutPanel/ChangeTemplateCompareDialog.d.ts +2 -0
  5. package/dist/editor-sample/App/InspectorDrawer/LayoutPanel/SectionLibraryTab.d.ts +9 -0
  6. package/dist/editor-sample/App/InspectorDrawer/LayoutPanel/SectionsModal.d.ts +4 -0
  7. package/dist/editor-sample/App/InspectorDrawer/LayoutPanel/TemplatePreviewDialog.d.ts +5 -1
  8. package/dist/editor-sample/App/InspectorDrawer/LayoutPanel/index.d.ts +1 -0
  9. package/dist/editor-sample/App/InspectorDrawer/VariablesPanel/ArrayFieldEditor.d.ts +3 -0
  10. package/dist/editor-sample/App/InspectorDrawer/VariablesPanel/DataReferencePanel.d.ts +3 -1
  11. package/dist/editor-sample/App/InspectorDrawer/VariablesPanel/RowCard.d.ts +5 -1
  12. package/dist/editor-sample/App/InspectorDrawer/VariablesPanel/dataReferenceUtils.d.ts +20 -5
  13. package/dist/editor-sample/App/InspectorDrawer/VariablesPanel/useAutoRefreshDataSources.d.ts +8 -0
  14. package/dist/editor-sample/App/hooks/page/useSaveHandler.d.ts +1 -0
  15. package/dist/editor-sample/documents/editor/EditorContext.d.ts +2 -2
  16. package/dist/editor-sample/documents/editor/templateVariables.d.ts +9 -1
  17. package/dist/host-stubs/config.d.ts +4 -0
  18. package/dist/{index-BksEeUhc.cjs → index-BoRfsMEk.cjs} +288 -288
  19. package/dist/{index-CI-ydHOL.js → index-BzP_d1Tz.js} +1 -1
  20. package/dist/{index-BszXspnA.cjs → index-CQKG85qV.cjs} +1 -1
  21. package/dist/{index-Bqru3CFh.js → index-CZDJUpCA.js} +28825 -28353
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/{xlsx-D2eLxkb-.cjs → xlsx-Bc8RxjL3.cjs} +1 -1
  25. package/dist/{xlsx-BJAjl_m-.js → xlsx-ChzvWWQV.js} +1 -1
  26. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
  ## [Unreleased]
8
8
 
9
9
  ### Changed
10
+ - Synced ahd-fe bc20f58b2 (auto refresh minutes):
11
+ - Pages data source now GETs `/tenant/:id/client/page` with only the mapped
12
+ fields (`buildPagesUrl`) and maps raw page rows onto sub-field ids
13
+ client-side (`mapPageRows`), in the panel and in editor auto-refresh.
14
+ Field list / mapping guesses updated (`groups`, `createdAt`, `heroImage`);
15
+ a saved mapping to an unlisted field stays selectable.
16
+ - Per-source TTL inputs removed from the API / Pages source forms; auto
17
+ refresh is now page-level: "Auto Refresh (minutes)" in the publish dialog,
18
+ sent as `ttlMinutes` on `upsert-page-item` and merged into the record.
10
19
  - Re-synced the vendored editor with ahd-fe `plugin-integration` (2aa96315d),
11
20
  covering everything since the 67f2b933 sync. Upstream behaviour pulled in
12
21
  includes:
@@ -24,6 +24,8 @@ interface PagePublishDialogProps {
24
24
  injectCarouselScript?: boolean;
25
25
  injectPaginationScript?: boolean;
26
26
  injectAnimationScript?: boolean;
27
+ /** Page-level auto refresh in minutes (0 = off). */
28
+ ttlMinutes?: number;
27
29
  }) => Promise<boolean>;
28
30
  }
29
31
  export default function PagePublishDialog({ open, onClose, record, apiClient, onSubmit, }: PagePublishDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -8,5 +8,9 @@ declare const ChangeDesignFlow: React.FC<{
8
8
  blockId: string;
9
9
  open: boolean;
10
10
  onClose: () => void;
11
+ /** Render the library in the sidebar (Section library tab) instead of a dialog. */
12
+ inline?: boolean;
13
+ /** Offer "Add as new section" in the compare dialog; inserts the picked section. */
14
+ onInsert?: (block: any, preassignedId?: string) => void;
11
15
  }>;
12
16
  export default ChangeDesignFlow;
@@ -11,6 +11,8 @@ interface ChangeTemplateCompareDialogProps {
11
11
  title?: string;
12
12
  description?: string;
13
13
  confirmLabel?: string;
14
+ secondaryLabel?: string;
15
+ onSecondary?: () => void;
14
16
  notes?: string[];
15
17
  }
16
18
  /**
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * Section library sidebar tab. With a section selected on the canvas it works
4
+ * like the tune menu's "Change design" (opens on the section's category, pick →
5
+ * before/after compare → swap in place, or "Add as new section" from the
6
+ * compare dialog); otherwise picking appends a section.
7
+ */
8
+ declare const SectionLibraryTab: React.FC;
9
+ export default SectionLibraryTab;
@@ -7,6 +7,10 @@ interface SectionsModalProps {
7
7
  /** Pick mode ("Change design"): hand the fetched template back instead of inserting it. */
8
8
  onPick?: (record: any) => void;
9
9
  title?: string;
10
+ /** Render without the Dialog, laid out for the narrow left-panel tab. */
11
+ inline?: boolean;
10
12
  }
13
+ /** Insert a fetched section template into the page (as a new section). */
14
+ export declare function insertSectionRecord(record: any, onInsert?: (block: any, preassignedId?: string) => void): void;
11
15
  declare const SectionsModal: React.FC<SectionsModalProps>;
12
16
  export default SectionsModal;
@@ -12,5 +12,9 @@ export interface TemplatePreviewDialogProps {
12
12
  changeLoading?: boolean;
13
13
  /** True when the template is gated to a plan the tenant doesn't have. */
14
14
  locked?: boolean;
15
+ /** Hide the "Choose design" (use whole template) button, e.g. in the Section library. */
16
+ hideUse?: boolean;
17
+ /** Dialog title; defaults to "Template Preview". */
18
+ title?: string;
15
19
  }
16
- export default function TemplatePreviewDialog({ open, template, onClose, onUse, onUseStyles, onAppend, loading, styleLoading, appendLoading, onChangeTemplate, changeLoading, locked, }: TemplatePreviewDialogProps): import("react/jsx-runtime").JSX.Element;
20
+ export default function TemplatePreviewDialog({ open, template, onClose, onUse, onUseStyles, onAppend, loading, styleLoading, appendLoading, onChangeTemplate, changeLoading, locked, hideUse, title, }: TemplatePreviewDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ interface LayoutPanelProps {
2
2
  record?: any;
3
3
  onUpdateRecord?: (record: any) => void;
4
4
  }
5
+ export declare const appendSectionToRoot: (block: any, preassignedId?: string) => void;
5
6
  declare const LayoutPanel: (_props: LayoutPanelProps) => import("react/jsx-runtime").JSX.Element;
6
7
  export default LayoutPanel;
@@ -1,4 +1,7 @@
1
1
  import { TemplateArrayRow, TemplateFormField } from '../../../documents/editor/templateVariables';
2
+ /** Window event `{ fieldId, rowIndex }` — expand that row (canvas selection
3
+ * landed inside a repeated copy). */
4
+ export declare const FOCUS_REPEAT_ROW_EVENT = "variables:focus-repeat-row";
2
5
  type ArrayFieldEditorProps = {
3
6
  field: TemplateFormField;
4
7
  onChange: (rows: TemplateArrayRow[]) => void;
@@ -8,6 +8,8 @@ type DataReferencePanelProps = {
8
8
  addRow: () => void;
9
9
  removeRow: (rowIndex: number) => void;
10
10
  updateCell: (rowIndex: number, key: string, value: string) => void;
11
+ /** Drag-and-drop reorder of the item list. */
12
+ moveRow?: (from: number, to: number) => void;
11
13
  onPatch?: (patch: Partial<TemplateFormField>) => void;
12
14
  };
13
15
  /**
@@ -16,5 +18,5 @@ type DataReferencePanelProps = {
16
18
  * an API endpoint, or a Menu. JSON/API/Menu seed one copy per object, mapping
17
19
  * object keys → sub-field ids.
18
20
  */
19
- export default function DataReferencePanel({ field, rows, itemFields, expandedRow, toggleRow, addRow, removeRow, updateCell, onPatch, }: DataReferencePanelProps): import("react/jsx-runtime").JSX.Element;
21
+ export default function DataReferencePanel({ field, rows, itemFields, expandedRow, toggleRow, addRow, removeRow, updateCell, moveRow, onPatch, }: DataReferencePanelProps): import("react/jsx-runtime").JSX.Element;
20
22
  export {};
@@ -13,6 +13,10 @@ type RowCardProps = {
13
13
  disabled?: boolean;
14
14
  /** Shows an "Edit variable" icon per sub-field (`{{this.subId}}` rename/unlink/delete). */
15
15
  onEditSub?: (subId: string) => void;
16
+ /** When set, a drag handle is shown in the header (drag-and-drop reorder). */
17
+ dragHandleProps?: React.HTMLAttributes<HTMLElement> & {
18
+ draggable?: boolean;
19
+ };
16
20
  };
17
21
  /**
18
22
  * The bare list of sub-field inputs for one row — no card chrome. Used inside
@@ -23,5 +27,5 @@ export declare function RowFields({ rowIndex, row, itemFields, updateCell, sx, d
23
27
  sx?: object;
24
28
  }): import("react/jsx-runtime").JSX.Element;
25
29
  /** One collapsible copy/template card in the Variables array editor. */
26
- export default function RowCard({ rowIndex, row, itemFields, isExpanded, onToggle, onRemove, updateCell, headerLabel, disabled, onEditSub, }: RowCardProps): import("react/jsx-runtime").JSX.Element;
30
+ export default function RowCard({ rowIndex, row, itemFields, isExpanded, onToggle, onRemove, updateCell, headerLabel, disabled, onEditSub, dragHandleProps, }: RowCardProps): import("react/jsx-runtime").JSX.Element;
27
31
  export {};
@@ -26,12 +26,14 @@ export declare function buildReferenceJson(itemFields: TemplateFormField['itemFi
26
26
  */
27
27
  export declare function extractArrayFromResponse(body: any, path?: string): Record<string, any>[] | null;
28
28
  /**
29
- * GET a URL and return the array of objects from its JSON response. Throws with
30
- * a user-facing message on a bad URL, network error, non-OK status, non-JSON
31
- * body, or a response that carries no array. Only GET is supported today
32
- * (POST is planned — the panel disables it).
29
+ * GET (or POST with a JSON `body`) a URL and return the array of objects from
30
+ * its JSON response. Throws with a user-facing message on a bad URL, network
31
+ * error, non-OK status, non-JSON body, or a response that carries no array.
33
32
  */
34
- export declare function fetchApiRows(url: string, responsePath?: string): Promise<Record<string, any>[]>;
33
+ export declare function fetchApiRows(url: string, responsePath?: string, request?: {
34
+ method?: 'GET' | 'POST';
35
+ body?: unknown;
36
+ }): Promise<Record<string, any>[]>;
35
37
  /**
36
38
  * GET a URL and return a SINGLE object from its JSON response, for scalar
37
39
  * (non-repeatable) variables. When `responsePath` is given, resolve it via
@@ -50,3 +52,16 @@ export declare function fetchApiObject(url: string, responsePath?: string): Prom
50
52
  export declare function fetchApiRaw(url: string): Promise<string>;
51
53
  /** Copy `text` to the clipboard, toasting success/failure. */
52
54
  export declare function copyToClipboard(text: string): Promise<void>;
55
+ /** Page fields offered in the Pages source mapping (same list as the docs' Endpoint builder). */
56
+ export declare const PAGE_FIELD_OPTIONS: readonly ["slug", "name", "title", "metaDescription", "thumbnailImage", "heroImage", "tags", "groups", "createdAt", "updatedAt"];
57
+ /** Best-guess page field for each sub-field id (unmatched sub-fields are left out). */
58
+ export declare function guessPageFieldMap(itemFields: TemplateFormField['itemFields']): Record<string, string>;
59
+ /** `pageGroup` value meaning "every live page, no group filter". */
60
+ export declare const ALL_PAGES_GROUP = "__all__";
61
+ /**
62
+ * Absolute `client/page` URL for the Pages source — absolute so the backend
63
+ * refresh can call it too. Selects only the mapped fields, never sections.
64
+ */
65
+ export declare function buildPagesUrl(backendUrl: string, tenantId: string, group: string, map: Record<string, string>): string;
66
+ /** Key each raw page row by sub-field id, using the Pages source mapping. */
67
+ export declare function mapPageRows(rows: Record<string, any>[], map: Record<string, string>): Record<string, any>[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Live refresh for repeatable fields bound to an `api` / `pages` source with
3
+ * `dataSource.ttlMinutes` set: every N minutes the saved request is re-run and
4
+ * the field reseeded, so the canvas keeps up with the source while the page is
5
+ * open (the published page refreshes server-side on the same interval).
6
+ * Silent: failures keep the current rows; a grid that's too small grows by rows.
7
+ */
8
+ export default function useAutoRefreshDataSources(): void;
@@ -8,6 +8,7 @@ type UseSaveHandlerReturn = {
8
8
  startDate?: Date | null;
9
9
  endDate?: Date | null;
10
10
  };
11
+ ttlMinutes?: number;
11
12
  }) => Promise<any>;
12
13
  loading: boolean | undefined;
13
14
  };
@@ -6,7 +6,7 @@ type TValue = {
6
6
  document: TEditorConfiguration;
7
7
  record: any | null;
8
8
  selectedBlockId: string | null;
9
- selectedSidebarTab: 'block-configuration' | 'styles' | 'behaviour' | 'layout' | 'settings' | 'background' | 'page-pilot-ai' | 'layers' | 'brand' | 'seo' | 'variables' | 'research';
9
+ selectedSidebarTab: 'block-configuration' | 'styles' | 'behaviour' | 'layout' | 'settings' | 'background' | 'page-pilot-ai' | 'layers' | 'brand' | 'seo' | 'variables' | 'research' | 'sections';
10
10
  selectedMainTab: 'editor' | 'preview' | 'json' | 'html';
11
11
  selectedScreenSize: 'desktop' | 'mobile' | 'tablet';
12
12
  previewHostTheme: PreviewHostTheme;
@@ -189,7 +189,7 @@ type SetActiveStepIndexOptions = {
189
189
  };
190
190
  export declare function setActiveStepIndex(activeStepIndex: number, options?: SetActiveStepIndexOptions): void;
191
191
  export declare function setSelectedMainTab(selectedMainTab: TValue['selectedMainTab']): void;
192
- export declare function useSelectedSidebarTab(): "layout" | "background" | "behaviour" | "block-configuration" | "styles" | "settings" | "page-pilot-ai" | "layers" | "brand" | "seo" | "variables" | "research";
192
+ export declare function useSelectedSidebarTab(): "layout" | "background" | "behaviour" | "block-configuration" | "styles" | "settings" | "page-pilot-ai" | "layers" | "brand" | "seo" | "variables" | "research" | "sections";
193
193
  export declare function useInspectorDrawerOpen(): boolean;
194
194
  export declare function useSamplesDrawerOpen(): boolean;
195
195
  export declare function useInlineEditingEnabled(): boolean;
@@ -109,7 +109,15 @@ export type TemplateFormField = {
109
109
  */
110
110
  dataSource?: {
111
111
  /** `api` = fetch an array of objects from a REST endpoint. */
112
- type: 'custom' | 'custom-json' | 'api' | 'menu';
112
+ type: 'custom' | 'custom-json' | 'api' | 'menu' | 'pages';
113
+ /** `pages`: page group to list (tenant settings → groups). */
114
+ pageGroup?: string;
115
+ /** `pages`: sub-field id → page field (name, slug, thumbnailImage, …). */
116
+ pageFieldMap?: Record<string, string>;
117
+ /** POST body sent with `apiUrl` (the `pages` source builds it). */
118
+ apiBody?: Record<string, any>;
119
+ /** Minutes between automatic refreshes of the published page. 0/empty = off. */
120
+ ttlMinutes?: number;
113
121
  /** Raw JSON text for `custom-json`. */
114
122
  customJson?: string;
115
123
  /** Endpoint URL for the `api` source. Persisted in config. */
@@ -0,0 +1,4 @@
1
+ declare const config: {
2
+ readonly backendUrl: string;
3
+ };
4
+ export default config;