Skip to content

Commit

Permalink
Merge pull request #445 from amtrack/perf/retrieve-customer-portal-en…
Browse files Browse the repository at this point in the history
…abled

perf: use Metadata API to retrieve CustomerPortal enabled state
  • Loading branch information
amtrack authored Oct 5, 2022
2 parents 2666f33 + 8dc3254 commit a915341
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/plugins/customer-portal/enabled/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ export type Config = boolean;
export class CustomerPortalEnable extends BrowserforcePlugin {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async retrieve(definition?: Config): Promise<Config> {
const page = await this.browserforce.openPage(PATHS.EDIT_VIEW);
await page.waitForSelector(SELECTORS.ENABLED);
const response = await page.$eval(
SELECTORS.ENABLED,
(el: HTMLInputElement) => el.checked
);
return response;
const conn = await this.browserforce.org.getConnection();
const orgSettings = await conn.metadata.read('OrgSettings', 'Org');
return orgSettings.enableCustomerSuccessPortal;
}

public diff(state: Config, definition: Config): Config {
Expand Down

0 comments on commit a915341

Please sign in to comment.