Methods to authenticate a customer's account and get information about their current session.

Use to authenticate a customer with their email address and password. If the email/password combo is correct, their account will be added to the session, making customer-specific methods available. This will set account_logged_in=true and guest=false.

Log in
await swell.account.login('runsincircles@shiverisles.net', 'thepassword')

Use to disconnect the account from the current session. This will set account_logged_in=false and guest=true.

Log out
await swell.account.logout()

Use to get information about the customer currently logged in.

Returns an account object, or null if the customer is not logged in.

Get logged in account
await swell.account.get()

Use to get current session values, including properties such as `account_id` when the user has been logged-in, and `cart_id` when the user has established a shopping cart.

Returns a decoded session object.

Get session values
await swell.session.get()

Use to get the encoded session cookie created by Swell. This can be used to store the cookie value in an external system with the intention of restoring it later.

Returns an encoded session string.

Get the session cookie
swell.session.getCookie()

Use to set the encoded session cookie initially created by Swell. This can be used to restore the cookie value from an external system.

Set the session cookie
swell.session.setCookie(encodedString)