Giter VIP home page Giter VIP logo

lotus-typescript's Introduction

Lotus Typescript Library

MIT License

Official Lotus Typescript library to capture and send events to any Lotus instance (self-hosted or cloud).

Installing

Install the lotus-node package for use in your node.js based backend.

npm install lotus-typescript

Initializing

First grab a new api key from the Settings tab. Then change the host to wherever you want to send data to and omit the line if you are using Lotus Cloud.

const lotus = new Lotus(api_key, {
  host: "https://api.uselotus.io/", // You can omit this line if using Lotus Cloud
});

Currently Supported Methods

1. trackEvent
2. listCustomers
3. getCustomer
4. createCustomer
5. createSubscription
6. cancelSubscription
7. updateSubscription
8. switchSubscriptionPlan
9. listSubscriptions
10. attachAddon
11. cancelAddon
12. changePrepaidUnits
13. listPlans
14. getPlan
15. checkFeatureAccess
16. checkMetricAccess
17. listInvoices
18. getInvoice
19. listCredits
20. createCredit
21. voidCredit
22. updateCredit

Making calls

Please refer to the Lotus documentation for more information on how to use the library.

All parameters and return types are defined in snake_case. This is consistent across all Lotus SDKs. Method names are in camelCase.

Questions?

Thank you

lotus-typescript's People

Contributors

mnida avatar hardik-uselotus avatar glamboyosa avatar diego-escobedo avatar

Stargazers

 avatar Daniel Putzer avatar

Watchers

 avatar  avatar

Forkers

dru-go

lotus-typescript's Issues

TypeError: Cannot read properties of undefined (reading 'data')

I was referring to this documentation to test out the lotus typescript package on a self hosted version. But I encountered the following error:

Stack Trace:

index.js:18 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
    at isApiError (index.js:18:1)
    at callReq (index.js:32:1)
    at Lotus.flush (index.js:150:1)
    at index.js:123:1
isApiError	@	index.js:18
callReq	@	index.js:32
flush	@	index.js:150
(anonymous)	@	index.js:123
setTimeout (async)		
enqueue	@	index.js:123
trackEvent	@	index.js:167
onClick	@	index.js:45
handleClick	@	button.js:124
callCallback	@	react-dom.development.js:4164
invokeGuardedCallbackDev	@	react-dom.development.js:4213
invokeGuardedCallback	@	react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError	@	react-dom.development.js:4291
executeDispatch	@	react-dom.development.js:9041
processDispatchQueueItemsInOrder	@	react-dom.development.js:9073
processDispatchQueue	@	react-dom.development.js:9086
dispatchEventsForPlugins	@	react-dom.development.js:9097
(anonymous)	@	react-dom.development.js:9288
batchedUpdates$1	@	react-dom.development.js:26140
batchedUpdates	@	react-dom.development.js:3991
dispatchEventForPluginEventSystem	@	react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay	@	react-dom.development.js:6465
dispatchEvent	@	react-dom.development.js:6457
dispatchDiscreteEvent

The debug point in the source code:
image

Steps to reproduce:

  • Simply called lotus.trackEvent() with http://localhost as the host name

Any help is appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.