@@ -74,7 +74,8 @@ export default {
7474     * @param  properties - Properties from the selected page obtained from Notion 
7575     * @returns  the selected props inputted by the user with the following attributes: 
7676     *            - type: the Notion property type used in notion-page-properties.mjs 
77-      *            - label: the page's property name 
77+      *            - label: the property ID for API calls 
78+      *              (was property name before data source migration) 
7879     *            - value: the property value inputted by the user 
7980     */ 
8081    _filterProps ( properties  =  { } )  { 
@@ -83,7 +84,7 @@ export default {
8384          ||  ( this . properties  &&  this . properties [ property ] ) ) 
8485        . map ( ( property )  =>  ( { 
8586          type : properties [ property ] ?. type  ??  property , 
86-           label : property , 
87+           label : properties [ property ] ?. id   ||   property , 
8788          value : this [ property ]  ||  this . properties ?. [ property ] , 
8889        } ) ) ; 
8990    } , 
@@ -96,8 +97,14 @@ export default {
9697    _convertPropertiesToNotion ( properties  =  [ ] ,  NOTION_CONVERTER  =  { } )  { 
9798      const  notionProperties  =  { } ; 
9899      for  ( const  property  of  properties )  { 
99-         const  notionProperty  =  NOTION_CONVERTER [ property . type ] ; 
100-         notionProperties [ property . label ]  =  notionProperty ?. convertToNotion ( property ) ; 
100+         // If the property value is already in Notion format, use it directly 
101+         if  ( this . _isAlreadyNotionFormat ( property . value ,  property . type ) )  { 
102+           notionProperties [ property . label ]  =  property . value ; 
103+         }  else  { 
104+           // Otherwise, convert using the appropriate converter 
105+           const  notionProperty  =  NOTION_CONVERTER [ property . type ] ; 
106+           notionProperties [ property . label ]  =  notionProperty ?. convertToNotion ( property ) ; 
107+         } 
101108      } 
102109      return  notionProperties ; 
103110    } , 
@@ -156,6 +163,32 @@ export default {
156163      const  filteredProperties  =  this . _filterProps ( parentProperties ) ; 
157164      return  this . _buildNotionPageProperties ( filteredProperties ) ; 
158165    } , 
166+     /** 
167+      * Checks if a property value is already in Notion format 
168+      * @param  value - the property value to check 
169+      * @returns  true if already in Notion format, false otherwise 
170+      */ 
171+     _isAlreadyNotionFormat ( value )  { 
172+       if  ( ! value  ||  typeof  value  !==  "object" )  return  false ; 
173+ 
174+       // Check for common Notion property structures 
175+       const  notionKeys  =  [ 
176+         "title" , 
177+         "rich_text" , 
178+         "number" , 
179+         "select" , 
180+         "multi_select" , 
181+         "date" , 
182+         "people" , 
183+         "files" , 
184+         "checkbox" , 
185+         "url" , 
186+         "email" , 
187+         "phone_number" , 
188+         "relation" , 
189+       ] ; 
190+       return  notionKeys . some ( ( key )  =>  key  in  value ) ; 
191+     } , 
159192    /** 
160193     * Creates the block children inputted by the user in Notion format 
161194     * @returns  the block children in Notion format 
0 commit comments