Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into saveAsFragment-1
  • Loading branch information
dmaurya929 committed Jan 5, 2025
2 parents 751e5e1 + c7a55a5 commit acbfe0c
Show file tree
Hide file tree
Showing 202 changed files with 8,951 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .circleci/ci/it-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ try {

//todo: remove this later, once aem image is released, since sites rotary aem base image has "2.25.4"
//let wcmVersion = ci.sh('mvn help:evaluate -Dexpression=core.wcm.components.version -q -DforceStdout', true);
let wcmVersion = "2.26.0";
let wcmVersion = "2.27.0";
ci.stage("Integration Tests");
ci.dir(qpPath, () => {
// Connect to QP
Expand Down
2 changes: 1 addition & 1 deletion .circleci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
entrypoint: tail -f /dev/null # Keeps the container running

circleci-aem-cloudready:
image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem-cloudready:17689-rel-openjdk11
image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem-cloudready:9aa621f43a-openjdk11
depends_on:
- circleci-qp
# Add any additional configurations or environment variables if needed
Expand Down
43 changes: 24 additions & 19 deletions .github/workflows/exporter-validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,39 @@ jobs:
# Loop through each changed file
for file in $changed_files; do
# Fetch the base and head versions of the file
base_file=$(git show ${{ github.base_ref }}:$file)
head_file=$(git show ${{ github.head_ref }}:$file)
# Check if the file exists in both branches
if git cat-file -e origin/${{ github.base_ref }}:$file 2>/dev/null && git cat-file -e origin/${{ github.head_ref }}:$file 2>/dev/null; then
# Fetch the base and head versions of the file
base_file=$(git show origin/${{ github.base_ref }}:$file)
head_file=$(git show origin/${{ github.head_ref }}:$file)
# Compare the JSON keys
base_keys=$(echo "$base_file" | jq -r 'paths | map(tostring) | join(".")' | sed 's/\./\\./g')
head_keys=$(echo "$head_file" | jq -r 'paths | map(tostring) | join(".")' | sed 's/\./\\./g')
# Compare the JSON keys
base_keys=$(echo "$base_file" | jq -r 'paths | map(tostring) | join(".")' | sed 's/\./\\./g')
head_keys=$(echo "$head_file" | jq -r 'paths | map(tostring) | join(".")' | sed 's/\./\\./g')
# Check for removed keys
removed_keys=$(comm -23 <(echo "$base_keys" | sort) <(echo "$head_keys" | sort))
# Check for removed keys
removed_keys=$(comm -23 <(echo "$base_keys" | sort) <(echo "$head_keys" | sort))
if [ -n "$removed_keys" ]; then
echo "Backward incompatibility change detected in $file. The following keys were removed:"
echo "$removed_keys"
exit 1
fi
if [ -n "$removed_keys" ]; then
echo "Backward incompatibility change detected in $file. The following keys were removed:"
echo "$removed_keys"
exit 1
fi
# Check for changed values
for key in $base_keys; do
base_value=$(echo "$base_file" | jq -r --arg key "$key" '.[$key]')
head_value=$(echo "$head_file" | jq -r --arg key "$key" '.[$key]')
if [ "$base_value" != "$head_value" ]; then
echo "Backward incompatibility change detected in $file. The value of key '$key' was changed from '$base_value' to '$head_value'."
exit 1
fi
done
if [ "$base_value" != "$head_value" ]; then
echo "Backward incompatibility change detected in $file. The value of key '$key' was changed from '$base_value' to '$head_value'."
exit 1
fi
done
else
echo "Skipping file $file as it exists in one branch but not the other."
fi
done
echo "All exporter JSON files have only additions. No backward incompatibility changes detected."
shell: bash
shell: bash
25 changes: 20 additions & 5 deletions .github/workflows/spec-validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,34 @@ jobs:
- name: Check out code
uses: actions/checkout@v2

- name: Validate branch names
id: validate
run: |
echo "Validating branch names..."
if ! [[ "${{ github.event.pull_request.head.ref }}" =~ ^[a-zA-Z0-9._/-]+$ ]]; then
echo "Invalid characters in head ref"
exit 1
fi
if ! [[ "${{ github.event.pull_request.base.ref }}" =~ ^[a-zA-Z0-9._/-]+$ ]]; then
echo "Invalid characters in base ref"
exit 1
fi
echo "::set-output name=head_ref::${{ github.event.pull_request.head.ref }}"
echo "::set-output name=base_ref::${{ github.event.pull_request.base.ref }}"
- name: Fetch Base and Head References
run: |
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
git fetch origin ${{ github.head_ref }}:${{ github.head_ref }}
git fetch origin ${{ steps.validate.outputs.head_ref }}:${{ steps.validate.outputs.head_ref }}
git fetch origin ${{ steps.validate.outputs.base_ref }}:${{ steps.validate.outputs.base_ref }}
if: github.event_name == 'pull_request'

- name: Validate Changes and Commit Message
run: |
# Check for changes in specification files inside the resources folder
changed_files=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }})
changed_files=$(git diff --name-only ${{ steps.validate.outputs.base_ref }} ${{ steps.validate.outputs.head_ref }})
# Fetch the commit messages from the PR
commit_messages=$(git log --pretty=oneline ${{ github.base_ref }}..${{ github.head_ref }})
commit_messages=$(git log --pretty=oneline ${{ steps.validate.outputs.base_ref }}..${{ steps.validate.outputs.head_ref }})
# Check if any commit message contains a specific keyword or pattern (e.g., "RTC")
if echo "$commit_messages" | grep -q 'RTC' && echo "$changed_files" | grep -E 'resources/schema/.*\.json$'; then
Expand All @@ -34,4 +49,4 @@ jobs:
echo "Either commit message doesn't contain 'RTC' keyword or specification files haven't changed. Build failed. Please check if your changes are working in visual rule editor"
exit 1
fi
shell: bash
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ private FormConstants() {
/** The resource type for check box group v1 */
public static final String RT_FD_FORM_CHECKBOX_GROUP_V1 = RT_FD_FORM_PREFIX + "checkboxgroup/v1/checkboxgroup";

/** The resource type for reCaptcha v1 */
/** The resource type for turnstile v1 */
public static final String RT_FD_FORM_TURNSTILE_V1 = RT_FD_FORM_PREFIX + "turnstile/v1/turnstile";

/** The resource type for hCaptcha v1 */
public static final String RT_FD_FORM_HCAPTCHA_V1 = RT_FD_FORM_PREFIX + "hcaptcha/v1/hcaptcha";

/** The resource type for reCaptcha v1 */
Expand Down Expand Up @@ -133,4 +136,10 @@ private FormConstants() {
public static final String REQ_ATTR_REFERENCED_PATH = "referencedPage";

public static final String PROP_FRAGMENT_PATH = "fragmentPath";

/** The resource type for review v1 */
public static final String RT_FD_FORM_REVIEW_V1 = RT_FD_FORM_PREFIX + "review/v1/review";

/* The resource type for the pre-selected the linked panel */
public final static String RT_FD_FORM_REVIEW_DATASOURCE_V1 = RT_FD_FORM_PREFIX + "review/v1/datasource";
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import com.adobe.cq.forms.core.components.internal.form.ReservedProperties;
import com.adobe.cq.forms.core.components.models.form.HCaptcha;
import com.adobe.cq.forms.core.components.util.AbstractCaptchaImpl;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
Expand All @@ -68,26 +67,23 @@ public class HCaptchaImpl extends AbstractCaptchaImpl implements HCaptcha {
private CloudConfigurationProvider cloudConfigurationProvider;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@JsonIgnore
@Named(ReservedProperties.PN_CLOUD_SERVICE_PATH)
protected String cloudServicePath;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@JsonIgnore
@Named(ReservedProperties.PN_SIZE)
protected String size;

private static final String SITE_KEY = "siteKey";
private static final String URI = "uri";
private static final String SIZE = "size";
private static final String THEME = "theme";
private static final String TYPE = "type";

@Override
public String getCloudServicePath() {
return cloudServicePath;
}

@Override
public String getSize() {
return size;
}

@Override
public String getProvider() {
return "hcaptcha";
Expand All @@ -113,11 +109,11 @@ public Map<String, Object> getCaptchaProperties() throws GuideException {
} catch (GuideException e) {
LOGGER.error("[AF] [Captcha] [HCAPTCHA] Error while fetching cloud configuration, upgrade to latest release to use hCaptcha.");
}
customCaptchaProperties.put(SITE_KEY, siteKey);
customCaptchaProperties.put(URI, uri);
customCaptchaProperties.put(SIZE, this.size);
customCaptchaProperties.put(THEME, "light");
customCaptchaProperties.put(TYPE, "image");
customCaptchaProperties.put(CAPTCHA_SITE_KEY, siteKey);
customCaptchaProperties.put(CAPTCHA_URI, uri);
customCaptchaProperties.put(CAPTCHA_SIZE, getSize());
customCaptchaProperties.put(CAPTCHA_THEME, "light");
customCaptchaProperties.put(CAPTCHA_TYPE, "image");

return customCaptchaProperties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import com.adobe.cq.forms.core.components.internal.form.ReservedProperties;
import com.adobe.cq.forms.core.components.models.form.Captcha;
import com.adobe.cq.forms.core.components.util.AbstractCaptchaImpl;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
Expand All @@ -65,33 +64,25 @@ public class RecaptchaImpl extends AbstractCaptchaImpl implements Captcha {
private CloudConfigurationProvider cloudConfigurationProvider;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@JsonIgnore
@Named(ReservedProperties.PN_RECAPTCHA_CLOUD_SERVICE_PATH)
protected String cloudServicePath;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@JsonIgnore
@Named(ReservedProperties.PN_RECAPTCHA_SIZE)
protected String size;

public static final String RECAPTCHA_DEFAULT_DOMAIN = "https://www.recaptcha.net/";
public static final String RECAPTCHA_DEFAULT_URL = RECAPTCHA_DEFAULT_DOMAIN + "recaptcha/api.js";
public static final String RECAPTCHA_ENTERPRISE_DEFAULT_URL = RECAPTCHA_DEFAULT_DOMAIN + "recaptcha/enterprise.js";
private static final String RECAPTCHA_SITE_KEY = "siteKey";
private static final String RECAPTCHA_URI = "uri";
private static final String RECAPTCHA_SIZE = "size";
private static final String RECAPTCHA_THEME = "theme";
private static final String RECAPTCHA_TYPE = "type";
private static final String RECAPTCHA_VERSION = "version";
private static final String RECAPTCHA_KEYTYPE = "keyType";
public static final String RECAPTCHA_VERSION = "version";
public static final String RECAPTCHA_KEYTYPE = "keyType";

@Override
@JsonIgnore
public String getCloudServicePath() {
return cloudServicePath;
}

@JsonIgnore
@Override
public String getSize() {
return size;
}
Expand All @@ -101,7 +92,6 @@ public String getProvider() {
return "recaptcha";
}

@JsonIgnore
@Override
public Map<String, Object> getCaptchaProperties() throws GuideException {

Expand All @@ -118,20 +108,19 @@ public Map<String, Object> getCaptchaProperties() throws GuideException {
keyType = reCaptchaConfiguration.keyType();
}
}
customCaptchaProperties.put(RECAPTCHA_SITE_KEY, siteKey);
customCaptchaProperties.put(CAPTCHA_SITE_KEY, siteKey);
if (StringUtils.isNotEmpty(version) && version.equals("enterprise")) {
customCaptchaProperties.put(RECAPTCHA_URI, RECAPTCHA_ENTERPRISE_DEFAULT_URL);
customCaptchaProperties.put(CAPTCHA_URI, RECAPTCHA_ENTERPRISE_DEFAULT_URL);
} else {
customCaptchaProperties.put(RECAPTCHA_URI, RECAPTCHA_DEFAULT_URL);
customCaptchaProperties.put(CAPTCHA_URI, RECAPTCHA_DEFAULT_URL);
}
customCaptchaProperties.put(RECAPTCHA_SIZE, getSize());
customCaptchaProperties.put(RECAPTCHA_THEME, "light");
customCaptchaProperties.put(RECAPTCHA_TYPE, "image");
customCaptchaProperties.put(CAPTCHA_SIZE, getSize());
customCaptchaProperties.put(CAPTCHA_THEME, "light");
customCaptchaProperties.put(CAPTCHA_TYPE, "image");
customCaptchaProperties.put(RECAPTCHA_VERSION, version);
customCaptchaProperties.put(RECAPTCHA_KEYTYPE, keyType);

return customCaptchaProperties;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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.Arrays;
import java.util.Map;

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 org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

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.Review;
import com.adobe.cq.forms.core.components.util.AbstractBaseImpl;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { Review.class,
ComponentExporter.class },
resourceType = { FormConstants.RT_FD_FORM_REVIEW_V1 })
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class ReviewImpl extends AbstractBaseImpl implements Review {

private static final String LINKED_PANEL_PROPERTY = "fd:linkedPanels";
private static final String EDIT_ACTION_PROPERTY = "fd:editModeAction";

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "fd:linkedPanels")
@Nullable
private String[] linkedPanels;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "fd:editModeAction")
@Nullable
private String editModeAction;

public String[] getLinkedPanels() {
return linkedPanels != null ? Arrays.copyOf(linkedPanels, linkedPanels.length) : new String[] {};
}

public String getEditModeAction() {
return editModeAction;
}

@Override
public String getFieldType() {
return super.getFieldType(FieldType.PLAIN_TEXT);
}

@Override
public @NotNull Map<String, Object> getProperties() {
Map<String, Object> customProperties = super.getProperties();
customProperties.put(LINKED_PANEL_PROPERTY, getLinkedPanels());
customProperties.put(EDIT_ACTION_PROPERTY, getEditModeAction());
return customProperties;
}
}
Loading

0 comments on commit acbfe0c

Please sign in to comment.