Skip to content

Commit

Permalink
Merge pull request #594 from Esri/prav5100/add-general-app
Browse files Browse the repository at this point in the history
Add support for General instant app
  • Loading branch information
pspraveenkr authored Dec 13, 2024
2 parents 90ac4be + d13cbe5 commit bc45950
Show file tree
Hide file tree
Showing 34 changed files with 693 additions and 672 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist
distESM
node_modules
coverage
.vscode
.vscode
.idea
18 changes: 14 additions & 4 deletions build/esmBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,24 @@ const updateFiles = (files) => {
.then(fileTxt => {
// esm uses @arcgis/core package for JS API and the references are different
let updatedFile = fileTxt.replaceAll(/esri\//g, "@arcgis/core/");

// the previous line messes up "@esri/" imports. revert those back specifically
updatedFile = updatedFile.replaceAll("@@arcgis/core/", "@esri/");

// Add .js extension to module specifiers that contain bare module names without file extension
// Ex:
// "@arcgis/core/core/promiseUtils" -> "@arcgis/core/core/promiseUtils.js"
updatedFile = updatedFile.replaceAll(/(from)\s+\"([^"\.]+)\";/g, "$1 \"$2.js\";");

// Add .js extension to module specifiers that contain a relative path without file extension
// Ex:
// "./support/configParser" -> "./support/configParser.js"
// "../functionality/configurationSettings" -> "../functionality/configurationSettings.js"
updatedFile = updatedFile.replaceAll(/(from)\s+\"(((\.\/)|(\.\.\/)+)([^"\.]+))\";/g, "$1 \"$2.js\";");

// esm needs different telemetry file
updatedFile = updatedFile.replaceAll("\"./telemetry.dojo.min\"", "\"./telemetry.min\"");
// Takes out the dojo logic for injecting json file info
updatedFile = updatedFile.replaceAll("dojo/text!", "");
// Takes out the JSON.parse - esm apps don't need it
updatedFile = updatedFile.replaceAll("JSON.parse(INSTANT_APPS", "(INSTANT_APPS");

return fse.writeFile(filePath, updatedFile);
});
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"generateTypes:amd": "dts-generator --prefix TemplatesCommonLib --project ./ --out ./dist/index.d.ts",
"run:test": "npx intern serveOnly",
"build:run:test": "npm run build:test && npm run run:test",
"filesCopy:amd": "npx cpy ./amd/package.json ./dist --flat && npx cpy ./README.md ./dist && npx cpy ./src/structuralFunctionality/telemetry/telemetry.dojo.min.js ./dist/structuralFunctionality/telemetry --flat && npx cpy ./src/configParamsJSON ./dist/configParamsJSON --flat",
"filesCopy:esm": "npx cpy ./esm/package.json ./distESM --flat && npx cpy ./README.md ./distESM && npx cpy ./src/structuralFunctionality/telemetry/telemetry.min.js ./distESM/structuralFunctionality/telemetry --flat && npx cpy ./src/configParamsJSON ./distESM/configParamsJSON --flat"
"filesCopy:amd": "npx cpy ./amd/package.json ./dist --flat && npx cpy ./README.md ./dist && npx cpy ./src/structuralFunctionality/telemetry/telemetry.dojo.min.js ./dist/structuralFunctionality/telemetry --flat",
"filesCopy:esm": "npx cpy ./esm/package.json ./distESM --flat && npx cpy ./README.md ./distESM && npx cpy ./src/structuralFunctionality/telemetry/telemetry.min.js ./distESM/structuralFunctionality/telemetry --flat"
},
"author": "Cameron Smith ([email protected])",
"license": "ISC",
Expand Down
5 changes: 0 additions & 5 deletions src/baseClasses/ApplicationBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ApplicationBaseSettings,
ApplicationConfig,
ApplicationConfigs,
ApplicationProxy,
Direction,
ILocalTestCase,
} from "../interfaces/applicationBase";
Expand Down Expand Up @@ -752,10 +751,6 @@ export default class ApplicationBase {
flowType: shouldUsePopup ? "authorization-code" : "auto",
});

if (!info) {
return;
}

IdentityManager.registerOAuthInfos([info]);
}

