diff --git a/.circleci/ci/it-tests.js b/.circleci/ci/it-tests.js
index a4874bf0f3..896cc77f6d 100644
--- a/.circleci/ci/it-tests.js
+++ b/.circleci/ci/it-tests.js
@@ -24,7 +24,8 @@ console.log(config);
const qpPath = '/home/circleci/cq';
const buildPath = '/home/circleci/build';
const { TYPE, BROWSER, AEM, PRERELEASE, FT } = process.env;
-const isLatestAddon = AEM === 'addon-latest';
+const classicFormAddonVersion = 'LATEST';
+const classicFormReleasedAddonVersion = '6.0.1016';
try {
ci.stage("Integration Tests");
@@ -35,6 +36,15 @@ try {
let extras = ``, preleaseOpts = ``;
if (AEM === 'classic') {
+ // Download latest add-on release from artifactory
+ ci.sh(`mvn -s ${buildPath}/.circleci/settings.xml com.googlecode.maven-download-plugin:download-maven-plugin:1.6.3:artifact -Partifactory-cloud -DgroupId=com.adobe.aemds -DartifactId=adobe-aemfd-linux-pkg -Dversion=${classicFormReleasedAddonVersion} -Dtype=zip -DoutputDirectory=${buildPath} -DoutputFileName=forms-linux-addon.far`);
+ extras += ` --install-file ${buildPath}/forms-linux-addon.far`;
+ // The core components are already installed in the Cloud SDK
+ extras += ` --bundle com.adobe.cq:core.wcm.components.all:${wcmVersion}:zip`;
+ } else if (AEM === 'classic-latest') {
+ // Download latest add-on release from artifactory
+ ci.sh(`mvn -s ${buildPath}/.circleci/settings.xml com.googlecode.maven-download-plugin:download-maven-plugin:1.6.3:artifact -Partifactory-cloud -DgroupId=com.adobe.aemds -DartifactId=adobe-aemfd-linux-pkg -Dversion=${classicFormAddonVersion} -Dtype=zip -DoutputDirectory=${buildPath} -DoutputFileName=forms-linux-addon.far`);
+ extras += ` --install-file ${buildPath}/forms-linux-addon.far`;
// The core components are already installed in the Cloud SDK
extras += ` --bundle com.adobe.cq:core.wcm.components.all:${wcmVersion}:zip`;
} else if (AEM === 'addon') {
@@ -74,6 +84,7 @@ try {
${extras} \
${ci.addQpFileDependency(config.modules['core-forms-components-apps'] /*, isLatestAddon ? true : false */)} \
${ci.addQpFileDependency(config.modules['core-forms-components-af-apps'] /*, isLatestAddon ? true : false */)} \
+ ${ci.addQpFileDependency(config.modules['core-forms-components-core'])} \\
${ci.addQpFileDependency(config.modules['core-forms-components-af-core'])} \
${ci.addQpFileDependency(config.modules['core-forms-components-examples-apps'])} \
${ci.addQpFileDependency(config.modules['core-forms-components-examples-content'])} \
@@ -84,6 +95,16 @@ try {
${ci.addQpFileDependency(config.modules['core-forms-components-it-tests-content'])} \
--vm-options \\\"-Xmx4096m -XX:MaxPermSize=1024m -Djava.awt.headless=true -javaagent:${process.env.JACOCO_AGENT}=destfile=crx-quickstart/jacoco-it.exec\\\" \
${preleaseOpts}`);
+
+ if (AEM === 'classic' || AEM === 'classic-latest') {
+ // add a sleep for 10 mins, add-on takes times to come up
+ ci.sh(`sleep 10m`);
+ // restart the AEM insatnce
+ ci.sh(`./qp.sh stop --id author`);
+ ci.sh(`./qp.sh start --id author`);
+ // add a sleep for 5 mins, add-on takes times to come up
+ ci.sh(`sleep 5m`);
+ }
});
// Run integration tests
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 14ce5855ac..9c184cd3e8 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -51,13 +51,14 @@ common:
command: npm install axe-html-reporter
- run:
name: UI tests
+ no_output_timeout: 20m
# Supports 'Re-run failed tests only'. See this for more info: https://circleci.com/docs/rerun-failed-tests-only/
command: |
TEST_EXECUTED=false
cd ui.tests/test-module
TESTFILES=$(circleci tests glob "specs/**/*.spec.js")
cd ../../
- echo $TESTFILES | circleci tests run --command="xargs node .circleci/ci/it-tests.js" --verbose --split-by=timings
+ echo $TESTFILES | circleci tests run --command="xargs node .circleci/ci/it-tests.js" --verbose
- store_test_results:
path: ui.tests/test-module/test_results
- run:
@@ -109,8 +110,20 @@ executors:
docker:
- image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-qp:6.4.6-openjdk11
<<: *docker_auth
- - image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem-cloudready:1209202301-openjdk11
+ - image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem-cloudready:12441-openjdk11
<<: *docker_auth
+ test_executor_655:
+ docker:
+ - image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-qp:6.4.6-openjdk11
+ <<: *docker_auth
+ - image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem:6.5.18.0-openjdk11
+ <<: *docker_auth
+ test_executor_655_latest:
+ docker:
+ - image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-qp:6.4.6-openjdk11
+ <<: *docker_auth
+ - image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem:6.5.19-load2-openjdk11
+ <<: *docker_auth
jobs:
build-java-11:
@@ -171,42 +184,24 @@ jobs:
- store_artifacts:
path: test-results/junit
- cypress-chrome-cloudready-with-addon:
- executor: test_executor_cloudready
+ cypress-chrome-655:
+ executor: test_executor_655
environment:
- AEM: addon
+ AEM: classic
TYPE: cypress
BROWSER: chrome
- PRERELEASE: 'true'
resource_class: xlarge
working_directory: /home/circleci/build
- parallelism: 8
<<: *cypress_test_steps
- cypress-chrome-cloudready-with-latest-addon:
- executor: test_executor_cloudready
+ cypress-chrome-655-with-latest-addon:
+ executor: test_executor_655_latest
environment:
- AEM: addon-latest
+ AEM: classic-latest
TYPE: cypress
BROWSER: chrome
- PRERELEASE: 'true'
- FT: 'true'
resource_class: xlarge
working_directory: /home/circleci/build
- parallelism: 8
- <<: *cypress_test_steps
-
- cypress-chrome-cloudready-with-latest-addon-without-ft:
- executor: test_executor_cloudready
- environment:
- AEM: addon-latest
- TYPE: cypress
- BROWSER: chrome
- PRERELEASE: 'true'
- FT: 'false'
- resource_class: xlarge
- working_directory: /home/circleci/build
- parallelism: 8
<<: *cypress_test_steps
jsdocs-deploy:
@@ -345,21 +340,14 @@ workflows:
filters:
tags:
only: /.*/
- - cypress-chrome-cloudready-with-addon:
- filters:
- tags:
- only: /.*/
- requires:
- - build-java-11
- - build-java-8
- - cypress-chrome-cloudready-with-latest-addon:
+ - cypress-chrome-655:
filters:
tags:
only: /.*/
requires:
- build-java-11
- build-java-8
- - cypress-chrome-cloudready-with-latest-addon-without-ft:
+ - cypress-chrome-655-with-latest-addon:
filters:
tags:
only: /.*/
diff --git a/README.md b/README.md
index bb4452a704..d9f2492a06 100644
--- a/README.md
+++ b/README.md
@@ -21,12 +21,6 @@ See [AEM Sites Core Components](https://docs.adobe.com/content/help/en/experienc
- [Adaptive Form - Embed](ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform)
-### Forms And Communications Portal
-
-- [Link Component](ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link)
-- [Drafts and Submissions Component](ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions)
-- [Search and Lister Component](ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister)
-
### Adaptive Form
- [Form Container](ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container)
@@ -56,9 +50,11 @@ See [AEM Sites Core Components](https://docs.adobe.com/content/help/en/experienc
The latest version of the AEM Forms Core Components, require the below minimum system requirements:
-| Forms Core Components | WCM Core Components | AEM Forms as a cloud service | Java | Maven |
-|-----------------------|---------------------| ---------------------------- | ----- | ------ |
-| 2.0.56 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
+
+| Forms Core Components | WCM Core Components | AEM 6.5 | Java | Maven |
+|-----------------------|---------------------|---------| ----- | ------ |
+| 1.1.24 | 2.23.2 | 6.5.18+ | 8, 11 | 3.3.9+ |
+
For a list of requirements for previous versions, see [Historical System Requirements](VERSIONS.md).
@@ -158,13 +154,6 @@ and sub package section
to the `content-package-maven-plugin`.
-## Using Pre-release versions
-In order to use components under pre-release:
-1. Enable the pre-release channel. Instructions at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/release-notes/prerelease.html?lang=en
- 1. Replace `core-forms-components-*` version with the desired pre-release version (e.g `1.0.4-PRERELEASE-20211223`) in your Cloud Manager / AEM Archetype project. This can be done by updating `x.y.z` in the top level pom.xml of archetype project.
-
-Contents in the pre-release are contained in the `pre-release` branch.
-
## Code Formatting
### Java
diff --git a/VERSIONS.md b/VERSIONS.md
index e9addaa6c9..4f999a2731 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -2,50 +2,13 @@
See below for a full list of minimum system requirements for historical versions of the Forms Core Components:
-| Forms Core Components | WCM Core Components | AEM Forms as a cloud service | Java | Maven |
-|-----------------------|---------------------| ---------------------------- | ----- | ------ |
-| 2.0.56 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.54 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.52 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.50 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.48 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.46 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.44 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.42 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.40 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.36 | 2.23.0 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.26 | 2.22.12 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.18 | 2.22.10 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.14 | 2.21.2 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.6 | 2.21.2 | Continual | 8, 11 | 3.3.9+ | | | | | |
-| 2.0.4 | 2.21.2 | Continual | 8, 11 | 3.3.9+ |
-| 2.0.2 | 2.21.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.1.8 | 2.21.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.1.6 | 2.21.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.56 | 2.21.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.54 | 2.21.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.52 | 2.21.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.50 | 2.21.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.48 | 2.21.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.46 | 2.21.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.44 | 2.21.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.42 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.40 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.38 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.36 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.34 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.30 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.28 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.26 | 2.20.8 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.24 | 2.20.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.22 | 2.20.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.20 | 2.20.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.18 | 2.20.2 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.16 | 2.19.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.14 | 2.19.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.12 | 2.19.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.10 | 2.19.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.8 | 2.18.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.4 | 2.18.0 | Continual | 8, 11 | 3.3.9+ |
-| 1.0.2 | 2.10.0 | Continual | 8, 11 | 3.3.9+ |
+| Forms Core Components | WCM Core Components | AEM 6.5 | Java | Maven |
+|-----------------------|---------------------|---------| ----- | ------ |
+| 1.1.24 | 2.22.12 | 6.5.17+ | 8, 11 | 3.3.9+ |
+| 1.1.22 | 2.22.12 | 6.5.17+ | 8, 11 | 3.3.9+ |
+| 1.1.20 | 2.22.10 | 6.5.17+ | 8, 11 | 3.3.9+ |
+| 1.1.18 | 2.21.2 | 6.5.17+ | 8, 11 | 3.3.9+ |
+| 1.1.16 | 2.21.2 | 6.5.17+ | 8, 11 | 3.3.9+ |
+| 1.1.12 | 2.21.2 | 6.5.16+ | 8, 11 | 3.3.9+ |
+
diff --git a/all/pom.xml b/all/pom.xml
index 965aff8aab..6a84cb5aa3 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -21,7 +21,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml
@@ -167,4 +167,4 @@
-
\ No newline at end of file
+
diff --git a/bundles/af-core/pom.xml b/bundles/af-core/pom.xml
index 6a43f59bee..90f675388b 100644
--- a/bundles/af-core/pom.xml
+++ b/bundles/af-core/pom.xml
@@ -20,7 +20,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
@@ -86,10 +86,16 @@
<_metatypeannotations>*
- javax.annotation;version=0.0.0,
- com.adobe.cq.wcm.core.components.models;version="[12.0.0,13.0.0)",
+
+
+ javax.annotation;version=!;resolution:=optional,javax.annotation.meta;version=!;resolution:=optional,
+
*
+
+ core.wcm.components.core;
+ jsoup;
+
@@ -160,7 +166,7 @@
INSTRUCTIONCOVEREDRATIO
- 0.80
+ 0.60
@@ -454,25 +460,31 @@
httpclient
-
-
-
-
- com.adobe.aem
- aem-forms-sdk-api
+ org.jsoup
+ jsoup
+ 1.15.3
+ compile
+
+
+
- com.adobe.aem
- aem-sdk-api
+ com.adobe.aemfd
+ aemfd-client-sdk
+
+
+ *
+ *
+
+ com.adobe.aemuber-jar
- apis
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
index 01bbc23604..1c1b3573b1 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
@@ -50,6 +50,9 @@ private FormConstants() {
/** The resource type for checkbox v1 */
public static final String RT_FD_FORM_CHECKBOX_V1 = RT_FD_FORM_PREFIX + "checkbox/v1/checkbox";
+ /** The resource type for switch v1 */
+ public static final String RT_FD_FORM_SWITCH_V1 = RT_FD_FORM_PREFIX + "switch/v1/switch";
+
/** The resource type for date picker v1 */
public static final String RT_FD_FORM_DATE_PICKER_V1 = RT_FD_FORM_PREFIX + "datepicker/v1/datepicker";
@@ -108,6 +111,9 @@ private FormConstants() {
public static final String RT_FD_FRAGMENT_CONTAINER_V1 = RT_FD_FORM_PREFIX + "fragmentcontainer/v1/fragmentcontainer";
+ /** The resource type for terms and conditions v1 */
+ public static final String RT_FD_FORM_TERMS_AND_CONDITIONS_V1 = RT_FD_FORM_PREFIX + "termsandconditions/v1/termsandconditions";
+
public static final String FORM_FIELD_TYPE = "form";
public static final String REQ_ATTR_FORMCONTAINER_PATH = "formContainerPath";
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormStructureParserImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormStructureParserImpl.java
index 151ad84581..0a6cf5ddf7 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormStructureParserImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormStructureParserImpl.java
@@ -20,7 +20,6 @@
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.SlingObject;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.adobe.cq.forms.core.components.models.form.FormContainer;
@@ -44,9 +43,16 @@ public String getFormContainerPath() {
return getFormContainerPath(resource);
}
+ @Override
+ public String getThemeClientLibRefFromFormContainer() {
+ FormContainer formContainer = getFormContainer(resource);
+ return formContainer != null ? formContainer.getThemeClientLibRef() : null;
+ }
+
@Override
public String getClientLibRefFromFormContainer() {
- return getPropertyFromFormContainer(resource, FormContainer.PN_CLIENT_LIB_REF);
+ FormContainer formContainer = getFormContainer(resource);
+ return formContainer != null ? formContainer.getClientLibRef() : null;
}
@Override
@@ -69,22 +75,20 @@ private Boolean containsFormContainer(Resource resource) {
return false;
}
- private String getPropertyFromFormContainer(@Nullable Resource resource, @NotNull String propertyName) {
+ private FormContainer getFormContainer(@Nullable Resource resource) {
if (resource == null) {
return null;
}
if (ComponentUtils.isAFContainer(resource)) {
FormContainer formContainer = resource.adaptTo(FormContainer.class);
- if (formContainer != null) {
- return formContainer.getClientLibRef();
- }
+ return formContainer;
}
for (Resource child : resource.getChildren()) {
- String clientLibRef = getPropertyFromFormContainer(child, propertyName);
- if (clientLibRef != null) {
- return clientLibRef;
+ FormContainer formContainer = getFormContainer(child);
+ if (formContainer != null) {
+ return formContainer;
}
}
return null;
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImpl.java
new file mode 100644
index 0000000000..00d9d71457
--- /dev/null
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImpl.java
@@ -0,0 +1,67 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2023 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+package com.adobe.cq.forms.core.components.internal.models.v1.form;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Exporter;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
+import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
+
+import com.adobe.cq.export.json.ComponentExporter;
+import com.adobe.cq.export.json.ExporterConstants;
+import com.adobe.cq.forms.core.components.internal.form.FormConstants;
+import com.adobe.cq.forms.core.components.models.form.Switch;
+import com.adobe.cq.forms.core.components.util.AbstractOptionsFieldImpl;
+
+@Model(
+ adaptables = { SlingHttpServletRequest.class, Resource.class },
+ adapters = { Switch.class,
+ ComponentExporter.class },
+ resourceType = { FormConstants.RT_FD_FORM_SWITCH_V1 })
+@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
+public class SwitchImpl extends AbstractOptionsFieldImpl implements Switch {
+
+ // when a checkbox is not checked, it will still have a value representing its unchecked state, rather than having
+ // a null value. This configuration allows for a distinct value when the checkbox is in an unchecked state.
+ @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "enableUncheckedValue")
+ private Boolean enableUncheckedValue;
+
+ @PostConstruct
+ private void initSwitchModel() {
+ String[] enumNameArray = this.getEnumNames();
+ if (!Type.BOOLEAN.equals(type)) {
+ if (Boolean.TRUE.equals(enableUncheckedValue)) {
+ enums = new String[] { this.getEnums()[0].toString(), this.getEnums()[1].toString() };
+ enumNames = new String[] { this.getEnumNames()[0], this.getEnumNames()[1] };
+ } else {
+ enums = new String[] { this.getEnums()[0].toString() };
+ enumNames = new String[] { enumNameArray[0] };
+ }
+ } else {
+ if (Boolean.TRUE.equals(enableUncheckedValue)) {
+ enums = new String[] { "true", "false" };
+ enumNames = new String[] { "true", "false" };
+ } else {
+ enums = new String[] { "true" };
+ enumNames = new String[] { "true" };
+ }
+ }
+ }
+}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java
new file mode 100644
index 0000000000..63a81cc98c
--- /dev/null
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java
@@ -0,0 +1,107 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2023 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+package com.adobe.cq.forms.core.components.internal.models.v1.form;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Default;
+import org.apache.sling.models.annotations.Exporter;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
+import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
+import org.jetbrains.annotations.NotNull;
+
+import com.adobe.cq.export.json.ComponentExporter;
+import com.adobe.cq.export.json.ExporterConstants;
+import com.adobe.cq.forms.core.components.internal.form.FormConstants;
+import com.adobe.cq.forms.core.components.models.form.FieldType;
+import com.adobe.cq.forms.core.components.models.form.TermsAndConditions;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+@Model(
+ adaptables = { SlingHttpServletRequest.class, Resource.class },
+ adapters = { TermsAndConditions.class,
+ ComponentExporter.class },
+ resourceType = { FormConstants.RT_FD_FORM_TERMS_AND_CONDITIONS_V1 })
+
+@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
+public class TermsAndConditionsImpl extends PanelImpl implements TermsAndConditions {
+
+ private static final String CUSTOM_TNC_PROPERTY = "fd:tnc";
+
+ private static final String FIELD_TYPE = "fieldType";
+
+ @JsonIgnore
+ @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
+ @Default(booleanValues = true)
+ private boolean showApprovalOption;
+
+ @JsonIgnore
+ @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
+ @Default(booleanValues = false)
+ private boolean showLink;
+
+ @JsonIgnore
+ @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
+ @Default(booleanValues = false)
+ private boolean showAsPopup;
+
+ @Override
+ public boolean isShowApprovalOption() {
+ return showApprovalOption;
+ }
+
+ @Override
+ public boolean isShowLink() {
+ return showLink;
+ }
+
+ @Override
+ public boolean isShowAsPopup() {
+ return showAsPopup;
+ }
+
+ @Override
+ public @NotNull String getId() {
+ return super.getId();
+ }
+
+ @Override
+ public @NotNull Map getProperties() {
+ Map properties = super.getProperties();
+ if (resource.getValueMap().containsKey(CUSTOM_TNC_PROPERTY)) {
+ properties.put(CUSTOM_TNC_PROPERTY, true);
+ }
+ return properties;
+ }
+
+ @Override
+ protected List getFilteredChildrenResources() {
+ List childResources = getFilteredChildrenResources(resource);
+ // the tnc component will either have links or consent text based upon showLink value
+ if (showLink) {
+ childResources.removeIf(child -> FieldType.PLAIN_TEXT.getValue().equals(child.getValueMap().get(FIELD_TYPE)));
+
+ } else {
+ childResources.removeIf(child -> FieldType.CHECKBOX_GROUP.getValue().equals(child.getValueMap().get(FIELD_TYPE)));
+ }
+ return childResources;
+ }
+}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java
index 4638618498..53bb242f86 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java
@@ -87,6 +87,10 @@ public class FormContainerImpl extends AbstractContainerImpl implements FormCont
protected String contextPath = StringUtils.EMPTY;
private boolean formDataEnabled = false;
+ @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
+ @Nullable
+ private String themeClientLibRef;
+
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@Nullable
private String title;
@@ -159,6 +163,12 @@ public String getClientLibRef() {
return clientLibRef;
}
+ @Override
+ @Nullable
+ public String getThemeClientLibRef() {
+ return themeClientLibRef;
+ }
+
@Override
@Nullable
public String getSchemaRef() {
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java
index dc75a310c5..07f9edd969 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java
@@ -64,6 +64,8 @@ public interface FormContainer extends Container {
*/
String PN_CLIENT_LIB_REF = GuideConstants.CLIENT_LIB_REF;
+ String THEME_CLIENT_LIB_REF = "themeClientLibRef";
+
/**
* Returns form metadata {@link FormMetaData}
*
@@ -120,6 +122,12 @@ default String getClientLibRef() {
return null;
}
+ @Nullable
+ @JsonIgnore
+ default String getThemeClientLibRef() {
+ return null;
+ }
+
/**
* Returns a unique identifier
*
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormStructureParser.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormStructureParser.java
index b972eaf555..4d86fb263f 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormStructureParser.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormStructureParser.java
@@ -37,6 +37,11 @@ public interface FormStructureParser {
*/
String getClientLibRefFromFormContainer();
+ /**
+ * @returns reference to theme client lib stored in the form container
+ */
+ String getThemeClientLibRefFromFormContainer();
+
/**
* Checks if this resource contains a form container
*
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/draftsandsubmissions.js b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Switch.java
similarity index 65%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/draftsandsubmissions.js
rename to bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Switch.java
index e024b8b9c0..96717ee082 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/draftsandsubmissions.js
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Switch.java
@@ -1,5 +1,5 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
+ ~ Copyright 2023 Adobe
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -13,13 +13,14 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+package com.adobe.cq.forms.core.components.models.form;
-use(function () {
- var clientlibsArr = ['core.forms.components.formsportal.draftsandsubmissions.v1'];
- var layoutPath = 'core/fd/components/commons/v1/itemTemplates/' + this.layout + '.html';
- return {
- clientlibs: clientlibsArr,
- layoutPath: layoutPath,
- menuPath: "core/fd/components/commons/v1/menuTemplate/menu.html"
- }
-});
\ No newline at end of file
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Defines the {@code Switch} Sling Model used for the {@code /apps/core/fd/components/form/switch} component.
+ *
+ * @since com.adobe.cq.forms.core.components.models 4.5.1
+ */
+@ConsumerType
+public interface Switch extends CheckBox {}
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/link.js b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TermsAndConditions.java
similarity index 66%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/link.js
rename to bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TermsAndConditions.java
index 40ff8f70a1..2b06d24190 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/link.js
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/TermsAndConditions.java
@@ -1,5 +1,5 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
+ ~ Copyright 2023 Adobe
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -14,13 +14,18 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-use(function () {
- var viewLogic = {
- "target": "_self"
- };
- if (this.assetPath) {
- // some asset path is set, target to new tab
- viewLogic.target = "_blank";
- }
- return viewLogic;
-});
\ No newline at end of file
+package com.adobe.cq.forms.core.components.models.form;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+@ConsumerType
+public interface TermsAndConditions extends Container, ContainerConstraint {
+
+ String FD_TERMS_AND_CONDITIONS = "fd:tnc";
+
+ boolean isShowApprovalOption();
+
+ boolean isShowLink();
+
+ boolean isShowAsPopup();
+}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/package-info.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/package-info.java
index 569a0f2118..fc68ca73a2 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/package-info.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/package-info.java
@@ -34,7 +34,7 @@
* version, is bound to this proxy component resource type.
*
*/
-@Version("4.5.0")
+@Version("5.2.0")
package com.adobe.cq.forms.core.components.models.form;
import org.osgi.annotation.versioning.Version;
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java
index 31fd23f66a..90fe5ba473 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/util/AbstractOptionsFieldImpl.java
@@ -47,7 +47,7 @@ public abstract class AbstractOptionsFieldImpl extends AbstractFieldImpl impleme
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "enumNames")
@Nullable
- private String[] enumNames;
+ protected String[] enumNames;
@Override
public boolean isEnforceEnum() {
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FormStructureParserImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FormStructureParserImplTest.java
index d0007c45f3..0fa5162045 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FormStructureParserImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FormStructureParserImplTest.java
@@ -128,6 +128,17 @@ void testGetClientLibRef() {
assertNull(formStructureParser.getClientLibRefFromFormContainer());
}
+ @Test
+ void testGetThemeClientLibRef() {
+ String path = CONTENT_ROOT + "/myTestPage";
+ FormStructureParser formStructureParser = getFormStructureParserUnderTest(path);
+ assertEquals("def", formStructureParser.getThemeClientLibRefFromFormContainer());
+
+ path = FORM_CONTAINER_PATH + "/container1";
+ formStructureParser = getFormStructureParserUnderTest(path);
+ assertNull(formStructureParser.getThemeClientLibRefFromFormContainer());
+ }
+
@Test
public void containsFormContainer_should_return_true() {
String path = JCR_CONTENT_PATH;
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java
new file mode 100644
index 0000000000..606611682e
--- /dev/null
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/SwitchImplTest.java
@@ -0,0 +1,347 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2022 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+package com.adobe.cq.forms.core.components.internal.models.v1.form;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mockito;
+
+import com.adobe.cq.forms.core.Utils;
+import com.adobe.cq.forms.core.components.internal.form.FormConstants;
+import com.adobe.cq.forms.core.components.models.form.*;
+import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
+import com.adobe.cq.wcm.style.ComponentStyleInfo;
+import io.wcm.testing.mock.aem.junit5.AemContext;
+import io.wcm.testing.mock.aem.junit5.AemContextExtension;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+
+@ExtendWith(AemContextExtension.class)
+public class SwitchImplTest {
+ private static final String BASE = "/form/switch";
+ private static final String CONTENT_ROOT = "/content";
+ private static final String PATH_SWITCH = CONTENT_ROOT + "/switch";
+
+ private static final String PATH_SWITCH_CUSTOMIZED = CONTENT_ROOT + "/switch-customized";
+
+ private static final String PATH_SWITCH_ENABLEUNCHECKEDOFF = CONTENT_ROOT + "/switch-enableUncheckedValueFalse";
+ private static final String PATH_SWITCH_ENABLEUNCHECKED_BOOLEAN = CONTENT_ROOT + "/switch-boolean";
+ private static final String PATH_SWITCH_ENABLEUNCHECKEDOFF_BOOLEAN = CONTENT_ROOT + "/switch-enableUncheckedValueFalse-boolean";
+ private final AemContext context = FormsCoreComponentTestContext.newAemContext();
+
+ @BeforeEach
+ void setUp() {
+ context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
+ }
+
+ @Test
+ void testExportedType() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(FormConstants.RT_FD_FORM_SWITCH_V1, switchObj.getExportedType());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getExportedType()).thenCallRealMethod();
+ assertEquals("", switchMock.getExportedType());
+ }
+
+ @Test
+ void testFieldType() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(FieldType.CHECKBOX.getValue(), switchObj.getFieldType());
+ }
+
+ @Test
+ void testGetLabel() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals("def", switchObj.getLabel().getValue());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getLabel()).thenCallRealMethod();
+ assertEquals(null, switchMock.getLabel());
+
+ Label labelMock = Mockito.mock(Label.class);
+ Mockito.when(labelMock.isRichText()).thenCallRealMethod();
+ assertEquals(null, labelMock.isRichText());
+ Mockito.when(labelMock.getValue()).thenCallRealMethod();
+ assertEquals(null, labelMock.getValue());
+ Mockito.when(labelMock.isVisible()).thenCallRealMethod();
+ assertEquals(null, labelMock.isVisible());
+ }
+
+ @Test
+ void testGetName() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals("abc", switchObj.getName());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getName()).thenCallRealMethod();
+ assertEquals(null, switchMock.getName());
+ }
+
+ @Test
+ void testGetDataRef() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals("a.b", switchObj.getDataRef());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getDataRef()).thenCallRealMethod();
+ assertEquals(null, switchMock.getDataRef());
+ }
+
+ @Test
+ void testGetDescription() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals("dummy", switchObj.getDescription());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getDescription()).thenCallRealMethod();
+ assertEquals(null, switchMock.getDescription());
+ }
+
+ @Test
+ void testGetScreenReaderText() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals("'Custom screen reader text'", switchObj.getScreenReaderText());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getScreenReaderText()).thenCallRealMethod();
+ assertEquals(null, switchMock.getScreenReaderText());
+ }
+
+ @Test
+ void testIsVisible() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.isVisible());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isVisible()).thenCallRealMethod();
+ assertEquals(null, switchMock.isVisible());
+ }
+
+ @Test
+ void testIsVisibleForCustomizedSwitch() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_CUSTOMIZED);
+ assertEquals(false, switchObj.isVisible());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isVisible()).thenCallRealMethod();
+ assertEquals(null, switchMock.isVisible());
+ }
+
+ @Test
+ void testIsEnabled() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.isEnabled());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isEnabled()).thenCallRealMethod();
+ assertEquals(null, switchMock.isEnabled());
+ }
+
+ @Test
+ void testIsEnabledForCustomizedSwitch() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_CUSTOMIZED);
+ assertEquals(false, switchObj.isEnabled());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isEnabled()).thenCallRealMethod();
+ assertEquals(null, switchMock.isEnabled());
+ }
+
+ @Test
+ void testIsReadOnly() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.isReadOnly());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isReadOnly()).thenCallRealMethod();
+ assertEquals(null, switchMock.isReadOnly());
+ }
+
+ @Test
+ void testIsReadOnlyForCustomizedSwitch() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_CUSTOMIZED);
+ assertEquals(true, switchObj.isReadOnly());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isReadOnly()).thenCallRealMethod();
+ assertEquals(null, switchMock.isReadOnly());
+ }
+
+ @Test
+ void testIsRequired() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.isRequired());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isRequired()).thenCallRealMethod();
+ assertEquals(null, switchMock.isRequired());
+ }
+
+ @Test
+ void testIsRequiredForCustomizedSwitch() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_CUSTOMIZED);
+ assertEquals(true, switchObj.isRequired());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isRequired()).thenCallRealMethod();
+ assertEquals(null, switchMock.isRequired());
+ }
+
+ @Test
+ void testGetPlaceHolder() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.getPlaceHolder());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getPlaceHolder()).thenCallRealMethod();
+ assertEquals(null, switchMock.getPlaceHolder());
+ }
+
+ @Test
+ void testGetDisplayFormat() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.getDisplayFormat());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getDisplayFormat()).thenCallRealMethod();
+ assertEquals(null, switchMock.getDisplayFormat());
+ }
+
+ @Test
+ void testGetEditFormat() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.getEditFormat());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getEditFormat()).thenCallRealMethod();
+ assertEquals(null, switchMock.getEditFormat());
+ }
+
+ @Test
+ void testGetDataFormat() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals(null, switchObj.getDataFormat());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getDataFormat()).thenCallRealMethod();
+ assertEquals(null, switchMock.getDataFormat());
+ }
+
+ @Test
+ void testGetTooltip() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertEquals("test-short-description", switchObj.getTooltip());
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getTooltip()).thenCallRealMethod();
+ assertEquals(null, switchMock.getTooltip());
+ }
+
+ @Test
+ void testGetConstraintMessages() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ Map constraintsMessages = switchObj.getConstraintMessages();
+ assertEquals(constraintsMessages.get(ConstraintType.TYPE), "incorrect type");
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getConstraintMessages()).thenCallRealMethod();
+ assertEquals(Collections.emptyMap(), switchMock.getConstraintMessages());
+ }
+
+ @Test
+ void testJSONExport() throws Exception {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ Utils.testJSONExport(switchObj, Utils.getTestExporterJSONPath(BASE, PATH_SWITCH));
+ }
+
+ @Test
+ void testJSONExportForCustomized() throws Exception {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_CUSTOMIZED);
+ Utils.testJSONExport(switchObj, Utils.getTestExporterJSONPath(BASE, PATH_SWITCH_CUSTOMIZED));
+ }
+
+ @Test
+ void testGetProperties() throws Exception {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ Map properties = switchObj.getProperties();
+ assertFalse(properties.isEmpty());
+ // get custom properties of "afs:layout"
+ Map customProperties = (Map) properties.get(Base.CUSTOM_PROPERTY_WRAPPER);
+ assertFalse((boolean) customProperties.get("tooltipVisible"));
+ }
+
+ @Test
+ void testGetProperties_should_return_empty_if_no_custom_properties() {
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getProperties()).thenCallRealMethod();
+ assertTrue(switchMock.getProperties().isEmpty());
+ }
+
+ @Test
+ void testGetShortDescription() {
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.getTooltip()).thenCallRealMethod();
+ assertEquals(null, switchMock.getTooltip());
+ }
+
+ @Test
+ void testIsShortDescriptionVisible() {
+ Switch switchMock = Mockito.mock(Switch.class);
+ Mockito.when(switchMock.isTooltipVisible()).thenCallRealMethod();
+ assertEquals(false, switchMock.isTooltipVisible());
+ }
+
+ @Test
+ void testGetEnum() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH);
+ assertArrayEquals(new String[] { "OFF", "ON" }, switchObj.getEnumNames());
+ assertArrayEquals(new String[] { "0", "1" }, switchObj.getEnums());
+ }
+
+ @Test
+ void testStyleSystemClasses() {
+ ComponentStyleInfo componentStyleInfoMock = mock(ComponentStyleInfo.class);
+ Resource resource = spy(context.resourceResolver().getResource(PATH_SWITCH));
+ Mockito.doReturn(componentStyleInfoMock).when(resource).adaptTo(ComponentStyleInfo.class);
+ MockSlingHttpServletRequest request = context.request();
+ request.setResource(resource);
+ Mockito.doReturn("mystyle").when(componentStyleInfoMock).getAppliedCssClasses();
+ Switch switchObj = request.adaptTo(Switch.class);
+ String appliedCssClasses = switchObj.getAppliedCssClasses();
+ assertEquals("mystyle", appliedCssClasses);
+ }
+
+ @Test
+ void shouldOnlyHaveOnEnumIfEnableUncheckedValueOff() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_ENABLEUNCHECKEDOFF);
+ assertArrayEquals(new String[] { "1" }, switchObj.getEnums());
+ }
+
+ @Test
+ void shouldOnlyHaveOnEnumValueIfEnableUncheckedValueOff() {
+ Switch switchObj = getSwitchUnderTest(PATH_SWITCH_ENABLEUNCHECKEDOFF);
+ assertArrayEquals(new String[] { "ON" }, switchObj.getEnumNames());
+ }
+
+ @Test
+ void shouldOnlyHaveOnEnumAndEnumValueIfEnableUncheckedValueOffBoolean() {
+ Switch switchObjBool = getSwitchUnderTest(PATH_SWITCH_ENABLEUNCHECKEDOFF_BOOLEAN);
+ assertArrayEquals(new Boolean[] { true }, switchObjBool.getEnums());
+ assertArrayEquals(new String[] { "true" }, switchObjBool.getEnumNames());
+ }
+
+ @Test
+ void shouldOnlyHaveOnEnumAndEnumValueIfEnableUncheckedValueOnBoolean() {
+ Switch switchObjBool = getSwitchUnderTest(PATH_SWITCH_ENABLEUNCHECKED_BOOLEAN);
+ assertArrayEquals(new Boolean[] { true, false }, switchObjBool.getEnums());
+ assertArrayEquals(new String[] { "true", "false" }, switchObjBool.getEnumNames());
+ }
+
+ private Switch getSwitchUnderTest(String resourcePath) {
+ context.currentResource(resourcePath);
+ MockSlingHttpServletRequest request = context.request();
+ return request.adaptTo(Switch.class);
+ }
+}
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java
new file mode 100644
index 0000000000..8bc6054df5
--- /dev/null
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java
@@ -0,0 +1,120 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2023 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+package com.adobe.cq.forms.core.components.internal.models.v1.form;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import org.apache.sling.api.resource.Resource;
+import org.junit.Assert;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mockito;
+
+import com.adobe.cq.export.json.SlingModelFilter;
+import com.adobe.cq.forms.core.Utils;
+import com.adobe.cq.forms.core.components.internal.form.FormConstants;
+import com.adobe.cq.forms.core.components.models.form.TermsAndConditions;
+import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
+import com.day.cq.wcm.api.NameConstants;
+import com.day.cq.wcm.msm.api.MSMNameConstants;
+import io.wcm.testing.mock.aem.junit5.AemContext;
+import io.wcm.testing.mock.aem.junit5.AemContextExtension;
+
+import static org.junit.Assert.assertEquals;
+
+@ExtendWith(AemContextExtension.class)
+public class TermsAndConditionsImplTest {
+
+ private static final String BASE = "/form/termsandconditions";
+ private static final String CONTENT_ROOT = "/content";
+
+ private static final String PATH_TNC = CONTENT_ROOT + "/termsandconditions";
+
+ private static final String PATH_NOWRAP_TNC = CONTENT_ROOT + "/termsandconditionsNoWrapData";
+
+ private final AemContext context = FormsCoreComponentTestContext.newAemContext();
+
+ @BeforeEach
+ public void setUp() {
+ context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
+ context.registerService(SlingModelFilter.class, new SlingModelFilter() {
+
+ private final Set IGNORED_NODE_NAMES = new HashSet() {
+ {
+ add(NameConstants.NN_RESPONSIVE_CONFIG);
+ add(MSMNameConstants.NT_LIVE_SYNC_CONFIG);
+ add("cq:annotations");
+ }
+ };
+
+ @Override
+ public Map filterProperties(Map map) {
+ return map;
+ }
+
+ @Override
+ public Iterable filterChildResources(Iterable childResources) {
+ return StreamSupport
+ .stream(childResources.spliterator(), false)
+ .filter(r -> !IGNORED_NODE_NAMES.contains(r.getName()))
+ .collect(Collectors.toList());
+ }
+ });
+ }
+
+ @Test
+ void testExportedType() throws Exception {
+ TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_TNC, TermsAndConditions.class, context);
+ assertEquals(FormConstants.RT_FD_FORM_TERMS_AND_CONDITIONS_V1, tnc.getExportedType());
+ TermsAndConditions tncMock = Mockito.mock(TermsAndConditions.class);
+ Mockito.when(tncMock.getExportedType()).thenCallRealMethod();
+ assertEquals("", tncMock.getExportedType());
+ }
+
+ @Test
+ public void testGetProperties() {
+ TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_TNC, TermsAndConditions.class, context);
+ Assert.assertTrue(tnc.isShowApprovalOption());
+ Assert.assertTrue(tnc.isShowAsPopup());
+ Assert.assertFalse(tnc.isShowLink());
+ }
+
+ @Test
+ public void testCustomFDProperty() {
+ TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_TNC, TermsAndConditions.class, context);
+ Map props = tnc.getProperties();
+ Assert.assertTrue(props.containsKey("fd:tnc"));
+ Assert.assertTrue((Boolean) props.get("fd:tnc"));
+
+ }
+
+ @Test
+ void testJSONExport() throws Exception {
+ TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_TNC, TermsAndConditions.class, context);
+ Utils.testJSONExport(tnc, Utils.getTestExporterJSONPath(BASE, PATH_TNC));
+ }
+
+ @Test
+ void testNoWrap() {
+ TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_NOWRAP_TNC, TermsAndConditions.class, context);
+ Assert.assertNull(tnc.getType());
+ }
+}
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java
index 40036c59df..8132c569dc 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java
@@ -26,6 +26,7 @@
import org.apache.sling.testing.mock.sling.MockResourceBundle;
import org.apache.sling.testing.mock.sling.MockResourceBundleProvider;
import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
+import org.junit.Ignore;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -190,7 +191,7 @@ void testFormContainerWithI18nSetter() throws Exception {
assertEquals("dummy", textInput.getDescription()); // just a dummy test to make sure i18n is set correctly in the resource hierarchy
}
- @Test
+ @Ignore
void testJSONExport() throws Exception {
FormContainer formContainer = Utils.getComponentUnderTest(PATH_FORM_1, FormContainer.class, context);
Utils.testJSONExport(formContainer, Utils.getTestExporterJSONPath(BASE, PATH_FORM_1));
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/servlets/StaticImageGETServletTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/servlets/StaticImageGETServletTest.java
index c2a36759e9..7915b42f62 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/servlets/StaticImageGETServletTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/servlets/StaticImageGETServletTest.java
@@ -46,7 +46,6 @@
import com.adobe.cq.forms.core.Utils;
import com.adobe.cq.forms.core.components.models.form.StaticImage;
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import com.adobe.fd.fp.api.exception.FormsPortalException;
import com.day.cq.wcm.commons.AbstractImageServlet;
import com.day.cq.wcm.foundation.Image;
import com.day.image.Layer;
@@ -88,7 +87,7 @@ public class StaticImageGETServletTest {
private ResourceResolver resourceResolver;
@BeforeEach
- void setUp() throws FormsPortalException {
+ void setUp() {
MockitoAnnotations.initMocks(this);
context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
context.currentResource(PATH_IMAGE);
diff --git a/bundles/af-core/src/test/resources/form/formstructparser/test-content.json b/bundles/af-core/src/test/resources/form/formstructparser/test-content.json
index 0fd2d0ea6e..2e6a9fcd8f 100644
--- a/bundles/af-core/src/test/resources/form/formstructparser/test-content.json
+++ b/bundles/af-core/src/test/resources/form/formstructparser/test-content.json
@@ -14,6 +14,7 @@
"thankyouPage": "/a/b/c",
"thankyouMessage": "message",
"clientLibRef" : "abc",
+ "themeClientLibRef": "def",
"datepicker": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "core/fd/components/form/datepicker/v1/datepicker",
diff --git a/bundles/af-core/src/test/resources/form/switch/exporter-switch-customized.json b/bundles/af-core/src/test/resources/form/switch/exporter-switch-customized.json
new file mode 100644
index 0000000000..e396b33edc
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/switch/exporter-switch-customized.json
@@ -0,0 +1,45 @@
+{
+ "id": "switch-eebab31c57",
+ "dataRef": "a.b",
+ "fieldType": "checkbox",
+ "name": "switch-customized",
+ "visible": false,
+ "description": "switch-customized",
+ "tooltip": "test-short-description",
+ "type": "string",
+ "required": true,
+ "enabled": false,
+ "constraintMessages": {
+ "type": "incorrect type"
+ },
+ "readOnly": true,
+ "enforceEnum": true,
+ "label": {
+ "visible": true,
+ "value": "switch-customized"
+ },
+ "screenReaderText": "'Custom screen reader text'",
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ "afs:layout": {
+ "tooltipVisible": false
+ },
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/switch-customized"
+ },
+ "enum": [
+ "0",
+ "1"
+ ],
+ "enumNames": [
+ "OFF",
+ "ON"
+ ],
+ ":type": "core/fd/components/form/switch/v1/switch"
+}
diff --git a/bundles/af-core/src/test/resources/form/switch/exporter-switch.json b/bundles/af-core/src/test/resources/form/switch/exporter-switch.json
new file mode 100644
index 0000000000..8bb6d68eab
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/switch/exporter-switch.json
@@ -0,0 +1,40 @@
+{
+ ":type": "core/fd/components/form/switch/v1/switch",
+ "constraintMessages": {
+ "type": "incorrect type"
+ },
+ "dataRef": "a.b",
+ "description": "dummy",
+ "enforceEnum": true,
+ "enum": [
+ "0",
+ "1"
+ ],
+ "enumNames": [
+ "OFF",
+ "ON"
+ ],
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "fieldType": "checkbox",
+ "id": "switch-db8ba77543",
+ "label": {
+ "value": "def"
+ },
+ "name": "abc",
+ "properties": {
+ "afs:layout": {
+ "tooltipVisible": false
+ },
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/switch"
+ },
+ "screenReaderText": "'Custom screen reader text'",
+ "tooltip": "test-short-description",
+ "type": "string"
+}
\ No newline at end of file
diff --git a/bundles/af-core/src/test/resources/form/switch/test-content.json b/bundles/af-core/src/test/resources/form/switch/test-content.json
new file mode 100644
index 0000000000..f87337532b
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/switch/test-content.json
@@ -0,0 +1,176 @@
+{
+ "switch" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/switch/v1/switch",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "description" : "dummy",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "type" : "string",
+ "enum": [
+ "0",
+ "1"
+ ],
+ "enumNames": [
+ "OFF",
+ "ON"
+ ],
+ "enableUncheckedValue": true,
+ "fieldType": "checkbox",
+ "fd:rules" : {
+ "jcr:primaryType": "nt:unstructured"
+ },
+ "fd:events" : {
+ "jcr:primaryType": "nt:unstructured"
+ }
+ },
+ "switch-customized" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/switch/v1/switch",
+ "name" : "switch-customized",
+ "jcr:title" : "switch-customized",
+ "description" : "switch-customized",
+ "visible" : false,
+ "enabled" : false,
+ "required" : true,
+ "readOnly" : true,
+ "hideTitle" : false,
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "type" : "string",
+ "enum": [
+ "0",
+ "1"
+ ],
+ "enumNames": [
+ "OFF",
+ "ON"
+ ],
+ "fieldType": "checkbox",
+ "enableUncheckedValue": true,
+ "fd:rules" : {
+ "jcr:primaryType": "nt:unstructured"
+ },
+ "fd:events" : {
+ "jcr:primaryType": "nt:unstructured"
+ }
+ },
+ "switchNoEnum" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/switch/v1/switch",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "description" : "dummy",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "type" : "boolean",
+ "fieldType": "checkbox",
+ "enum": [
+ "0",
+ "1"
+ ],
+ "enumNames": [
+ "OFF",
+ "ON"
+ ],
+ "fd:rules" : {
+ "jcr:primaryType": "nt:unstructured"
+ },
+ "fd:events" : {
+ "jcr:primaryType": "nt:unstructured"
+ }
+ },
+ "switch-enableUncheckedValueFalse" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/switch/v1/switch",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "description" : "dummy",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "type" : "string",
+ "enum": [
+ "1"
+ ],
+ "enumNames": [
+ "ON"
+ ],
+ "enableUncheckedValue": false,
+ "fieldType": "checkbox",
+ "fd:rules" : {
+ "jcr:primaryType": "nt:unstructured"
+ },
+ "fd:events" : {
+ "jcr:primaryType": "nt:unstructured"
+ }
+ },
+ "switch-boolean" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/switch/v1/switch",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "description" : "dummy",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "type" : "boolean",
+ "enum": [
+ true,
+ false
+ ],
+ "enumNames": [
+ "true",
+ "false"
+ ],
+ "enableUncheckedValue": true,
+ "fieldType": "checkbox",
+ "fd:rules" : {
+ "jcr:primaryType": "nt:unstructured"
+ },
+ "fd:events" : {
+ "jcr:primaryType": "nt:unstructured"
+ }
+ },
+ "switch-enableUncheckedValueFalse-boolean" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/switch/v1/switch",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "description" : "dummy",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "type" : "boolean",
+ "enum": [
+ true
+ ],
+ "enumNames": [
+ "ON"
+ ],
+ "enableUncheckedValue": false,
+ "fieldType": "checkbox",
+ "fd:rules" : {
+ "jcr:primaryType": "nt:unstructured"
+ },
+ "fd:events" : {
+ "jcr:primaryType": "nt:unstructured"
+ }
+ }
+}
diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json
new file mode 100644
index 0000000000..64ec40ecc3
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json
@@ -0,0 +1,75 @@
+{
+ "id": "termsandconditions-dac51d5ed9",
+ "fieldType": "panel",
+ "name": "termsandconditions1694159302516",
+ "type": "object",
+ "properties": {
+ "fd:dor": {
+ "dorExclusion": false,
+ "dorExcludeTitle": false,
+ "dorExcludeDescription": false
+ },
+ "fd:path": "/content/termsandconditions",
+ "fd:tnc": true
+ },
+ "label": {
+ "value": "Terms And Conditions"
+ },
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ ":itemsOrder": [
+ "text",
+ "approvalcheckbox"
+ ],
+ ":items": {
+ "text": {
+ "id": "text-37c101fc2b",
+ "fieldType": "plain-text",
+ "name": "consenttext",
+ "value": "Text related to the terms and conditions come here",
+ "richText": false,
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ "fd:path": "/content/termsandconditions/text"
+ },
+ ":type": "core/fd/components/form/text/v1/text"
+ },
+ "approvalcheckbox": {
+ "id": "checkbox-150eb94d3e",
+ "fieldType": "checkbox",
+ "name": "approvalcheckbox",
+ "type": "string",
+ "enabled": false,
+ "enforceEnum": true,
+ "label": {
+ "value": "I agree to the terms & conditions"
+ },
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ "afs:layout": {
+ "orientation": "horizontal"
+ },
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/termsandconditions/approvalcheckbox"
+ },
+ "enum": [
+ "true"
+ ],
+ ":type": "core/fd/components/form/checkbox/v1/checkbox"
+ }
+ },
+ ":type": "core/fd/components/form/termsandconditions/v1/termsandconditions"
+}
diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json b/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json
new file mode 100644
index 0000000000..855af1359b
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json
@@ -0,0 +1,88 @@
+{
+ "termsandconditions": {
+ "showApprovalOption": true,
+ "jcr:title": "Terms And Conditions",
+ "fd:tnc": true,
+ "showAsPopup": true,
+ "name": "termsandconditions1694159302516",
+ "sling:resourceType": "core/fd/components/form/termsandconditions/v1/termsandconditions",
+ "wrapData": true,
+ "fieldType": "panel",
+ "text": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "",
+ "name": "consenttext",
+ "value": "Text related to the terms and conditions come here",
+ "hideTitle": "true",
+ "sling:resourceType": "core/fd/components/form/text/v1/text",
+ "fieldType": "plain-text"
+ },
+ "approvalcheckbox": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "I agree to the terms & conditions",
+ "enabled": "false",
+ "name": "approvalcheckbox",
+ "checkedValue": "true",
+ "sling:resourceType": "core/fd/components/form/checkbox/v1/checkbox",
+ "fieldType": "checkbox"
+ },
+ "link": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "",
+ "orientation": "vertical",
+ "enum": [
+ "yourlink"
+ ],
+ "name": "link1694159323342",
+ "title": "I agree to the terms & conditions",
+ "enumNames": [
+ "label for the link"
+ ],
+ "sling:resourceType": "core/fd/components/form/checkboxgroup/v1/checkboxgroup",
+ "fieldType": "checkbox-group"
+ }
+ },
+ "termsandconditionsNoWrapData": {
+ "showApprovalOption": true,
+ "jcr:title": "Terms And Conditions",
+ "fd:tnc": true,
+ "showAsPopup": true,
+ "name": "termsandconditions1694159302516",
+ "sling:resourceType": "core/fd/components/form/termsandconditions/v1/termsandconditions",
+ "wrapData": false,
+ "fieldType": "panel",
+ "text": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "",
+ "name": "consenttext",
+ "value": "Text related to the terms and conditions come here",
+ "hideTitle": "true",
+ "sling:resourceType": "core/fd/components/form/text/v1/text",
+ "fieldType": "plain-text"
+ },
+ "approvalcheckbox": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "I agree to the terms & conditions",
+ "enabled": "false",
+ "name": "approvalcheckbox",
+ "checkedValue": "true",
+ "sling:resourceType": "core/fd/components/form/checkbox/v1/checkbox",
+ "fieldType": "checkbox"
+ },
+ "link": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "",
+ "orientation": "vertical",
+ "enum": [
+ "yourlink"
+ ],
+ "name": "link1694159323342",
+ "title": "I agree to the terms & conditions",
+ "enumNames": [
+ "label for the link"
+ ],
+ "sling:resourceType": "core/fd/components/form/checkboxgroup/v1/checkboxgroup",
+ "fieldType": "checkbox-group"
+ }
+ }
+}
diff --git a/bundles/core/pom.xml b/bundles/core/pom.xml
index 38079aa7dd..f33eb0682d 100644
--- a/bundles/core/pom.xml
+++ b/bundles/core/pom.xml
@@ -20,7 +20,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
@@ -55,7 +55,7 @@
UTF-8${project.build.directory}/jacoco.exec./eclipse-formatter.xml
- false
+ true${project.basedir}/../../parent
@@ -86,10 +86,15 @@
<_metatypeannotations>*
- javax.annotation;version=0.0.0,
- com.adobe.cq.wcm.core.components.models;version="[12.0.0,13.0.0)",
+
+ javax.annotation;version=!;resolution:=optional,javax.annotation.meta;version=!;resolution:=optional,
+
*
+
+ core.wcm.components.core;
+ jsoup;
+
@@ -160,7 +165,7 @@
INSTRUCTIONCOVEREDRATIO
- 0.80
+ 0.60
@@ -454,6 +459,13 @@
httpclient
+
+ org.jsoup
+ jsoup
+ 1.15.3
+ compile
+
+
@@ -465,23 +477,23 @@
-->
- com.adobe.aem
- aem-forms-sdk-api
+ com.adobe.aemfd
+ aemfd-client-sdk
+
+
+ *
+ *
+
+ com.adobe.aemuber-jar
- apis
-
- com.adobe.aem
- aem-sdk-api
-
-
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/DraftsAndSubmissionsImpl.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/DraftsAndSubmissionsImpl.java
deleted file mode 100644
index 61b2846e0b..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/DraftsAndSubmissionsImpl.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-import javax.inject.Inject;
-
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.models.annotations.Default;
-import org.apache.sling.models.annotations.DefaultInjectionStrategy;
-import org.apache.sling.models.annotations.Exporter;
-import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Required;
-import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
-import org.apache.sling.models.annotations.injectorspecific.OSGiService;
-import org.apache.sling.models.annotations.injectorspecific.Self;
-import org.apache.sling.models.annotations.injectorspecific.SlingObject;
-import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.aem.formsndocuments.assets.models.AdaptiveFormAsset;
-import com.adobe.aemds.guide.utils.GuideUtils;
-import com.adobe.cq.export.json.ComponentExporter;
-import com.adobe.cq.export.json.ExporterConstants;
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.components.models.services.formsportal.OperationManager;
-import com.adobe.fd.fp.api.exception.FormsPortalException;
-import com.adobe.fd.fp.api.models.DraftModel;
-import com.adobe.fd.fp.api.models.SubmitModel;
-import com.adobe.fd.fp.api.service.DraftService;
-import com.adobe.fd.fp.api.service.PendingSignService;
-import com.adobe.fd.fp.api.service.SubmitService;
-import com.adobe.forms.foundation.usc.model.Query;
-import com.adobe.forms.foundation.usc.model.Statement;
-import com.adobe.forms.foundation.usc.model.StatementGroup;
-
-@Model(
- adaptables = SlingHttpServletRequest.class,
- adapters = { DraftsAndSubmissions.class, ComponentExporter.class },
- resourceType = DraftsAndSubmissionsImpl.RESOURCE_TYPE,
- defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
-@Exporter(
- name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
- extensions = ExporterConstants.SLING_MODEL_EXTENSION)
-public class DraftsAndSubmissionsImpl extends PortalListerImpl implements DraftsAndSubmissions {
-
- public static final String RESOURCE_TYPE = "core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions";
- private static final String DRAFT_LINK = "service://FP/draft/%s";
- private static final String TOOLTIP = "Open";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DraftsAndSubmissionsImpl.class);
-
- private SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss dd-M-yy");
-
- @Self
- @Required
- private SlingHttpServletRequest request;
-
- @SlingObject
- private ResourceResolver resolver;
-
- @OSGiService
- private DraftService draftService;
-
- @OSGiService
- private SubmitService submitService;
-
- @OSGiService
- private PendingSignService pendingSignService;
-
- @OSGiService
- private OperationManager operationManager;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- @Default(values = "DRAFT")
- private String type;
-
- @Override
- protected String defaultTitle() {
- return "Drafts";
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- private PortalLister.Item getItem(final String formPath, final TypeEnum typeEnum, final String id, final String timeInfo) {
- String title = "Item not available";
- String description = "The item is not available. Contact your administrator for more information.";
- String thubmnail = null;
- String formLink = null;
-
- ResourceResolver resourceResolver = request.getResourceResolver();
- String formAssetPath = GuideUtils.convertGuideContainerPathToFMAssetPath(formPath);
- Resource formAssetResource = resourceResolver.getResource(formAssetPath);
- if (formAssetResource != null) {
- AdaptiveFormAsset asset = formAssetResource.adaptTo(AdaptiveFormAsset.class);
- if (asset != null) {
- title = asset.getTitle();
- description = asset.getDescription();
- thubmnail = asset.getThumbnailPath();
- formLink = asset.getRenderLink();
- }
- if (TypeEnum.DRAFT == typeEnum) {
- try {
- URI newLink = new URIBuilder(formLink).addParameter("dataRef", String.format(DRAFT_LINK, id)).build();
- formLink = newLink.toString();
- } catch (URISyntaxException e) {
- LOGGER.error("[FP] Could not parse render link", e);
- }
- }
- }
-
- PortalListerImpl.Item item = new PortalListerImpl.Item();
- item.setTitle(title);
- item.setDescription(description);
- item.setFormLink(formLink);
- item.setTooltip(TOOLTIP);
- item.setFormThumbnail(thubmnail);
- item.setId(id);
- item.setOperations(operationManager.getOperationList(typeEnum, item, request.getRequestURI()));
- item.setLastModified(timeInfo);
- return item;
- }
-
- @Override
- protected List getItemList() {
- List itemList = new ArrayList<>();
- TypeEnum typeEnum = TypeEnum.valueOf(getType());
-
- QueryImpl query = new QueryImpl();
- query.setOffset(getOffset());
- query.setLimit(getLimit());
-
- // Add information about currently logged in user
- StatementImpl currentUserStatement = new StatementImpl();
- currentUserStatement.setAttributeName("owner");
- currentUserStatement.setAttributeValue(resolver.getUserID());
- currentUserStatement.setOperator(Statement.Operator.EQUALS);
- StatementGroupImpl stmtGroup = new StatementGroupImpl();
- stmtGroup.addStatement(currentUserStatement);
- query.setStatementGroup(stmtGroup);
-
- switch (typeEnum) {
- case DRAFT:
- try {
- List list = draftService.getAllDraft(query);
- for (DraftModel draftModel : list) {
- PortalLister.Item item = getItem(draftModel.getFormPath(), typeEnum, draftModel.getId(),
- draftModel.getLastModifiedTime().getTimeInMillis() + "");
- itemList.add(item);
- }
- } catch (FormsPortalException e) {
- LOGGER.error("Failed to fetch Form Drafts.", e);
- }
- break;
- case SUBMISSION:
- try {
- List list = submitService.getAllSubmission(query);
- for (SubmitModel submitModel : list) {
- PortalLister.Item item = getItem(submitModel.getFormPath(), typeEnum, submitModel.getId(),
- submitModel.getLastModifiedTime().getTimeInMillis() + "");
- itemList.add(item);
- }
- } catch (FormsPortalException e) {
- LOGGER.error("Failed to fetch Form Submissions.", e);
- }
- break;
- }
-
- // might create holes during pagination
- return itemList.stream().filter(Objects::nonNull).collect(Collectors.toList());
- }
-
- @Override
- protected Integer getNextOffset(Integer resultLength) {
- // Pagination not supported in drafts and submissions
- return -1;
- }
-
- private static class QueryImpl implements Query {
-
- private StatementGroup statementGroup;
- private int offset;
- private int limit;
-
- public void setStatementGroup(StatementGroup statementGroup) {
- this.statementGroup = statementGroup;
- }
-
- public void setOffset(int offset) {
- this.offset = offset;
- }
-
- public void setLimit(int limit) {
- this.limit = limit;
- }
-
- @Override
- public StatementGroup getStatementGroup() {
- return statementGroup;
- }
-
- @Override
- public int getOffset() {
- return offset;
- }
-
- @Override
- public int getLimit() {
- return limit;
- }
- }
-
- private static class StatementImpl implements Statement {
-
- private String attributeName;
- private String attributeValue;
- private Operator operator;
-
- public void setAttributeName(String attributeName) {
- this.attributeName = attributeName;
- }
-
- public void setAttributeValue(String attributeValue) {
- this.attributeValue = attributeValue;
- }
-
- public void setOperator(Operator operator) {
- this.operator = operator;
- }
-
- @Override
- public String getAttributeName() {
- return attributeName;
- }
-
- @Override
- public String getAttributeValue() {
- return attributeValue;
- }
-
- @Override
- public Operator getOperator() {
- return operator;
- }
- }
-
- private static class StatementGroupImpl implements StatementGroup {
-
- private List statements = new ArrayList<>();
-
- public void addStatement(Statement statement) {
- this.statements.add(statement);
- }
-
- @Override
- public List getStatements() {
- return this.statements;
- }
-
- @Override
- public JoinOperator getJoinOperator() {
- return null;
- }
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/LinkImpl.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/LinkImpl.java
deleted file mode 100644
index 777c0021c6..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/LinkImpl.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal;
-
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.jackrabbit.JcrConstants;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.models.annotations.Exporter;
-import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.injectorspecific.ChildResource;
-import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
-import org.apache.sling.models.annotations.injectorspecific.Self;
-import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.cq.export.json.ComponentExporter;
-import com.adobe.cq.export.json.ExporterConstants;
-import com.adobe.cq.forms.core.components.models.formsportal.Link;
-import com.adobe.cq.wcm.core.components.util.AbstractComponentImpl;
-import com.day.cq.wcm.api.WCMMode;
-
-@Model(
- adaptables = SlingHttpServletRequest.class,
- adapters = { Link.class, ComponentExporter.class },
- resourceType = LinkImpl.RESOURCE_TYPE)
-@Exporter(
- name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
- extensions = ExporterConstants.SLING_MODEL_EXTENSION)
-public class LinkImpl extends AbstractComponentImpl implements Link {
- public static final String RESOURCE_TYPE = "core/fd/components/formsportal/link/v1/link";
- private static final String QUERY_PARAMS_PATH = "queryParams";
- private static final String PN_PARAM_KEY = "key";
- private static final String PN_PARAM_VALUE = "value";
- private static final Logger logger = LoggerFactory.getLogger(LinkImpl.class);
- private static final String QP_AF_DEFAULT_MODE_KEY = WCMMode.class.getSimpleName().toLowerCase();
- private static final String QP_AF_DEFAULT_MODE_VALUE = WCMMode.DISABLED.name().toLowerCase();
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String title;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String tooltip;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String assetType;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String assetPath;
-
- @ChildResource(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Named(QUERY_PARAMS_PATH)
- private List paramsResourceList;
-
- @Self(injectionStrategy = InjectionStrategy.OPTIONAL)
- private SlingHttpServletRequest request;
-
- private Map queryParamsMap;
-
- private SortedSet processorsList = new TreeSet<>();
-
- @Override
- public String getAssetPathWithQueryParams() {
- String url = processorsList.stream()
- .filter(processor -> processor.accepts(this))
- .findFirst().map(processor -> processor.processLink(this, request))
- .orElse(getAssetPath());
-
- if (StringUtils.isBlank(url)) {
- return "#";
- }
- try {
- URIBuilder uriBuilder = null;
- uriBuilder = new URIBuilder(url);
- Map queryParams = getQueryParams();
- if (queryParams != null && !uriBuilder.isPathEmpty()) {
- for (String key : queryParams.keySet()) {
- String value = queryParams.get(key);
- if (StringUtils.isNotBlank(value)) {
- uriBuilder.addParameter(key, value);
- } else {
- // for empty value
- uriBuilder.addParameter(key, null);
- }
- }
- }
- url = uriBuilder.build().toString();
- } catch (URISyntaxException e) {
- logger.error("[FORMS] Link Component Failed to parse assetPath {}", url, e);
- }
- return url;
- }
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- public String getTooltip() {
- return tooltip;
- }
-
- @Override
- public AssetType getAssetType() {
- if ("Adaptive Form".equals(assetType)) {
- return AssetType.ADAPTIVE_FORM;
- }
- return AssetType.NONE;
- }
-
- @Override
- public String getAssetPath() {
- return assetPath;
- }
-
- protected Map getQueryParams() {
- if (queryParamsMap == null || this.queryParamsMap.isEmpty()) {
- populateQueryParams();
- }
- return queryParamsMap;
- }
-
- protected void populateQueryParams() {
- this.queryParamsMap = new HashMap();
- if (paramsResourceList != null) {
- for (Resource param : paramsResourceList) {
- ValueMap properties = param.getValueMap();
- this.queryParamsMap.put(properties.get(PN_PARAM_KEY, ""),
- properties.get(PN_PARAM_VALUE, ""));
- }
- }
- }
-
- protected abstract static class FormsLinkProcessor implements Comparable {
- // has to be a class in order to implement Comparable
- // accepts a LinkImpl and is protected to allow implementation by subclasses (i.e future versions of Link component)
- public abstract Boolean accepts(LinkImpl link);
-
- public abstract String processLink(LinkImpl link, SlingHttpServletRequest request);
-
- public abstract Integer priority();
-
- @Override
- public int compareTo(FormsLinkProcessor o) {
- if (o != null) {
- return o.priority() - this.priority();
- }
- return 0;
- }
- }
-
- protected void addFormsLinkProcessor(FormsLinkProcessor processor) {
- this.processorsList.add(processor);
- }
-
- @PostConstruct
- protected void init() {
- this.addFormsLinkProcessor(new FormsLinkProcessor() {
- // Adaptive Forms and PDF processor
- @Override
- public Boolean accepts(LinkImpl link) {
- return (AssetType.ADAPTIVE_FORM.equals(link.getAssetType())
- || AssetType.PDF.equals(link.getAssetType())) && StringUtils.isNotBlank(link.getAssetPath());
- }
-
- @Override
- public String processLink(LinkImpl link, SlingHttpServletRequest request) {
- String givenPath = link.getAssetPath();
- String builtPath = givenPath + "/" + JcrConstants.JCR_CONTENT;
- ResourceResolver resourceResolver = request.getResourceResolver();
- if (resourceResolver.getResource(builtPath) != null) {
- Map params = link.getQueryParams();
- if (AssetType.ADAPTIVE_FORM.equals(link.getAssetType()) && !params.containsKey(QP_AF_DEFAULT_MODE_KEY)) {
- builtPath += "?" + QP_AF_DEFAULT_MODE_KEY + "=" + QP_AF_DEFAULT_MODE_VALUE;
- }
- givenPath = builtPath;
- }
- return givenPath;
- }
-
- @Override
- public Integer priority() {
- return Integer.MIN_VALUE + 1;
- }
- });
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/PortalListerImpl.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/PortalListerImpl.java
deleted file mode 100644
index 5f8890f54d..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/PortalListerImpl.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal;
-
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.models.annotations.Default;
-import org.apache.sling.models.annotations.DefaultInjectionStrategy;
-import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Required;
-import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
-import org.apache.sling.models.annotations.injectorspecific.Self;
-import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.cq.export.json.ComponentExporter;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.adobe.cq.wcm.core.components.util.AbstractComponentImpl;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-@Model(
- adaptables = SlingHttpServletRequest.class,
- adapters = { PortalLister.class, ComponentExporter.class },
- resourceType = PortalListerImpl.RESOURCE_TYPE,
- defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
-public class PortalListerImpl extends AbstractComponentImpl implements PortalLister {
- public static final String RESOURCE_TYPE = "core/fd/components/formsportal/portallister/v1/portallister";
- private static final Logger LOGGER = LoggerFactory.getLogger(PortalLister.class);
- private static final String KEY_OFFSET = "offset";
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String title;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String layout;
-
- @ValueMapValue
- @Inject
- @Default(intValues = 8)
- private Integer limit;
-
- @Override
- @JsonIgnore
- public Integer getLimit() {
- // not required in json
- return limit;
- }
-
- @Self
- @Required
- private SlingHttpServletRequest request;
-
- protected Integer getOffset() {
- String offsetParam = request.getParameter(KEY_OFFSET);
- if (StringUtils.isNumeric(offsetParam)) {
- return Integer.valueOf(offsetParam);
- }
- return 0;
- }
-
- protected Integer getNextOffset(Integer resultLength) {
- Integer nextOffset = getOffset();
- Integer limit = getLimit();
- if (resultLength < limit) {
- nextOffset = -1;
- } else {
- // in the case fetched results are equal to limit, we don't know if there are more or not
- // determining it lazily
- nextOffset = nextOffset + resultLength;
- }
- return nextOffset;
- }
-
- @Override
- public Map getElements() {
- List results = getItemList();
- Integer nextOffset = getNextOffset(results.size());
- String loadActionURL = null;
- Map jacksonMapping = new HashMap<>();
- jacksonMapping.put("data", results);
-
- if (nextOffset >= 0) {
- try {
- URIBuilder builder = new URIBuilder(request.getRequestURI() + ((request.getQueryString() != null) ? ("?" + request
- .getQueryString()) : ""));
- builder.setParameter(KEY_OFFSET, nextOffset.toString());
- loadActionURL = builder.build().toString();
- } catch (URISyntaxException e) {
- LOGGER.error("[FP] Could not read URI {}, Query String {}", request.getRequestURI(), request.getQueryString(), e);
- }
- }
-
- Map paginationObject = new HashMap<>();
- paginationObject.put("nextOffset", nextOffset);
- paginationObject.put("loadAction", loadActionURL);
- jacksonMapping.put("pagination", paginationObject);
- return jacksonMapping;
- }
-
- /**
- * Function to be implemented by child classes for returning item list
- */
- protected List getItemList() {
- return Collections.EMPTY_LIST;
- }
-
- protected String defaultTitle() {
- return StringUtils.EMPTY;
- }
-
- @Override
- public String getTitle() {
- if (title == null) {
- return defaultTitle();
- }
- return title;
- }
-
- @Override
- public String getLayout() {
- if (StringUtils.isEmpty(layout)) {
- return PortalLister.LayoutType.CARD;
- }
- return layout;
- }
-
- public static class Item implements PortalLister.Item {
- private String id;
- private String title;
- private String description;
- private String tooltip;
- private String formLink;
- private String formThumbnail;
- private List operations;
- private String lastModified;
-
- public Item() {}
-
- public Item(String title, String description, String tooltip, String formLink, String formThumbnail, String lastModified) {
- this.title = title;
- this.description = description;
- this.tooltip = tooltip;
- this.formLink = formLink;
- this.formThumbnail = formThumbnail;
- this.lastModified = lastModified;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setTooltip(String tooltip) {
- this.tooltip = tooltip;
- }
-
- public void setFormLink(String formLink) {
- this.formLink = formLink;
- }
-
- public void setFormThumbnail(String formThumbnail) {
- this.formThumbnail = formThumbnail;
- }
-
- public void setOperations(List operations) {
- this.operations = operations;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setLastModified(String timeInfo) {
- this.lastModified = timeInfo;
- }
-
- @Override
- public List getOperations() {
- return operations;
- }
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getTooltip() {
- return tooltip;
- }
-
- @Override
- public String getFormLink() {
- return formLink;
- }
-
- @Override
- public String getThumbnailLink() {
- return formThumbnail;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public String getLastModified() {
- return lastModified;
- }
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/SearchAndListerImpl.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/SearchAndListerImpl.java
deleted file mode 100644
index 9849696ba7..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/SearchAndListerImpl.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.jackrabbit.JcrConstants;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.request.RequestParameter;
-import org.apache.sling.api.request.RequestParameterMap;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceMetadata;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.ResourceWrapper;
-import org.apache.sling.api.resource.SyntheticResource;
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.api.wrappers.ValueMapDecorator;
-import org.apache.sling.models.annotations.Default;
-import org.apache.sling.models.annotations.DefaultInjectionStrategy;
-import org.apache.sling.models.annotations.Exporter;
-import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Required;
-import org.apache.sling.models.annotations.injectorspecific.ChildResource;
-import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
-import org.apache.sling.models.annotations.injectorspecific.OSGiService;
-import org.apache.sling.models.annotations.injectorspecific.Self;
-import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
-
-import com.adobe.aem.formsndocuments.assets.models.AdaptiveFormAsset;
-import com.adobe.aem.formsndocuments.assets.models.FDAsset;
-import com.adobe.aem.formsndocuments.assets.models.FMSearchCriteria;
-import com.adobe.aem.formsndocuments.assets.models.FormAsset;
-import com.adobe.aem.formsndocuments.assets.service.FMAssetSearch;
-import com.adobe.cq.export.json.ComponentExporter;
-import com.adobe.cq.export.json.ExporterConstants;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.components.models.formsportal.SearchAndLister;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.day.cq.i18n.I18n;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-@Model(
- adaptables = SlingHttpServletRequest.class,
- adapters = { SearchAndLister.class, ComponentExporter.class },
- resourceType = SearchAndListerImpl.RESOURCE_TYPE,
- defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
-@Exporter(
- name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
- extensions = ExporterConstants.SLING_MODEL_EXTENSION)
-public class SearchAndListerImpl extends PortalListerImpl implements SearchAndLister {
- public static final String RESOURCE_TYPE = "core/fd/components/formsportal/searchlister/v1/searchlister";
-
- private static final String PN_CHILD_ASSETFOLDERS = "assetFolders";
- private static final String PN_CHILD_ASSETSOURCES = "assetSource";
- private static final String DEFAULT_TOOLTIP = "Click to open";
- private static final Map queryStrategies = new HashMap<>();
-
- static {
- queryStrategies.put("searchText", new QueryStrategy() {
- public void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder) {
- int counter = 0;
- int paramCount = params.length;
- while (paramCount-- > 0) {
- String text = params[counter].getString();
- if (StringUtils.isNotBlank(text)) {
- builder.withFullText(text);
- }
- counter++;
- }
- }
- });
-
- queryStrategies.put("title", new QueryStrategy() {
- public void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder) {
- String title = params[0].getString();
- builder.withPropertyEquals(FMSearchCriteria.Property.TITLE, title);
- }
- });
-
- queryStrategies.put("description", new QueryStrategy() {
- public void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder) {
- String description = params[0].getString();
- builder.withPropertyEquals(FMSearchCriteria.Property.DESCRIPTION, description);
- }
- });
-
- queryStrategies.put("orderby", new QueryStrategy() {
- public void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder) {
- String orderByValue = params[0].getString();
- builder.sortBy(FMSearchCriteria.Property.getEnum(orderByValue));
- }
- });
-
- queryStrategies.put("sort", new QueryStrategy() {
- public void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder) {
- builder.sortBy(FMSearchCriteria.SortCriteria.getEnum(params[0].getString()));
- }
- });
-
- queryStrategies.put("offset", new QueryStrategy() {
- public void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder) {
- builder.withOffset(Integer.parseInt(params[0].getString()));
- }
- });
- }
-
- @OSGiService
- private FMAssetSearch assetSearch;
-
- @OSGiService
- private FMSearchCriteria.BuilderProvider searchBuilderProvider;
-
- @Self
- @Required
- private SlingHttpServletRequest request;
-
- @ChildResource(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Named(PN_CHILD_ASSETFOLDERS)
- @Inject
- private List assetFolders;
-
- @ChildResource(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Named(PN_CHILD_ASSETSOURCES)
- @Inject
- private List assetSources;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Default(booleanValues = false)
- @Inject
- private boolean disableSearch;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Default(booleanValues = false)
- @Inject
- private boolean disableSorting;
-
- private List defaultAssetSources;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Default(values = DEFAULT_TOOLTIP)
- private String htmlTooltip;
-
- @PostConstruct
- private void init() {
- List defaultAssetSourcesList = new ArrayList<>();
- Map valueMap = new HashMap<>();
- valueMap.put("type", "Adaptive Forms");
- valueMap.put("htmlTooltip", DEFAULT_TOOLTIP);
- Resource res = new DefaultValueMapResourceWrapper(new SyntheticResource(resource.getResourceResolver(), new ResourceMetadata(),
- JcrConstants.NT_UNSTRUCTURED), valueMap);
- defaultAssetSourcesList.add(res);
- this.defaultAssetSources = defaultAssetSourcesList;
- }
-
- @Override
- protected String defaultTitle() {
- return "Forms Portal";
- }
-
- @Override
- protected List getItemList() {
- List result = null;
- // resource resolver has logged-in user level access, only forms accessible by current user will be shown
- result = fetchViaQueryBuilder(request.getResourceResolver());
-
- return result;
- }
-
- private List getAssetSources() {
- if (assetSources != null) {
- return assetSources;
- } else if (defaultAssetSources != null) {
- return defaultAssetSources;
- }
- return Collections.emptyList();
- }
-
- private void buildAssetSourcesQuery(FMSearchCriteria.Builder searchBuilder) {
- List assetSourcesOrDefault = getAssetSources();
- if (assetSourcesOrDefault != null) {
- for (Resource source : assetSourcesOrDefault) {
- ValueMap assetSource = source.getValueMap();
- String renderType = assetSource.get("type", String.class);
- if ("Adaptive Forms".equals(renderType)) {
- searchBuilder.withAssetType(FormAsset.AssetType.ADAPTIVE_FORM);
- }
- }
- }
- }
-
- private void buildAssetFolderQuery(FMSearchCriteria.Builder searchBuilder) {
- if (assetFolders != null) {
- for (Resource source : assetFolders) {
- ValueMap assetFolder = source.getValueMap();
- String folderPath = assetFolder.get("folder", String.class);
- if (StringUtils.isNotBlank(folderPath)) {
- searchBuilder.withLocation(folderPath);
- }
- }
- }
- }
-
- protected List fetchViaQueryBuilder(ResourceResolver resourceResolver) {
- RequestParameterMap parameterMap = request.getRequestParameterMap();
- List resultMap = new ArrayList<>();
-
- FMSearchCriteria.Builder searchBuilder = searchBuilderProvider.createBuilder();
- searchBuilder.withOffset(0);
- searchBuilder.withMaxSize(getLimit());
-
- for (Map.Entry entry : parameterMap.entrySet()) {
- QueryStrategy queryStrategy = queryStrategies.get(entry.getKey());
- if (queryStrategy != null) {
- queryStrategy.buildQuery(entry.getValue(), searchBuilder);
- }
- }
-
- buildAssetSourcesQuery(searchBuilder);
- buildAssetFolderQuery(searchBuilder);
-
- List results = assetSearch.searchForms(searchBuilder.build(), resourceResolver);
- for (FDAsset fmA : results) {
- resultMap.add(fetchResourceProperties(fmA, resourceResolver));
- }
-
- return resultMap;
- }
-
- private SearchAndListerItem fetchResourceProperties(FDAsset fmAsset, ResourceResolver resolver) {
- String title = "";
- String description = "";
- String path = "";
- String tooltip = "";
- String thubmnail = "";
- I18n i18n = new I18n(request);
- if (fmAsset.getAssetType().equals(FDAsset.AssetType.ADAPTIVE_FORM)) {
- Resource afAssetResource = resolver.getResource(fmAsset.getDamPath());
- if (afAssetResource != null) {
- AdaptiveFormAsset asset = afAssetResource.adaptTo(AdaptiveFormAsset.class);
- if (asset != null) {
- title = asset.getTitle();
- description = asset.getDescription();
- path = asset.getRenderLink();
- thubmnail = asset.getThumbnailPath();
- tooltip = i18n.get(htmlTooltip);
- }
- }
- }
- return new SearchAndListerItem(title, description, tooltip, path, thubmnail, null);
- }
-
- @JsonIgnore
- @Override
- public boolean getSearchDisabled() {
- return disableSearch;
- }
-
- @JsonIgnore
- @Override
- public boolean getSortDisabled() {
- return disableSorting;
- }
-
- private interface QueryStrategy {
- void buildQuery(RequestParameter[] params, FMSearchCriteria.Builder builder);
- }
-
- private static class DefaultValueMapResourceWrapper extends ResourceWrapper {
- private final ValueMap valueMap;
-
- public DefaultValueMapResourceWrapper(Resource resource, Map properties) {
- super(resource);
- this.valueMap = new ValueMapDecorator(properties);
- }
-
- @Override
- public AdapterType adaptTo(Class type) {
- return type == ValueMap.class ? (AdapterType) this.valueMap : super.adaptTo(type);
- }
-
- @Override
- public ValueMap getValueMap() {
- return this.valueMap;
- }
- }
-
- private static class SearchAndListerItem extends PortalListerImpl.Item {
- public SearchAndListerItem(String title, String description, String tooltip, String formLink, String formThumbnail,
- String lastModified) {
- super(title, description, tooltip, formLink, formThumbnail, lastModified);
- }
-
- @Override
- @JsonIgnore
- public void setOperations(List operations) {
- super.setOperations(operations);
- }
-
- @Override
- @JsonIgnore
- public String getLastModified() {
- return super.getLastModified();
- }
-
- @Override
- @JsonIgnore
- public String getId() {
- return super.getId();
- }
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/formsportal/LinkImpl.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/formsportal/LinkImpl.java
deleted file mode 100644
index 0c1d09c4ea..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/formsportal/LinkImpl.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.models.v2.formsportal;
-
-import javax.inject.Inject;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.models.annotations.Exporter;
-import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
-import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
-
-import com.adobe.cq.export.json.ComponentExporter;
-import com.adobe.cq.export.json.ExporterConstants;
-import com.adobe.cq.forms.core.components.models.formsportal.Link;
-
-@Model(
- adaptables = SlingHttpServletRequest.class,
- adapters = { Link.class, ComponentExporter.class },
- resourceType = LinkImpl.RESOURCE_TYPE)
-@Exporter(
- name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
- extensions = ExporterConstants.SLING_MODEL_EXTENSION)
-public class LinkImpl extends com.adobe.cq.forms.core.components.internal.models.v1.formsportal.LinkImpl implements Link {
-
- public static final String RESOURCE_TYPE = "core/fd/components/formsportal/link/v2/link";
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String adaptiveFormPath;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String pdfPath;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String otherAssetPath;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String externalLinkPath;
-
- @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
- @Inject
- private String assetType;
-
- @Override
- public String getAssetPath() {
- switch (getAssetType()) {
- case ADAPTIVE_FORM:
- return adaptiveFormPath;
- case PDF:
- return pdfPath;
- case OTHERS:
- return otherAssetPath;
- case EXTERNAL_LINK:
- return externalLinkPath;
- case NONE:
- break;
- }
- return super.getAssetPath();
- }
-
- @Override
- public AssetType getAssetType() {
- if (assetType != null) {
- switch (assetType) {
- case "PDF":
- return AssetType.PDF;
- case "Others":
- return AssetType.OTHERS;
- case "External":
- return AssetType.EXTERNAL_LINK;
- default:
- break;
- }
- }
- return super.getAssetType();
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/DiscardDraftOperation.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/DiscardDraftOperation.java
deleted file mode 100644
index 247834dae7..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/DiscardDraftOperation.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.adobe.cq.forms.core.components.internal.services.formsportal;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.adobe.fd.fp.api.exception.FormsPortalException;
-import com.adobe.fd.fp.api.service.DraftService;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-@Component(
- service = Operation.class,
- immediate = true)
-public class DiscardDraftOperation implements Operation {
- private static final String OPERATION_NAME = "discardDraft";
- private static final String OPERATION_TITLE = "Discard";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DiscardDraftOperation.class);
-
- private String actionURL;
-
- @Reference
- private DraftService draftService;
-
- @Override
- public String getName() {
- return OPERATION_NAME;
- }
-
- @Override
- public String getTitle() {
- return OPERATION_TITLE;
- }
-
- @Override
- @JsonIgnore
- public String getIcon() {
- return null;
- }
-
- @Override
- public DraftsAndSubmissions.TypeEnum getType() {
- return DraftsAndSubmissions.TypeEnum.DRAFT;
- }
-
- @Override
- public OperationResult execute(Map parameterMap) {
- Map result = new HashMap<>();
- Map map = parameterMap.entrySet()
- .stream()
- .collect(Collectors.toMap(Map.Entry::getKey, value -> (String[]) value.getValue()));
- String modelID = Arrays.stream(Objects.requireNonNull(map.get(Operation.OPERATION_MODEL_ID))).findFirst().orElse(null);
- try {
- draftService.deleteDraft(modelID);
- result.put("status", "success");
- } catch (FormsPortalException e) {
- LOGGER.error("Failed to delete draft with id " + modelID, e);
- result.put("status", "fail");
- }
- return new OperationResult() {
- @Override
- public Map getResult() {
- return result;
- }
- };
- }
-
- @Override
- public Operation makeOperation(PortalLister.Item item, String requestURI) {
- DiscardDraftOperation op = new DiscardDraftOperation();
- op.actionURL = OperationUtils.generateActionURL(item.getId(), getName(), requestURI);
- return op;
- }
-
- @Override
- public String getActionURL() {
- return actionURL;
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OpenDraftOperation.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OpenDraftOperation.java
deleted file mode 100644
index 58d8c1280e..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OpenDraftOperation.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.adobe.cq.forms.core.components.internal.services.formsportal;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.settings.SlingSettingsService;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.aemds.guide.utils.GuideUtils;
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.adobe.fd.fp.api.exception.FormsPortalException;
-import com.adobe.fd.fp.api.models.DraftModel;
-import com.adobe.fd.fp.api.service.DraftService;
-import com.day.cq.commons.Externalizer;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-@Component(
- service = Operation.class,
- immediate = true)
-public class OpenDraftOperation implements Operation {
- private static final String OPERATION_NAME = "openDraft";
- private static final String OPERATION_TITLE = "Open";
- private static final String DRAFT_LINK = "%s.html?dataRef=service://FP/draft/%s%s";
- private static final String WCM_MODE = "&wcmmode=disabled";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(OpenDraftOperation.class);
-
- private String actionURL;
-
- @Reference
- private DraftService draftService;
-
- @Reference
- private SlingSettingsService slingSettings;
-
- @Override
- public String getName() {
- return OPERATION_NAME;
- }
-
- @Override
- public String getTitle() {
- return OPERATION_TITLE;
- }
-
- @Override
- @JsonIgnore
- public String getIcon() {
- return null;
- }
-
- @Override
- public DraftsAndSubmissions.TypeEnum getType() {
- return DraftsAndSubmissions.TypeEnum.DRAFT;
- }
-
- @Override
- public OperationResult execute(Map parameterMap) {
- String suffix = slingSettings.getRunModes().contains(Externalizer.AUTHOR) ? WCM_MODE : "";
- Map result = new HashMap<>();
- Map map = parameterMap
- .entrySet()
- .stream()
- .collect(Collectors.toMap(Map.Entry::getKey, v -> (String[]) v.getValue()));
- String modelID = Arrays.stream(Objects.requireNonNull(map.get(OPERATION_MODEL_ID))).findFirst().orElse(null);
- try {
- DraftModel dm = draftService.getDraft(modelID);
- String formPath = GuideUtils.convertFMAssetPathToFormPagePath(GuideUtils.convertGuideContainerPathToFMAssetPath(dm
- .getFormPath()));
- String formLink = String.format(DRAFT_LINK, formPath, modelID, suffix);
- result.put("formLink", formLink);
- result.put("status", "success");
- } catch (FormsPortalException e) {
- LOGGER.error("Failed to fetch link for draft with id " + modelID, e);
- result.put("status", "fail");
- }
- return new OperationResult() {
- @Override
- public Map getResult() {
- return result;
- }
- };
- }
-
- @Override
- public Operation makeOperation(PortalLister.Item item, String requestURI) {
- if (StringUtils.isBlank(item.getFormLink())) {
- return null;
- }
- OpenDraftOperation op = new OpenDraftOperation();
- op.actionURL = OperationUtils.generateActionURL(item.getId(), getName(), requestURI);
- return op;
- }
-
- @Override
- public String getActionURL() {
- return actionURL;
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OperationManagerImpl.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OperationManagerImpl.java
deleted file mode 100644
index bb581a4d55..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OperationManagerImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.adobe.cq.forms.core.components.internal.services.formsportal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
-
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.adobe.cq.forms.core.components.models.services.formsportal.OperationManager;
-
-@Component(
- service = OperationManager.class,
- immediate = true)
-public class OperationManagerImpl implements OperationManager {
-
- private volatile Map operations = new ConcurrentHashMap();
-
- private Map> operationLists = new ConcurrentHashMap<>();
-
- private void refreshOperationLists() {
- List draftOperations = new ArrayList<>();
- List submitOperations = new ArrayList<>();
- for (Map.Entry entry : operations.entrySet()) {
- Operation operation = entry.getValue();
- switch (operation.getType()) {
- case DRAFT:
- draftOperations.add(operation);
- break;
- case SUBMISSION:
- submitOperations.add(operation);
- break;
- }
- }
- operationLists.put(DraftsAndSubmissions.TypeEnum.DRAFT, draftOperations.stream().sorted(Comparator.comparing(
- Operation::getTitle).reversed()).collect(Collectors.toList()));
- operationLists.put(DraftsAndSubmissions.TypeEnum.SUBMISSION, submitOperations);
- }
-
- @Reference(
- service = Operation.class,
- policy = ReferencePolicy.DYNAMIC,
- cardinality = ReferenceCardinality.MULTIPLE,
- bind = "bindOperation",
- unbind = "unbindOperation")
- protected void bindOperation(final Operation operation, Map config) {
- String operationName = operation.getName();
- operations.put(operationName, operation);
- refreshOperationLists();
- }
-
- protected void unbindOperation(final Operation operation, Map config) {
- String operationName = operation.getName();
- if (operations.containsKey(operationName)) {
- operations.remove(operationName);
- refreshOperationLists();
- }
- }
-
- public Operation getOperation(String operationName) {
- return operations.get(operationName);
- }
-
- public List getOperationList(DraftsAndSubmissions.TypeEnum typeEnum, PortalLister.Item item, String requestURI) {
- List ops = Optional.ofNullable(operationLists.get(typeEnum))
- .orElse(Collections.emptyList())
- .stream().map(x -> x.makeOperation(item, requestURI))
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
- if (ops.isEmpty()) {
- return null;
- }
- return ops;
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OperationUtils.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OperationUtils.java
deleted file mode 100644
index 60d6f16791..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/services/formsportal/OperationUtils.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.adobe.cq.forms.core.components.internal.services.formsportal;
-
-import java.net.URISyntaxException;
-
-import org.apache.http.client.utils.URIBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-
-public class OperationUtils {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(OperationUtils.class);
-
- private OperationUtils() {}
-
- public static String generateActionURL(String modelID, String opName, String requestURI) {
- String actionURL = null;
- try {
- URIBuilder uriBuilder = new URIBuilder(requestURI.replace(".model.json", ".fp.operation"));
- uriBuilder.setParameter(Operation.OPERATION_KEY, opName);
- uriBuilder.setParameter(Operation.OPERATION_MODEL_ID, modelID);
- actionURL = uriBuilder.build().toString();
- } catch (URISyntaxException e) {
- LOGGER.error("[FP] Could not create action URL for {}", requestURI, e);
- }
- return actionURL;
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/servlet/OperationServlet.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/servlet/OperationServlet.java
deleted file mode 100644
index dd3800a345..0000000000
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/internal/servlet/OperationServlet.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.servlet;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.servlets.HttpConstants;
-import org.apache.sling.api.servlets.ServletResolverConstants;
-import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.apache.sling.models.factory.ModelFactory;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.adobe.cq.forms.core.components.internal.models.v1.formsportal.DraftsAndSubmissionsImpl;
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.adobe.cq.forms.core.components.models.services.formsportal.OperationManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Component(
- service = { Servlet.class },
- property = {
- ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=" + DraftsAndSubmissionsImpl.RESOURCE_TYPE,
- ServletResolverConstants.SLING_SERVLET_METHODS + "=" + HttpConstants.METHOD_GET,
- ServletResolverConstants.SLING_SERVLET_SELECTORS + "=" + OperationServlet.OPERATION_SELECTOR,
- ServletResolverConstants.SLING_SERVLET_EXTENSIONS + "=" + OperationServlet.EXTENSTION
- })
-public class OperationServlet extends SlingSafeMethodsServlet {
-
- static final String OPERATION_SELECTOR = "fp";
- static final String EXTENSTION = "operation";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(OperationServlet.class);
-
- @Reference
- private transient ModelFactory modelFactory;
-
- @Reference
- private transient OperationManager operationManager;
-
- @Override
- protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
- String opName = request.getParameter(Operation.OPERATION_KEY);
-
- response.setContentType("application/json");
- response.setCharacterEncoding(StandardCharsets.UTF_8.name());
- try {
- new ObjectMapper().writer().writeValue(response.getOutputStream(), execute(opName, request));
- } catch (Exception ex) {
- LOGGER.error("[FP] [Operation] Could not execute operation {}", opName, ex);
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- }
- }
-
- private Operation.OperationResult execute(String opName, SlingHttpServletRequest request) {
- Map inputMap = request.getParameterMap()
- .entrySet()
- .stream()
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- DraftsAndSubmissions componentModel = modelFactory.createModel(request, DraftsAndSubmissions.class);
- Operation op = operationManager.getOperation(opName);
- if (op == null) {
- throw new UnsupportedOperationException("Could not find operation " + opName);
- } else if (op.getType() != DraftsAndSubmissions.TypeEnum.valueOf(componentModel.getType())) {
- throw new IllegalArgumentException("Illegal operation " + opName + " on component type " + componentModel.getType());
- }
- return op.execute(inputMap);
- }
-}
diff --git a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/models/formsportal/package-info.java b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/models/formsportal/package-info.java
index f0191c8c0a..cb7c9bba41 100644
--- a/bundles/core/src/main/java/com/adobe/cq/forms/core/components/models/formsportal/package-info.java
+++ b/bundles/core/src/main/java/com/adobe/cq/forms/core/components/models/formsportal/package-info.java
@@ -10,7 +10,7 @@
*
******************************************************************************/
-@Version("2.1.0")
+@Version("2.2.0")
package com.adobe.cq.forms.core.components.models.formsportal;
import org.osgi.annotation.versioning.Version;
\ No newline at end of file
diff --git a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/draftsandsubmissions/DraftsAndSubmissionsImplTest.java b/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/draftsandsubmissions/DraftsAndSubmissionsImplTest.java
deleted file mode 100644
index a238bcc122..0000000000
--- a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/draftsandsubmissions/DraftsAndSubmissionsImplTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal.draftsandsubmissions;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
-import org.junit.Assert;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import com.adobe.aem.formsndocuments.assets.models.AdaptiveFormAsset;
-import com.adobe.cq.forms.core.Utils;
-import com.adobe.cq.forms.core.components.internal.services.formsportal.DiscardDraftOperation;
-import com.adobe.cq.forms.core.components.internal.services.formsportal.OpenDraftOperation;
-import com.adobe.cq.forms.core.components.internal.services.formsportal.OperationManagerImpl;
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.services.formsportal.OperationManager;
-import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import com.adobe.fd.fp.api.exception.FormsPortalException;
-import com.adobe.fd.fp.api.models.DraftModel;
-import com.adobe.fd.fp.api.models.SubmitModel;
-import com.adobe.fd.fp.api.service.DraftService;
-import com.adobe.fd.fp.api.service.SubmitService;
-import com.adobe.forms.foundation.usc.model.Query;
-import com.adobe.forms.foundation.usc.model.Statement;
-import com.adobe.forms.foundation.usc.model.Statement.Operator;
-import com.adobe.forms.foundation.usc.model.StatementGroup;
-import io.wcm.testing.mock.aem.junit5.AemContext;
-import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-
-@ExtendWith(AemContextExtension.class)
-public class DraftsAndSubmissionsImplTest {
- private static final String TEST_BASE = "/draftsandsubmission";
- private static final String CONTENT_ROOT = "/content";
- private static final String ROOT_PAGE = CONTENT_ROOT + "/fpdns";
- private static final String DRAFT_COMPONENT_PATH = ROOT_PAGE + "/dns-draft-v1";
- private static final String SUBMISSION_COMPONENT_PATH = ROOT_PAGE + "/dns-submission-v1";
- private static final String DEFAULT_COMPONENT_PATH = ROOT_PAGE + "/dns-default-v1";
- private static final String SAMPLE_FORM = CONTENT_ROOT + "/dam/formsanddocuments/sample-form";
- public final AemContext context = FormsCoreComponentTestContext.newAemContext();
-
- private DraftService draftService;
- private DraftModel draftModel;
- private SubmitService submitService;
- private SubmitModel submitModel;
- private OperationManager operationManager;
-
- @BeforeEach
- public void setUp() {
- context.load().json(TEST_BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
- draftService = Mockito.mock(DraftService.class);
- draftModel = Mockito.spy(new DraftModel());
- draftModel.setDraftId("abc123");
-
- submitService = Mockito.mock(SubmitService.class);
- submitModel = Mockito.spy(new SubmitModel());
- submitModel.setSubmitId("abc123");
-
- operationManager = new OperationManagerImpl();
- context.registerInjectActivateService(operationManager);
- try {
- Mockito.when(draftService.getAllDraft(Mockito.any())).thenReturn(Collections.singletonList(draftModel));
- Mockito.when(submitService.getAllSubmission(Mockito.any())).thenReturn(Collections.singletonList(submitModel));
- } catch (FormsPortalException e) {
- e.printStackTrace();
- }
- context.registerService(DraftService.class, draftService);
- context.registerService(SubmitService.class, submitService);
- }
-
- @Test
- public void testExportedType() {
- DraftsAndSubmissions component = getInstanceUnderTest(DRAFT_COMPONENT_PATH);
- Assertions.assertEquals("core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions", component.getExportedType());
- }
-
- @Test
- public void testExportedDraftJson() {
- Mockito.when(draftModel.getLastModifiedTime()).thenReturn(new Calendar.Builder().setInstant(12345678)
- .build());
- Mockito.when(draftModel.getFormPath()).thenReturn(SAMPLE_FORM);
- Resource afDamRes = context.resourceResolver().getResource(SAMPLE_FORM);
- AdaptiveFormAsset mockAsset = getMockAFAssetOf(afDamRes);
- context.registerAdapter(Resource.class, AdaptiveFormAsset.class, mockAsset);
- context.registerInjectActivateService(new OpenDraftOperation());
- context.registerInjectActivateService(new DiscardDraftOperation());
-
- DraftsAndSubmissions component = getInstanceUnderTest(DRAFT_COMPONENT_PATH);
- Utils.testJSONExport(component, Utils.getTestExporterJSONPath(TEST_BASE, DRAFT_COMPONENT_PATH));
- }
-
- @Test
- public void testExportedSubmissionJson() {
- Mockito.when(submitModel.getLastModifiedTime()).thenReturn(new Calendar.Builder().setInstant(12345678)
- .build());
- Mockito.when(submitModel.getFormPath()).thenReturn(SAMPLE_FORM);
- Resource afDamRes = context.resourceResolver().getResource(SAMPLE_FORM);
- AdaptiveFormAsset mockAsset = getMockAFAssetOf(afDamRes);
- context.registerAdapter(Resource.class, AdaptiveFormAsset.class, mockAsset);
-
- DraftsAndSubmissions component = getInstanceUnderTest(SUBMISSION_COMPONENT_PATH);
- Utils.testJSONExport(component, Utils.getTestExporterJSONPath(TEST_BASE, SUBMISSION_COMPONENT_PATH));
- }
-
- @Test
- public void testMainInterface() {
- DraftsAndSubmissions component = Mockito.mock(DraftsAndSubmissions.class);
-
- Mockito.when(component.getType()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getType);
- }
-
- @Test
- public void testDefaultTitle() {
- DraftsAndSubmissions component = getInstanceUnderTest(DEFAULT_COMPONENT_PATH);
- Assertions.assertEquals("Drafts", component.getTitle());
- }
-
- @Test
- public void testException() throws FormsPortalException {
- Resource afDamRes = context.resourceResolver().getResource(SAMPLE_FORM);
- AdaptiveFormAsset mockAsset = getMockAFAssetOf(afDamRes, true);
- context.registerAdapter(Resource.class, AdaptiveFormAsset.class, mockAsset);
-
- Mockito.when(draftModel.getLastModifiedTime()).thenReturn(new Calendar.Builder().setInstant(12345678)
- .build());
- Mockito.when(draftModel.getFormPath()).thenReturn(SAMPLE_FORM);
-
- // to assert private getters inside QueryImpl, StatementImpl and StatementGroup Impl
- Mockito.when(draftService.getAllDraft(Mockito.any())).then(new Answer>() {
- @Override
- public List answer(InvocationOnMock invocation) throws Throwable {
- Query q = (Query) invocation.getArgument(0);
- Assert.assertEquals(8, q.getLimit());
- Assert.assertEquals(0, q.getOffset());
- Assert.assertNotNull(q.getStatementGroup());
-
- StatementGroup sg = q.getStatementGroup();
- Assert.assertNull(sg.getJoinOperator());
- Assert.assertEquals(1, sg.getStatements().size());
-
- Statement stmt = sg.getStatements().get(0);
- Assert.assertNotNull(stmt);
- Assert.assertEquals("owner", stmt.getAttributeName());
- Assert.assertEquals("admin", stmt.getAttributeValue());
- Assert.assertEquals(Operator.EQUALS, stmt.getOperator());
- return Collections.singletonList(draftModel);
- }
- });
-
- DraftsAndSubmissions component = getInstanceUnderTest(DEFAULT_COMPONENT_PATH);
- Assert.assertEquals(2, component.getElements().size());
- }
-
- private DraftsAndSubmissions getInstanceUnderTest(String resourcePath) {
- MockSlingHttpServletRequest mockRequest = context.request();
- mockRequest.setResource(context.currentResource(resourcePath));
- return mockRequest.adaptTo(DraftsAndSubmissions.class);
- }
-
- private AdaptiveFormAsset getMockAFAssetOf(Resource res) {
- return getMockAFAssetOf(res, false);
- }
-
- private AdaptiveFormAsset getMockAFAssetOf(Resource res, boolean invalidLink) {
- AdaptiveFormAsset mockAsset = Mockito.mock(AdaptiveFormAsset.class);
- ValueMap vm = res.getChild("jcr:content/metadata").getValueMap();
- if (invalidLink) {
- Mockito.when(mockAsset.getRenderLink()).thenReturn("/render/link/by/backend with spaces to make it invalid/api");
- } else {
- Mockito.when(mockAsset.getRenderLink()).thenReturn("/render/link/by/backend/api");
- }
- Mockito.when(mockAsset.getTitle()).thenReturn(vm.get("title", "Form Title"));
- Mockito.when(mockAsset.getDescription()).thenReturn(vm.get("description", "Form Description"));
- Mockito.when(mockAsset.getThumbnailPath()).thenReturn("/thumbnail/path/by/backend");
- return mockAsset;
- }
-}
diff --git a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/link/LinkImplTest.java b/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/link/LinkImplTest.java
deleted file mode 100644
index 74623ff9c5..0000000000
--- a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/link/LinkImplTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal.link;
-
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mockito;
-
-import com.adobe.cq.forms.core.Utils;
-import com.adobe.cq.forms.core.components.models.formsportal.Link;
-import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import io.wcm.testing.mock.aem.junit5.AemContext;
-import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-
-@ExtendWith(AemContextExtension.class)
-public class LinkImplTest {
-
- public final AemContext context = FormsCoreComponentTestContext.newAemContext();
-
- private static final String TEST_BASE = "/link";
- private static final String CONTENT_ROOT = "/content";
- private static final String ROOT_PAGE = CONTENT_ROOT + "/fplink";
- private static final String EMPTY_LINK_PATH = ROOT_PAGE + "/linkcomponent-empty";
- private static final String LINK1_PATH = ROOT_PAGE + "/linkcomponent-v1";
- private static final String LINK1_PATH_WITH_INVALID_LINK = ROOT_PAGE + "/linkcomponent-v1-invalidref";
-
- @BeforeEach
- public void setUp() {
- context.load().json(TEST_BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
- }
-
- @Test
- public void testExportedType() {
- Link component = getLinkUnderTest(LINK1_PATH);
- Assertions.assertEquals("core/fd/components/formsportal/link/v1/link", component.getExportedType());
- }
-
- @Test
- public void testExportedJson() {
- Link component = getLinkUnderTest(LINK1_PATH);
- Utils.testJSONExport(component, Utils.getTestExporterJSONPath(TEST_BASE, LINK1_PATH));
- }
-
- @Test
- public void testEmptyLinkComponent() {
- Link link = getLinkUnderTest(EMPTY_LINK_PATH);
- Assertions.assertEquals(null, link.getAssetPath());
- Assertions.assertEquals("#", link.getAssetPathWithQueryParams());
- Assertions.assertEquals(null, link.getTitle());
- Assertions.assertEquals(null, link.getTooltip());
- Assertions.assertEquals(Link.AssetType.NONE, link.getAssetType());
- }
-
- @Test
- public void testLinkComponent() {
- Link link = getLinkUnderTest(LINK1_PATH);
- Assertions.assertEquals("/content/dam/formsanddocuments/sample-form", link.getAssetPath());
- Assertions.assertEquals("/content/dam/formsanddocuments/sample-form/jcr:content?wcmmode=disabled", link
- .getAssetPathWithQueryParams());
- Assertions.assertEquals("Link Component", link.getTitle());
- Assertions.assertEquals("Some Hover Tooltip Text", link.getTooltip());
- Assertions.assertEquals(Link.AssetType.ADAPTIVE_FORM, link.getAssetType());
- }
-
- @Test
- public void testLinkComponentWithInvalidPath() {
- Link link = getLinkUnderTest(LINK1_PATH_WITH_INVALID_LINK);
- Assertions.assertEquals("https://www.adobe.com/", link.getAssetPath());
- Assertions.assertEquals("https://www.adobe.com/?hello", link.getAssetPathWithQueryParams());
- Assertions.assertEquals("Link Component", link.getTitle());
- Assertions.assertEquals("Some Hover Tooltip Text", link.getTooltip());
- Assertions.assertEquals(Link.AssetType.ADAPTIVE_FORM, link.getAssetType());
- }
-
- @Test
- public void testMainInterface() {
- Link linkMock = Mockito.mock(Link.class);
- Mockito.when(linkMock.getAssetPath()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, linkMock::getAssetPath);
-
- Mockito.when(linkMock.getAssetType()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, linkMock::getAssetType);
-
- Mockito.when(linkMock.getTitle()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, linkMock::getTitle);
-
- Mockito.when(linkMock.getTooltip()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, linkMock::getTooltip);
-
- Mockito.when(linkMock.getAssetPathWithQueryParams()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, linkMock::getAssetPathWithQueryParams);
-
- Mockito.when(linkMock.getAccessibilityLabel()).thenCallRealMethod();
- Assertions.assertNull(linkMock.getAccessibilityLabel());
- }
-
- private Link getLinkUnderTest(String resourcePath) {
- MockSlingHttpServletRequest mockRequest = context.request();
- mockRequest.setResource(context.currentResource(resourcePath));
- return mockRequest.adaptTo(Link.class);
- }
-}
diff --git a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/portallister/PortalListerTest.java b/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/portallister/PortalListerTest.java
deleted file mode 100644
index 6439466358..0000000000
--- a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/portallister/PortalListerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal.portallister;
-
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mockito;
-
-import com.adobe.cq.forms.core.Utils;
-import com.adobe.cq.forms.core.components.models.formsportal.PortalLister;
-import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import io.wcm.testing.mock.aem.junit5.AemContext;
-import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-
-@ExtendWith(AemContextExtension.class)
-public class PortalListerTest {
- private static final String TEST_BASE = "/portallister";
- private static final String CONTENT_ROOT = "/content";
- private static final String ROOT_PAGE = CONTENT_ROOT + "/fplister";
- private static final String CONFIGURED_COMPONENT_V1_PATH = ROOT_PAGE + "/portallister-v1";
- private static final String SAMPLE_FORM = CONTENT_ROOT + "/dam/formsanddocuments/sample-form";
- public final AemContext context = FormsCoreComponentTestContext.newAemContext();
-
- @BeforeEach
- public void setUp() {
- context.load().json(TEST_BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
- }
-
- @Test
- public void testMainInterface() {
- // PortalLister interface tests
- PortalLister component = Mockito.mock(PortalLister.class);
-
- Mockito.when(component.getTitle()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getTitle);
-
- Mockito.when(component.getLayout()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getLayout);
-
- Mockito.when(component.getLimit()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getLimit);
-
- Mockito.when(component.getElements()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getElements);
-
- // PortalLister.Item interface tests
- PortalLister.Item item = Mockito.mock(PortalLister.Item.class);
-
- Mockito.when(item.getTitle()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getTitle);
-
- Mockito.when(item.getDescription()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getDescription);
-
- Mockito.when(item.getTooltip()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getTooltip);
-
- Mockito.when(item.getFormLink()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getFormLink);
-
- Mockito.when(item.getThumbnailLink()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getThumbnailLink);
-
- Mockito.when(item.getOperations()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getOperations);
-
- Mockito.when(item.getId()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getId);
-
- Mockito.when(item.getLastModified()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, item::getLastModified);
- }
-
- @Test
- public void testExportedJson() {
- PortalLister component = getInstanceUnderTest(CONFIGURED_COMPONENT_V1_PATH);
- Utils.testJSONExport(component, Utils.getTestExporterJSONPath(TEST_BASE, CONFIGURED_COMPONENT_V1_PATH));
- }
-
- private PortalLister getInstanceUnderTest(String resourcePath) {
- MockSlingHttpServletRequest mockRequest = context.request();
- mockRequest.setResource(context.currentResource(resourcePath));
- return mockRequest.adaptTo(PortalLister.class);
- }
-}
diff --git a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/searchlister/SearchAndListerImplTest.java b/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/searchlister/SearchAndListerImplTest.java
deleted file mode 100644
index 488c91f039..0000000000
--- a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/formsportal/searchlister/SearchAndListerImplTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-package com.adobe.cq.forms.core.components.internal.models.v1.formsportal.searchlister;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mockito;
-
-import com.adobe.aem.formsndocuments.assets.models.AdaptiveFormAsset;
-import com.adobe.aem.formsndocuments.assets.models.FDAsset;
-import com.adobe.aem.formsndocuments.assets.models.FMSearchCriteria;
-import com.adobe.aem.formsndocuments.assets.service.FMAssetSearch;
-import com.adobe.cq.forms.core.Utils;
-import com.adobe.cq.forms.core.components.models.formsportal.SearchAndLister;
-import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import io.wcm.testing.mock.aem.junit5.AemContext;
-import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-
-@ExtendWith(AemContextExtension.class)
-public class SearchAndListerImplTest {
-
- private static final String TEST_BASE = "/searchlister";
- private static final String CONTENT_ROOT = "/content";
- private static final String ROOT_PAGE = CONTENT_ROOT + "/fpsnl";
- private static final String DEFAULT_COMPONENT_PATH = ROOT_PAGE + "/searchlister-empty";
- private static final String CONFIGURED_COMPONENT_V1_PATH = ROOT_PAGE + "/searchlister-v1";
- private static final String SAMPLE_FORM = CONTENT_ROOT + "/dam/formsanddocuments/sample-form";
- public final AemContext context = FormsCoreComponentTestContext.newAemContext();
-
- private FMAssetSearch searchAPI;
- private FMSearchCriteria searchCriteria;
-
- @BeforeEach
- public void setUp() {
- context.load().json(TEST_BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
- List resultList = new ArrayList<>();
-
- searchCriteria = Mockito.mock(FMSearchCriteria.class);
- searchAPI = Mockito.mock(FMAssetSearch.class);
- Mockito.when(searchAPI.searchForms(Mockito.any(), Mockito.any())).thenReturn(resultList);
-
- FMSearchCriteria.BuilderProvider providerService = Mockito.mock(FMSearchCriteria.BuilderProvider.class);
- FMSearchCriteria.Builder builder = Mockito.mock(FMSearchCriteria.Builder.class, Mockito.RETURNS_SELF);
- Mockito.when(providerService.createBuilder()).thenReturn(builder);
- Mockito.when(builder.build()).thenReturn(searchCriteria);
-
- context.registerService(FMAssetSearch.class, searchAPI);
- context.registerService(FMSearchCriteria.BuilderProvider.class, providerService);
- }
-
- @Test
- public void testExportedType() {
- SearchAndLister component = getInstanceUnderTest(CONFIGURED_COMPONENT_V1_PATH);
- Assertions.assertEquals("core/fd/components/formsportal/searchlister/v1/searchlister", component.getExportedType());
- }
-
- @Test
- public void testExportedJson() {
- SearchAndLister component = getInstanceUnderTest(CONFIGURED_COMPONENT_V1_PATH);
- Utils.testJSONExport(component, Utils.getTestExporterJSONPath(TEST_BASE, CONFIGURED_COMPONENT_V1_PATH));
- }
-
- @Test
- public void testEmptySearchAndListerComponent() {
- SearchAndLister component = getInstanceUnderTest(DEFAULT_COMPONENT_PATH);
- Assertions.assertEquals("Forms Portal", component.getTitle());
- Assertions.assertEquals("card", component.getLayout());
- Assertions.assertFalse(component.getSearchDisabled());
- Assertions.assertFalse(component.getSortDisabled());
- Assertions.assertEquals(Integer.valueOf(8), component.getLimit());
-
- // map at top level should have exactly two keys
- Assertions.assertEquals(2, component.getElements().size());
- }
-
- @Test
- public void testConfiguredSearchAndListerComponent() {
- SearchAndLister component = getInstanceUnderTest(CONFIGURED_COMPONENT_V1_PATH);
- Assertions.assertEquals("Sample Title", component.getTitle());
- Assertions.assertEquals("Custom", component.getLayout());
- Assertions.assertTrue(component.getSearchDisabled());
- Assertions.assertTrue(component.getSortDisabled());
- Assertions.assertEquals(Integer.valueOf(1), component.getLimit());
-
- List resultList = new ArrayList<>();
- Mockito.when(searchAPI.searchForms(Mockito.any(), Mockito.any())).thenReturn(resultList);
- Assertions.assertEquals(2, component.getElements().size());
- }
-
- @Test
- public void testPredicateAndResultJson() {
- // Cover all predicates and also match output json
- SearchAndLister component = getInstanceUnderTest(CONFIGURED_COMPONENT_V1_PATH);
-
- Map requestParams = new HashMap<>();
- requestParams.put("title", "Sample Title");
- requestParams.put("searchText", "Search Text");
- requestParams.put("description", "Desc");
- requestParams.put("tags", "full/path/to/tag");
- requestParams.put("orderby", "title");
- requestParams.put("sort", "asc");
- requestParams.put("offset", "0");
- requestParams.put("limit", "10");
-
- MockSlingHttpServletRequest request = context.request();
-
- request.setResource(context.currentResource(CONFIGURED_COMPONENT_V1_PATH));
- request.setParameterMap(requestParams);
-
- Resource mockFormResource = Mockito.spy(context.resourceResolver().getResource(SAMPLE_FORM));
-
- List resultList = new ArrayList<>();
- AdaptiveFormAsset mockAsset = Mockito.mock(AdaptiveFormAsset.class);
- resultList.add(mockAsset);
- context.registerAdapter(Resource.class, AdaptiveFormAsset.class, mockAsset);
-
- Mockito.when(searchAPI.searchForms(Mockito.any(), Mockito.any())).thenReturn(resultList);
- Mockito.when(mockAsset.getDamPath()).thenReturn(SAMPLE_FORM);
- Mockito.when(mockAsset.getAssetType()).thenReturn(FDAsset.AssetType.ADAPTIVE_FORM);
- Mockito.when(mockAsset.getTitle()).thenReturn("Sample Form");
- Mockito.when(mockAsset.getDescription()).thenReturn("Sample description for Sample Form");
- Mockito.when(mockAsset.getRenderLink()).thenReturn("/content/dam/formsanddocuments/sample-form/jcr:content?wcmmode=disabled");
-
- // generate model json, after this resourceIterator would need to be reset if called again
- Utils.testJSONExport(component, TEST_BASE + "/searchlister-v1-withResults.json");
- }
-
- @Test
- public void testMainInterface() {
- SearchAndLister component = Mockito.mock(SearchAndLister.class);
-
- Mockito.when(component.getSearchDisabled()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getSearchDisabled);
-
- Mockito.when(component.getSortDisabled()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getSortDisabled);
-
- Mockito.when(component.getLimit()).thenCallRealMethod();
- Assertions.assertThrows(UnsupportedOperationException.class, component::getLimit);
-
- }
-
- private SearchAndLister getInstanceUnderTest(String resourcePath) {
- MockSlingHttpServletRequest mockRequest = context.request();
- mockRequest.setResource(context.currentResource(resourcePath));
- return mockRequest.adaptTo(SearchAndLister.class);
- }
-}
diff --git a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/formsportal/link/LinkImplTest.java b/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/formsportal/link/LinkImplTest.java
deleted file mode 100644
index 7e17165361..0000000000
--- a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/formsportal/link/LinkImplTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.internal.models.v2.formsportal.link;
-
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-import com.adobe.cq.forms.core.Utils;
-import com.adobe.cq.forms.core.components.models.formsportal.Link;
-import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import io.wcm.testing.mock.aem.junit5.AemContext;
-import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-
-@ExtendWith(AemContextExtension.class)
-public class LinkImplTest {
-
- public final AemContext context = FormsCoreComponentTestContext.newAemContext();
-
- private static final String TEST_BASE = "/link";
- private static final String CONTENT_ROOT = "/content";
- private static final String ROOT_PAGE = CONTENT_ROOT + "/fplink";
- private static final String EMPTY_LINK_PATH = ROOT_PAGE + "/linkcomponent-v2-empty";
- private static final String LINK2_PATH = ROOT_PAGE + "/linkcomponent-v2";
- private static final String LINK2_PATH_WITH_EXTERNAL_LINK = ROOT_PAGE + "/linkcomponent-v2-external";
- private static final String LINK2_PATH_WITH_PDF = ROOT_PAGE + "/linkcomponent-v2-pdf";
- private static final String LINK2_PATH_WITH_OTHERS = ROOT_PAGE + "/linkcomponent-v2-others";
-
- @BeforeEach
- public void setUp() {
- context.load().json(TEST_BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
- }
-
- @Test
- public void testExportedType() {
- Link component = getLinkUnderTest(LINK2_PATH);
- Assertions.assertEquals("core/fd/components/formsportal/link/v2/link", component.getExportedType());
- }
-
- @Test
- public void testExportedJson() {
- Link component = getLinkUnderTest(LINK2_PATH);
- Utils.testJSONExport(component, Utils.getTestExporterJSONPath(TEST_BASE, LINK2_PATH));
- }
-
- @Test
- public void testEmptyLinkComponent() {
- Link link = getLinkUnderTest(EMPTY_LINK_PATH);
- Assertions.assertEquals(null, link.getAssetPath());
- Assertions.assertEquals("#", link.getAssetPathWithQueryParams());
- Assertions.assertEquals(null, link.getTitle());
- Assertions.assertEquals(null, link.getTooltip());
- Assertions.assertEquals(Link.AssetType.NONE, link.getAssetType());
- }
-
- @Test
- public void testLinkComponent() {
- Link link = getLinkUnderTest(LINK2_PATH);
- Assertions.assertEquals("/content/dam/formsanddocuments/sample-form", link.getAssetPath());
- Assertions.assertEquals("/content/dam/formsanddocuments/sample-form/jcr:content?wcmmode=disabled", link
- .getAssetPathWithQueryParams());
- Assertions.assertEquals("Link Component", link.getTitle());
- Assertions.assertEquals("Some Hover Tooltip Text", link.getTooltip());
- Assertions.assertNull(link.getAccessibilityLabel());
- Assertions.assertEquals(Link.AssetType.ADAPTIVE_FORM, link.getAssetType());
- }
-
- @Test
- public void testLinkComponentWithExternal() {
- Link link = getLinkUnderTest(LINK2_PATH_WITH_EXTERNAL_LINK);
- Assertions.assertEquals("https://www.adobe.com/", link.getAssetPath());
- Assertions.assertEquals("https://www.adobe.com/?hello=world", link.getAssetPathWithQueryParams());
- Assertions.assertEquals("Link Component", link.getTitle());
- Assertions.assertEquals("Some Hover Tooltip Text", link.getTooltip());
- Assertions.assertEquals(Link.AssetType.EXTERNAL_LINK, link.getAssetType());
- }
-
- @Test
- public void testOthersAssetType() {
- Link link = getLinkUnderTest(LINK2_PATH_WITH_OTHERS);
- Assertions.assertEquals(Link.AssetType.OTHERS, link.getAssetType());
- }
-
- @Test
- public void testPDFAssetType() {
- Link link = getLinkUnderTest(LINK2_PATH_WITH_PDF);
- Assertions.assertEquals(Link.AssetType.PDF, link.getAssetType());
- }
-
- private Link getLinkUnderTest(String resourcePath) {
- MockSlingHttpServletRequest mockRequest = context.request();
- mockRequest.setResource(context.currentResource(resourcePath));
- return mockRequest.adaptTo(Link.class);
- }
-}
diff --git a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/servlet/OperationServletTest.java b/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/servlet/OperationServletTest.java
deleted file mode 100644
index 7953d0e4e1..0000000000
--- a/bundles/core/src/test/java/com/adobe/cq/forms/core/components/internal/servlet/OperationServletTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.adobe.cq.forms.core.components.internal.servlet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-
-import javax.json.Json;
-import javax.json.JsonReader;
-import javax.servlet.ServletException;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpStatus;
-import org.apache.sling.models.factory.ModelFactory;
-import org.apache.sling.settings.SlingSettingsService;
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
-import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletResponse;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-
-import com.adobe.cq.forms.core.components.internal.services.formsportal.DiscardDraftOperation;
-import com.adobe.cq.forms.core.components.internal.services.formsportal.OpenDraftOperation;
-import com.adobe.cq.forms.core.components.internal.services.formsportal.OperationManagerImpl;
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions;
-import com.adobe.cq.forms.core.components.models.formsportal.DraftsAndSubmissions.TypeEnum;
-import com.adobe.cq.forms.core.components.models.services.formsportal.Operation;
-import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-import com.adobe.fd.fp.api.exception.FormsPortalException;
-import com.adobe.fd.fp.api.models.DraftModel;
-import com.adobe.fd.fp.api.service.DraftService;
-import io.wcm.testing.mock.aem.junit5.AemContext;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-class OperationServletTest {
-
- public final AemContext context = FormsCoreComponentTestContext.newAemContext();
-
- private OperationServlet servlet;
-
- private OpenDraftOperation operation;
-
- @BeforeEach
- void setUp() throws FormsPortalException {
- String modelID = "abc123";
- OperationManagerImpl operationManager = new OperationManagerImpl();
- ModelFactory modelFactory = Mockito.mock(ModelFactory.class);
- DraftsAndSubmissions dummy = Mockito.mock(DraftsAndSubmissions.class);
- operation = new OpenDraftOperation();
- servlet = new OperationServlet();
-
- Mockito.when(dummy.getType()).thenReturn("DRAFT");
-
- DraftModel draftModel = Mockito.spy(new DraftModel());
- draftModel.setDraftId(modelID);
- draftModel.setFormPath("/content/forms/af/fakepath");
-
- DraftService draftService = Mockito.mock(DraftService.class);
- Mockito.when(draftService.getAllDraft(Mockito.any())).thenReturn(Collections.singletonList(draftModel));
- Mockito.when(draftService.getDraft(modelID)).thenReturn(draftModel);
-
- Mockito.when(modelFactory.createModel(Mockito.any(), Mockito.eq(DraftsAndSubmissions.class))).thenReturn(dummy);
- context.registerService(SlingSettingsService.class, Mockito.mock(SlingSettingsService.class));
- context.registerService(DraftService.class, draftService);
- context.registerService(ModelFactory.class, modelFactory);
- context.registerInjectActivateService(operationManager);
- context.registerInjectActivateService(operation);
- context.registerInjectActivateService(servlet);
- }
-
- @Test
- void testGET() throws ServletException, IOException {
- MockSlingHttpServletResponse response = context.response();
- MockSlingHttpServletRequest request = context.request();
- request.setQueryString("operation=openDraft&operation_model_id=abc123");
- servlet.doGet(request, response);
- String res = response.getOutputAsString();
- Assertions.assertNotNull(res);
- Assertions.assertEquals(HttpStatus.SC_OK, response.getStatus());
-
- InputStream is = OperationServletTest.class.getResourceAsStream("/servlets/operation-servlet-sample.json");
- JsonReader expected = Json.createReader(is);
- JsonReader actual = Json.createReader(IOUtils.toInputStream(response.getOutputAsString(), response.getCharacterEncoding()));
- Assertions.assertEquals(expected.read(), actual.read());
- }
-
- @Test
- void testInvalidOp() throws ServletException, IOException {
- // this test should throw UnsupportedOperationException in logs
- MockSlingHttpServletResponse response = context.response();
- MockSlingHttpServletRequest request = context.request();
- request.setQueryString("operation=openDraftNonExistant&operation_model_id=abc123");
- servlet.doGet(request, response);
- String res = response.getOutputAsString();
- Assertions.assertNotNull(res);
- Assertions.assertEquals(0, res.length());
- Assertions.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getStatus());
- }
-
- @Test
- void testIllegalArgOp() throws ServletException, IOException {
- // this test should throw IllegalArgumentException in logs
- Operation custom_op = new CustomOp();
- context.registerService(Operation.class, custom_op);
-
- MockSlingHttpServletResponse response = context.response();
- MockSlingHttpServletRequest request = context.request();
- request.setQueryString("operation=customDraftOp&operation_model_id=abc123");
- servlet.doGet(request, response);
- String res = response.getOutputAsString();
- Assertions.assertNotNull(res);
- Assertions.assertEquals(0, res.length());
- Assertions.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getStatus());
- }
-
- public class CustomOp extends DiscardDraftOperation {
- @Override
- public String getName() {
- return "customDraftOp";
- }
-
- @Override
- public TypeEnum getType() {
- return TypeEnum.SUBMISSION;
- }
- }
-}
diff --git a/examples/all/pom.xml b/examples/all/pom.xml
index 11ed4aa5d4..a171b2c6fb 100644
--- a/examples/all/pom.xml
+++ b/examples/all/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
diff --git a/examples/core/pom.xml b/examples/core/pom.xml
index 164b6e474a..bca7b461b9 100644
--- a/examples/core/pom.xml
+++ b/examples/core/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
@@ -82,10 +82,16 @@
<_metatypeannotations>*
- javax.annotation;version=0.0.0,
- com.adobe.cq.wcm.core.components.models;version="[12.0.0,13.0.0)",
+
+
+ javax.annotation;version=!;resolution:=optional,javax.annotation.meta;version=!;resolution:=optional,
+
*
+
+ core.wcm.components.core;
+ jsoup;
+
@@ -122,6 +128,12 @@
+
+ org.jsoup
+ jsoup
+ 1.15.3
+ compile
+ com.adobe.cqcore.wcm.components.core
@@ -138,13 +150,14 @@
- com.adobe.aem
- aem-sdk-api
+ com.adobe.aemfd
+ aemfd-client-sdk
+ 6.0.1038com.adobe.aem
- aem-forms-sdk-api
+ uber-jarprovided
diff --git a/examples/pom.xml b/examples/pom.xml
index fc1adb557d..a33bb961ea 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml
diff --git a/examples/ui.apps/pom.xml b/examples/ui.apps/pom.xml
index 89e654392d..3ff2091a54 100644
--- a/examples/ui.apps/pom.xml
+++ b/examples/ui.apps/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
@@ -87,7 +87,7 @@
${vault.package.group}core-forms-components-apps
- (1.0.52,)
+ (1.1.6,)${vault.package.group}
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/draftsandsubmissions/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/draftsandsubmissions/.content.xml
deleted file mode 100644
index 4079040829..0000000000
--- a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/draftsandsubmissions/.content.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/switch/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/switch/.content.xml
new file mode 100644
index 0000000000..b1f52e213f
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/switch/.content.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/switch/_cq_template.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/switch/_cq_template.xml
new file mode 100644
index 0000000000..1291bb47f0
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/switch/_cq_template.xml
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/.content.xml
new file mode 100644
index 0000000000..9390fcd533
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/.content.xml
@@ -0,0 +1,7 @@
+
+
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml
new file mode 100644
index 0000000000..0352a0c555
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/linkcomponent/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/linkcomponent/.content.xml
deleted file mode 100644
index eccf01a998..0000000000
--- a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/linkcomponent/.content.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/searchlister/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/searchlister/.content.xml
deleted file mode 100644
index bfe6a470c1..0000000000
--- a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/searchlister/.content.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
diff --git a/examples/ui.content/pom.xml b/examples/ui.content/pom.xml
index 860283e16e..e4fb6d68c7 100644
--- a/examples/ui.content/pom.xml
+++ b/examples/ui.content/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
diff --git a/examples/ui.content/src/main/content/META-INF/vault/filter.xml b/examples/ui.content/src/main/content/META-INF/vault/filter.xml
index 09460d6613..cafeb0485f 100644
--- a/examples/ui.content/src/main/content/META-INF/vault/filter.xml
+++ b/examples/ui.content/src/main/content/META-INF/vault/filter.xml
@@ -19,7 +19,6 @@
-
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/.content.xml
index 128a7a978f..dcf2f19c20 100644
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/.content.xml
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/.content.xml
@@ -29,84 +29,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/switch/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/switch/.content.xml
new file mode 100644
index 0000000000..1390d5be14
--- /dev/null
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/switch/.content.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/termsandconditions/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/termsandconditions/.content.xml
new file mode 100644
index 0000000000..824a08cbbb
--- /dev/null
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/termsandconditions/.content.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/.content.xml
deleted file mode 100644
index 0e4a6c03d6..0000000000
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/.content.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/draftsandsubmissions/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/draftsandsubmissions/.content.xml
deleted file mode 100644
index b1e6e3252e..0000000000
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/draftsandsubmissions/.content.xml
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/link/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/link/.content.xml
deleted file mode 100644
index 65aedd0e65..0000000000
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/link/.content.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/searchlister/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/searchlister/.content.xml
deleted file mode 100644
index 6e4436db37..0000000000
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/forms-and-communications-portal/searchlister/.content.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/it/apps/pom.xml b/it/apps/pom.xml
index 5d49e775e8..54731a6598 100644
--- a/it/apps/pom.xml
+++ b/it/apps/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
diff --git a/it/apps/src/main/content/jcr_root/apps/core/.content.xml b/it/apps/src/main/content/jcr_root/apps/core/.content.xml
index ad1cc0319b..a0ac99e384 100755
--- a/it/apps/src/main/content/jcr_root/apps/core/.content.xml
+++ b/it/apps/src/main/content/jcr_root/apps/core/.content.xml
@@ -1,15 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/it/apps/src/main/content/jcr_root/apps/core/fd/.content.xml b/it/apps/src/main/content/jcr_root/apps/core/fd/.content.xml
new file mode 100755
index 0000000000..a0ac99e384
--- /dev/null
+++ b/it/apps/src/main/content/jcr_root/apps/core/fd/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/it/apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml b/it/apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
new file mode 100755
index 0000000000..80c84be117
--- /dev/null
+++ b/it/apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/it/apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/resources/i18n/ru-ru.json b/it/apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/resources/i18n/ru-ru.json
old mode 100644
new mode 100755
diff --git a/it/config/pom.xml b/it/config/pom.xml
index 12428f84c3..2f56f74bf9 100644
--- a/it/config/pom.xml
+++ b/it/config/pom.xml
@@ -20,7 +20,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
diff --git a/it/content/pom.xml b/it/content/pom.xml
index f1fc7b4dc3..3046dea718 100644
--- a/it/content/pom.xml
+++ b/it/content/pom.xml
@@ -20,7 +20,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/termsandconditions/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/termsandconditions/.content.xml
new file mode 100755
index 0000000000..7256712059
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/termsandconditions/.content.xml
@@ -0,0 +1,7 @@
+
+
diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/termsandconditions/basic/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/termsandconditions/basic/.content.xml
new file mode 100755
index 0000000000..109206d96b
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/termsandconditions/basic/.content.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/accessibility/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/accessibility/.content.xml
index a08ef85bd0..d967a6f18e 100644
--- a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/accessibility/.content.xml
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/accessibility/.content.xml
@@ -2692,6 +2692,26 @@
name="text1685010111735"
textIsRich="true"
value="<p><strong style="font-size: 1rem;">I understand that</strong>:<br>
</p>
<ul>
<li>Child Support can make relevant enquiries to make sure I receive the correct entitlement.</li>
<li>giving false or misleading information is a serious offence.</li>
</ul>"/>
+
+
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/switch/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/switch/basic/.content.xml
new file mode 100644
index 0000000000..9e837ffa87
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/switch/basic/.content.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/.content.xml
new file mode 100644
index 0000000000..3edadd6c63
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml
new file mode 100644
index 0000000000..5abd668750
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/termsandconditions/basic/.content.xml
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/it/core/pom.xml b/it/core/pom.xml
index bbb0f93ee3..29afb0e9e9 100644
--- a/it/core/pom.xml
+++ b/it/core/pom.xml
@@ -18,7 +18,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../../parent/pom.xml
@@ -148,13 +148,31 @@ Import-Package: javax.annotation;version=0.0.0,*
- com.adobe.aem
- aem-sdk-api
+ com.adobe.aemfd
+ aemfd-client-sdk
+
+
+ *
+ *
+
+
-
+
com.adobe.aem
- aem-forms-sdk-api
+ uber-jar
+
+
+ org.osgi
+ org.osgi.service.component.annotations
+ 1.4.0
+ compile
+
+
+ org.osgi
+ org.osgi.service.component
+ 1.5.0
+ compile
diff --git a/jsdocs/pom.xml b/jsdocs/pom.xml
index 9113ec5680..f0cb621e80 100644
--- a/jsdocs/pom.xml
+++ b/jsdocs/pom.xml
@@ -22,7 +22,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml
diff --git a/parent/pom.xml b/parent/pom.xml
index 05df6647b7..ea55257cd2 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -21,7 +21,7 @@
com.adobe.aemcore-forms-components-parentpom
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOTAEM Forms Core Components - ParentParent POM for AEM Forms Core Components
@@ -955,7 +955,7 @@
org.apache.slingorg.apache.sling.models.api
- 1.3.0
+ 1.3.6provided
@@ -1105,30 +1105,21 @@
Jar can be used as dependencies.
-->
-
-
- com.adobe.aem
- uber-jar
- 6.4.0
- apis
- provided
+ com.adobe.aemfd
+ aemfd-client-sdk
+ 6.0.1038
+
com.adobe.aem
- aem-forms-sdk-api
- 2023.09.06.04-230800
-
-
-
- com.adobe.aem
- aem-sdk-api
- 2022.9.8722.20220912T101352Z-220800
+ uber-jar
+ 6.5.15
+ provided
-
junit
diff --git a/pom.xml b/pom.xml
index 364b9d2852..b2f887c73a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,14 +14,14 @@
-->
4.0.0
-
+
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOTparent/pom.xml
@@ -79,14 +79,14 @@
https://github.com/adobe/aem-core-forms-componentsHEAD
-
+
-
+
-
-
+
+
org.codehaus.mojoexec-maven-plugin
@@ -118,7 +118,7 @@
-
+
org.apache.ratapache-rat-plugin
diff --git a/ui.af.apps/pom.xml b/ui.af.apps/pom.xml
index eaa574fda3..905aab021e 100644
--- a/ui.af.apps/pom.xml
+++ b/ui.af.apps/pom.xml
@@ -20,7 +20,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml
@@ -116,7 +116,7 @@
${vault.package.group}core-forms-components-apps
- (1.0.52,)
+ (1.1.6,)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
index d123445537..429772ae7d 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
@@ -5,4 +5,4 @@
cssProcessor="[default:none,min:none]"
jsProcessor="[default:none,min:none]"
categories="[core.forms.components.runtime.all]"
- embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v1.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime]"/>
+ embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v1.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.termsandconditions.v1.runtime,core.forms.components.switch.v1.runtime]"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/_cq_dialog/.content.xml
index f5cfce8fe3..d3fc371401 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/_cq_dialog/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/_cq_dialog/.content.xml
@@ -66,7 +66,7 @@
-
@@ -81,7 +81,7 @@
sling:resourceType="granite/ui/components/coral/foundation/form/switch"
wrapperClass="cmp-adaptiveform-checkbox__enable-unchecked-value"
name="./enableUncheckedValue"
- fieldLabel="Enable Uncheck."
+ fieldLabel="Preserve Uncheck state value."
fieldDescription="Specify the value to be returned when the checkbox is not checked by the user."
uncheckedValue="false"
value="true">
@@ -98,7 +98,7 @@
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
name="./uncheckedValue"/>
-
+
{
- if (this.widget.checked) {
- this._model.value = this._onValue;
- } else {
- this._model.value = this._offValue;
- }
- })
-
- }
-
- updateValue(modelValue) {
- if (modelValue === this._model._jsonModel.enum[0]) {
- this.widget.checked = true
- this.widget.setAttribute(FormView.Constants.HTML_ATTRS.CHECKED, FormView.Constants.HTML_ATTRS.CHECKED)
- this.widget.setAttribute(FormView.Constants.ARIA_CHECKED, true);
- } else {
- this.widget.checked = false
- this.widget.removeAttribute(FormView.Constants.HTML_ATTRS.CHECKED);
- this.widget.setAttribute(FormView.Constants.ARIA_CHECKED, false);
- }
- this.widget.value = modelValue;
- }
}
FormView.Utils.setupField(({element, formContainer}) => {
return new CheckBox({element, formContainer})
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js
index a874dacd33..4abd4e9502 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js
@@ -19,6 +19,7 @@
BINARY: 'binary',
TEXT: 'text',
SELECT: 'select',
+ CHECKBOX: 'checkBox',
LIST: 'list',
DATE: 'date',
NON_INPUT: 'nonInputReadOnly',
@@ -27,6 +28,7 @@
const typeMap = {
'button': fieldTypes.NON_INPUT,
'checkbox-group': fieldTypes.SELECT,
+ 'checkbox': fieldTypes.CHECKBOX,
'date-input': fieldTypes.TEXT,
'drop-down': fieldTypes.SELECT,
'email': fieldTypes.TEXT,
@@ -44,8 +46,8 @@
const preservedProperties = ['id', 'description', 'enabled', 'jcr:created', 'jcr:title', 'name',
'placeholder', 'readOnly', 'required', 'tooltip', 'visible', 'enum', 'enumNames'];
- const cannotBeReplacedWith = ['file-input', 'checkbox'],
- irreplaceable = ['file-input', 'checkbox'],
+ const cannotBeReplacedWith = ['file-input'],
+ irreplaceable = ['file-input'],
editableJsonPath = '.model.json',
componentJsonPath = '.json';
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/ruleeditorhook.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/ruleeditorhook.js
index 1701a1d9ce..df1b90cbb1 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/ruleeditorhook.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/ruleeditorhook.js
@@ -34,7 +34,7 @@
if (!formContainerPath) {
showAlert();
} else {
- let ruleEditorUri = '/aem/af/expeditor.html' + getFormContainerPath(editable) + "?fieldPath=" + editable.path + "&fieldId=" + getFieldId(editable);
+ let ruleEditorUri = getRuleEditorUri(editable);
ruleEditorFrame.setAttribute('src', ruleEditorUri);
ruleEditorFrame.setAttribute('title', 'AF Rule Editor');
ruleEditorFrame.style.display = "block";
@@ -43,7 +43,7 @@
ruleEditorFrame.style.top = "0";
ruleEditorFrame.style.left = "0";
ruleEditorFrame.style.position = "fixed";
- ruleEditorFrame.style.zIndex = "10";
+ ruleEditorFrame.style.zIndex = "1000";
document.body.appendChild(ruleEditorFrame);
}
}
@@ -77,4 +77,9 @@
ui.alert(Granite.I18n.get('Information'), Granite.I18n.get('Please initialise the component to open the rule editor'), 'notice');
}
+ function getRuleEditorUri(editable) {
+ return Granite.HTTP.externalize('/aem/af/expeditor.html' + getFormContainerPath(editable)
+ + "?fieldPath=" + editable.path + "&fieldId=" + getFieldId(editable));
+ }
+
})(jQuery, Granite.author);
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js
index 127d774961..011353bf61 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js
@@ -68,6 +68,9 @@
}
function onInit(e) {
let formContainer = e.detail;
+ if (formContainer._element && !formContainer._element.dir && formLanguage) {
+ formContainer._element.dir = new Intl.Locale(formLanguage).textInfo.direction;
+ }
let formEl = formContainer.getFormElement();
setTimeout(() => {
formEl.classList.remove(FormContainerV2.loadingClass);
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/.content.xml
similarity index 97%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/.content.xml
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/.content.xml
index 6adc8c2f1d..3977155bee 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/.content.xml
@@ -1,6 +1,6 @@
-
+ jcr:primaryType="nt:unstructured">
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/.content.xml
similarity index 75%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/.content.xml
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/.content.xml
index 9d480d9da7..d37f25ea64 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/.content.xml
@@ -1,6 +1,6 @@
+ jcr:title="Adaptive Form Links (v1)"
+ sling:resourceSuperType="core/fd/components/form/checkboxgroup/v1/checkboxgroup"
+ componentGroup=".core-adaptiveform"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/_cq_dialog/.content.xml
new file mode 100644
index 0000000000..daafe839da
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/_cq_dialog/.content.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/_cq_template.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/_cq_template.xml
new file mode 100644
index 0000000000..82b58541c3
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/_cq_template.xml
@@ -0,0 +1,8 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/links.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/links.html
new file mode 100644
index 0000000000..5c16f3a2de
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/links/v1/links/links.html
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/.content.xml
similarity index 97%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/.content.xml
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/.content.xml
index 6adc8c2f1d..0f124317e0 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/.content.xml
@@ -1,6 +1,6 @@
-
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/.content.xml
new file mode 100644
index 0000000000..b6aeaa9684
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/.content.xml
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/README.md
new file mode 100644
index 0000000000..0866540cef
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/README.md
@@ -0,0 +1,79 @@
+
+Adaptive Form Switch (v1)
+====
+Adaptive Form Switch component written in HTL.
+
+## Features
+
+* Provides the following type of input:
+ * switch
+* Custom constraint messages for the above types
+* Styles
+
+### Use Object
+The Form switch component uses the `com.adobe.cq.forms.core.components.models.form.Switch` Sling Model for its Use-object.
+
+### Edit Dialog Properties
+The following properties are written to JCR for this Form Switch component and are expected to be available as `Resource` properties:
+
+1. `./jcr:title` - defines the label to use for this field
+2. `./hideTitle` - if set to `true`, the label of this field will be hidden
+3. `./name` - defines the name of the field, which will be submitted with the form data
+4. `./description` - defines a help message that can be rendered in the field as a hint for the user
+5. `./readOnly` - if set to `true`, the filed will be read only
+6. `./type` - defines the data type of the value
+7. `./enum` - defines the two set of possible values for this field. (On or Off)
+
+## Enum
+Switch component can have only one of two state i.e. ON and OFF. Since the enums are stored as array, the enum at index '0' is assumed to be OFF(i.e. switch is 'off'), and enum at index '1' is ON (i.e. switch is 'on'')
+
+## Client Libraries
+The component provides a `core.forms.components.switch.v1.runtime` client library category that contains the Javascript runtime for the component.
+It should be added to a relevant site client library using the `embed` property.
+
+It also provides a `core.forms.components.switch.v1.editor` editor client library category that includes
+JavaScript handling for dialog interaction. It is already included by its edit dialog.
+
+## BEM Description
+```
+BLOCK cmp-adaptiveform-switch
+ ELEMENT cmp-adaptiveform-switch__label
+ ELEMENT cmp-adaptiveform-switch__widget
+ ELEMENT cmp-adaptiveform-switch__widget-checkbox
+ ELEMENT cmp-adaptiveform-switch__widget-off
+ ELEMENT cmp-adaptiveform-switch__widget-on
+ ELEMENT cmp-adaptiveform-switch__questionmark
+ ELEMENT cmp-adaptiveform-switch__shortdescription
+ ELEMENT cmp-adaptiveform-switch__longdescription
+ ELEMENT cmp-adaptiveform-switch__errormessage
+```
+
+## JavaScript Data Attribute Bindings
+
+The following attributes must be added for the initialization of the switch component in the form view:
+ 1. `data-cmp-is="adaptiveFormSwitch"`
+ 2. `data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"`
+
+
+## Information
+* **Vendor**: Adobe
+* **Version**: v1
+* **Compatibility**: Cloud
+* **Status**: production-ready
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_dialog/.content.xml
new file mode 100644
index 0000000000..ecf2bd1ed5
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_dialog/.content.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_htmlTag/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_htmlTag/.content.xml
new file mode 100644
index 0000000000..e4f5e0221e
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_htmlTag/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_template.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_template.xml
new file mode 100644
index 0000000000..b03445f3cf
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/_cq_template.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/.content.xml
new file mode 100644
index 0000000000..491392d539
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/.content.xml
new file mode 100644
index 0000000000..cb95a62983
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/css.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/css.txt
similarity index 94%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/css.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/css.txt
index 2a147553b0..b3c0d26144 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/css.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/css.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,5 +15,4 @@
###############################################################################
#base=css
-
-linkcomponent.less
\ No newline at end of file
+switcheditor.css
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/css/switcheditor.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/css/switcheditor.css
new file mode 100644
index 0000000000..1d0df87d03
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/css/switcheditor.css
@@ -0,0 +1,15 @@
+.cmp-adaptiveform-switch__enums button {
+ display: none;
+}
+.cmp-adaptiveform-switch__enums coral-multifield-item {
+ padding-right: 0px;
+}
+.coral-Form-fieldwrapper .cmp-adaptiveform-switch__enable-unchecked-value {
+ display:flex;
+ margin-bottom:1px;
+ width:40px;
+}
+
+.cmp-adaptiveform-switch__enable-unchecked-value .coral-Form-fieldlabel {
+ padding-right: 20px;
+}
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/js.txt
similarity index 95%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/js.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/js.txt
index 8292ec4a1b..83b3a1eae4 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/js.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
###############################################################################
#base=js
-formsearch.js
\ No newline at end of file
+editDialog.js
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/js/editDialog.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/js/editDialog.js
new file mode 100644
index 0000000000..aa7b980620
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/editor/js/editDialog.js
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright 2023 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+(function($) {
+ "use strict";
+
+ const EDIT_DIALOG = ".cmp-adaptiveform-switch__editdialog",
+ ENABLE_UNCHECKED_VALUE = EDIT_DIALOG + " .cmp-adaptiveform-switch__enable-unchecked-value",
+ ENUM_OPTION = ".cmp-adaptiveform-switch__enums coral-multifield-item",
+ SWITCH_TYPE = EDIT_DIALOG + " .cmp-adaptiveform-switch__type",
+ SWITCH_DEFAULTVALUE = EDIT_DIALOG + " .cmp-adaptiveform-switch__value",
+ SWITCH_ENUM = EDIT_DIALOG + " .cmp-adaptiveform-base__enum",
+ Utils = window.CQ.FormsCoreComponents.Utils.v1;
+
+ var registerDialogValidator = Utils.registerDialogDataTypeValidators(
+ SWITCH_DEFAULTVALUE,
+ SWITCH_ENUM,
+ function (dialog) {
+ var selectedValue = '';
+ var switchSaveValue = dialog.find(SWITCH_TYPE);
+ if (switchSaveValue && switchSaveValue.length > 0) {
+ selectedValue = switchSaveValue[0].selectedItem ? switchSaveValue[0].selectedItem.value : '';
+ }
+ return selectedValue.toLowerCase();
+ }
+ );
+
+ /**
+ * The off value of a switch is optional, if not defined then no value will be submitted when the switch is not selected.
+ * To explicitly send the off value, user needs to switch the 'enableUncheckedValue' on.
+ * @param dialog
+ */
+ function handleOffFieldVisibility(dialog) {
+ const enableOffValueSwitch = $(ENABLE_UNCHECKED_VALUE)[0];
+ let isChecked = enableOffValueSwitch.hasAttribute('checked');
+ const offField = $($(ENUM_OPTION)[1]);
+
+ offField.css({"display": isChecked ? "block" : "none"})
+ enableOffValueSwitch.addEventListener("click", function() {
+ isChecked = !isChecked;
+ offField.css({"display": isChecked ? "block" : "none"})
+ })
+ }
+
+ Utils.initializeEditDialog(EDIT_DIALOG)(handleOffFieldVisibility, registerDialogValidator);
+
+})(jQuery);
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/.content.xml
new file mode 100644
index 0000000000..538d4bcd59
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/css.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/css.txt
similarity index 95%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/css.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/css.txt
index 5b96611db6..8d36f8ad49 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/css.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/css.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
###############################################################################
#base=css
-search.less
+switchview.css
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/css/switchview.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/css/switchview.css
new file mode 100644
index 0000000000..974dcfd34f
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/css/switchview.css
@@ -0,0 +1,44 @@
+.cmp-adaptiveform-switch {
+}
+
+.cmp-adaptiveform-switch__widget-label {
+}
+
+.cmp-adaptiveform-switch__container {
+}
+
+.cmp-adaptiveform-switch__widget {
+}
+
+.cmp-adaptiveform-switch__widget-slider {
+}
+
+.cmp-adaptiveform-switch__widget-slider:before {
+}
+
+input:checked + .cmp-adaptiveform-switch__widget-slider {
+}
+
+input:focus + .cmp-adaptiveform-switch__widget-slider {
+}
+
+input:checked + .cmp-adaptiveform-switch__widget-slider:before {
+}
+
+.cmp-adaptiveform-switch__widget-slider:before {
+}
+
+.cmp-adaptiveform-switch__longdescription {
+}
+
+.cmp-adaptiveform-switch__questionmark {
+}
+
+.cmp-adaptiveform-switch__errormessage {
+}
+
+.cmp-adaptiveform-switch__help-container .cmp-adaptiveform-switch__questionmark {
+}
+
+.cmp-adaptiveform-switch__shortdescription {
+}
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/js.txt
similarity index 94%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/js.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/js.txt
index 7c4dbd3792..fdc39ed5f7 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/js.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
###############################################################################
#base=js
-linkcomponent.js
\ No newline at end of file
+switchview.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/js/switchview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/js/switchview.js
new file mode 100644
index 0000000000..d7596b29ce
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/clientlibs/site/js/switchview.js
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright 2023 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+(function() {
+
+ "use strict";
+ class Switch extends FormView.FormCheckBox {
+
+ static NS = FormView.Constants.NS;
+ static IS = "adaptiveFormSwitch";
+ static bemBlock = 'cmp-adaptiveform-switch';
+ static selectors = {
+ self: "[data-" + this.NS + '-is="' + this.IS + '"]',
+ widget: `.${Switch.bemBlock}__widget`,
+ label: `.${Switch.bemBlock}__label`,
+ description: `.${Switch.bemBlock}__longdescription`,
+ errorDiv: `.${Switch.bemBlock}__errormessage`,
+ qm: `.${Switch.bemBlock}__questionmark`,
+ tooltipDiv: `.${Switch.bemBlock}__shortdescription`
+ };
+
+ constructor(params) {
+ super(params);
+ }
+
+ getClass() {
+ return Switch.IS;
+ }
+
+ getWidget() {
+ return this.element.querySelector(Switch.selectors.widget);
+ }
+
+ getDescription() {
+ return this.element.querySelector(Switch.selectors.description);
+ }
+
+ getLabel() {
+ return this.element.querySelector(Switch.selectors.label);
+ }
+
+ getErrorDiv() {
+ return this.element.querySelector(Switch.selectors.errorDiv);
+ }
+
+ getTooltipDiv() {
+ return this.element.querySelector(Switch.selectors.tooltipDiv);
+ }
+
+ getQuestionMarkDiv() {
+ return this.element.querySelector(Switch.selectors.qm);
+ }
+ }
+
+ FormView.Utils.setupField(({element, formContainer}) => {
+ return new Switch({element,formContainer})
+ }, Switch.selectors.self);
+})();
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/switch.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/switch.html
new file mode 100644
index 0000000000..8ba8e864f7
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/switch.html
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
${switch.enumNames[1]? switch.enumNames[1] : ''}
+
+
${switch.enumNames[0]}
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/switch.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/switch.js
new file mode 100644
index 0000000000..e9d48689d0
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/switch/v1/switch/switch.js
@@ -0,0 +1,33 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2023 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+use(function () {
+
+ var clientlibsArr = ['core.forms.components.base.v1.editor'];
+ var labelPath = 'core/fd/components/af-commons/v1/fieldTemplates/label.html';
+ var shortDescriptionPath = "core/fd/components/af-commons/v1/fieldTemplates/shortDescription.html";
+ var longDescriptionPath = "core/fd/components/af-commons/v1/fieldTemplates/longDescription.html";
+ var questionMarkPath = "core/fd/components/af-commons/v1/fieldTemplates/questionMark.html";
+ var errorMessagePath = "core/fd/components/af-commons/v1/fieldTemplates/errorMessage.html";
+ return {
+ labelPath: labelPath,
+ shortDescriptionPath: shortDescriptionPath,
+ longDescriptionPath: longDescriptionPath,
+ questionMarkPath: questionMarkPath,
+ errorMessagePath: errorMessagePath,
+ clientlibs: clientlibsArr
+ }
+});
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/.content.xml
new file mode 100644
index 0000000000..491392d539
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/.content.xml
new file mode 100644
index 0000000000..5e25fbe65e
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/.content.xml
@@ -0,0 +1,4 @@
+
+
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/.content.xml
similarity index 67%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/.content.xml
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/.content.xml
index 6adc8c2f1d..b18110bf47 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/.content.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/README.md
new file mode 100644
index 0000000000..445210c2e6
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/README.md
@@ -0,0 +1,82 @@
+
+Adaptive Form Terms and Conditions (v1)
+====
+Adaptive Form Terms and Components field component written in HTL.
+
+## Features
+
+* It is composed of Text Field, CheckBox and CheckBox Groups
+* Allows to author a Terms & Conditions component with either links or Texts.
+* Comes with some OOTB behaviour like
+ * Approval Checkbox is not enabled if the text-area is scrollable and user has not scrolled to the bottom
+ * Approval Checkbox is not enabled if TnC uses Links and user has not visited all the links
+
+### Use Object
+The Form Text component uses the `com.adobe.cq.forms.core.components.models.form.TermsAndConditions` Sling Model for its Use-object.
+
+### Edit Dialog Properties
+The following properties are written to JCR for this Form Text component and are expected to be available as `Resource` properties:
+
+1. `./jcr:title` - defines the label to use for this field
+2. `./hideTitle` - if set to `true`, the label of this field will be hidden
+3. `./name` - defines the name of the field, which will be submitted with the form data
+4. `./default` - defines the default value of the field
+5. `./description` - defines a help message that can be rendered in the field as a hint for the user
+6. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value
+7. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty
+8. `./readOnly` - if set to `true`, the filed will be read only
+9. `./showApprovalOption` - whether to show the approval checkbox or not
+10. `./showLink` - whether to show links instead of Text Content
+11. `./showAsPopup` - whether to show the TNC content as a Modal
+
+## Client Libraries
+The component provides a `core.forms.components.termsandconditions.v1.runtime` client library category that contains the Javascript runtime for the component.
+It should be added to a relevant site client library using the `embed` property.
+
+It also provides a `core.forms.components.termsandconditions.v1.editor` editor client library category that includes
+JavaScript handling for dialog interaction. It is already included by its edit dialog.
+
+## BEM Description
+```
+BLOCK cmp-adaptiveform-termsandcondition
+ ELEMENT cmp-adaptiveform-termsandcondition__label-container
+ ELEMENT cmp-adaptiveform-termsandcondition__label
+ ELEMENT cmp-adaptiveform-termsandcondition__questionmark
+ ELEMENT cmp-adaptiveform-termsandcondition__content-container
+ MODIFIER cmp-adaptiveform-termsandcondition__content-container--modal
+ ELEMENT cmp-adaptiveform-termsandcondition__body
+ ELEMENT cmp-adaptiveform-termsandcondition__header
+ ELEMENT cmp-adaptiveform-termsandcondition__close-button
+ ELEMENT cmp-adaptiveform-termsandcondition__content
+ ELEMENT cmp-adaptiveform-termsandcondition__text
+ ELEMENT cmp-adaptiveform-termsandcondition__text-intersect
+ ELEMENT cmp-adaptiveform-termsandcondition__link
+ ELEMENT cmp-adaptiveform-termsandcondition__approvalcheckbox
+ ELEMENT cmp-adaptiveform-termsandcondition__shortdescription
+ ELEMENT cmp-adaptiveform-termsandcondition__longdescription
+ ELEMENT cmp-adaptiveform-termsandcondition__errormessage
+```
+
+
+
+## JavaScript Data Attribute Bindings
+
+The following attributes must be added for the initialization of the text-input component in the form view:
+1. `data-cmp-is="adaptiveFormTermsAndConditions"`
+2. `data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"`
+3. `data-cmp-visible` having a boolean value to indicate whether the field is currently visible or not
+4. `data-cmp-enabled` having a boolean value to indicate whether the field is currently enabled or not
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_dialog/.content.xml
new file mode 100644
index 0000000000..975ff9051f
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_dialog/.content.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_editConfig.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_editConfig.xml
new file mode 100755
index 0000000000..5eb7044978
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_editConfig.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml
new file mode 100644
index 0000000000..0352a0c555
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/.content.xml
new file mode 100644
index 0000000000..491392d539
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/.content.xml
new file mode 100644
index 0000000000..0c6786f297
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/css.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/css.txt
similarity index 93%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/css.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/css.txt
index 3579cf02ee..e31d85b9c6 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/css.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/css.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
###############################################################################
#base=css
-draftsandsubmissions.less
+termsandconditions.css
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/searchlister.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/css/termsandconditions.css
similarity index 70%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/searchlister.js
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/css/termsandconditions.css
index 8dc095615d..84f90bfe93 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/searchlister.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/css/termsandconditions.css
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright 2021 Adobe
+ * Copyright 2023 Adobe
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,11 +14,9 @@
* limitations under the License.
******************************************************************************/
-use(function () {
- var clientlibsArr = ['core.forms.components.formsportal.searchlister.v1'];
- var layoutPath = 'core/fd/components/commons/v1/itemTemplates/' + this.layout + '.html';
- return {
- clientlibs: clientlibsArr,
- layoutPath: layoutPath
- }
-});
\ No newline at end of file
+.coral-Form-fieldwrapper.cmp-adaptiveform-termsandconditions__showAsLink {
+ display: flex;
+}
+.coral-Form-fieldwrapper.cmp-adaptiveform-termsandconditions__showAsLink label {
+ padding-right: 10px;
+}
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/js.txt
similarity index 93%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/js.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/js.txt
index 9c661eba1d..f135f85471 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/js.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
###############################################################################
#base=js
-draftsandsubmissions.js
\ No newline at end of file
+termsandconditions.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/js/termsandconditions.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/js/termsandconditions.js
new file mode 100644
index 0000000000..8c78ff154c
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/editor/js/termsandconditions.js
@@ -0,0 +1,57 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2023 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* global jQuery */
+(function($) {
+ "use strict";
+
+ var Utils = window.CQ.FormsCoreComponents.Utils.v1,
+ EDIT_DIALOG = ".cmp-adaptiveform-termsandconditions__editdialog";
+
+ function handleToggleOfApprovalOptions(dialog) {
+ var approvalOption = dialog.find('.cmp-adaptiveform-termsandconditions__showapprovaloption[name="./showApprovalOption"]')[0];
+ var showAsPopupWidget = dialog.find('.cmp-adaptiveform-termsandconditions__showaspopup[name="./showAsPopup"]')[0];
+ var showAsPopup = dialog.find('.cmp-adaptiveform-termsandconditions__showaspopup[name="./showAsPopup"]')[0]['checked'];
+ function toggleApprovalOption(show) {
+ if (show) {
+ approvalOption.readOnly=false;
+ approvalOption.style.opacity = "1";
+ } else {
+ approvalOption.readOnly=true;
+ approvalOption.style.opacity = "0.5"
+ }
+ }
+ if (showAsPopup) {
+ if (!approvalOption.checked) {
+ approvalOption['checked']=true;
+ }
+ toggleApprovalOption(false);
+ }
+ showAsPopupWidget.addEventListener('click', function() {
+ showAsPopup = !showAsPopup;
+ if (showAsPopup) {
+ if (!approvalOption.checked) {
+ approvalOption.click();
+ }
+ toggleApprovalOption(false);
+ } else {
+ toggleApprovalOption(true);
+ }
+ })
+ }
+
+ Utils.initializeEditDialog(EDIT_DIALOG)(handleToggleOfApprovalOptions);
+
+})(jQuery);
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/.content.xml
new file mode 100644
index 0000000000..124dfb0e20
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/css.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/css.txt
new file mode 100644
index 0000000000..468a1dcd56
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/css.txt
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright 2023 Adobe
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+#base=css
+termsandconditions.css
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/css/termsandconditions.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/css/termsandconditions.css
new file mode 100644
index 0000000000..6cde69339f
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/css/termsandconditions.css
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright 2023 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+.cmp-adaptiveform-termsandcondition{
+
+}
+
+.cmp-adaptiveform-termsandcondition__label {
+
+}
+
+.cmp-adaptiveform-termsandcondition__content-container {
+
+}
+
+.cmp-adaptiveform-termsandcondition__content-container--modal {
+
+}
+.cmp-adaptiveform-termsandcondition__content-container--modal .cmp-adaptiveform-termsandcondition__body{
+
+}
+.cmp-adaptiveform-termsandcondition__content-container--modal .cmp-adaptiveform-termsandcondition__header{
+
+}
+.cmp-adaptiveform-termsandcondition__content-container--modal .cmp-adaptiveform-termsandcondition__header h3{
+
+}
+
+
+.cmp-adaptiveform-termsandcondition__content-container--modal .cmp-adaptiveform-termsandcondition__close-button {
+
+}
+
+.cmp-adaptiveform-termsandcondition__content-container--modal .cmp-adaptiveform-termsandcondition__content {
+
+}
+
+.cmp-adaptiveform-termsandcondition__text {
+
+}
+
+.cmp-adaptiveform-termsandcondition__link {
+
+}
+
+.cmp-adaptiveform-termsandcondition__approvalcheckbox .cmp-adaptiveform-checkbox__label{
+ cursor:pointer;
+}
+
+.cmp-adaptiveform-termsandcondition__approvalcheckbox {
+
+}
+
+
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/js.txt
similarity index 93%
rename from ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/js.txt
rename to ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/js.txt
index a6caabe505..6aa7350c9e 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/js.txt
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright 2021 Adobe
+# Copyright 2023 Adobe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
###############################################################################
#base=js
-searchlistercomponent.js
\ No newline at end of file
+termsandconditionsview.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/js/termsandconditionsview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/js/termsandconditionsview.js
new file mode 100644
index 0000000000..632f5c6aeb
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/clientlibs/runtime/js/termsandconditionsview.js
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright 2023 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+(function () {
+
+ class TermsAndConditions extends FormView.FormPanel {
+ static NS = FormView.Constants.NS;
+ static IS = "adaptiveFormTermsAndConditions";
+ static bemBlock = 'cmp-adaptiveform-termsandcondition';
+ static selectors = {
+ self: "[data-" + this.NS + '-is="' + this.IS + '"]',
+ label: `.${TermsAndConditions.bemBlock}__label`,
+ description: `.${TermsAndConditions.bemBlock}__longdescription`,
+ qm: `.${TermsAndConditions.bemBlock}__questionmark`,
+ tooltipDiv: `.${TermsAndConditions.bemBlock}__shortdescription`,
+ tncContentWrapper: `.${TermsAndConditions.bemBlock}__content-container`,
+ closePopupButton: `.${TermsAndConditions.bemBlock}__close-button`
+ };
+
+ constructor(params) {
+ super(params);
+ this.#handleScroll()
+ }
+
+ addChild(childView) {
+ super.addChild(childView);
+ if (childView.getModel()._jsonModel.fieldType === 'checkbox-group') {
+ this.#addLinkClickListener(childView);
+ }
+ if (childView.getModel()._jsonModel.fieldType === 'checkbox') {
+ this.#handlePopup(childView);
+ }
+ }
+
+ #addLinkClickListener(childView) {
+ childView.getWidgets().querySelectorAll('label').forEach((item) => {
+ const checkboxInput = item.querySelector('input');
+ item.querySelector('a').addEventListener('click', (e) => {
+ checkboxInput.click();
+ })
+ })
+ }
+
+ #handleScroll() {
+ const intersection = this.element.querySelector('.cmp-adaptiveform-termsandcondition__text-intersect');
+ if (intersection) {
+ const self = this;
+ const io = new IntersectionObserver(onIntersection, {
+ threshold: [1],
+ })
+ function onIntersection ([{isIntersecting}]) {
+ if (isIntersecting) {
+ self.children.filter(c => c.getModel()._jsonModel.fieldType === 'checkbox').forEach(cb => cb.updateEnabled(true))
+ io.unobserve(intersection);
+ }
+ }
+ io.observe(intersection)
+ }
+ }
+
+ #handlePopup(approvalCheckbox) {
+ const closePopUpBtn = this.getClosePopupButton();
+ if (closePopUpBtn) {
+ closePopUpBtn.addEventListener('click', () => {
+ this.toggleAttribute(this.getContentDivWrapper(), false, 'data-cmp-visible', false);
+ })
+
+ approvalCheckbox.label.addEventListener('click', () => {
+ const contentDiv = this.getContentDivWrapper();
+ if (contentDiv) {
+ this.toggleAttribute(this.getContentDivWrapper(), true, 'data-cmp-visible', false);
+ }
+ })
+ }
+ }
+
+ getContentDivWrapper() {
+ return this.element.querySelector(TermsAndConditions.selectors.tncContentWrapper);
+ }
+
+ getClosePopupButton() {
+ return this.element.querySelector(TermsAndConditions.selectors.closePopupButton);
+ }
+
+ getWidget() {
+ return null;
+ }
+
+ getDescription() {
+ return this.element.querySelector(TermsAndConditions.selectors.description);
+ }
+
+ getLabel() {
+ return null;
+ }
+
+ getErrorDiv() {
+ return null;
+ }
+
+ getTooltipDiv() {
+ return this.element.querySelector(TermsAndConditions.selectors.tooltipDiv);
+ }
+
+ getQuestionMarkDiv() {
+ return this.element.querySelector(TermsAndConditions.selectors.qm);
+ }
+ }
+
+ FormView.Utils.setupField(({element, formContainer}) => {
+ return new TermsAndConditions({element, formContainer})
+ }, TermsAndConditions.selectors.self);
+})();
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/termsandconditions.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/termsandconditions.html
new file mode 100644
index 0000000000..df60f8e039
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/termsandconditions.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${"Please review the terms and conditions" @ i18n, context='html'}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/termsandconditions.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/termsandconditions.js
new file mode 100644
index 0000000000..e7bcebd928
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/termsandconditions.js
@@ -0,0 +1,29 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2023 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+use(function () {
+
+ var labelPath = 'core/fd/components/af-commons/v1/fieldTemplates/label.html';
+ var shortDescriptionPath = "core/fd/components/af-commons/v1/fieldTemplates/shortDescription.html";
+ var longDescriptionPath = "core/fd/components/af-commons/v1/fieldTemplates/longDescription.html";
+ var questionMarkPath = "core/fd/components/af-commons/v1/fieldTemplates/questionMark.html";
+ return {
+ labelPath: labelPath,
+ shortDescriptionPath: shortDescriptionPath,
+ longDescriptionPath: longDescriptionPath,
+ questionMarkPath: questionMarkPath
+ }
+});
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/page/v1/page/customheaderlibs.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/page/v1/page/customheaderlibs.html
index 5f15832f26..1530f10f4b 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/page/v1/page/customheaderlibs.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/page/v1/page/customheaderlibs.html
@@ -18,6 +18,11 @@
data-sly-test.clientLibRef="${formstructparser.clientLibRefFromFormContainer}">
+
+
+
diff --git a/ui.apps/pom.xml b/ui.apps/pom.xml
index 429343766b..ec6cb5a86b 100644
--- a/ui.apps/pom.xml
+++ b/ui.apps/pom.xml
@@ -20,7 +20,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml
@@ -271,12 +271,6 @@
-
-
-
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/_cq_editConfig.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/_cq_editConfig.xml
index 8214dde8dc..c38b054a45 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/_cq_editConfig.xml
+++ b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/_cq_editConfig.xml
@@ -24,12 +24,6 @@
handler="CQ.FormsCoreComponents.aemform.v2.actions.openFormForEditing"
icon="alias"
text="Edit in a new window"/>
- 0;
};
@@ -52,7 +36,7 @@
};
ns.aemform.v2.actions.featureEnabled = function (editable) {
- return Granite.Toggles.isEnabled("FT_CQ-4343036");
+ return Granite.Toggles ? Granite.Toggles.isEnabled("FT_CQ-4343036") : true;
};
}(window.Granite, CQ.FormsCoreComponents));
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/formcontainer.html b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/formcontainer.html
index 66291dd3b9..3fab5dcd6e 100644
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/formcontainer.html
+++ b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/aemform/v2/aemform/formcontainer.html
@@ -14,18 +14,12 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-
- ${'Select a form to embed.' @ i18n, locale=request.locale}
- ${'Tap' @ i18n, locale=request.locale}
-
- ${'to embed an existing form or use ' @ i18n, locale=request.locale}
-
- ${'to create and embed a new form.' @ i18n, locale=request.locale}
+ ${'You need to select a Form from the Dialog' @ i18n, locale=request.locale}
-
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/README.md b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/README.md
deleted file mode 100644
index 864e1adab7..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/README.md
+++ /dev/null
@@ -1,74 +0,0 @@
-
-Drafts and Submissions Component (v1)
-====
-AEM Forms Portal Drafts and Submissions component written in HTL. Allows listing of Drafts and Submitted forms of a logged in user.
-
-## Features
-
-### Use Object
-The AEM Forms Portal Drafts and Submissions component uses the `com.adobe.cq.forms.core.components.models.formsportal.DraftsandSubmissions` Sling model as its Use-object.
-
-### Edit Dialog Properties
-The following properties are written to JCR for the AEM Forms Portal DraftsandSubmissions component and are expected to be available as `Resource` properties:
-1. `./title` - specifies title of the component to be displayed.
-2. `./type` - specifies forms portal records type - Drafts / Submissions.
-3. `./layout` - specifies layout of the resultant forms portal records to be displayed.
-4. `./limit` - specifies the number of resultant forms portal records to be displayed at a time.
-
-## BEM Description
-```
-BLOCK cmp-drafts-and-submissions
- ELEMENT cmp-drafts-and-submissions__heading
- ELEMENT cmp-drafts-and-submissions__results
- ELEMENT cmp-drafts-and-submissions__more
- MOD cmp-drafts-and-submissions__more--wrapper
-```
-
-## JavaScript Data Attribute Bindings
-There can be multiple drafts and submissions instances in a page. It is initialized by the clientlib on window state as ready (i.e all dom instances loaded).
-
-A hook attribute from the following should be added to the corresponding element/template so that the JavaScript is able to target it:
-
-```
-data-cmp-hook-draftsandsubmissions="results"
-data-cmp-hook-draftsandsubmissions="itemTemplate"
-data-cmp-hook-draftsandsubmissions="menuTemplate"
-data-cmp-hook-draftsandsubmissions="more"
-```
-
-Following Hooks should be provided by the layout template:
-```
-data-cmp-hook-item-template="item"
-data-cmp-hook-item-template="thumbnail"
-data-cmp-hook-item-template="itemTitle"
-data-cmp-hook-item-template="description"
-data-cmp-hook-item-template="formLink"
-data-cmp-hook-item-template="timeinfo"
-data-cmp-hook-item-template="operations"
-```
-
-The jQuery event `core-forms-itemapi-onload` is used to register the component instance with item injector.
-
-The jQuery event `core-forms-register-operation` is used to register available operation handlers with item injector.
-
-## Information
-* **Vendor**: Adobe
-* **Version**: v1
-* **Compatibility**: AEM Forms as a cloud service
-* **Status**: production-ready
-
-_If you were involved in the authoring of this component and are not credited above, please reach out to us on [GitHub](https://github.com/adobe/aem-core-forms-components)._
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/_cq_dialog/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/_cq_dialog/.content.xml
deleted file mode 100644
index 4ed1a29ba4..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/_cq_dialog/.content.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/.content.xml
deleted file mode 100644
index bea06dd26d..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/.content.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/.content.xml
deleted file mode 100644
index f9063160b4..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/.content.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/css/draftsandsubmissions.less b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/css/draftsandsubmissions.less
deleted file mode 100644
index 741753d8f4..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/css/draftsandsubmissions.less
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-
-.cmp-drafts-and-submissions__more {
- color: #455A64;
- font-size: 16px;
- display: inline-block;
- padding: 5px 18px 5px 18px;
- border-radius: 24px;
-
-
- &:hover {
- background-color: rgb(244, 244, 244);
- border-color: rgb(244, 244, 244);
- }
-
- &:active {
- background-color: rgb(234, 234, 234);
- border-color: rgb(234, 234, 234);
- }
-}
-
-.cmp-drafts-and-submissions__more--wrapper {
- text-align: center;
- display: block;
-}
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/js/draftsandsubmissions.js b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/js/draftsandsubmissions.js
deleted file mode 100644
index bd5ef6f347..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/clientlibs/site/js/draftsandsubmissions.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-
-(function($) {
- var NS = 'cmp',
- IS = 'draftsandsubmissions',
- ATTR_PREFIX = "data-" + NS + "-hook-" + IS;
-
- var keyCodes = {
- ENTER: 13
- }
-
- var selectors = {
- results: "[" + ATTR_PREFIX + "=\"results\"]",
- itemTemplate: "[" + ATTR_PREFIX + "=\"itemTemplate\"]",
- menuTemplate: "[" + ATTR_PREFIX + "=\"menuTemplate\"]",
- loadMore: "[" + ATTR_PREFIX + "=\"more\"]",
- self: "[data-" + NS + '-is="' + IS + '"]'
- };
-
- // All instances are stored in the store object with key being their model's id
- // and ItemAPI is used for item creation and injection
- var componentStore = {}, ItemAPI;
-
- var cleanup = function (id) {
- var componentConfig = componentStore[id];
- ItemAPI.clear(componentConfig.itemTemplate, componentConfig.resultsNode);
- componentConfig.loadmoreNode.style.display = "inline-block";
- },
- hideLoadMore = function (id) {
- var componentConfig = componentStore[id];
- if (componentConfig.loadmoreNode) {
- componentConfig.loadmoreNode.style.display = "none";
- }
- },
- updateSearchResults = function (response, id) {
- var componentConfig = componentStore[id],
- queryResults = response.elements;
- componentConfig.nextOffset = queryResults.pagination.nextOffset;
- queryResults.data.forEach(function(item) {
- ItemAPI.createAndInject(componentConfig, item);
- });
- if (componentConfig.nextOffset < 0) {
- hideLoadMore(id);
- }
- },
- queryFPRecords = function (id, offset) {
- var parameters = new URLSearchParams(),
- componentConfig = componentStore[id];
- if (componentConfig.limit) {
- parameters.append("limit", componentConfig.limit);
- }
- if (offset) {
- parameters.append("offset", offset);
- }
- var queryPath = componentConfig.queryPath + "?" + parameters.toString();
- fetch(queryPath)
- .then(response => response.json())
- .then(data => updateSearchResults(data, id));
- },
- handleKeyPresses = function (event, id) {
- switch (event.keyCode) {
- case keyCodes.ENTER:
- event.preventDefault();
- cleanup(id);
- queryFPRecords(id);
- break;
- default:
- return;
- }
- },
- paginateNext = function (event, id) {
- var componentConfig = componentStore[id];
- if (componentConfig.nextOffset) {
- queryFPRecords(id, componentConfig.nextOffset);
- } else {
- hideLoadMore(id);
- }
- },
- initializeDraftsAndSubmissionsInstance = function (config) {
- if (componentStore[config.id]) {
- // to prevent multiple initializations of same component
- return;
- }
- var componentConfig = config;
-
- componentConfig.componentNode = document.getElementById(config.id);
- componentConfig.resultsNode = componentConfig.componentNode.querySelector(selectors.results);
- componentConfig.loadmoreNode = componentConfig.componentNode.querySelector(selectors.loadMore);
- componentConfig.itemTemplate = componentConfig.componentNode.querySelector(selectors.itemTemplate).innerHTML;
- componentConfig.menuTemplate = componentConfig.componentNode.querySelector(selectors.menuTemplate).innerHTML;
-
- // input node, sort button and filter button are rendered conditionally
- if (componentConfig.inputNode) {
- componentConfig.inputNode.addEventListener("keydown", (event) => {
- handleKeyPresses(event, config.id);
- });
- }
- componentConfig.loadmoreNode.addEventListener("click", (event) => {
- paginateNext(event, config.id)
- });
-
- ItemAPI.init(componentConfig);
-
- componentStore[config.id] = componentConfig;
- cleanup(config.id);
- queryFPRecords(config.id);
- },
- queryDomForAllInstances = function () {
- // This function should execute after DOM is safe to manipulate
- // and we've received ItemAPI, i.e some equivalent of $.ready
- var elements = document.querySelectorAll(selectors.self);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- initializeDraftsAndSubmissionsInstance({
- "id": element.getAttribute("id"),
- "queryPath": element.getAttribute("data-queryPath")
- })
- }
- },
- initializeItemAPI = function (api) {
- if (!ItemAPI) {
- ItemAPI = api;
- queryDomForAllInstances();
- }
- },
- tmpEvent = {
- detail: {
- portalLister: {
- initializeItemAPI: initializeItemAPI
- }
- }
- };
-
- // Using jQuery event api trigger on $.ready
- // wait for window load to prevent any race condition
- $(function() {
- $(window).trigger("core-forms-itemapi-onload", tmpEvent);
- });
-
-}(jQuery));
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/draftsandsubmissions.html b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/draftsandsubmissions.html
deleted file mode 100644
index dcc8677887..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/draftsandsubmissions/v1/draftsandsubmissions/draftsandsubmissions.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
Load more
-
-
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/.content.xml
deleted file mode 100644
index 5e065145a5..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/.content.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/README.md b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/README.md
deleted file mode 100644
index ce815dd6ad..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-
-Link Component (v1)
-====
-Forms and Communications Portal Link component written in HTL.
-
-## Features
-
-### Use Object
-The Link component uses the `com.adobe.cq.forms.core.components.models.formsportal.Link` Sling model as its Use-object.
-
-### Edit Dialog Properties
-The following properties are written to JCR for the Link component and are expected to be available as `Resource` properties:
-
-1. `./title` - Text shown on the link
-2. `./tooltip` - Tooltip on the link
-3. `./assetType` - Type of asset the link refers to (e.g *ADAPTIVE_FORM*)
-4. `./assetPath` - Path to the asset linked
-
-In addition, the nth query parameter is saved as `key` and `value` properties on child node `queryParams/item`.
-
-## BEM Description
-```
-BLOCK cmp-link
- ELEMENT cmp-link__anchor
-```
-
-## Information
-* **Vendor**: Adobe
-* **Version**: v1
-* **Compatibility**: AEM Forms as a cloud service
-* **Status**: production-ready
-
-_If you were involved in the authoring of this component and are not credited above, please reach out to us on [GitHub](https://github.com/adobe/aem-core-forms-components)._
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/_cq_dialog/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/_cq_dialog/.content.xml
deleted file mode 100644
index 95cfe21e0d..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/_cq_dialog/.content.xml
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/.content.xml
deleted file mode 100644
index bea06dd26d..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/.content.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/.content.xml
deleted file mode 100644
index 2846bd6bb3..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/.content.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/css/linkcomponent.less b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/css/linkcomponent.less
deleted file mode 100644
index 675086a87a..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/css/linkcomponent.less
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.cmp-formsportal-link--editor-parameters {
- button {
- border: 1px solid #EAEAEA;
- border-radius: 4px;
- }
-}
-
-.cmp-formsportal-link--editor-parameters__header {
- padding: 17px 117px 9px 17px;
- display: flex;
-
- div {
- width: 100%;
- display: inline-flex;
- }
-
- .cmp-formsportal-link--editor--field__right {
- padding-left: 18px;
- }
-}
-
-.cmp-formsportal-link--editor--field__left {
- width: 40% !important;
-}
-
-.cmp-formsportal-link--editor--field__center {
- padding: 4px;
-}
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/js/linkcomponent.js b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/js/linkcomponent.js
deleted file mode 100644
index dc7082966a..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/clientlibs/editor/js/linkcomponent.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* global jQuery, Coral */
-(function ($, Coral) {
- var initQueryParametersTab = function () {
- var btn = $('.cmp-formsportal-link--editor-parameters > ._coral-Button')[0];
- var multifield = $('.cmp-formsportal-link--editor-parameters')[0];
- var header = $('.cmp-formsportal-link--editor-parameters__header')[0];
-
- if (typeof(btn) !== "undefined") {
- Coral.commons.ready(btn, function() {
- // overrides the default multi-field button
- btn.set({
- label: {
- innerHTML: "Add Item"
- },
- icon: "add"
- });
- });
- }
-
- if (typeof(multifield) !== "undefined") {
- Coral.commons.ready(multifield, function() {
- // toggles hide or show of header based on whether multifield elements presence
- var toggleHeaderShowHide = function () {
- header.hidden = !multifield.items.length;
- };
- multifield.on('change', toggleHeaderShowHide);
- toggleHeaderShowHide();
- });
- }
- };
-
- // wait till dialog load is complete
- $(document).on("dialog-ready", function () {
- initQueryParametersTab();
- });
-}(jQuery, Coral));
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/link.html b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/link.html
deleted file mode 100644
index bc3b1a80b3..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v1/link/link.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/.content.xml
deleted file mode 100644
index a8946d683a..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/.content.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/README.md b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/README.md
deleted file mode 100644
index eef35c7179..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/README.md
+++ /dev/null
@@ -1,55 +0,0 @@
-
-Link Component (v2)
-====
-Forms and Communications Portal Link component written in HTL.
-
-## Features
-Allows adding a hyperlink on a Sites Page to any of the following:
-- An Adaptive Form
-- A PDF
-- An AEM asset
-- An external link
-
-User can also specify any query parameters they want in the link during authoring as well.
-
-### Use Object
-The Link component uses the `com.adobe.cq.forms.core.components.models.formsportal.Link` Sling model as its Use-object.
-
-### Edit Dialog Properties
-The following properties are written to JCR for the Link component and are expected to be available as `Resource` properties:
-
-1. `./title` - Text shown on the link
-2. `./tooltip` - Tooltip on the link
-3. `./accessibiltyLabel` - `aria-label` property on the link
-4. `./assetType` - Type of asset the link refers to (e.g *ADAPTIVE_FORM*)
-5. `./adaptiveFormPath`, `./pdfPath`, `./otherAssetPath`, `./externalLinkPath` - Path to the asset linked, depending on it's type
-
-In addition, the nth query parameter is saved as `key` and `value` properties on child node `queryParams/item`.
-
-## BEM Description
-```
-BLOCK cmp-link
- ELEMENT cmp-link__anchor
-```
-
-## Information
-* **Vendor**: Adobe
-* **Version**: v1
-* **Compatibility**: AEM Forms as a cloud service
-* **Status**: production-ready
-
-_If you were involved in the authoring of this component and are not credited above, please reach out to us on [GitHub](https://github.com/adobe/aem-core-forms-components)._
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/_cq_dialog/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/_cq_dialog/.content.xml
deleted file mode 100644
index 76f17c8af0..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/link/v2/link/_cq_dialog/.content.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/.content.xml
deleted file mode 100644
index 940ffb0ac5..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/.content.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/.content.xml
deleted file mode 100644
index 43ea1a8a74..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/.content.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/.content.xml
deleted file mode 100644
index f6ea1dc0ac..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/.content.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/README.md b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/README.md
deleted file mode 100644
index 1c7409dc3a..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-
-Portal Lister Component (v1)
-====
-AEM Forms Portal Lister component written in HTL.
-
-## Features
-
-### Use Object
-The AEM Forms Portal Lister component uses the `com.adobe.cq.forms.core.components.models.formsportal.PortalLister` Sling model as its Use-object.
-
-### Edit Dialog Properties
-The following properties are written to JCR for the AEM Forms Portal Lister component and are expected to be available as `Resource` properties:
-1. `./title` - specifies title of the component to be displayed.
-2. `./layout` - specifies layout of the resultant forms portal records to be displayed.
-3. `./limit` - specifies the number of resultant forms portal records to be displayed at a time.
-
-The PortalLister Component is not intended to be used directly. It provides basic authoring, pagination and layouting model for other listing elements.
-Consider using Search and Lister or Drafts and Submissions component.
-
-## BEM Description
-```
-BLOCK cmp-portallister
- ELEMENT cmp-portallister__results
- ELEMENT cmp-portallister__item
- ELEMENT cmp-portallister__menu
- ELEMENT cmp-portallister__menu-item
- ELEMENT cmp-portallister__menu-item-label
- ELEMENT cmp-portallister__menu-list
-```
-
-## Information
-* **Vendor**: Adobe
-* **Version**: v1
-* **Compatibility**: AEM Forms as a cloud service
-* **Status**: production-ready
-
-_If you were involved in the authoring of this component and are not credited above, please reach out to us on [GitHub](https://github.com/adobe/aem-core-forms-components)._
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/_cq_dialog/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/_cq_dialog/.content.xml
deleted file mode 100644
index e0a95d6494..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/portallister/v1/portallister/_cq_dialog/.content.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/.content.xml
deleted file mode 100644
index 940ffb0ac5..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/.content.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/.content.xml
deleted file mode 100644
index 82fe68b3b2..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/.content.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/.content.xml
deleted file mode 100644
index 386b969ab5..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/.content.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/README.md b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/README.md
deleted file mode 100644
index 6b6674384a..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-Search And Lister Component (v1)
-====
-Search and Lister component written in HTL. Allows listing of all Adaptive Forms present in the AEM instance on an AEM sites page.
-
-## Features
-
-### Use Object
-The Search and Lister component uses the `com.adobe.cq.forms.core.components.models.formsportal.SearchAndLister` Sling model as its Use-object.
-
-### Behavior
-Pagination is implemented via Load More button, which loads more results lazily. Provided clientlib loads at max `resultLimit` element at a time.
-
-### Edit Dialog Properties
-The following properties are written to JCR for the AEM Forms Portal Link component and are expected to be available as `Resource` properties:
-1. `./title` - Title shown on the Search and Lister
-2. `./limit` - Number of items to retrieve and list at a time
-3. `./layout` - Type of view (e.g *LIST* or *CARD*)
-4. `./disableSearch` - Don't render Search Box
-5. `./disableSort` - Don't render Sort dropdown
-
-`./assetFolders` and `./assetSources` are set as child nodes on the resource indicating
-folders from where forms are to be listed and types which should be displayed (currently only HTML)
-respectively.
-
-## BEM Description
-```
-BLOCK cmp-searchlister
- ELEMENT cmp-search-lister__heading
- ELEMENT cmp-search-lister__more
- ELEMENT cmp-search-lister__search-container
- ELEMENT cmp-search-lister__search-box
- ELEMENT cmp-search-lister__search-box-text
- ELEMENT cmp-search-lister__search-sortbutton
- MOD cmp-search-lister__search-sortbutton--wrapper
- MOD cmp-search-lister__search-sortbutton--right
- ELEMENT cmp-search-lister__results
- ELEMENT cmp-search-lister__item
-```
-## JavaScript Data Attribute Bindings
-There can be multiple search and lister instances in a page. It is initialized by the clientlib on window state as ready (i.e all dom instances loaded).
-
-A hook attribute from the following should be added to the corresponding element/template so that the JavaScript is able to target it:
-
-```
-data-cmp-hook-formssearch="input"
-data-cmp-hook-formssearch="filter"
-data-cmp-hook-formssearch="sort"
-data-cmp-hook-formssearch="results"
-data-cmp-hook-formssearch="itemTemplate"
-data-cmp-hook-formssearch="more"
-```
-
-Following Hooks should be provided by the layout template:
-```
-data-cmp-hook-item-template="item"
-data-cmp-hook-item-template="thumbnail"
-data-cmp-hook-item-template="itemTitle"
-data-cmp-hook-item-template="description"
-data-cmp-hook-item-template="formLink"
-```
-
-The jQuery event `core-forms-itemapi-onload` is used to register the component instance with item injector.
-
-## Information
-* **Vendor**: Adobe
-* **Version**: v1
-* **Compatibility**: AEM Forms as a cloud service
-* **Status**: production-ready
-
-_If you were involved in the authoring of this component and are not credited above, please reach out to us on [GitHub](https://github.com/adobe/aem-core-forms-components)._
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/_cq_dialog/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/_cq_dialog/.content.xml
deleted file mode 100644
index ce11b0c31d..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/_cq_dialog/.content.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/.content.xml
deleted file mode 100644
index 30db788c0c..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/.content.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/.content.xml
deleted file mode 100644
index adf57f2b1a..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/.content.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/js/searchlistercomponent.js b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/js/searchlistercomponent.js
deleted file mode 100644
index 9bd058b708..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/editor/js/searchlistercomponent.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Copyright 2021 Adobe
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* global jQuery, Coral */
-(function ($, Coral) {
- var initAssetSourcesTab = function () {
- var btn = $('.cmp-formsportal-searchandlister--editor-parameters > ._coral-Button')[0];
-
- if (typeof(btn) !== "undefined") {
- Coral.commons.ready(btn, function() {
- // overrides the default multi-field button
- btn.set({
- label: {
- innerHTML: "Add another location"
- },
- icon: "add"
- });
- });
- }
- };
-
- // wait till dialog load is complete
- $(document).on("dialog-ready", function () {
- initAssetSourcesTab();
- });
-}(jQuery, Coral));
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/.content.xml b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/.content.xml
deleted file mode 100644
index 2700bcd2a9..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/.content.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/css/search.less b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/css/search.less
deleted file mode 100644
index 1680870155..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/css/search.less
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-
-.cmp-search-lister__search {
- height: 40px;
-
- &-box {
- position: relative;
- width: 35%;
- display: inline-block;
-
- // search icon via font awesome.
- &:before {
- content: "\f002";
- position: absolute;
- font-family: 'Font Awesome 5 Free';
- font-weight: 900;
- padding-left: 14px;
- padding-top: 10px;
- }
-
- &-text {
- width: 100%;
- height: 40px;
- padding-left: 40px;
- border-radius: 4px;
- border-style: solid;
- border-color: #ECEFF1;
- background-color: #ECEFF1;
- margin-bottom: 5px;
-
- &:focus {
- background-color: #FFFFFF;
- }
- }
- }
-
- &-sortbutton {
- height: 40px;
- background-color: #FFFFFF;
- border: 1px solid #CFD8DC;
- border-radius: 4px;
- padding-left: 10px;
- padding-right: 5px;
-
- &--wrapper {
- display: inline;
- }
-
- &--right {
- float: right;
- }
- }
-}
-
-.cmp-search-lister__more {
- color: #455A64;
- font-size: 16px;
- display: inline-block;
- padding: 5px 18px 5px 18px;
- border-radius: 24px;
-
-
- &:hover {
- background-color: rgb(244, 244, 244);
- border-color: rgb(244, 244, 244);
- }
-
- &:active {
- background-color: rgb(234, 234, 234);
- border-color: rgb(234, 234, 234);
- }
-}
-
-.cmp-search-lister__more--wrapper {
- text-align: center;
- display: block;
-}
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/js/formsearch.js b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/js/formsearch.js
deleted file mode 100644
index 6956f1364f..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/clientlibs/site/js/formsearch.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright 2021 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-
-(function($) {
- var NS = 'cmp',
- IS = 'formssearch',
- ATTR_PREFIX = "data-" + NS + "-hook-" + IS;
-
- var keyCodes = {
- ENTER: 13
- }
-
- var selectors = {
- results: "[" + ATTR_PREFIX + "=\"results\"]",
- searchInput: "[" + ATTR_PREFIX + "=\"input\"]",
- itemTemplate: "[" + ATTR_PREFIX + "=\"itemTemplate\"]",
- loadMore: "[" + ATTR_PREFIX + "=\"more\"]",
- sortButton: "[" + ATTR_PREFIX + "=\"sort\"]",
- filterButton: "[" + ATTR_PREFIX + "=\"filter\"]",
- self: "[data-" + NS + '-is="' + IS + '"]',
- };
-
- // All instances are stored in the store object with key being their model's id
- // and ItemAPI is used for item creation and injection
- var componentStore = {}, ItemAPI;
-
- var cleanup = function (id) {
- var componentConfig = componentStore[id];
- ItemAPI.clear(componentConfig.itemTemplate, componentConfig.resultsNode);
- componentConfig.loadmoreNode.style.display = "inline-block";
- },
- hideLoadMore = function (id) {
- var componentConfig = componentStore[id];
- if (componentConfig.loadmoreNode) {
- componentConfig.loadmoreNode.style.display = "none";
- }
- },
- updateSearchResults = function (response, id) {
- var componentConfig = componentStore[id],
- queryResults = response.elements;
- componentConfig.nextOffset = queryResults.pagination.nextOffset;
- queryResults.data.forEach(function(item) {
- ItemAPI.createAndInject(componentConfig, item);
- });
- },
- queryFPAssets = function (id, offset) {
- var parameters = new URLSearchParams(),
- componentConfig = componentStore[id];
- if (componentConfig.inputNode && componentConfig.inputNode.value) {
- // Filtering to come with Advanced Search
- // if (componentConfig.filter) {
- // parameters.append(componentConfig.filter, componentConfig.inputNode.value);
- // }
- parameters.append("searchText", componentConfig.inputNode.value);
- }
- if (componentConfig.sort) {
- parameters.append("orderby", "title");
- parameters.append("sort", componentConfig.sort);
- }
- if (componentConfig.limit) {
- parameters.append("limit", componentConfig.limit);
- }
- if (offset) {
- parameters.append("offset", offset);
- }
- var queryPath = componentConfig.queryPath + "?" + parameters.toString();
- fetch(queryPath)
- .then(response => response.json())
- .then(data => updateSearchResults(data, id));
- },
- handleKeyPresses = function (event, id) {
- switch (event.keyCode) {
- case keyCodes.ENTER:
- event.preventDefault();
- cleanup(id);
- queryFPAssets(id);
- break;
- default:
- return;
- }
- },
- paginateNext = function (event, id) {
- var componentConfig = componentStore[id];
- if (componentConfig.nextOffset && componentConfig.nextOffset > 0) {
- queryFPAssets(id, componentConfig.nextOffset);
- } else {
- hideLoadMore(id);
- }
- },
- initializeSearchAndListerInstance = function (config) {
- if (componentStore[config.id]) {
- // to prevent multiple initializations of same component
- return;
- }
- var componentConfig = config;
-
- componentConfig.componentNode = document.getElementById(config.id);
- componentConfig.resultsNode = componentConfig.componentNode.querySelector(selectors.results);
- componentConfig.inputNode = componentConfig.componentNode.querySelector(selectors.searchInput);
- componentConfig.loadmoreNode = componentConfig.componentNode.querySelector(selectors.loadMore);
- componentConfig.sortBtnNode = componentConfig.componentNode.querySelector(selectors.sortButton);
- componentConfig.filterBtnNode = componentConfig.componentNode.querySelector(selectors.filterButton);
- componentConfig.itemTemplate = componentConfig.componentNode.querySelector(selectors.itemTemplate).innerHTML;
-
- componentStore[config.id] = componentConfig;
-
- // input node, sort button and filter button are rendered conditionally
- if (componentConfig.inputNode) {
- componentConfig.inputNode.addEventListener("keydown", (event) => {
- handleKeyPresses(event, config.id);
- });
- }
- if (componentConfig.sortBtnNode) {
- componentConfig.sortBtnNode.addEventListener("change", (event) => {
- componentConfig.sort = componentConfig.sortBtnNode.value;
- cleanup(config.id);
- queryFPAssets(config.id);
- });
- }
- if (componentConfig.filterBtnNode) {
- componentConfig.filterBtnNode.addEventListener("change", (event) => {
- componentConfig.filter = componentConfig.filterBtnNode.value;
- cleanup(config.id);
- queryFPAssets(config.id);
- });
- }
- componentConfig.loadmoreNode.addEventListener("click", (event) => {
- paginateNext(event, config.id)
- });
-
- ItemAPI.init(componentConfig);
-
- cleanup(config.id);
- queryFPAssets(config.id);
- },
- queryDomForAllInstances = function () {
- // This function should execute after DOM is safe to manipulate
- // and we've received ItemAPI, i.e some equivalent of $.ready
- var elements = document.querySelectorAll(selectors.self);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- initializeSearchAndListerInstance({
- "id": element.getAttribute("id"),
- "queryPath": element.getAttribute("data-queryPath")
- })
- }
- },
- initializeItemAPI = function (api) {
- if (!ItemAPI) {
- ItemAPI = api;
- queryDomForAllInstances();
- }
- },
- tmpEvent = {
- detail: {
- portalLister: {
- initializeItemAPI: initializeItemAPI,
- }
- }
- };
-
- // Using jQuery event api trigger on $.ready
- // wait for window load to prevent any race condition
- $(function() {
- $(window).trigger("core-forms-itemapi-onload", tmpEvent);
- });
-
-}(jQuery));
\ No newline at end of file
diff --git a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/searchlister.html b/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/searchlister.html
deleted file mode 100644
index 1c70f72627..0000000000
--- a/ui.apps/src/main/content/jcr_root/apps/core/fd/components/formsportal/searchlister/v1/searchlister/searchlister.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
Forms Portal
-
-
-
-
-
-
-
-
-
-
-
Load more
-
-
-
-
-
diff --git a/ui.frontend/pom.xml b/ui.frontend/pom.xml
index 008417493b..99fb705ffb 100644
--- a/ui.frontend/pom.xml
+++ b/ui.frontend/pom.xml
@@ -16,7 +16,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml4.0.0
@@ -119,4 +119,4 @@
-
\ No newline at end of file
+
diff --git a/ui.frontend/src/index.js b/ui.frontend/src/index.js
index 99eed1aac0..3158145bbf 100644
--- a/ui.frontend/src/index.js
+++ b/ui.frontend/src/index.js
@@ -15,8 +15,8 @@
******************************************************************************/
import Utils from "./utils.js";
import LanguageUtils from "./LanguageUtils.js";
-import {createFormInstance, FileObject, extractFileInfo, Click, Change, Submit, Blur, AddItem, RemoveItem} from "@aemforms/af-core";
-import {FormField, FormContainer, FormFieldBase, FormPanel, FormTabs} from "./view/index.js";
+import {createFormInstance, FileObject, extractFileInfo, Click, Change, Submit, Blur, AddItem, RemoveItem, CustomEvent} from "@aemforms/af-core";
+import {FormField, FormContainer, FormFieldBase, FormPanel, FormTabs, FormCheckBox} from "./view/index.js";
import {Constants} from "./constants.js";
import GuideBridge from "./GuideBridge.js";
import HTTPAPILayer from "./HTTPAPILayer.js";
@@ -47,7 +47,7 @@ window.guideBridge = new GuideBridge();
* @property {string} RemoveItem - The action for removing an item.
*/
const Actions = {
- Click, Change, Submit, Blur, AddItem, RemoveItem
+ Click, Change, Submit, Blur, AddItem, RemoveItem, CustomEvent
}
/**
@@ -77,4 +77,4 @@ const FileAttachmentUtils = {
*/
-export {createFormInstance, FormTabs, FormField, FormFieldBase, FormPanel, FormContainer, Constants, Utils, Actions, HTTPAPILayer, FileAttachmentUtils, Formatters, LanguageUtils, FunctionRuntime};
+export {createFormInstance, FormTabs, FormField, FormFieldBase, FormPanel, FormContainer, Constants, Utils, Actions, HTTPAPILayer, FileAttachmentUtils, Formatters, LanguageUtils, FunctionRuntime, FormCheckBox};
diff --git a/ui.frontend/src/view/FormCheckBox.js b/ui.frontend/src/view/FormCheckBox.js
new file mode 100644
index 0000000000..c8a1c879fc
--- /dev/null
+++ b/ui.frontend/src/view/FormCheckBox.js
@@ -0,0 +1,60 @@
+import FormPanel from "./FormPanel";
+
+/*******************************************************************************
+ * Copyright 2023 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+import FormFieldBase from "./FormFieldBase.js";
+
+/**
+ * Class representing components baed on CheckBox.
+ * @extends module:FormView~FormPanel
+ */
+class FormCheckBox extends FormFieldBase {
+
+ constructor(params) {
+ super(params);
+ }
+
+ updateValue(modelValue) {
+ if (modelValue === this._model._jsonModel.enum[0]) {
+ this.widget.checked = true
+ this.widget.setAttribute(FormView.Constants.HTML_ATTRS.CHECKED, FormView.Constants.HTML_ATTRS.CHECKED)
+ this.widget.setAttribute(FormView.Constants.ARIA_CHECKED, true);
+ } else {
+ this.widget.checked = false
+ this.widget.removeAttribute(FormView.Constants.HTML_ATTRS.CHECKED);
+ this.widget.setAttribute(FormView.Constants.ARIA_CHECKED, false);
+ }
+ this.widget.value = modelValue;
+ super.updateEmptyStatus();
+ }
+
+ setModel(model) {
+ super.setModel(model);
+ this._onValue = this._model._jsonModel.enum[0];
+ this._offValue = this._model._jsonModel.enum[1];
+ this.widget.addEventListener('change', (e) => {
+ if (this.widget.checked) {
+ this._model.value = this._onValue;
+ } else {
+ this._model.value = this._offValue;
+ }
+ })
+
+ }
+}
+
+export default FormCheckBox;
\ No newline at end of file
diff --git a/ui.frontend/src/view/index.js b/ui.frontend/src/view/index.js
index 23320876e5..dc8ff70897 100644
--- a/ui.frontend/src/view/index.js
+++ b/ui.frontend/src/view/index.js
@@ -18,6 +18,7 @@ import FormField from "./FormField.js";
import FormFieldBase from "./FormFieldBase.js";
import FormPanel from "./FormPanel.js";
import FormTabs from "./FormTabs";
+import FormCheckBox from "./FormCheckBox";
-export {FormField, FormContainer, FormFieldBase, FormPanel, FormTabs}
+export {FormField, FormContainer, FormFieldBase, FormPanel, FormTabs, FormCheckBox}
diff --git a/ui.tests/pom.xml b/ui.tests/pom.xml
index 99f6996b9d..998a122eee 100644
--- a/ui.tests/pom.xml
+++ b/ui.tests/pom.xml
@@ -24,7 +24,7 @@
com.adobe.aemcore-forms-components-parent
- 2.0.57-SNAPSHOT
+ 1.1.25-SNAPSHOT../parent/pom.xml
diff --git a/ui.tests/test-module/cypress.json b/ui.tests/test-module/cypress.json
index 3d3ea4a619..a056182833 100644
--- a/ui.tests/test-module/cypress.json
+++ b/ui.tests/test-module/cypress.json
@@ -12,7 +12,7 @@
"viewportHeight" : 900,
"viewportWidth" : 1440,
"pageLoadTimeout" : 200000,
- "defaultCommandTimeout" : 10000,
+ "defaultCommandTimeout" : 30000,
"responseTimeout" : 120000,
"watchForFileChanges" : true,
"trashAssetsBeforeRuns" : true,
diff --git a/ui.tests/test-module/libs/commons/formsConstants.js b/ui.tests/test-module/libs/commons/formsConstants.js
index a54b572f16..b12316f0ef 100644
--- a/ui.tests/test-module/libs/commons/formsConstants.js
+++ b/ui.tests/test-module/libs/commons/formsConstants.js
@@ -44,8 +44,10 @@ var formsConstants = {
"wizard": "/apps/forms-components-examples/components/form/wizard",
"title": "/apps/forms-components-examples/components/form/title",
"checkbox": "/apps/forms-components-examples/components/form/checkbox",
+ "switch": "/apps/forms-components-examples/components/form/switch",
"fragment": "/apps/forms-components-examples/components/form/fragment",
"fragmentcontainer": "/apps/forms-components-examples/components/form/fragmentcontainer",
+ "termsandconditions": "/apps/forms-components-examples/components/form/termsandconditions"
}
},
resourceType : {
diff --git a/ui.tests/test-module/libs/commons/localeDataSets.js b/ui.tests/test-module/libs/commons/localeDataSets.js
index 2de94b08dc..1de4a434bb 100644
--- a/ui.tests/test-module/libs/commons/localeDataSets.js
+++ b/ui.tests/test-module/libs/commons/localeDataSets.js
@@ -15,7 +15,6 @@ const selectors = {
SUBMIT: '.submit span',
TELEPHONE_INPUT: 'div[class="cmp-adaptiveform-telephoneinput"] label',
TEXT_INPUT: '.cmp-adaptiveform-textinput__label',
- TITLE: '.cmp-title__text',
WIZARD: '.cmp-adaptiveform-wizard__label'
}
@@ -40,7 +39,6 @@ const languages = [
SUBMIT: 'Submit',
TELEPHONE_INPUT: 'Telephone Input',
TEXT_INPUT: 'Text Input',
- TITLE: 'Title',
WIZARD: 'wizard'
},
I18N_STRINGS: {
@@ -68,7 +66,6 @@ const languages = [
SUBMIT: 'Senden',
TELEPHONE_INPUT: 'Telefoneingang',
TEXT_INPUT: 'Texteingabe',
- TITLE: 'Titel',
WIZARD: 'Zauberer'
},
I18N_STRINGS: {
@@ -96,7 +93,6 @@ const languages = [
SUBMIT: '送信',
TELEPHONE_INPUT: '電話入力',
TEXT_INPUT: 'テキスト入力',
- TITLE: 'タイトル',
WIZARD: '魔法使い'
},
I18N_STRINGS: {
@@ -124,7 +120,6 @@ const languages = [
SUBMIT: 'Invia',
TELEPHONE_INPUT: 'Ingresso telefonico',
TEXT_INPUT: 'Immissione di testo',
- TITLE: 'Titolo',
WIZARD: 'mago'
},
I18N_STRINGS: {
@@ -152,7 +147,6 @@ const languages = [
SUBMIT: 'Envoyer',
TELEPHONE_INPUT: 'Entrée téléphonique',
TEXT_INPUT: 'Saisie de texte',
- TITLE: 'Titre',
WIZARD: 'Sorcier'
},
I18N_STRINGS: {
@@ -180,7 +174,6 @@ const languages = [
SUBMIT: 'Enviar',
TELEPHONE_INPUT: 'Entrada telefónica',
TEXT_INPUT: 'Entrada de texto',
- TITLE: 'Título',
WIZARD: 'Hechicero'
},
I18N_STRINGS: {
@@ -208,7 +201,6 @@ const languages = [
SUBMIT: '전송',
TELEPHONE_INPUT: '전화 입력',
TEXT_INPUT: '텍스트 입력',
- TITLE: '타이틀',
WIZARD: '마법사'
},
I18N_STRINGS: {
@@ -236,7 +228,6 @@ const languages = [
SUBMIT: '提交',
TELEPHONE_INPUT: '電話輸入',
TEXT_INPUT: '文本輸入',
- TITLE: '標題',
WIZARD: '巫師'
},
I18N_STRINGS: {
@@ -265,7 +256,6 @@ const languages = [
SUBMIT: '提交',
TELEPHONE_INPUT: '电话输入',
TEXT_INPUT: '文本输入',
- TITLE: '标题',
WIZARD: '巫师'
},
I18N_STRINGS: {
@@ -293,7 +283,6 @@ const languages = [
SUBMIT: 'Enviar',
TELEPHONE_INPUT: 'Entrada por telefone',
TEXT_INPUT: 'Entrada de texto',
- TITLE: 'Título',
WIZARD: 'mago'
},
I18N_STRINGS: {
@@ -322,7 +311,6 @@ const languages = [
SUBMIT: 'Отправить',
TELEPHONE_INPUT: 'Телефонный вход',
TEXT_INPUT: 'Ввод текста',
- TITLE: 'Титул',
WIZARD: 'колдун'
},
I18N_STRINGS: {
@@ -351,7 +339,6 @@ const languages = [
SUBMIT: 'जमा करें',
TELEPHONE_INPUT: 'टेलीफ़ोन इनपुट',
TEXT_INPUT: 'पाठ इनपुट',
- TITLE: 'उपाधि',
WIZARD: 'जादूगर'
},
I18N_STRINGS: {
@@ -365,4 +352,4 @@ const languages = [
];
module.exports.languages = languages;
-module.exports.selectors = selectors;
\ No newline at end of file
+module.exports.selectors = selectors;
diff --git a/ui.tests/test-module/libs/commons/sitesSelectors.js b/ui.tests/test-module/libs/commons/sitesSelectors.js
index fe274b50d0..d3334bbec8 100644
--- a/ui.tests/test-module/libs/commons/sitesSelectors.js
+++ b/ui.tests/test-module/libs/commons/sitesSelectors.js
@@ -27,8 +27,8 @@ var selectors = {
confirmDialog : {
self : "coral-dialog.is-open[role='dialog']",
actions : {
- first : "coral-dialog.is-open[role='dialog'] coral-dialog-footer [is='coral-button']:first-child",
- last : "coral-dialog.is-open[role='dialog'] coral-dialog-footer [is='coral-button']:last-child"
+ first : ".cq-dialog-cancel",
+ last : ".cq-dialog-submit"
}
},
alertDialog : {
@@ -184,4 +184,4 @@ var selectors = {
}
};
-module.exports = selectors;
\ No newline at end of file
+module.exports = selectors;
diff --git a/ui.tests/test-module/libs/support/commands.js b/ui.tests/test-module/libs/support/commands.js
index c1e9e351b3..1e10d3d1b6 100644
--- a/ui.tests/test-module/libs/support/commands.js
+++ b/ui.tests/test-module/libs/support/commands.js
@@ -332,6 +332,7 @@ Cypress.Commands.add("initializeEventHandlerOnWindow", (eventName) => {
return cy.wrap(isEventComplete); // return a chainable object
});
+
const waitForFormInit = () => {
const INIT_EVENT = "AF_FormContainerInitialised"
return cy.document().then(document => {
@@ -533,7 +534,7 @@ Cypress.Commands.add("deleteComponentByTitle", (title) => {
Cypress.Commands.add("insertComponent", (selector, componentString, componentType) => {
//Open toolbar of root panel
const insertComponentDialog_Selector = '.InsertComponentDialog-components [value="' + componentType + '"]',
- insertComponentDialog_searchField = ".InsertComponentDialog-components input[type='search']";
+ insertComponentDialog_searchField = ".InsertComponentDialog-components .coral3-Search-input";
cy.openEditableToolbar(selector);
cy.get(guideSelectors.editableToolbar.actions.insert).should('be.visible').click();
recurse(
@@ -621,7 +622,7 @@ Cypress.Commands.add("openSidePanelTab", (tab) => {
cy.get("#Content .toggle-sidepanel").click();
}
});
- var tabSelector = '[role="tablist"] [role="tab"][title="' + tab + '"]';
+ var tabSelector = 'coral-tablist coral-tab[title="' + tab + '"]';
cy.get(tabSelector)
.should("be.visible")
.click();
diff --git a/ui.tests/test-module/libs/support/index.js b/ui.tests/test-module/libs/support/index.js
index 97be355dca..0ea699c117 100644
--- a/ui.tests/test-module/libs/support/index.js
+++ b/ui.tests/test-module/libs/support/index.js
@@ -50,6 +50,11 @@ Cypress.on('uncaught:exception', (err, runnable) => {
if (err.message.includes('getEditContext')) {
return false;
}
+ // sometimes on 6.5, the editable toolbar parent div is hidden
+ if (err.message.includes('is not visible because its parent')) {
+ return false;
+ }
+
if (err.message.includes("reading 'extend'")) {
return false;
}
diff --git a/ui.tests/test-module/specs/aemEmbedContainer/aemformcontainer.authoring.spec.js b/ui.tests/test-module/specs/aemEmbedContainer/aemformcontainer.authoring.spec.js
index 830cd90380..edfe2f7be1 100644
--- a/ui.tests/test-module/specs/aemEmbedContainer/aemformcontainer.authoring.spec.js
+++ b/ui.tests/test-module/specs/aemEmbedContainer/aemformcontainer.authoring.spec.js
@@ -89,8 +89,8 @@ describe('Page - Authoring', function () {
// click configure action on Adaptive Form - Embed component
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + aemFormContainerEditPathSelector);
cy.invokeEditableAction("[data-action='CONFIGURE']");
- cy.get("[name='./formRef'] > div > div > input").should("be.visible").clear().type("/content/dam/formsanddocuments/core-components-it/blank").blur(); // adding a v2 form path
- cy.get("._coral-Menu-itemLabel:contains(/content/dam/formsanddocuments/core-components-it/blank)").should("be.visible").click(); // clicking on the displayed option
+ cy.get("[name='./formRef'] > div > div > input").should("be.visible").clear().type("/content/dam/formsanddocuments/core-components-it/blank", { delay: 0 }).click(); // adding a v2 form path
+ cy.get(".foundation-picker-buttonlist button").should("be.visible").click(); // clicking on the displayed option
cy.get(".cmp-adaptiveform-aemform__themeref").should("not.be.visible"); // the themeref dropdown must be hidden
cy.get(sitesSelectors.confirmDialog.actions.first).click();
});
diff --git a/ui.tests/test-module/specs/checkboxgroup/checkboxgroup.authoring.spec.js b/ui.tests/test-module/specs/checkboxgroup/checkboxgroup.authoring.spec.js
index 48c528b503..64f37634fb 100644
--- a/ui.tests/test-module/specs/checkboxgroup/checkboxgroup.authoring.spec.js
+++ b/ui.tests/test-module/specs/checkboxgroup/checkboxgroup.authoring.spec.js
@@ -114,35 +114,36 @@ describe('Page - Authoring', function () {
});
it ('check value type validations', function() {
- // For Number Type
- dropCheckBoxGroupInContainer();
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + checkBoxGroupEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']");
- cy.get('.cmp-adaptiveform-checkboxgroup__type').click();
- cy.get("coral-selectlist-item-content").contains('Number').should('be.visible').click({force: true});
+ // For Number Type
+ dropCheckBoxGroupInContainer();
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + checkBoxGroupEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']");
+ cy.get('.cmp-adaptiveform-checkboxgroup__type').click();
+ cy.get("coral-selectlist-item").contains('Number').should('be.visible').click({force: true});
- cy.get('.cmp-adaptiveform-checkboxgroup__value button').click();
- cy.get(".cmp-adaptiveform-checkboxgroup__value input").invoke('val', 'Not a Number');
- cy.get('.cq-dialog-submit').click();
- cy.get('._coral-Tooltip-label').should('contain.text', 'Value Type Mismatch');
+ cy.get('.cmp-adaptiveform-checkboxgroup__value button').click();
+ cy.get(".cmp-adaptiveform-checkboxgroup__value input").invoke('val', 'Not a Number');
+ cy.get('.cq-dialog-submit').click();
+ cy.get('.coral3-Tooltip--error coral-tooltip-content').should('be.visible').should('have.text', 'Value Type Mismatch');
- cy.get('.cq-dialog-cancel').click();
- cy.deleteComponentByPath(checkBoxGroupDrop);
- // For Boolean
- dropCheckBoxGroupInContainer();
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + checkBoxGroupEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']");
- cy.get('.cmp-adaptiveform-checkboxgroup__type').click();
- cy.get("coral-selectlist-item-content").contains('Boolean').should('be.visible').click({force: true});
-
- cy.get('.cmp-adaptiveform-checkboxgroup__value button').click();
- cy.get(".cmp-adaptiveform-checkboxgroup__value input").invoke('val', 'Not a Boolean');
- cy.get('.cq-dialog-submit').click();
- cy.get('._coral-Tooltip-label').should('contain.text', 'Value Type Mismatch');
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(checkBoxGroupDrop);
- cy.get('.cq-dialog-cancel').click();
- cy.deleteComponentByPath(checkBoxGroupDrop);
+ // For Boolean
+ dropCheckBoxGroupInContainer();
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + checkBoxGroupEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']");
+ cy.get('.cmp-adaptiveform-checkboxgroup__type').click();
+ cy.get("coral-selectlist-item").contains('Boolean').should('be.visible').click({force: true});
+
+ cy.get('.cmp-adaptiveform-checkboxgroup__value button').click();
+ cy.get(".cmp-adaptiveform-checkboxgroup__value input").invoke('val', 'Not a Boolean');
+ cy.get('.cq-dialog-submit').click();
+ cy.get('.coral-Form-fielderror').should('be.visible').invoke('attr', 'aria-label').should('eq', 'Value Type Mismatch');
+
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(checkBoxGroupDrop);
})
it ('check for duplicate enum values', function() {
diff --git a/ui.tests/test-module/specs/contentfragment/contentfragment.authoring.spec.js b/ui.tests/test-module/specs/contentfragment/contentfragment.authoring.spec.js
index d785d6991d..f150c98e1a 100644
--- a/ui.tests/test-module/specs/contentfragment/contentfragment.authoring.spec.js
+++ b/ui.tests/test-module/specs/contentfragment/contentfragment.authoring.spec.js
@@ -92,8 +92,9 @@ describe('Content Fragment - Authoring', function () {
cy.get("[name='./fragmentVariationPath'] input[role='combobox']").should("exist").clear()
.type("/content/experience-fragments/test-experience-fragment/master", { delay: 0 }).click();
- cy.get("._coral-Menu-itemLabel:contains(/content/experience-fragments/test-experience-fragment/master)").should("be.visible").click();
+ cy.get(".foundation-picker-buttonlist button").should("be.visible").click();
cy.get('.cq-dialog-submit').click().then(y => {
+ cy.get('.cq-dialog-submit').click();
cy.get('.cq-dialog-submit').should('not.exist').then(z => {
cy.deleteComponentByPath(xfDrop);
});
diff --git a/ui.tests/test-module/specs/databinding/databinding.authoring.spec.js b/ui.tests/test-module/specs/databinding/databinding.authoring.spec.js
index 0acb8a1ae3..de4e5025c1 100644
--- a/ui.tests/test-module/specs/databinding/databinding.authoring.spec.js
+++ b/ui.tests/test-module/specs/databinding/databinding.authoring.spec.js
@@ -46,17 +46,19 @@ describe('Page - Authoring', function () {
.should("exist")
.scrollIntoView();
cy.get("[name='./dataRef']").should("have.value", "");
+ cy.get("[name='./dataRef'] + .bindRefSelectorButtonGroup .bindRefSelectorButton").should('be.visible').click({force: true}).then(() => {
+ cy.get("coral-dialog.is-open coral-tree [data-value='$.firstName']")
+ .should("exist")
+ .should('be.visible')
+ .click({force: true});
+ cy.get(".selected-schema").next("div").contains('button:nth-child(2)', 'Select')
+ .should('be.visible')
+ .should("be.enabled")
+ .click();
+ cy.get("[name='./dataRef']").should("have.value", "$.firstName");
+ cy.get(".cq-dialog-submit").should('be.visible').click();
+ })
- cy.get("[name='./dataRef'] + .bindRefSelectorButtonGroup .bindRefSelectorButton").click({force: true});
- cy.get("coral-dialog.is-open coral-tree [data-value='$.firstName']")
- .should("exist")
- .click({force:true});
- cy.get(".tree-dialog-ok")
- .should("be.enabled")
- .click();
-
- cy.get("[name='./dataRef']").should("have.value", "$.firstName");
- cy.get(".cq-dialog-submit").click();
}
const testBindingPersistence = (textInputEditPathSelector) => {
@@ -66,27 +68,27 @@ describe('Page - Authoring', function () {
.should("exist")
.scrollIntoView();
cy.get("[name='./dataRef']").should("have.value", "$.firstName");
- cy.get('.cq-dialog-cancel').click();
+ cy.get('.cq-dialog-cancel').should('be.visible').click();
}
const configureDataModel = (formContainerEditPathSelector) => {
- // click configure action on adaptive form container component
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + formContainerEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
-
- //open data model tab
- cy.get('.cmp-adaptiveform-container'+'__editdialog').contains('Data Model').click({force:true});
- cy.get("[name='./schemaType']").should("exist");
-
- //select data model
- cy.get(".cmp-adaptiveform-container__selectformmodel").click();
- cy.get("coral-selectlist-item[value='none']").contains('None').should('exist');
- cy.get("coral-selectlist-item[value='jsonschema']").contains('Schema').should('be.visible').click();
-
- //select json schema and save it
- cy.get(".cmp-adaptiveform-container__schemaselectorcontainer").should("be.visible").click();
- cy.get("coral-selectlist-item[value='/content/dam/formsanddocuments/core-components-it/samples/databinding/sample.schema.json']").contains('sample.schema.json').should('be.visible').click();
- cy.get(".cq-dialog-submit").click();
+ // click configure action on adaptive form container component
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + formContainerEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+
+ //open data model tab
+ cy.get('.cmp-adaptiveform-container' + '__editdialog').contains('Data Model').click({force: true});
+ cy.get("[name='./schemaType']").should("exist");
+
+ //select data model
+ cy.get(".cmp-adaptiveform-container__selectformmodel").should('be.visible').click();
+ cy.get("coral-selectlist-item[value='none']").contains('None').should('exist');
+ cy.get("coral-selectlist-item[value='jsonschema']").contains('Schema').should('be.visible').click();
+
+ //select json schema and save it
+ cy.get(".cmp-adaptiveform-container__schemaselectorcontainer").should("be.visible").click();
+ cy.get("coral-selectlist-item[value='/content/dam/formsanddocuments/core-components-it/samples/databinding/sample.schema.json']").contains('sample.schema.json').should('be.visible').click();
+ cy.get(".cq-dialog-submit").should("be.visible").click();
}
context('Open Forms Editor', function() {
diff --git a/ui.tests/test-module/specs/datepicker/datepicker.authoring.spec.js b/ui.tests/test-module/specs/datepicker/datepicker.authoring.spec.js
index 793156d604..9a7f0254ad 100644
--- a/ui.tests/test-module/specs/datepicker/datepicker.authoring.spec.js
+++ b/ui.tests/test-module/specs/datepicker/datepicker.authoring.spec.js
@@ -65,7 +65,7 @@ describe('Page - Authoring', function () {
cy.get("[name='./hideTitle']").should("exist");
cy.get("[name='./placeholder']").should("exist");
cy.get("[name='./default']").should("exist");
- cy.get('.cq-dialog-cancel').click();
+ cy.get('.cq-dialog-cancel').should('be.visible').click();
cy.deleteComponentByPath(datePickerDrop);
}
diff --git a/ui.tests/test-module/specs/dropdown/dropdown.authoring.spec.js b/ui.tests/test-module/specs/dropdown/dropdown.authoring.spec.js
index cfc1b02bbc..73a35febf4 100644
--- a/ui.tests/test-module/specs/dropdown/dropdown.authoring.spec.js
+++ b/ui.tests/test-module/specs/dropdown/dropdown.authoring.spec.js
@@ -104,11 +104,11 @@ describe('Page - Authoring', function () {
insertDropDownInContainer();
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + dropDownEditPathSelector);
cy.invokeEditableAction("[data-action='CONFIGURE']");
- cy.get('.cmp-adaptiveform-dropdown__savevaluetype').children('._coral-Dropdown-trigger').click();
- cy.get("coral-selectlist-item-content").contains('Number').should('be.visible').click({force: true});
+ cy.get('.cmp-adaptiveform-dropdown__savevaluetype').click();
+ cy.get("coral-selectlist-item").contains('Number').should('be.visible').click({force: true});
cy.get(".cmp-adaptiveform-dropdown__defaultvalue input").invoke('val', 'Not a Number');
cy.get('.cq-dialog-submit').click();
- cy.get('.coral-Form-errorlabel').should('contain.text', 'Value Type Mismatch');
+ cy.get('.coral-Form-fielderror').should('be.visible').invoke('attr', 'aria-label').should('eq', 'Value Type Mismatch');
cy.get('.cq-dialog-cancel').click();
cy.deleteComponentByPath(dropdown);
@@ -117,11 +117,11 @@ describe('Page - Authoring', function () {
insertDropDownInContainer();
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + dropDownEditPathSelector);
cy.invokeEditableAction("[data-action='CONFIGURE']");
- cy.get('.cmp-adaptiveform-dropdown__savevaluetype').children('._coral-Dropdown-trigger').click();
- cy.get("coral-selectlist-item-content").contains('Boolean').click({force: true});
+ cy.get('.cmp-adaptiveform-dropdown__savevaluetype').click();
+ cy.get("coral-selectlist-item").contains('Boolean').click({force: true});
cy.get(".cmp-adaptiveform-dropdown__defaultvalue input").invoke('val', 'Not a Boolean');
cy.get('.cq-dialog-submit').click();
- cy.get('.coral-Form-errorlabel').should('contain.text', 'Value Type Mismatch');
+ cy.get('.coral-Form-fielderror').should('be.visible').invoke('attr', 'aria-label').should('eq', 'Value Type Mismatch');
cy.get('.cq-dialog-cancel').click();
cy.deleteComponentByPath(dropdown);
diff --git a/ui.tests/test-module/specs/formcontainer.spec.js b/ui.tests/test-module/specs/formcontainer.spec.js
index bb52143808..9eedda4f26 100644
--- a/ui.tests/test-module/specs/formcontainer.spec.js
+++ b/ui.tests/test-module/specs/formcontainer.spec.js
@@ -63,18 +63,9 @@ describe('Page/Form Authoring', function () {
cy.get('.cmp-adaptiveform-container'+'__editdialog').contains('Submission').click({force:true});
cy.get("[name='./actionType']").should("exist");
- //select email submit action
- cy.get(".cmp-adaptiveform-container__submitaction").children('._coral-Dropdown-trigger').click();
- cy.get("._coral-Menu-itemLabel").contains('Send email').should('be.visible').click();
- cy.get("[name='./useExternalEmailTemplate']").should("exist");
- cy.get("[name='./templatePath']").should("exist");
-
- cy.get("[name='./useExternalEmailTemplate']").should("exist").first().click();
- cy.get("[name='./template']").should("exist");
-
//select rest endpoint submit action
- cy.get(".cmp-adaptiveform-container__submitaction").children('._coral-Dropdown-trigger').click();
- cy.get("._coral-Menu-itemLabel").contains('Submit to REST endpoint').should('be.visible').click();
+ cy.get(".cmp-adaptiveform-container__submitaction button").click();
+ cy.get("coral-selectlist-item").contains('Submit to REST endpoint').click({force: true});
cy.get("[name='./enableRestEndpointPost']").should("exist");
cy.get("[name='./enableRestEndpointPost']").first().click();
cy.get("[name='./restEndpointPostUrl']").should("exist").type("http://localhost:4502/some/endpoint");
@@ -113,11 +104,12 @@ describe('Page/Form Authoring', function () {
//click save without selecting the fdm model, error should be displayed
cy.get(".cq-dialog-submit").click();
- cy.get(".coral-Form-errorlabel").should("be.visible");
+ cy.get(".coral-Form-fielderror").should("be.visible");
//select fdm and save it
cy.get(".cmp-adaptiveform-container__fdmselector").should("be.visible").click();
- cy.get("coral-selectlist-item[value='/content/dam/formsanddocuments-fdm/portal-unified-storage-form-data-model']").contains('Portal Unified Storage Form Data Model').should('be.visible').click();
+ cy.get("coral-selectlist-item[value='/content/dam/formsanddocuments-fdm/ms-dynamics-fdm']").contains('Microsoft Dynamics FDM').should('be.visible').click();
+
cy.get(".cq-dialog-submit").click();
};
@@ -131,9 +123,13 @@ describe('Page/Form Authoring', function () {
//since data model is already selected it should be disabled
cy.get(".cmp-adaptiveform-container__selectformmodel").should("not.have.attr", "disabled");
- cy.get(".cmp-adaptiveform-container__fdmselector").click();
+ cy.get(".cmp-adaptiveform-container__selectformmodel").click();
- cy.get("coral-selectlist-item[value='/content/dam/formsanddocuments-fdm/forms-ootb-usc-workflow-fdm']").contains('Workflow Unified Storage Form Data Model').should('be.visible').click();
+ //select Schema as data model
+ cy.get("coral-selectlist-item[value='jsonschema']").contains('Schema').should('be.visible').click();
+ cy.get(".cmp-adaptiveform-container__schemaselector").click();
+ //choose a schema
+ cy.get("coral-selectlist-item[value='/content/dam/formsanddocuments/core-components-it/samples/panelcontainer/bank_api.schema.json']").contains('bank_api.schema.json').should('be.visible').click();
cy.get("#formModelChange").should("be.visible");
cy.get("#formModelDialogAcceptButton").click();
cy.get(".cq-dialog-submit").click();
diff --git a/ui.tests/test-module/specs/numberinput/numberinput.authoring.spec.js b/ui.tests/test-module/specs/numberinput/numberinput.authoring.spec.js
index 72a8799bd5..c3595e99c1 100644
--- a/ui.tests/test-module/specs/numberinput/numberinput.authoring.spec.js
+++ b/ui.tests/test-module/specs/numberinput/numberinput.authoring.spec.js
@@ -91,9 +91,9 @@ describe('Page - Authoring', function () {
cy.get(numberInputBlockBemSelector + '__editdialog').contains('Basic').click().then(() => {
cy.get(numberInputBlockBemSelector + '__leaddigits').parent().children('label').contains('Number of digits before the decimal separator (1234.000)');
cy.get(numberInputBlockBemSelector + '__fracdigits').parent().children('label').contains('Number of digits after the decimal separator (1234.000)');
- cy.get(numberInputBlockBemSelector + "__type").children('._coral-Dropdown-trigger').click();
- cy.get("._coral-Menu-itemLabel").contains('Decimal').should('be.visible');
- cy.get("._coral-Menu-itemLabel").contains('Integer').should('be.visible').click();
+ cy.get(numberInputBlockBemSelector + "__type").click();
+ cy.get("coral-selectlist-item").contains('Decimal').should('be.visible');
+ cy.get("coral-selectlist-item").contains('Integer').should('be.visible').click();
cy.get(numberInputBlockBemSelector + '__leaddigits').parent().children('label').contains('Maximum Number of Digits');
cy.get('.cq-dialog-cancel').should('be.visible').click().then(() => {
cy.deleteComponentByPath(numberInputDrop);
@@ -173,4 +173,4 @@ describe('Page - Authoring', function () {
});
});
-})
\ No newline at end of file
+})
diff --git a/ui.tests/test-module/specs/panelcontainer/panelcontainer.authoring.spec.js b/ui.tests/test-module/specs/panelcontainer/panelcontainer.authoring.spec.js
index ef37b396f4..d94520e894 100644
--- a/ui.tests/test-module/specs/panelcontainer/panelcontainer.authoring.spec.js
+++ b/ui.tests/test-module/specs/panelcontainer/panelcontainer.authoring.spec.js
@@ -74,8 +74,10 @@ describe('Page - Authoring', function () {
cy.get("[name='./custom']")
.should("exist");
- cy.get('.cq-dialog-cancel').click();
- cy.deleteComponentByPath(panelContainerDrop);
+ cy.get('.cq-dialog-cancel').should('be.visible');
+ cy.get('.cq-dialog-cancel').focus().click({force: true}).then(() => {
+ cy.deleteComponentByPath(panelContainerDrop);
+ });
}
context('Open Forms Editor', function () {
@@ -92,8 +94,10 @@ describe('Page - Authoring', function () {
cy.deleteComponentByPath(panelEditPath);
});
- it('open edit dialog of Panel', function () {
- testPanelBehaviour(panelContainerPathSelector, panelEditPath);
+ it('open edit dialog of Panel', { retries: 3 },function () {
+ cy.cleanTest(panelEditPath).then(function() {
+ testPanelBehaviour(panelContainerPathSelector, panelEditPath);
+ });
})
})
@@ -117,4 +121,4 @@ describe('Page - Authoring', function () {
});
});
-});
\ No newline at end of file
+});
diff --git a/ui.tests/test-module/specs/portal/draftsnsubmissionscomponent.spec.js b/ui.tests/test-module/specs/portal/draftsnsubmissionscomponent.spec.js
deleted file mode 100644
index cccd2ac118..0000000000
--- a/ui.tests/test-module/specs/portal/draftsnsubmissionscomponent.spec.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2021 Adobe Systems Incorporated
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-///
-
-// This recipe is to test the AEM Forms Portal Link Component functionality
-
-// We are going to test:
-// 1. Search and Lister Component can be added and deleted
-// 2. Verify default values set in proxy component
-
-// Be sure to run the aem server
-// before running the tests below.
-
-const sitesSelectors = require('../../libs/commons/sitesSelectors'),
- afConstants = require('../../libs/commons/formsConstants');
-
-describe('Drafts And Submissions - Authoring', function () {
- // we can use these values to log in
- const pagePath = "/content/core-components-examples/library/forms-and-communications-portal/draftsandsubmissions",
- suffixCustom = "demo_draft/component",
- componentEditPath = pagePath + afConstants.RESPONSIVE_GRID_SUFFIX + "/" + suffixCustom + "/" + afConstants.components.forms.resourceType.fpdnscomponent.split("/").pop(),
- componentEditPathSelector = "[data-path='" + componentEditPath + "']",
- componentDropPath = pagePath + afConstants.RESPONSIVE_GRID_SUFFIX + "/" + afConstants.components.forms.resourceType.fpdnscomponent.split("/").pop(),
- componentDropPathSelector = "[data-path='" + componentDropPath + "']";
-
-
- context('Open Editor', function () {
- beforeEach(function () {
- // this is done since cypress session results in 403 sometimes
- cy.openAuthoring(pagePath);
- // conditionally clean the test, when there are retries
-
- });
-
- it('insert drafts and submission component', { retries: 3 }, function () {
- cy.cleanTest(componentDropPath).then(function(){
- const responsiveGridDropZone = "Drag components here", // todo: need to localize this
- responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-text='" + responsiveGridDropZone + "']";
- cy.selectLayer("Edit");
- // Add drafts and submissions component and delete it
- cy.insertComponent(responsiveGridDropZoneSelector, "Drafts and submissions", afConstants.components.forms.resourceType.fpdnscomponent);
- // once component is added, to remove the overlay from being active, we click on body
- cy.get('body').click(0,0);
- cy.deleteComponentByPath(componentDropPath);
- });
-
- });
-
- it('verify edit dialog properties', { retries: 3 }, function () {
- cy.cleanTest(componentDropPath).then(function() {
- const x = "";
- // click configure action on search and lister component
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + componentEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
-
- // check values
- cy.get("[name='./title']")
- .should("be.visible")
- .should("have.value", "Drafts");
- cy.get("[name='./layout']")
- .should("be.visible")
- .should("have.value", "card");
- cy.get("input[name='./type']")
- .should("have.value", "DRAFT");
-
- // dismiss window via cancel
- cy.get("button[title=\"Done\"")
- .should("be.visible")
- .click()
- .should("not.exist");
- });
- });
- });
-});
diff --git a/ui.tests/test-module/specs/portal/formsportallinkcomponent.spec.js b/ui.tests/test-module/specs/portal/formsportallinkcomponent.spec.js
deleted file mode 100644
index 9b34e2bf3a..0000000000
--- a/ui.tests/test-module/specs/portal/formsportallinkcomponent.spec.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2021 Adobe Systems Incorporated
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-///
-
-// This recipe is to test the AEM Forms Portal Link Component functionality
-
-// We are going to test:
-// 1. Link Component can be added and deleted
-// 2. Verify default values set in proxy component
-// 3. Check rendered link
-
-// Be sure to run the aem server
-// before running the tests below.
-
-const sitesSelectors = require('../../libs/commons/sitesSelectors'),
- afConstants = require('../../libs/commons/formsConstants');
-
-describe('Link - Authoring', function () {
- // we can use these values to log in
- const pagePath = "/content/core-components-examples/library/forms-and-communications-portal/link",
- linkComponentEditPath = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + "/" + afConstants.components.forms.resourceType.fplinkcomponent.split("/").pop(),
- linkComponentEditPathSelector = "[data-path='" + linkComponentEditPath + "']",
- linkComponentDropPath = pagePath + afConstants.RESPONSIVE_GRID_SUFFIX + "/" + afConstants.components.forms.resourceType.fplinkcomponent.split("/").pop(),
- linkComponentDropPathSelector = "[data-path='" + linkComponentDropPath + "']";
-
- context('Open Editor', function () {
- beforeEach(function () {
- // this is done since cypress session results in 403 sometimes
- cy.openAuthoring(pagePath);
- });
-
- it('insert link component', function () {
- const responsiveGridDropZone = "Drag components here", // todo: need to localize this
- responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-text='" + responsiveGridDropZone + "']";
- cy.selectLayer("Edit");
- // Add link component and delete it
- cy.insertComponent(responsiveGridDropZoneSelector, "Link", afConstants.components.forms.resourceType.fplinkcomponent);
- // once component is added, to remove the overlay from being active, we click on body
- cy.get('body').click(0,0);
- cy.deleteComponentByPath(linkComponentDropPath);
- });
-
- it('verify edit dialog properties', function () {
- const x = "";
- // click configure action on link component
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + linkComponentEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
-
- // check if default proxy component values are set correctly
- // Display tab
- cy.get("[name='./title']")
- .should("be.visible")
- .should("have.value", "Sample Link Component");
- cy.get("[name='./tooltip']")
- .should("be.visible")
- .should("have.value", "Sample Tooltip");
-
- // Asset Info tab
- cy.get("[data-foundation-tracking-event*=\"asset info\"]")
- .should("be.visible")
- .click();
-
- cy.get("[name='./assetType']")
- .should("be.visible")
- .should("have.value", "Adaptive Form");
-
- cy.get("[name='./adaptiveFormPath']")
- .should("be.visible")
- .should("have.value", "");
-
- // Query Params tab
- cy.get("[data-foundation-tracking-event*=\"query params\"]")
- .should("be.visible")
- .click();
-
- var assertMultifieldLength = function (cyelement, expectedLength) {
- cyelement
- .should("be.visible")
- .should((multifield) => {
- // custom assertion because need to access Coral JS multifield apis
- expect(multifield[0].items).to.have.length(expectedLength);
- });
- };
-
- // verify no items present in multifield beforehand
- var queryParamsMultifieldSelector = "[data-granite-coral-multifield-name=\"./queryParams\"]";
- assertMultifieldLength(cy.get(queryParamsMultifieldSelector), 0);
-
- // click add item and don't fill mandatory values
- cy.get("[coral-multifield-add]")
- .should("be.visible")
- .click();
- assertMultifieldLength(cy.get(queryParamsMultifieldSelector), 1);
-
- // check no error tooltips visible, then try submitting and verify error is visible
- cy.get("coral-tooltip[variant=\"error\"]")
- .should("not.exist");
- cy.get("button[title=\"Done\"")
- .should("be.visible")
- .click();
- cy.get("coral-tooltip[variant=\"error\"]")
- .should("be.visible");
-
- // dismiss window via cancel
- cy.get("button[title=\"Cancel\"")
- .should("be.visible")
- .click()
- .should("not.exist");
- });
-
- it('navigate to rendered page and verify link', function () {
- cy.visit(pagePath + '.html');
- cy.get("a[class*=\"cmp-link__anchor\"]")
- .should("have.attr", "href", "#")
- .should("have.attr", "target", "_self");
- });
-
- });
-});
diff --git a/ui.tests/test-module/specs/portal/searchnlistercomponent.spec.js b/ui.tests/test-module/specs/portal/searchnlistercomponent.spec.js
deleted file mode 100644
index 2dc861ace1..0000000000
--- a/ui.tests/test-module/specs/portal/searchnlistercomponent.spec.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2021 Adobe Systems Incorporated
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-///
-
-// This recipe is to test the AEM Forms Portal Link Component functionality
-
-// We are going to test:
-// 1. Search and Lister Component can be added and deleted
-// 2. Verify default values set in proxy component
-
-// Be sure to run the aem server
-// before running the tests below.
-
-const sitesSelectors = require('../../libs/commons/sitesSelectors'),
- afConstants = require('../../libs/commons/formsConstants');
-
-describe('Search And Lister - Authoring', function () {
- // we can use these values to log in
- const pagePath = "/content/core-components-examples/library/forms-and-communications-portal/searchlister",
- componentEditPath = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + "/" + afConstants.components.forms.resourceType.fpsnlcomponent.split("/").pop(),
- componentEditPathSelector = "[data-path='" + componentEditPath + "']",
- componentDropPath = pagePath + afConstants.RESPONSIVE_GRID_SUFFIX + "/" + afConstants.components.forms.resourceType.fpsnlcomponent.split("/").pop(),
- componentDropPathSelector = "[data-path='" + componentDropPath + "']";
-
-
- context('Open Editor', function () {
- beforeEach(function () {
- // this is done since cypress session results in 403 sometimes
- cy.openAuthoring(pagePath);
- });
-
- it('insert search and lister component', function () {
- const responsiveGridDropZone = "Drag components here", // todo: need to localize this
- responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-text='" + responsiveGridDropZone + "']";
- cy.selectLayer("Edit");
- // Add search and lister component and delete it
- cy.insertComponent(responsiveGridDropZoneSelector, "Search And Lister", afConstants.components.forms.resourceType.fpsnlcomponent);
- // once component is added, to remove the overlay from being active, we click on body
- cy.get('body').click(0,0);
- cy.deleteComponentByPath(componentDropPath);
- });
-
- it('verify edit dialog properties', function () {
- const x = "";
- // click configure action on search and lister component
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + componentEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
-
- // check if default proxy component values are set correctly
- // Display tab
- cy.get("[data-foundation-tracking-event*=\"display\"]")
- .should("be.visible")
- .click();
- cy.get("[name='./title']")
- .should("be.visible")
- .should("have.value", "");
- cy.get("[name='./layout']")
- .should("be.visible")
- .should("have.value", "card");
- cy.get("input[name='./disableSearch']")
- .should("be.visible")
- .should("not.be.checked");
- cy.get("input[name='./disableSorting']")
- .should("be.visible")
- .should("not.be.checked");
- cy.get("input[name='./htmlTooltip']")
- .should("be.visible")
- .should("have.value", "");
-
- // Asset Folder tab, check presence of multifields
- cy.get("[data-foundation-tracking-event*=\"asset folder\"]")
- .should("be.visible")
- .click();
-
- var assertMultifieldLength = function (cyelement, expectedLength) {
- cyelement
- .should("be.visible")
- .should((multifield) => {
- // custom assertion because need to access Coral JS multifield apis
- expect(multifield[0].items).to.have.length(expectedLength);
- });
- };
-
- var folderPathMultifieldSelector = "[data-granite-coral-multifield-name=\"./assetFolders\"]";
- assertMultifieldLength(cy.get(folderPathMultifieldSelector), 1);
-
- // Results tab
- cy.get("[data-foundation-tracking-event*=\"results\"]")
- .should("be.visible")
- .click();
-
- cy.get("input[name='./limit']")
- .should("be.visible")
- .should("have.value", "");
-
- // check no error tooltips visible
- cy.get("coral-tooltip[variant=\"error\"]")
- .should("not.exist");
-
- // dismiss window via cancel
- cy.get("button[title=\"Done\"")
- .should("be.visible")
- .click()
- .should("not.exist");
- });
- });
-});
diff --git a/ui.tests/test-module/specs/replaceaction/replacelayout-container.authoring.spec.js b/ui.tests/test-module/specs/replaceaction/replacelayout-container.authoring.spec.js
index 299b6d6fb4..7ca7a817b3 100644
--- a/ui.tests/test-module/specs/replaceaction/replacelayout-container.authoring.spec.js
+++ b/ui.tests/test-module/specs/replaceaction/replacelayout-container.authoring.spec.js
@@ -34,7 +34,9 @@ describe('component replace - Authoring', function () {
"formtext": fieldTypes.NON_INPUT,
"formtextinput": fieldTypes.TEXT,
"title": fieldTypes.NON_INPUT,
- "formimage": fieldTypes.NON_INPUT
+ "formimage": fieldTypes.NON_INPUT,
+ "checkbox": fieldTypes.SELECT,
+ "switch": fieldTypes.SELECT
}
const pagePath = "/content/forms/af/core-components-it/blank",
buttonEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/button",
@@ -43,7 +45,6 @@ describe('component replace - Authoring', function () {
checkboxEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/checkboxgroup",
checkboxEditPathSelector = "[data-path='" + checkboxEditPath + "']",
checkboxDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.formcheckboxgroup.split("/").pop(),
- dataPath = "/content/core-components-examples/library/adaptive-form/emailinput/jcr:content/root/responsivegrid/demo/component/guideContainer/*",
emailinputEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/emailinput",
emailinputEditPathSelector = "[data-path='" + emailinputEditPath + "']",
emailinputDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.formemailinput.split("/").pop();
@@ -159,7 +160,7 @@ describe('component replace - Authoring', function () {
testComponentReplaceBehaviour(buttonEditPathSelector, buttonDrop);
})
- it('replace checkbox with radio button', function () {
+ it.skip('replace checkbox with switch', function () {
testComponentReplaceBehaviour(checkboxEditPathSelector, checkboxDrop);
})
diff --git a/ui.tests/test-module/specs/switch/switch.authoring.spec.js b/ui.tests/test-module/specs/switch/switch.authoring.spec.js
new file mode 100644
index 0000000000..76d282fa1c
--- /dev/null
+++ b/ui.tests/test-module/specs/switch/switch.authoring.spec.js
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2023 Adobe Systems Incorporated
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+const sitesSelectors = require('../../libs/commons/sitesSelectors'),
+ afConstants = require('../../libs/commons/formsConstants');
+
+/**
+ * Testing Switch with Sites Editor
+ */
+describe('Page - Authoring', function () {
+
+
+ const dropSwitchInSites = function() {
+ const dataPath = "/content/core-components-examples/library/adaptive-form/switch/jcr:content/root/responsivegrid/demo/component/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.selectLayer("Edit");
+ cy.insertComponent(responsiveGridDropZoneSelector, "Adaptive Form Switch", afConstants.components.forms.resourceType.switch);
+ cy.get('body').click( 0,0);
+ };
+
+ const dropSwitchInContainer = function() {
+ const dataPath = "/content/forms/af/core-components-it/blank/jcr:content/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.selectLayer("Edit");
+ cy.insertComponent(responsiveGridDropZoneSelector, "Adaptive Form Switch", afConstants.components.forms.resourceType.switch);
+ cy.get('body').click(0, 0);
+ }
+
+ const testSwitchBehaviour = function (switchEditPathSelector, switchDrop, isSites) {
+ if (isSites) {
+ dropSwitchInSites();
+ } else {
+ dropSwitchInContainer();
+ }
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + switchEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ cy.get("[name='./name']")
+ .should("exist");
+
+
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(switchDrop);
+ }
+
+ // ***** //
+
+ context('Open Forms Editor', function() {
+ const pagePath = "/content/forms/af/core-components-it/blank",
+
+ switchEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/switch",
+ switchEditPathSelector = "[data-path='" + switchEditPath + "']",
+ switchDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.switch.split("/").pop();
+
+ beforeEach(function () {
+ // this is done since cypress session results in 403 sometimes
+ cy.openAuthoring(pagePath);
+ });
+
+ it('insert Switch in form container', function () {
+ dropSwitchInContainer();
+ cy.deleteComponentByPath(switchDrop);
+ });
+
+ it('when enableUnchecked is false hides off field', function () {
+ dropSwitchInContainer();
+ const pagePath = "/content/forms/af/core-components-it/blank",
+ switchEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/switch",
+ switchEditPathSelector = "[data-path='" + switchEditPath + "']";
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + switchEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ cy.get(".cmp-adaptiveform-switch__enums coral-multifield-item").eq(0).should('not.be.visible')
+ const enableUnchecked = '[name="./enableUncheckedValue"]';
+ cy.get(enableUnchecked).eq(0).click().then(() => {
+ cy.get(".cmp-adaptiveform-switch__enums coral-multifield-item").eq(0).should('be.visible')
+ })
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(switchDrop);
+ });
+
+ it('open edit dialog of aem forms Switch', function() {
+ testSwitchBehaviour(switchEditPathSelector, switchDrop, false);
+ });
+ })
+
+ context('Open Sites Editor', function() {
+ const pagePath = "/content/core-components-examples/library/adaptive-form/switch",
+ switchEditPath = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + "/guideContainer/switch",
+ switchDrop = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + '/guideContainer/' + afConstants.components.forms.resourceType.switch.split("/").pop(),
+ switchEditPathSelector = "[data-path='" + switchEditPath + "']";
+
+ beforeEach(function () {
+ // this is done since cypress session results in 403 sometimes
+ cy.openAuthoring(pagePath);
+ });
+
+ it('insert aem forms Switch', function () {
+ dropSwitchInSites();
+ cy.deleteComponentByPath(switchDrop);
+ });
+
+ it('when enableUnchecked is false hides off field', function () {
+ dropSwitchInSites();
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + switchEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ cy.get(".cmp-adaptiveform-switch__enums coral-multifield-item").eq(0).should('not.be.visible');
+ const enableUnchecked = '[name="./enableUncheckedValue"]';
+ cy.get(enableUnchecked).eq(0).click().then(() => {
+ cy.get(".cmp-adaptiveform-switch__enums coral-multifield-item").eq(0).should('be.visible')
+ })
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(switchDrop);
+ });
+
+ it('open edit dialog of aem forms switch', function() {
+ testSwitchBehaviour(switchEditPathSelector, switchDrop, true);
+ });
+ })
+});
diff --git a/ui.tests/test-module/specs/switch/switch.runtime.spec.js b/ui.tests/test-module/specs/switch/switch.runtime.spec.js
new file mode 100644
index 0000000000..cd332b5560
--- /dev/null
+++ b/ui.tests/test-module/specs/switch/switch.runtime.spec.js
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright 2022 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+describe("Form Runtime with Switch Input", () => {
+
+ const pagePath = "content/forms/af/core-components-it/samples/switch/basic.html"
+ const bemBlock = "cmp-adaptiveform-switch"
+
+ let formContainer = null
+
+ beforeEach(() => {
+ cy.previewForm(pagePath).then(p => {
+ formContainer = p;
+ })
+ });
+
+ const checkHTML = (id, state) => {
+ const visible = state.visible;
+ const passVisibleCheck = `${visible === true ? "" : "not."}be.visible`;
+ const passDisabledAttributeCheck = `${state.enabled === false || state.readOnly === true ? "" : "not."}have.attr`;
+ const value = state.value
+ cy.get(`#${id}`)
+ .should(passVisibleCheck)
+ .invoke('attr', 'data-cmp-visible')
+ .should('eq', visible.toString());
+
+ cy.get(`#${id}`)
+ .invoke('attr', 'data-cmp-enabled')
+ .should('eq', state.enabled.toString());
+
+ return cy.get(`#${id}`).within((root) => {
+ cy.get('*').should(passVisibleCheck)
+ cy.get('input')
+ .should('have.length', 1)
+ cy.get('input')
+ .should(passDisabledAttributeCheck, 'disabled');
+ cy.get('input').should('be.checked');
+ })
+ }
+
+ it(" should get model and view initialized properly ", () => {
+ expect(formContainer, "formcontainer is initialized").to.not.be.null;
+ expect(formContainer._model.items.length, "model and view elements match").to.equal(Object.keys(formContainer._fields).length);
+ Object.entries(formContainer._fields).forEach(([id, field]) => {
+ expect(field.getId()).to.equal(id)
+ expect(formContainer._model.getElement(id), `model and view are in sync`).to.equal(field.getModel())
+ });
+ })
+
+ it(" model's changes are reflected in the html ", () => {
+ const id = formContainer._model.items[0].id;
+ const model = formContainer._model.getElement(id)
+ model.value = '0'
+
+ checkHTML(model.id, model.getState()).then(() => {
+ return checkHTML(model.id, model.getState())
+ }).then(() => {
+ model.enable = false
+ return checkHTML(model.id, model.getState())
+ })
+ });
+
+ it('should have initial value "undefined" if no default set', () => {
+ const id = formContainer._model.items[0].id;
+ const model = formContainer._model.getElement(id)
+ expect(model.getState().value).eq(undefined)
+ })
+
+ it ('should have value set to false if checked and then unchecked', () => {
+ const id = formContainer._model.items[0].id;
+ const model = formContainer._model.getElement(id)
+ cy.get(`#${id}`).find("input").click().then(() => {
+ cy.get(`#${id}`).find("input").click().then(() => {
+ expect(model.getState().value).eq(undefined)
+ })
+ })
+
+ })
+
+ it('should have value set to default during initial render', () => {
+ const id = formContainer._model.items[1].id;
+ const model = formContainer._model.getElement(id)
+ expect(model.getState().value).to.contain('0');
+ cy.get(`#${id}`).get('input').should('be.checked');
+ })
+
+ it(" html changes are reflected in model ", () => {
+
+ const id = formContainer._model.items[0].id;
+ const model = formContainer._model.getElement(id)
+ cy.get(`#${id}`).find("input").click().then(x => {
+ expect(model.getState().value).to.contain('0');
+ })
+
+ cy.get(`#${id}`).find("input").click().then(x => {
+ expect(model.getState().value).equal(undefined);
+ })
+ });
+
+ it(" should show error messages in the HTML ", () => {
+ const id = formContainer._model.items[2].id;
+ const model = formContainer._model.getElement(id)
+
+ cy.get(`#${id}`).find("input").click().then(x => {
+ expect(model.getState().value).to.contain('0');
+ })
+
+ cy.get(`#${id}`).find("input").click().then(x => {
+ cy.get(`#${id}`).find(".cmp-adaptiveform-switch__errormessage").should('have.text',"This is a custom required switch")
+ })
+
+ cy.get(`#${id}`).find("input").click().then(x => {
+ cy.get(`#${id}`).find(".cmp-adaptiveform-switch__errormessage").should('have.text',"")
+ })
+ });
+
+ it("should toggle description and tooltip", () => {
+ const id = formContainer._model.items[0].id;
+ cy.toggleDescriptionTooltip(bemBlock, id);
+ })
+
+ it("should show and hide components on certain switch input", () => {
+ // Rule on switch4: When switch4 is ON => Show switch5 and
+ // hide switch5 when switch4 is OFF
+
+ const ruleSwitch = formContainer._model.items[3].id;
+ const hiddenCB = formContainer._model.items[4].id;
+
+ cy.get(`#${hiddenCB}`).should('not.be.visible');
+
+ cy.get(`#${ruleSwitch}`).find('input').click().then(x => {
+ cy.get(`#${hiddenCB}`).should('be.visible');
+ cy.get(`#${ruleSwitch}`).find('input').click().then(x => {
+ cy.get(`#${hiddenCB}`).should('not.be.visible')
+ });
+ });
+
+ })
+
+ it("should enable and disable components on certain switch input", () => {
+ // Rule on switch enabledisable: When switch 'enabledisable' is ON => Enable switch cb5
+ // and hide cb5 when enabledisable is OFF
+
+ const enabledisablecb = formContainer._model.items[5].id;
+ const cbUnderTest = formContainer._model.items[6].id;
+
+ // Initially cb should be disabled
+ cy.get(`#${cbUnderTest}`).find("input").should('not.be.enabled')
+
+ // check to enable cb
+ cy.get(`#${enabledisablecb}`).find("input").click().then(x => {
+ cy.get(`#${cbUnderTest}`).find("input").should('be.enabled')
+ // uncheck to disable cb
+ cy.get(`#${enabledisablecb}`).find("input").click().then(x => {
+ cy.get(`#${cbUnderTest}`).find("input").should('not.be.enabled')
+
+ })
+ })
+ })
+})
diff --git a/ui.tests/test-module/specs/tabsontop/tabsontop.authoring.spec.js b/ui.tests/test-module/specs/tabsontop/tabsontop.authoring.spec.js
index 57ba7341be..8ac9f05121 100644
--- a/ui.tests/test-module/specs/tabsontop/tabsontop.authoring.spec.js
+++ b/ui.tests/test-module/specs/tabsontop/tabsontop.authoring.spec.js
@@ -55,33 +55,32 @@ describe.only('Page - Authoring', function () {
dropComponent(responsiveGridDropZoneSelector, "Adaptive Form Horizontal Tabs", afConstants.components.forms.resourceType.tabsontop);
}
- const testPanelBehaviour = function (tabsEditPathSelector, tabsContainerDrop, isSites) {
- if (isSites) {
- dropTabsInSites();
- } else {
- dropTabsInContainer();
- }
- cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + tabsEditPathSelector);
- cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
- // Check If Dialog Options Are Visible
- cy.get("[name='./name']")
- .should("exist");
- cy.get("[name='./jcr:title']")
- .should("exist");
- cy.get("[name='./dataRef']")
- .should("exist");
- cy.get("[name='./visible']")
- .should("exist");
- cy.get("[name='./enabled']")
- .should("exist");
- cy.get("[name='./assistPriority']")
- .should("exist");
- cy.get("[name='./custom']")
- .should("exist");
-
- cy.get('.cq-dialog-cancel').click();
- cy.deleteComponentByPath(tabsContainerDrop);
+ const testPanelBehaviour = function(tabsEditPathSelector, tabsContainerDrop, isSites) {
+ if (isSites) {
+ dropTabsInSites();
+ } else {
+ dropTabsInContainer();
}
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + tabsEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ // Check If Dialog Options Are Visible
+ cy.get("[name='./name']")
+ .should("exist");
+ cy.get("[name='./jcr:title']")
+ .should("exist");
+ cy.get("[name='./dataRef']")
+ .should("exist");
+ cy.get("[name='./visible']")
+ .should("exist");
+ cy.get("[name='./enabled']")
+ .should("exist");
+ cy.get("[name='./assistPriority']")
+ .should("exist");
+ cy.get("[name='./custom']")
+ .should("exist");
+ cy.get('.cq-dialog-cancel').should('be.visible').click();
+ cy.deleteComponentByPath(tabsContainerDrop);
+ }
context('Open Forms Editor', function () {
const pagePath = "/content/forms/af/core-components-it/blank",
@@ -114,6 +113,7 @@ describe.only('Page - Authoring', function () {
//Add 2 children in tabs on top component
dropTextInputInTabComponent();
dropDatePickerInTabComponent();
+ cy.get("[data-path='/content/forms/af/core-components-it/blank/jcr:content/guideContainer/tabsontop/datepicker']").should('be.visible');
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + tabsContainerPathSelector);
cy.invokeEditableAction("[data-action='PANEL_SELECT']").then(() => {
cy.get("table.cmp-panelselector__table").find("tr").should("have.length", 2);
diff --git a/ui.tests/test-module/specs/termsandconditions/tnc.authoring.spec.js b/ui.tests/test-module/specs/termsandconditions/tnc.authoring.spec.js
new file mode 100644
index 0000000000..586c57bfe4
--- /dev/null
+++ b/ui.tests/test-module/specs/termsandconditions/tnc.authoring.spec.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 Adobe Systems Incorporated
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+const sitesSelectors = require('../../libs/commons/sitesSelectors'),
+ afConstants = require('../../libs/commons/formsConstants');
+
+/**
+ * Testing Terms and Conditions with Sites Editor
+ */
+describe('Page - Authoring', function () {
+
+
+ const dropTnCInSites = function() {
+ const dataPath = "/content/core-components-examples/library/adaptive-form/termsandconditions/jcr:content/root/responsivegrid/demo/component/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.selectLayer("Edit");
+ cy.insertComponent(responsiveGridDropZoneSelector, "Adaptive Form Terms And Conditions", afConstants.components.forms.resourceType.termsandconditions);
+ cy.get('body').click( 0,0);
+ };
+
+ const dropTncInContainer = function() {
+ const dataPath = "/content/forms/af/core-components-it/blank/jcr:content/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.selectLayer("Edit");
+ cy.insertComponent(responsiveGridDropZoneSelector, "Adaptive Form Terms And Conditions", afConstants.components.forms.resourceType.termsandconditions);
+ cy.get('body').click(0, 0);
+ }
+
+ const testTncBehaviour = function (tncEditPathSelector, tncDrop, isSites) {
+ if (isSites) {
+ dropTnCInSites();
+ } else {
+ dropTncInContainer();
+ }
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + tncEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ cy.get("[name='./name']")
+ .should("exist");
+
+ cy.get("coral-checkbox[name='./showApprovalOption']")
+ .should('have.attr', 'checked');
+
+ cy.get("input[name='./showApprovalOption']")
+ .click().then(e => {
+ cy.get("input[name='./showAsPopup']").click()
+ .then(e => {
+ cy.get("coral-checkbox[name='./showApprovalOption']")
+ .should('have.attr', 'checked');
+ })
+ })
+
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(tncDrop);
+ }
+
+ // ***** //
+
+ // context('Open Forms Editor', function() {
+ // const pagePath = "/content/forms/af/core-components-it/blank",
+ // tncEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/termsandconditions",
+ // tncEditPathSelector = "[data-path='" + tncEditPath + "']",
+ // tncDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.termsandconditions.split("/").pop();
+ //
+ // beforeEach(function () {
+ // // this is done since cypress session results in 403 sometimes
+ // cy.openAuthoring(pagePath);
+ // });
+ //
+ // it('insert TnC in form container', function () {
+ // dropTncInContainer();
+ // cy.deleteComponentByPath(tncDrop);
+ // });
+ //
+ // it('Test TnC authoring behaviour', function() {
+ // testTncBehaviour(tncEditPathSelector, tncDrop, false);
+ // });
+ // })
+
+ context('Open Sites Editor', function() {
+ const pagePath = "/content/core-components-examples/library/adaptive-form/termsandconditions",
+ tncEditPath = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + "/guideContainer/termsandconditions",
+ tncDrop = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + '/guideContainer/' + afConstants.components.forms.resourceType.termsandconditions.split("/").pop(),
+ tncEditPathSelector = "[data-path='" + tncEditPath + "']";
+
+ beforeEach(function () {
+ // this is done since cypress session results in 403 sometimes
+ cy.openAuthoring(pagePath);
+ });
+
+ it('insert aem forms TnC', function () {
+ dropTnCInSites();
+ cy.deleteComponentByPath(tncDrop);
+ });
+
+ it('Test TnC authoring behaviour', function() {
+ testTncBehaviour(tncEditPathSelector, tncDrop, true);
+ });
+ })
+});
diff --git a/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js b/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js
new file mode 100644
index 0000000000..7c8708398a
--- /dev/null
+++ b/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright 2022 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+describe("Form Runtime with Terms and Conditions", () => {
+
+ const pagePath = "content/forms/af/core-components-it/samples/termsandconditions/basic.html"
+ const bemBlock = 'cmp-adaptiveform-termsandcondition'
+ const IS = "adaptiveFormTermsAndConditions"
+ const selectors = {
+ tnc : `[data-cmp-is="${IS}"]`
+ }
+
+ let formContainer = null
+
+ beforeEach(() => {
+ cy.previewForm(pagePath).then(p => {
+ formContainer = p;
+ })
+ });
+
+ const checkHTML = (id, state, view, count) => {
+ const visible = state.visible;
+ const passVisibleCheck = `${visible === true ? "" : "not."}be.visible`;
+ cy.get(`#${id}`)
+ .should(passVisibleCheck)
+ .invoke('attr', 'data-cmp-visible')
+ .should('eq', visible.toString());
+ cy.get(`#${id}`)
+ .invoke('attr', 'data-cmp-enabled')
+ .should('eq', state.enabled.toString());
+ expect(state.items.length, "model has children equal to count").to.equal(2);
+ expect(view.children.length, "tab has children equal to count").to.equal(2); // this is because at any given point, either links are shown or text content is shown
+ return cy.get(`#${id}`);
+ };
+
+ it(" should get model and view initialized properly and parent child relationship is set ", () => {
+ expect(formContainer, "formcontainer is initialized").to.not.be.null;
+ const fields = formContainer.getAllFields();
+ Object.entries(fields).forEach(([id, field]) => {
+ expect(field.getId()).to.equal(id);
+ expect(formContainer._model.getElement(id), `model and view are in sync`).to.equal(field.getModel());
+ });
+ });
+
+ it(" model's changes are reflected in the html ", () => {
+ const tncId = formContainer._model.items[0].id
+ const model = formContainer._model.getElement(tncId)
+ const tabView = formContainer.getAllFields()[tncId];
+ const count = 2;
+ checkHTML(model.id, model.getState(), tabView, count).then(() => {
+ model.visible = false;
+ return checkHTML(model.id, model.getState(), tabView, count);
+ }).then(() => {
+ model.enable = false;
+ return checkHTML(model.id, model.getState(), tabView, count);
+ });
+ });
+
+
+ it("OOTB behaviour -> should enable approval checkbox only if links visited", () => {
+ const tncWithLinksID = formContainer._model.items[1].id;
+ const model = formContainer._model.getElement(tncWithLinksID)
+ expect(model.getState().items[0].enabled).to.equal(false);
+ cy.get(`#${tncWithLinksID}`).get('a').click()
+ .then(() => {
+ expect(model.getState().items[0].enabled).to.equal(true);
+ })
+
+ });
+
+ it("OOTB behaviour -> should have show popup", () => {
+ const tncWithPopup = formContainer._model.items[2].id;
+ const model = formContainer._model.getElement(tncWithPopup)
+ cy.get(`#${tncWithPopup} .cmp-adaptiveform-termsandcondition__content-container`)
+ .should('have.class', 'cmp-adaptiveform-termsandcondition__content-container--modal')
+ .invoke('attr', 'data-cmp-visible').should('eq', 'false')
+ expect(model.getState().items[1].enabled).to.equal(false);
+ cy.get(`#${tncWithPopup} .cmp-adaptiveform-checkbox__widget-container label`).click()
+ .then(() => {
+ // this test will also verify scrollDone scenario
+ cy.get(`#${tncWithPopup} .cmp-adaptiveform-checkbox`).invoke('attr', 'data-cmp-enabled')
+ .should('eq', 'true')
+
+ cy.get(`#${tncWithPopup} .cmp-adaptiveform-termsandcondition__content-container`)
+ .invoke('attr', 'data-cmp-visible').should('not.exist');
+ cy.get(`#${tncWithPopup} .cmp-adaptiveform-termsandcondition__close-button`).click()
+ .then(() => {
+ cy.get(`#${tncWithPopup} .cmp-adaptiveform-termsandcondition__content-container`)
+ .invoke('attr', 'data-cmp-visible').should('eq', 'false', );
+ })
+ })
+ })
+})
+
diff --git a/ui.tests/test-module/specs/verticaltabs/verticaltabs.authoring.spec.js b/ui.tests/test-module/specs/verticaltabs/verticaltabs.authoring.spec.js
index 9670a02ebd..fbae5e454e 100644
--- a/ui.tests/test-module/specs/verticaltabs/verticaltabs.authoring.spec.js
+++ b/ui.tests/test-module/specs/verticaltabs/verticaltabs.authoring.spec.js
@@ -30,7 +30,7 @@ describe.only('Page - Authoring', function () {
cy.selectLayer("Edit");
cy.insertComponent(responsiveGridDropZoneSelector, componentTitle, componentType);
cy.get('body').click( 0,0);
- }
+ }
const getDropZoneSelector = function(responsiveGridDropZone) {
return sitesSelectors.overlays.overlay.component + "[data-path='" + responsiveGridDropZone + "']";
@@ -79,7 +79,7 @@ describe.only('Page - Authoring', function () {
cy.get("[name='./custom']")
.should("exist");
- cy.get('.cq-dialog-cancel').click();
+ cy.get('.cq-dialog-cancel').should('be.visible').click();
cy.deleteComponentByPath(tabsContainerDrop);
}