Brain
A client of the Brain (the platform's central application), for pages that are not served by a site.
Quick start
const brain = new window.Portal.brain.Client({ subdomain: 'www' });
const member = await brain.getMember('MEMBER_REF');
console.log(member);API reference
brain
A client of the Brain (the platform's central application).
getMember()
Fetches the member payload for the given reference number.
const result = await brain.getMember(referenceNum);Parameters
| Name | Type | Required | Description |
|---|---|---|---|
referenceNum | string | Yes | The record's reference number. |
Returns
Resolves with Record<string, unknown> \| null.
isDev()
Returns true when the configured base URL points to the development brain host.
const ok = brain.isDev();Returns
Returns a boolean.
isProd()
Returns true when the configured base URL points to a production brain host.
const ok = brain.isProd();Returns
Returns a boolean.
window.Portal.brain
Portal.brain — talk to the Brain from a page that is not served by a site.
Client
Constructs a BrainClient that can query the external brain API.
new
const client = new window.Portal.brain.Client(opts);Parameters
| Name | Type | Required | Description |
|---|---|---|---|
opts | PortalBrainClientOptions | No | Options of new Portal.brain.Client(). |
Returns
Returns a PortalBrainClient: A client of the Brain (the platform's central application).
getBaseUrl()
The Brain's base address: https://www15.appfactory.studio for 'www15', else https://www.appfactory.studio.
const value = window.Portal.brain.Client.getBaseUrl(subdomain);Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subdomain | 'www15' | 'www' | No | The Brain application subdomain. |
Returns
Returns a string.
Types
PortalBrainClientOptions
Options of new Portal.brain.Client().
| Name | Type | Required | Description |
|---|---|---|---|
subdomain | 'www15' | 'www' | No | The brain application subdomain. Use "www15" for development and "www" for production. |
baseUrl | string | No | Optional override for the brain application base URL. |