diff --git a/app/client/src/ce/pages/Applications/EmbedSnippetTab.tsx b/app/client/src/ce/pages/Applications/EmbedSnippetTab.tsx
index 4899df1c24..0460ca5e2e 100644
--- a/app/client/src/ce/pages/Applications/EmbedSnippetTab.tsx
+++ b/app/client/src/ce/pages/Applications/EmbedSnippetTab.tsx
@@ -217,11 +217,14 @@ export function EmbedSnippetTab({
if (!isPublicApp) {
return (
-
+
);
}
diff --git a/app/client/src/pages/Editor/EditorName/useNavigationMenuData.ts b/app/client/src/pages/Editor/EditorName/useNavigationMenuData.ts
index f1dd26545e..28b48702ea 100644
--- a/app/client/src/pages/Editor/EditorName/useNavigationMenuData.ts
+++ b/app/client/src/pages/Editor/EditorName/useNavigationMenuData.ts
@@ -21,7 +21,7 @@ import { Colors } from "constants/Colors";
import { getCurrentApplicationId } from "selectors/editorSelectors";
import type { ThemeProp } from "WidgetProvider/constants";
import { toast } from "@appsmith/ads";
-import { DOCS_BASE_URL } from "constants/ThirdPartyConstants";
+import { DOCS_AI_BASE_URL, DOCS_BASE_URL } from "constants/ThirdPartyConstants";
import { getAppsmithConfigs } from "ee/configs";
import { getCurrentUser } from "selectors/usersSelectors";
import { getIsAiAgentFlowEnabled } from "ee/selectors/aiAgentSelectors";
@@ -151,7 +151,10 @@ export const useNavigationMenuData = ({
children: [
{
text: "Documentation",
- onClick: () => openExternalLink(DOCS_BASE_URL),
+ onClick: () =>
+ openExternalLink(
+ isAiAgentFlowEnabled ? DOCS_AI_BASE_URL : DOCS_BASE_URL,
+ ),
type: MenuTypes.MENU,
isVisible: true,
startIcon: "book-line",
diff --git a/app/client/src/pages/Editor/HelpButton.tsx b/app/client/src/pages/Editor/HelpButton.tsx
index 0aa475db70..c5b2e5c518 100644
--- a/app/client/src/pages/Editor/HelpButton.tsx
+++ b/app/client/src/pages/Editor/HelpButton.tsx
@@ -74,7 +74,7 @@ interface HelpItem {
icon: string;
}
-const HELP_MENU_ITEMS: HelpItem[] = [
+let HELP_MENU_ITEMS: HelpItem[] = [
{
icon: "book-line",
label: "Documentation",
@@ -201,9 +201,8 @@ function HelpButton() {
docItem.link = DOCS_AI_BASE_URL;
}
- HELP_MENU_ITEMS.splice(
- HELP_MENU_ITEMS.findIndex((item) => item.label === "Report a bug"),
- 1,
+ HELP_MENU_ITEMS = HELP_MENU_ITEMS.filter(
+ (item) => item.label !== "Report a bug",
);
}
diff --git a/app/client/src/widgets/wds/WDSSelectWidget/widget/derived.js b/app/client/src/widgets/wds/WDSSelectWidget/widget/derived.js
index 9973efaaec..5288fc09e7 100644
--- a/app/client/src/widgets/wds/WDSSelectWidget/widget/derived.js
+++ b/app/client/src/widgets/wds/WDSSelectWidget/widget/derived.js
@@ -16,29 +16,6 @@ export default {
: optionArray;
};
- /**
- * SourceData:
- * [{
- * "name": "Blue",
- * "code": "name"
- * },{
- * "name": "Green",
- * "code": "name"
- * },{
- * "name": "Red",
- * "code": "name"
- * }]
- * The `Label key` in UI can take following values:
- * 1. Normal string, without any quotes. e.g `name`
- * This can be assumed as a key in each item of sourceData. We search it in each item of sourceData.
- * 2. Except this everything comes in `{{}}`. It can have 2 types of values:
- * a. Expressions that evaluate to a normal string. e.g `{{(() => `name`)()}}`
- * In this case evaluated value will be ['name', 'name', 'name'].
- * i. This can be assumed as a key in each item of sourceData. Handled by `allLabelsEqual` check.
- * b. Dynamic property accessed via `item` object. e.g `{{item.name}}`
- * In this case evaluated value will be actual values form sourceData ['Red', 'Green', 'Blue'].
- * Hence we can assume that this array is the labels array.
- * */
if (typeof props.optionLabel === "string") {
labels = sourceData.map((d) => d[props.optionLabel]);
} else if (_.isArray(props.optionLabel)) {
@@ -56,11 +33,13 @@ export default {
value: values[i],
}));
},
+ //
getIsValid: (props, moment, _) => {
return props.isRequired
? !_.isNil(props.selectedOptionValue) && props.selectedOptionValue !== ""
: true;
},
+ //
getSelectedOptionValue: (props, moment, _) => {
const isServerSideFiltered = props.serverSideFiltering;
const options = props.options ?? [];
diff --git a/app/client/src/widgets/wds/WDSSelectWidget/widget/index.tsx b/app/client/src/widgets/wds/WDSSelectWidget/widget/index.tsx
index 65c7063081..0eef64ad23 100644
--- a/app/client/src/widgets/wds/WDSSelectWidget/widget/index.tsx
+++ b/app/client/src/widgets/wds/WDSSelectWidget/widget/index.tsx
@@ -20,9 +20,8 @@ import {
} from "../config";
import { validateInput } from "./helpers";
import type { WDSSelectWidgetProps } from "./types";
-import derivedPropertyFns from "./derived";
-import { parseDerivedProperties } from "widgets/WidgetUtils";
import isArray from "lodash/isArray";
+import derivedProperties from "./parseDerivedProperties";
const isTrueObject = (item: unknown): item is Record => {
return Object.prototype.toString.call(item) === "[object Object]";
@@ -67,13 +66,11 @@ class WDSSelectWidget extends BaseWidget {
}
static getDerivedPropertiesMap() {
- const parsedDerivedProperties = parseDerivedProperties(derivedPropertyFns);
-
return {
- options: `{{(()=>{${parsedDerivedProperties.getOptions}})()}}`,
- isValid: `{{(()=>{${parsedDerivedProperties.getIsValid}})()}}`,
- selectedOptionValue: `{{(()=>{${parsedDerivedProperties.getSelectedOptionValue}})()}}`,
- selectedOptionLabel: `{{(()=>{${parsedDerivedProperties.getSelectedOptionLabel}})()}}`,
+ options: `{{(()=>{${derivedProperties.getOptions}})()}}`,
+ isValid: `{{(()=>{${derivedProperties.getIsValid}})()}}`,
+ selectedOptionValue: `{{(()=>{${derivedProperties.getSelectedOptionValue}})()}}`,
+ selectedOptionLabel: `{{(()=>{${derivedProperties.getSelectedOptionLabel}})()}}`,
};
}
diff --git a/app/client/src/widgets/wds/WDSSelectWidget/widget/parseDerivedProperties.ts b/app/client/src/widgets/wds/WDSSelectWidget/widget/parseDerivedProperties.ts
new file mode 100644
index 0000000000..68719310ce
--- /dev/null
+++ b/app/client/src/widgets/wds/WDSSelectWidget/widget/parseDerivedProperties.ts
@@ -0,0 +1,40 @@
+// @ts-expect-error: Types are not available
+import widgetPropertyFns from "!!raw-loader!./derived.js";
+
+// TODO(abhinav):
+// Add unit test cases
+// Handle edge cases
+// Error out on wrong values
+// TODO: Fix this the next time the file is edited
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const derivedProperties: any = {};
+// const regex = /(\w+):\s?\(props\)\s?=>\s?{([\w\W]*?)},/gim;
+const regex =
+ /(\w+):\s?\(props, moment, _\)\s?=>\s?{([\w\W\n]*?)},\n?\s+?\/\//gim;
+
+let m;
+
+while ((m = regex.exec(widgetPropertyFns)) !== null) {
+ // This is necessary to avoid infinite loops with zero-width matches
+ if (m.index === regex.lastIndex) {
+ regex.lastIndex++;
+ }
+
+ let key = "";
+
+ // The result can be accessed through the `m`-variable.
+ m.forEach((match, groupIndex) => {
+ if (groupIndex === 1) {
+ key = match;
+ }
+
+ if (groupIndex === 2) {
+ derivedProperties[key] = match
+ .trim()
+ .replace(/\n/g, "")
+ .replace(/props\./g, "this.");
+ }
+ });
+}
+
+export default derivedProperties;