Just started working on building a Proof of Concept for my application. We want to use Amity to implement conversations between users on our site.
I started by just trying to run the client code provided and installing the sdk via npm and create a user like so
import AmityClient, { ApiRegion } from “@amityco/js-sdk”;
const client = new AmityClient({
apiKey: "b0e8ee0f3edfa53019308914545b148a855f8fe6e9616b7a",
apiRegion: ApiRegion.US,
})
client.registerSession(1, “Drew”)
But I’m receiving SyntaxError: Named export ‘ApiRegion’ not found. The requested module ‘@amityco/js-sdk’ is a CommonJS module, which may not support all module.exports as named exports.
I tried to switch the imports a bit like this instead
import AmityClient from “@amityco/js-sdk”;
const { ApiRegion } = AmityClient
But it is still giving me an error
TypeError: AmityClient is not a constructor
Any help so I can get started would be greatly appreciated. I was under the impression that I could implement this with just vanilla js.