Expand Down
7 changes: 6 additions & 1 deletion src/baseClasses/CompatibilityChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum EAppTemplateType {
Compare = "/apps/instant/compare/index.html",
Countdown = "/apps/instant/countdown/index.html",
Exhibit = "/apps/instant/exhibit/index.html",
General = "/apps/instant/general/index.html",
Insets = "/apps/instant/insets/index.html",
InteractiveLegend = "/apps/instant/interactivelegend/index.html",
ImageryApp = "/apps/instant/imageryviewer/index.html",
Expand Down Expand Up @@ -62,6 +63,7 @@ const EResourceType_to_AppType_Mapping = {
EAppTemplateType.Atlas,
EAppTemplateType.CategoryGallery,
EAppTemplateType.Charts,
EAppTemplateType.General,
EAppTemplateType.ImageryApp,
EAppTemplateType.Insets,
EAppTemplateType.InteractiveLegend,
Expand All @@ -83,6 +85,7 @@ const EResourceType_to_AppType_Mapping = {
EAppTemplateType.Compare,
EAppTemplateType.Countdown,
EAppTemplateType.Exhibit,
EAppTemplateType.General,
EAppTemplateType.ImageryApp,
EAppTemplateType.Insets,
EAppTemplateType.InteractiveLegend,
Expand Down Expand Up @@ -115,6 +118,7 @@ export interface ICompatibilityCheckerProperties {

resourceMessages: {
Webmap: string;
WebmapOrGroup: string;
Webscene: string;
Group: string;
WebmapOrWebscene: string;
Expand Down Expand Up @@ -170,13 +174,14 @@ export class CompatibilityChecker {

this._resourceMessagesMap = {
[EAppTemplateType.AttachmentViewer]: resourceMessages.Webmap,
[EAppTemplateType.Atlas]: resourceMessages.Group,
[EAppTemplateType.Atlas]: resourceMessages.WebmapOrGroup,
[EAppTemplateType.Basic]: resourceMessages.WebmapOrWebscene,
[EAppTemplateType.CategoryGallery]: resourceMessages.Group,
[EAppTemplateType.Charts]: resourceMessages.Webmap,
[EAppTemplateType.Compare]: resourceMessages.WebmapOrWebscene,
[EAppTemplateType.Countdown]: resourceMessages.WebmapOrWebscene,
[EAppTemplateType.Exhibit]: resourceMessages.WebmapOrWebscene,
[EAppTemplateType.General]: resourceMessages.Webmap,
[EAppTemplateType.ImageryApp]: resourceMessages.Webmap,
[EAppTemplateType.Insets]: resourceMessages.Webmap,
[EAppTemplateType.InteractiveLegend]: resourceMessages.Webmap,
Expand Down
52 changes: 27 additions & 25 deletions src/baseClasses/support/configParamsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import Atlas from "dojo/text!../../configParamsJSON/atlasConfigParams.json";
import AttachmentViewer from "dojo/text!../../configParamsJSON/avConfigParams.json";
import Basic from "dojo/text!../../configParamsJSON/basicConfigParams.json";
import CategoryGallery from "dojo/text!../../configParamsJSON/categoryGalleryConfigParams.json";
import Charts from "dojo/text!../../configParamsJSON/chartsConfigParams.json";
import Compare from "dojo/text!../../configParamsJSON/compareConfigParams.json";
import Countdown from "dojo/text!../../configParamsJSON/countdownConfigParams.json";
import Exhibit from "dojo/text!../../configParamsJSON/exhibitConfigParams.json";
import Imagery from "dojo/text!../../configParamsJSON/imageryViewerConfig.json";
import Insets from "dojo/text!../../configParamsJSON/insetConfigParams.json";
import InteractiveLegend from "dojo/text!../../configParamsJSON/intLegendConfigParams.json";
import Manager from "dojo/text!../../configParamsJSON/managerConfigParams.json";
import Media from "dojo/text!../../configParamsJSON/mediaConfigParams.json";
import Minimalist from "dojo/text!../../configParamsJSON/minimalistConfigParams.json";
import Nearby from "dojo/text!../../configParamsJSON/nearbyConfigParams.json";
import Notify from "dojo/text!../../configParamsJSON/notifyConfigParams.json";
import Observer from "dojo/text!../../configParamsJSON/observerConfigParams.json";
import Portfolio from "dojo/text!../../configParamsJSON/portfolioConfigParams.json";
import Reporter from "dojo/text!../../configParamsJSON/reporterConfigParams.json";
import Sidebar from "dojo/text!../../configParamsJSON/sidebarConfigParams.json";
import Slider from "dojo/text!../../configParamsJSON/dataSliderConfigParams.json";
import Streamflow from "dojo/text!../../configParamsJSON/streamflowConfigParams.json";
import ThreeDViewer from "dojo/text!../../configParamsJSON/3dViewerConfigParams.json";
import ZoneLookup from "dojo/text!../../configParamsJSON/lookupConfigParams.json";
import Atlas from "../../configParamsJSON/atlasConfigParams";
import AttachmentViewer from "../../configParamsJSON/avConfigParams";
import Basic from "../../configParamsJSON/basicConfigParams";
import CategoryGallery from "../../configParamsJSON/categoryGalleryConfigParams";
import Charts from "../../configParamsJSON/chartsConfigParams";
import Compare from "../../configParamsJSON/compareConfigParams";
import Countdown from "../../configParamsJSON/countdownConfigParams";
import Exhibit from "../../configParamsJSON/exhibitConfigParams";
import General from "../../configParamsJSON/generalConfigParams";
import Imagery from "../../configParamsJSON/imageryViewerConfig";
import Insets from "../../configParamsJSON/insetConfigParams";
import InteractiveLegend from "../../configParamsJSON/intLegendConfigParams";
import Manager from "../../configParamsJSON/managerConfigParams";
import Media from "../../configParamsJSON/mediaConfigParams";
import Minimalist from "../../configParamsJSON/minimalistConfigParams";
import Nearby from "../../configParamsJSON/nearbyConfigParams";
import Notify from "../../configParamsJSON/notifyConfigParams";
import Observer from "../../configParamsJSON/observerConfigParams";
import Portfolio from "../../configParamsJSON/portfolioConfigParams";
import Reporter from "../../configParamsJSON/reporterConfigParams";
import Sidebar from "../../configParamsJSON/sidebarConfigParams";
import Slider from "../../configParamsJSON/dataSliderConfigParams";
import Streamflow from "../../configParamsJSON/streamflowConfigParams";
import ThreeDViewer from "../../configParamsJSON/3dViewerConfigParams";
import ZoneLookup from "../../configParamsJSON/lookupConfigParams";

import { EAppTemplateType } from "../CompatibilityChecker";

Expand All @@ -34,6 +35,7 @@ const INSTANT_APPS_CONFIG_PARAMS_MAP = {
[EAppTemplateType.Compare]: Compare,
[EAppTemplateType.Countdown]: Countdown,
[EAppTemplateType.Exhibit]: Exhibit,
[EAppTemplateType.General]: General,
[EAppTemplateType.ImageryApp]: Imagery,
[EAppTemplateType.InteractiveLegend]: InteractiveLegend,
[EAppTemplateType.Insets]: Insets,
Expand All @@ -53,7 +55,7 @@ const INSTANT_APPS_CONFIG_PARAMS_MAP = {
};

export function getConfigParams(template: EAppTemplateType) {
return JSON.parse(INSTANT_APPS_CONFIG_PARAMS_MAP[template]);
return structuredClone(INSTANT_APPS_CONFIG_PARAMS_MAP[template]);
}

export function generateDefaultValuesObj(configParamsObj) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -1153,4 +1153,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -494,4 +494,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -524,4 +524,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -550,4 +550,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -365,4 +365,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -557,4 +557,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -476,4 +476,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -444,4 +444,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -854,4 +854,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -494,4 +494,4 @@
]
}
]
}
};
3 changes: 3 additions & 0 deletions src/configParamsJSON/generalConfigParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
"config": []
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -659,4 +659,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -564,4 +564,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -794,4 +794,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -1099,4 +1099,4 @@
]
}
]
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"config": [
{
"type": "section",
Expand Down Expand Up @@ -362,4 +362,4 @@
]
}
]
}
};
Loading

0 comments on commit bc45950

Please sign in to comment.