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.
await swell.account.login('email@example.com', 'thepassword')
Use to disconnect the account from the current session. This will set account_logged_in=false and guest=true.
Use to get information about the customer currently logged in.
Returns an account object, or null if the customer is not logged in.
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.
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.
Use to set the encoded session cookie initially created by Swell. This can be used to restore the cookie value from an external system.