For the Transcript option in your first question there are a few ways you can do this but the way I have helped customers in the past that has worked the best for them is to write a "Widget Extension" (as long as your using the V2 chat widget) This will allow you to register to various events including "WebChat.closed" normally when this is received I would then pop a custom "Toaster" with options asking if they would like a copy of the transcript and if they "Accept" off the transcript as a PDF. This would require you to use a package to convert the Transcript to PDF or write your own. Details on how to build a V2 Extension can be found here: https://all.docs.genesys.com/WID/Current/SDK/GWCBusExtensions This works very well for this use case and the CX is then inline with the Chat Widget experience.
As for the "Rating option" you could do a similar thing here in the past i have used the OOTB web survey to get the URL so the results can be reported on and linked to the original conversationId. This is more complex as you need to build some middleware to get the survey URL. It is possible though. Moving forward this is planned to be part of the Web Messaging channel coming (at the time of this post), this "survey" option is not part of the first release, so depending on your timelines and urgency you can decide.
In the download chat transcript feature, I want customers to have an option downloading transcripts from previous chat sessions. Can I get those transcripts from a database or this info doesn't get saved ?
The previous transcripts do exist in the Genesys Cloud Db and can be access through the API in the recordings endpoint. For this to happen though you will need to have a valid OAuth token and ability to download them. This is possible but will push the JS code from being just a Widget extension to also include some middleware server. I would warn you here as then you are exposing a service that's hosted to get the transcript and security needs to be kept in mind. Otherwise if you make the chat conversation trigger a "Policy" you can use the survey flow to email the chat transcript and previous transcripts through this flow and this then removes the need for an external service but is a different CX over a popup converting it to PDF on the client side.