* Change recaptcha key and type and add suggestion for recaptchatoken * Add recaptchaToken property as target for auto completion cypress tests * Added cypress test to validate recaptcha v2 can be selected in button widget property pane Co-authored-by: Arpit Mohan <arpit@appsmith.com>
22 lines
767 B
TypeScript
22 lines
767 B
TypeScript
import { WidgetProps } from "widgets/BaseWidget";
|
|
import { DSLWidget } from "widgets/constants";
|
|
import { RecaptchaTypes } from "components/constants";
|
|
|
|
export const migrateRecaptchaType = (currentDSL: DSLWidget): DSLWidget => {
|
|
currentDSL.children = currentDSL.children?.map((child: WidgetProps) => {
|
|
if (child.type === "BUTTON_WIDGET" || child.type === "FORM_BUTTON_WIDGET") {
|
|
const recaptchaV2 = child.recaptchaV2;
|
|
if (recaptchaV2) {
|
|
child.recaptchaType = RecaptchaTypes.V2;
|
|
} else {
|
|
child.recaptchaType = RecaptchaTypes.V3;
|
|
}
|
|
delete child.recaptchaV2;
|
|
} else if (child.children && child.children.length > 0) {
|
|
child = migrateRecaptchaType(child);
|
|
}
|
|
return child;
|
|
});
|
|
return currentDSL;
|
|
};
|