How to create a javascript sdk with react

I would appreciate a direction as I am lost and cannot find any source that explains how I can create a global function that my customers can use. I have multiple REST API that customers can use however I am trying to create a javascrtipt SDK so they can simply call a function and everything else is taken care of.

For example, all the user has to do is import a script in head tag and then use my variable across the app to invoke functions. Like how stripe provides SDK.

Stripe.getCustomer('pass some data id');

I have a similar need, where user can save data to DB.

myapp.saveDatatoDb(data).then(response => {
});

the saveToDB will take care of calling an API and storing the information. Where do I get started?