For custom libraries, they need to be hosted on a CDN which it looks like you’re good on so far. Depending on the library, you’ll access it inside of {{ }} tags or Run JS Code type queries. For the built-in Moment.js and PapaParse libraries, their functions are accessed with {{ moment() }} and {{ Papa.parse() }}.
A big qualifier here is that all JS in retool runs inside of a sandbox, so if the library won’t work property if any of it’s functions depend on listening to user input, use jQuery, listen to events on the Retool page, etc.
New user. I’m having the same issue. I’ve added the https://cdnjs.cloudflare.com/ajax/libs/voca/1.4.0/voca.min.js library to Organization Settings > Advanced > Libraries, but I can’t figure out how to call the slugify() function from the library.
@alex-w, would you be willing to provide a code snippet indicating where and how to call that function or any other from the voca library the OP mentions?
I want to slugify the value of one of my text inputs, like:
Just checked out the Voca library, it looks like their functions are all built off of v like v.slugify(). All of the voca methods should be available after adding the library, though it looks like we do still underline the custom libraries identifier in red, while the green highlight and returned value is correct. I'll look into getting that fixed!
You should be able to use any of the methods on their docs. At first glance, I don't see any conflicts with the JS sandbox.
New user. I’m having the same issue. I’ve added the (https://sdk.amazonaws.com/js/aws-sdk-2.799.0.min.js) library to Organization Settings > Advanced > Libraries, but I can’t figure out how to call the var AWS = require(‘aws-sdk’);
const provider = new AWS.CognitoIdentityServiceProvider(); function from the library.
@alex-w, would you be willing to provide a code snippet indicating where and how to call that aws sdk library function?
below i am sharing my code
var params = {
UserAttributes: [ /* required /
{
Name: ‘STRING_VALUE’, / required /
Value: ‘STRING_VALUE’
},
/ more items /
],
UserPoolId: ‘STRING_VALUE’, / required /
Username: ‘STRING_VALUE’, / required /
ClientMetadata: {
‘’: ‘STRING_VALUE’,
/ ‘’: … */
}
};
provider.adminUpdateUserAttributes(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
I was trying to import the AWS library (cognito) to query user data (email and provider), but it wouldn't load because it required using the require command to load the library.
How would I call it in a custom component? I basically want to create a flow chart that consists of custom components but I dont know how to reference it.
I tried adding something below in the iframe code but it doesnt appear to be working.
<script type="application/javascript">
const reactFlow = // how do I call the react-flow-renderer here?
</script