1.0.1 • Published 2 years ago

@climes/client-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Climes Client SDK

Installation

npm install @climes/client-sdk

How to use

Make sure @climes/server-sdk is installed before proceeding further

  1. Designate a tag with an id where the widget should be visible.
  2. Initialize client with the above id with uri from server where the truecost call has to be made and optInCallback callback in the starting point of your project

    id: Target ID
    uri: target API URI from server for truecost call
    optInCallback: callback to take action on Climes opt-in
    • For eg: In a react based app, inside App.js add a useEffect

      import { initialize } from '@climes/client-sdk';
      
      function App() {
        //...
        useEffect(() => {
          initialize({
            id: 'my-climes',
            uri: 'http://localhost:4000/api/truecost',
            optInCallback: (e) => {
              console.log(e.target.checked);
            }
          });
        }, []);
        //...
      }
  3. In the page where the widget is added, call makeTruecostCall function with the required arguments to get truecost.

Contact Us

To integrate Climes-SDK in your product, visit us at Climes