diff --git a/docs/development.md b/docs/development.md index e001318..9f9b196 100644 --- a/docs/development.md +++ b/docs/development.md @@ -67,7 +67,7 @@ Edit the `sfdx-project.json` file to specify the namespace: ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "60.0" + "sourceApiVersion": "62.0" } ``` Replace `` with your actual namespace. diff --git a/force-app/main/default/lwc/orgcheckApp/api/orgcheck-api.js b/force-app/main/default/lwc/orgcheckApp/api/orgcheck-api.js index 8408803..831cddd 100644 --- a/force-app/main/default/lwc/orgcheckApp/api/orgcheck-api.js +++ b/force-app/main/default/lwc/orgcheckApp/api/orgcheck-api.js @@ -62,6 +62,11 @@ export class OrgCheckAPI { */ #logger; + /** + * @property {Boolean} Is the current user accepted the terms to use Org Check in this org? + */ + #usageTermsAccepted; + /** * Org Check constructor * @@ -76,6 +81,7 @@ export class OrgCheckAPI { this.#sfdcManager = new OrgCheckSalesforceManager(jsConnectionFactory, accessToken, userId, this.#logger); this.#datasetManager = new OrgCheckDatasetManager(this.#sfdcManager, jsCompression, this.#logger); this.#recipeManager = new OrgCheckRecipeManager(this.#datasetManager, this.#logger); + this.#usageTermsAccepted = false; } /** @@ -142,6 +148,26 @@ export class OrgCheckAPI { return this.#recipeManager.run(RECIPE_ORGANIZATION_ALIAS); } + /** + * Check if we can use the current org according to the terms (specially if this is a production org) + * + * @returns true + * @throws Exception if the org is a Production and terms are not accepted + */ + async checkUsageTerms() { + const orgInfo = await this.#recipeManager.run(RECIPE_ORGANIZATION_ALIAS); + if (orgInfo.isProduction === true) { + if (this.#usageTermsAccepted === false) { + return false; + } + } + return true; + } + + acceptUsageTerms() { + this.#usageTermsAccepted = true; + } + /** * Check if the current user can run the application * diff --git a/force-app/main/default/lwc/orgcheckApp/orgcheckApp.html b/force-app/main/default/lwc/orgcheckApp/orgcheckApp.html index 69d7c27..7aa45ce 100644 --- a/force-app/main/default/lwc/orgcheckApp/orgcheckApp.html +++ b/force-app/main/default/lwc/orgcheckApp/orgcheckApp.html @@ -106,741 +106,763 @@

Welcome in Org Check ({o - + + - - - - - - - - - -