@@ -810,4 +810,122 @@ export class DocumentTypeApiHelper {
810810 return null ;
811811 }
812812 }
813+
814+ async createElementTypeWithTwoPropertyEditors ( elementTypeName : string , firstDataTypeName : string , firstDataTypeId : string , secondDataTypeName : string , secondDataTypeId : string , elementTypeVaryByCulture : boolean = false , firstPropertyVaryByCulture : boolean = false , secondPropertyVaryByCulture : boolean = false ) {
815+ const crypto = require ( 'crypto' ) ;
816+ await this . ensureNameNotExists ( elementTypeName ) ;
817+
818+ const containerId = crypto . randomUUID ( ) ;
819+ const elementType = new DocumentTypeBuilder ( )
820+ . withName ( elementTypeName )
821+ . withAlias ( AliasHelper . toAlias ( elementTypeName ) )
822+ . withIsElement ( true )
823+ . withVariesByCulture ( elementTypeVaryByCulture )
824+ . withIcon ( "icon-plugin" )
825+ . addContainer ( )
826+ . withName ( 'Content' )
827+ . withId ( containerId )
828+ . withType ( "Group" )
829+ . done ( )
830+ . addProperty ( )
831+ . withContainerId ( containerId )
832+ . withAlias ( AliasHelper . toAlias ( firstDataTypeName ) )
833+ . withName ( firstDataTypeName )
834+ . withDataTypeId ( firstDataTypeId )
835+ . withVariesByCulture ( firstPropertyVaryByCulture )
836+ . done ( )
837+ . addProperty ( )
838+ . withContainerId ( containerId )
839+ . withAlias ( AliasHelper . toAlias ( secondDataTypeName ) )
840+ . withName ( secondDataTypeName )
841+ . withDataTypeId ( secondDataTypeId )
842+ . withVariesByCulture ( secondPropertyVaryByCulture )
843+ . done ( )
844+ . build ( ) ;
845+
846+ return await this . create ( elementType ) ;
847+ }
848+
849+ /**
850+ * Creates a document type with variant and invariant block lists for testing multilingual scenarios.
851+ *
852+ * Structure created:
853+ * - Document Type (Vary by culture)
854+ * - Text 1 (Vary by culture)
855+ * - Text 2 (Shared)
856+ * - Block List 1 (Vary by culture) - contains Block 1 and Block 2
857+ * - Block List 2 (Shared) - contains Block 1 and Block 2
858+ *
859+ * - Block 1 Element Type (Vary by culture)
860+ * - Text 1 (Vary by culture)
861+ * - Text 2 (Shared)
862+ *
863+ * - Block 2 Element Type (Shared/Invariant)
864+ * - Text 1
865+ * - Text 2
866+ */
867+ async createDocumentTypeWithVariantAndInvariantBlockLists ( documentTypeName : string , firstDataTypeName : string , firstDataTypeId : string , secondDataTypeName : string , secondDataTypeId : string , blockList1DataTypeName : string , blockList2DataTypeName : string , block1ElementTypeName : string , block2ElementTypeName : string ) {
868+ const crypto = require ( 'crypto' ) ;
869+ await this . ensureNameNotExists ( documentTypeName ) ;
870+
871+ // Create Block 1 Element Type (Vary by culture) with first property (vary by culture) and second property (shared)
872+ const block1ElementTypeId = await this . createElementTypeWithTwoPropertyEditors ( block1ElementTypeName , firstDataTypeName , firstDataTypeId , secondDataTypeName , secondDataTypeId , true , true , false ) as string ;
873+
874+ // Create Block 2 Element Type (Shared/Invariant) with first property and second property
875+ const block2ElementTypeId = await this . createElementTypeWithTwoPropertyEditors ( block2ElementTypeName , firstDataTypeName , firstDataTypeId , secondDataTypeName , secondDataTypeId , false , false , false ) as string ;
876+
877+ // Create Block List 1 Data Type (will be used with vary by culture property)
878+ const blockList1DataTypeId = await this . api . dataType . createBlockListDataTypeWithTwoBlocks ( blockList1DataTypeName , block1ElementTypeId , block2ElementTypeId ) as string ;
879+
880+ // Create Block List 2 Data Type (will be used with shared property)
881+ const blockList2DataTypeId = await this . api . dataType . createBlockListDataTypeWithTwoBlocks ( blockList2DataTypeName , block1ElementTypeId , block2ElementTypeId ) as string ;
882+
883+ // Create Document Type (Vary by culture)
884+ const containerId = crypto . randomUUID ( ) ;
885+ const documentType = new DocumentTypeBuilder ( )
886+ . withName ( documentTypeName )
887+ . withAlias ( AliasHelper . toAlias ( documentTypeName ) )
888+ . withAllowedAsRoot ( true )
889+ . withVariesByCulture ( true )
890+ . addContainer ( )
891+ . withName ( 'Content' )
892+ . withId ( containerId )
893+ . withType ( "Group" )
894+ . done ( )
895+ . addProperty ( )
896+ . withContainerId ( containerId )
897+ . withAlias ( AliasHelper . toAlias ( firstDataTypeName ) )
898+ . withName ( firstDataTypeName )
899+ . withDataTypeId ( firstDataTypeId )
900+ . withVariesByCulture ( true )
901+ . withSortOrder ( 0 )
902+ . done ( )
903+ . addProperty ( )
904+ . withContainerId ( containerId )
905+ . withAlias ( AliasHelper . toAlias ( secondDataTypeName ) )
906+ . withName ( secondDataTypeName )
907+ . withDataTypeId ( secondDataTypeId )
908+ . withVariesByCulture ( false )
909+ . withSortOrder ( 1 )
910+ . done ( )
911+ . addProperty ( )
912+ . withContainerId ( containerId )
913+ . withAlias ( AliasHelper . toAlias ( blockList1DataTypeName ) )
914+ . withName ( blockList1DataTypeName )
915+ . withDataTypeId ( blockList1DataTypeId )
916+ . withVariesByCulture ( true )
917+ . withSortOrder ( 2 )
918+ . done ( )
919+ . addProperty ( )
920+ . withContainerId ( containerId )
921+ . withAlias ( AliasHelper . toAlias ( blockList2DataTypeName ) )
922+ . withName ( blockList2DataTypeName )
923+ . withDataTypeId ( blockList2DataTypeId )
924+ . withVariesByCulture ( false )
925+ . withSortOrder ( 3 )
926+ . done ( )
927+ . build ( ) ;
928+
929+ return await this . create ( documentType ) ;
930+ }
813931}
0 commit comments