@@ -21,6 +21,15 @@ export class HTMLPageSDK {
2121 if ( ! this . options . pageId ) {
2222 this . options . pageId = await this . iframeAdapter . request ( POST_MESSAGE_REQUEST_TYPE . GET_PAGE_ID ) ;
2323 }
24+ // Pull preview-mode view configs (only meaningful for the ai_agent preview page).
25+ // For real pages the server resolves views from app_config; the inline map is ignored server-side.
26+ if ( ! this . options . views ) {
27+ try {
28+ this . options . views = await this . iframeAdapter . request ( POST_MESSAGE_REQUEST_TYPE . GET_VIEWS ) ;
29+ } catch ( e ) {
30+ this . options . views = null ;
31+ }
32+ }
2433 if ( this . options . accountToken ) {
2534 // dev: try to get access-token via accountToken
2635 const { server, accountToken, appUuid } = this . options ;
@@ -34,8 +43,13 @@ export class HTMLPageSDK {
3443 }
3544 }
3645
37- listRows ( { tableName, start, limit } ) {
38- return this . htmlPageAPI . listRows ( this . options . pageId , tableName , start , limit ) ;
46+ listRows ( { tableName, viewName, start, limit } ) {
47+ let viewConfig = null ;
48+ if ( viewName && this . options . views && typeof this . options . views === 'object' ) {
49+ const cfg = this . options . views [ viewName ] ;
50+ if ( cfg && typeof cfg === 'object' ) viewConfig = cfg ;
51+ }
52+ return this . htmlPageAPI . listRows ( this . options . pageId , tableName , start , limit , viewName , viewConfig ) ;
3953 }
4054
4155 addRow ( { tableName, rowData } ) {
0 commit comments