diff --git a/README.md b/README.md index 1b5d95a..68b4321 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ All the available Crisp API resources are fully implemented. **Programmatic meth All methods that you will most likely need when building a Crisp integration are prefixed with a star symbol (⭐). -**⚠️ Note that, depending on your authentication token tier, which is either `user` or `plugin`, you may not be allowed to use all methods from the library. When in doubt, refer to the library method descriptions below. Most likely, you are using a `plugin` token.** +**⚠️ Note that, depending on your authentication token tier, which is either `user`, `website` or `plugin`, you may not be allowed to use all methods from the library. When in doubt, refer to the library method descriptions below. Most likely, you are using a `plugin` token.** --- diff --git a/lib/crisp.ts b/lib/crisp.ts index c7c3fb2..541937d 100644 --- a/lib/crisp.ts +++ b/lib/crisp.ts @@ -31,7 +31,7 @@ import Website, { WebsiteServiceInterface } from "@/services/website"; export type RTM_MODES = "websockets" | "webhooks"; -export type CrispTier = "user" | "plugin"; +export type CrispTier = "user" | "website" | "plugin"; /************************************************************************** * CONSTANTS @@ -323,7 +323,7 @@ class Crisp { /** * Sets the authentication tier */ - setTier(tier: "user" | "plugin") { + setTier(tier: "user" | "website" | "plugin") { this.auth.tier = (tier || "user"); } @@ -754,6 +754,12 @@ class Crisp { let restUrlSegments; switch (this.auth.tier) { + case "website": { + restUrlSegments = ["website", "connect", "endpoints"]; + + break; + } + case "plugin": { restUrlSegments = ["plugin", "connect", "endpoints"];