Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10,978 changes: 6,589 additions & 4,389 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
"@adobe/exc-app": "^1.3.0",
"@adobe/generator-app-excshell": "^2.0.0",
"@adobe/jwt-auth": "^2.0.0",
"@adobe/react-spectrum": "^3.4.0",
"@adobe/react-spectrum": "3.45.0",
"@adobe/uix-guest": "^1.0.1",
"@spectrum-icons/workflow": "^3.2.0",
"@reduxjs/toolkit": "^2.9.2",
"@spectrum-icons/workflow": "4.2.25",
"@types/randomstring": "^1.3.0",
"axios": "^1.9.0",
"cloudevents": "^9.0.0",
Expand All @@ -22,9 +23,11 @@
"node-fetch": "^2.7.0",
"openwhisk": "^3.21.8",
"randomstring": "^1.3.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-error-boundary": "^1.2.5",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-error-boundary": "4.1.2",
"react-querybuilder": "^8.10.0",
"react-redux": "^9.2.0",
"react-router-dom": "^6.26.2",
"regenerator-runtime": "^0.13.5"
},
Expand Down
67 changes: 67 additions & 0 deletions src/actions/classes/RulesManger/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { type RuleGroupType } from "react-querybuilder";

export enum RuleDirection {
EMIT = "emit", // Use "emitted" when describing the act of producing or broadcasting an event.
CONSUME = "consume", // Use "consumed" when describing the act of receiving and processing an event.
}

export enum RuleLogicalOperator {
AND = "and",
OR = "or",
}

export type TOperator =
| "equals"
| "contains"
| "startsWith"
| "endsWith"
| "regex"
| "exists"
| "notExists";

export enum RuleActionType {
TRANSFORM = "transform",
FILTER = "filter",
ROUTE = "route",
LOG = "log",
}

export enum RuleOperator {
EQUALS = "equals",
NOT_EQUALS = "notEquals",
CONTAINS = "contains",
NOT_CONTAINS = "notContains",
STARTS_WITH = "startsWith",
ENDS_WITH = "endsWith",
IS_EMPTY = "null",
NOT_IS_EMPTY = "notNull",
REGEX = "regex",
}

export interface Rule {
id: string;
name: string;
description: string;
eventType: string;
direction: RuleDirection;
targetBrands: string[];
conditions: RuleGroupType;
actions: RuleAction[];
enabled: boolean;
priority: number;
createdAt: Date;
updatedAt: Date;
}

export interface RuleAction {
type: RuleActionType;
target?: string;
parameters?: Record<string, any>;
}

export interface RuleEvaluationResult {
ruleId: string;
matched: boolean;
actions: RuleAction[];
executionTime: number;
}
37 changes: 19 additions & 18 deletions src/actions/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@

// HTTP Status Codes
export const HTTP_STATUS = {
OK: 200,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
INTERNAL_ERROR: 500
OK: 200,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
INTERNAL_ERROR: 500,
};

// Error Messages
export const ERROR_MESSAGES = {
INVALID_JSON: 'Invalid JSON: Input must be a valid JSON object',
MISSING_PROPERTIES: (props: string[]) => `Invalid data: Missing required properties: ${props.join(', ')}`,
INVALID_BRAND: 'Invalid brand data provided',
INVALID_EVENT: 'Invalid event data provided',
PROCESSING_ERROR: 'Error processing request'
INVALID_JSON: "Invalid JSON: Input must be a valid JSON object",
MISSING_PROPERTIES: (props: string[]) =>
`Invalid data: Missing required properties: ${props.join(", ")}`,
INVALID_BRAND: "Invalid brand data provided",
INVALID_EVENT: "Invalid event data provided",
PROCESSING_ERROR: "Error processing request",
};

// Log Levels
export const LOG_LEVELS = {
ERROR: 'error',
WARN: 'warn',
INFO: 'info',
DEBUG: 'debug'
ERROR: "error",
WARN: "warn",
INFO: "info",
DEBUG: "debug",
};

export const BRAND_STATE_PREFIX = 'BRAND_';
export const BRAND_FILE_STORE_DIR = 'brand';
export const BRAND_SECRET_INDEX_PREFIX = 'BRAND_SECRET_INDEX_';
export const BRAND_STATE_PREFIX = "BRAND_";
export const BRAND_FILE_STORE_DIR = "brand";
export const BRAND_SECRET_INDEX_PREFIX = "BRAND_SECRET_INDEX_";
136 changes: 80 additions & 56 deletions src/dx-excshell-1/web-src/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,116 @@
/*
* <license header>
*/
/*
* <license header>
*/

import React, { useEffect } from 'react'
import { Provider, defaultTheme, Grid, View } from '@adobe/react-spectrum'
import ErrorBoundary from 'react-error-boundary'
import { HashRouter as Router, Routes, Route } from 'react-router-dom'
import SpectrumHeader from './common/SpectrumHeader'
import SideBar from './common/SideBar'
import { Home } from './Home'
import { About } from './About'
import BrandManagerView from './layout/BrandManagerView'
import RulesManagerView from './RulesManagerView'
import RulesConfigurationView from './layout/RulesConfigurationView'
import { apiService } from '../services/api'
import React, { useEffect } from "react";
import { Provider, defaultTheme, Grid, View } from "@adobe/react-spectrum";
import { ErrorBoundary } from "react-error-boundary";
import { HashRouter as Router, Routes, Route } from "react-router-dom";
import SpectrumHeader from "./common/SpectrumHeader";
import SideBar from "./common/SideBar";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import SideBar.

Copilot Autofix

AI 10 months ago

The best way to fix this issue is to delete the unnecessary import statement import SideBar from "./common/SideBar"; on line 10 of src/dx-excshell-1/web-src/src/components/App.js. This change is safe and does not alter the existing functionality of the application since SideBar is not used elsewhere in the code. No other files or code regions need to be changed, and no additional methods, imports, or definitions are required to implement this fix.

Suggested changeset 1
src/dx-excshell-1/web-src/src/components/App.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/dx-excshell-1/web-src/src/components/App.js b/src/dx-excshell-1/web-src/src/components/App.js
--- a/src/dx-excshell-1/web-src/src/components/App.js
+++ b/src/dx-excshell-1/web-src/src/components/App.js
@@ -7,7 +7,6 @@
 import { ErrorBoundary } from "react-error-boundary";
 import { HashRouter as Router, Routes, Route } from "react-router-dom";
 import SpectrumHeader from "./common/SpectrumHeader";
-import SideBar from "./common/SideBar";
 import { Home } from "./Home";
 import { About } from "./About";
 import BrandManagerView from "./layout/BrandManagerView";
EOF
@@ -7,7 +7,6 @@
import { ErrorBoundary } from "react-error-boundary";
import { HashRouter as Router, Routes, Route } from "react-router-dom";
import SpectrumHeader from "./common/SpectrumHeader";
import SideBar from "./common/SideBar";
import { Home } from "./Home";
import { About } from "./About";
import BrandManagerView from "./layout/BrandManagerView";
Copilot is powered by AI and may make mistakes. Always verify output.
import { Home } from "./Home";
import { About } from "./About";
import BrandManagerView from "./layout/BrandManagerView";
import RulesManagerView from "./RulesManagerView";
import { apiService } from "../services/api";
import { store } from "../store/store";
import { Provider as ReduxProvider } from "react-redux";

function App(props) {
console.log('runtime object:', props.runtime)
console.log('viewProps object:', props.viewProps)
console.log("runtime object:", props.runtime);
console.log("viewProps object:", props.viewProps);

// Safe access to viewProps and ims with fallbacks
const safeViewProps = props.viewProps || {};
const safeIms = safeViewProps.ims || {};

// use exc runtime event handlers
// respond to configuration change events (e.g. user switches org)
props.runtime.on('configuration', (props) => {
console.log('Ready! received on configuration:', props)
props.runtime.on("configuration", (props) => {
console.log("Ready! received on configuration:", props);
//console.log('configuration change', { imsOrg, imsToken, locale })
})
});

// respond to history change events
props.runtime.on('history', ({ type, path }) => {
console.log('history change', { type, path })
})
props.runtime.on("history", ({ type, path }) => {
console.log("history change", { type, path });
});

useEffect(() => {
const apiBaseUrl = `https://${safeViewProps.aioRuntimeNamespace}.adobeio-static.net/api/v1/web/${safeViewProps.aioActionPackageName}`;
apiService.initialize(apiBaseUrl, safeViewProps.imsToken, safeViewProps.imsOrg);
apiService.initialize(
apiBaseUrl,
safeViewProps.imsToken,
safeViewProps.imsOrg
);
return () => {
apiService.clear();
};
}, [])
}, []);

return (
<ErrorBoundary onError={onError} FallbackComponent={fallbackComponent}>
<Router>
<Provider theme={defaultTheme} colorScheme={'light'}>
<Grid
areas={['header', 'content']}
columns={['1fr']}
rows={['auto', '1fr']}
height='100vh'
gap='size-100'
>
<View gridArea='header'>
<SpectrumHeader viewProps={safeViewProps} />
</View>
<View gridArea='content' padding='size-200'>
<Routes>
<Route path='/' element={<Home viewProps={safeViewProps} />} />
<Route path='/brand_manager' element={<BrandManagerView viewProps={safeViewProps} />} />
<Route path='/rules_manager' element={<RulesConfigurationView viewProps={safeViewProps} />} />
<Route path='/about' element={<About viewProps={safeViewProps} />} />
</Routes>
</View>
</Grid>
</Provider>
</Router>
<ReduxProvider store={store}>
<Router>
<Provider theme={defaultTheme} colorScheme={"light"}>
<Grid
areas={["header", "content"]}
columns={["1fr"]}
rows={["auto", "1fr"]}
height="100vh"
gap="size-100"
>
<View
gridArea="header"
UNSAFE_style={{
position: "sticky",
top: 0,
zIndex: 1000,
}}
>
<SpectrumHeader viewProps={safeViewProps} />
</View>
<View gridArea="content" padding="size-200">
<Routes>
<Route
path="/"
element={<Home viewProps={safeViewProps} />}
/>
<Route
path="/brand_manager"
element={<BrandManagerView viewProps={safeViewProps} />}
/>
<Route
path="/rules_manager"
element={<RulesManagerView viewProps={safeViewProps} />}
/>
<Route
path="/about"
element={<About viewProps={safeViewProps} />}
/>
</Routes>
</View>
</Grid>
</Provider>
</Router>
</ReduxProvider>
</ErrorBoundary>
)

// Methods
);

// error handler on UI rendering failure
function onError(e, componentStack) { }
function onError(e, componentStack) {}

// component to show if UI fails rendering
function fallbackComponent({ componentStack, error }) {
return (
<React.Fragment>
<h1 style={{ textAlign: 'center', marginTop: '20px' }}>
<h1 style={{ textAlign: "center", marginTop: "20px" }}>
Something went wrong :(
</h1>
<pre>{componentStack + '\n' + error.message}</pre>
<pre>{componentStack + "\n" + error.message}</pre>
</React.Fragment>
)
);
}
}

export default App
export default App;
43 changes: 6 additions & 37 deletions src/dx-excshell-1/web-src/src/components/RulesManagerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,16 @@
IllustratedMessage
} from '@adobe/react-spectrum'

import { CreateRuleBuilder } from './rules-manager/create-rule/CreateRuleBuilder'

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import CreateRuleBuilder.

Copilot Autofix

AI 10 months ago

The fix is to remove the unused import of CreateRuleBuilder from ./rules-manager/create-rule/CreateRuleBuilder in the file src/dx-excshell-1/web-src/src/components/RulesManagerView.js. To implement this, simply delete line 16. This will not impact any functionality, as the import is not referenced elsewhere in the file.

Suggested changeset 1
src/dx-excshell-1/web-src/src/components/RulesManagerView.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/dx-excshell-1/web-src/src/components/RulesManagerView.js b/src/dx-excshell-1/web-src/src/components/RulesManagerView.js
--- a/src/dx-excshell-1/web-src/src/components/RulesManagerView.js
+++ b/src/dx-excshell-1/web-src/src/components/RulesManagerView.js
@@ -13,7 +13,6 @@
   IllustratedMessage
 } from '@adobe/react-spectrum'
 
-import { CreateRuleBuilder } from './rules-manager/create-rule/CreateRuleBuilder'
 import { CreateForm } from './rules-manager/CraeteForm'
 
 
EOF
@@ -13,7 +13,6 @@
IllustratedMessage
} from '@adobe/react-spectrum'

import { CreateRuleBuilder } from './rules-manager/create-rule/CreateRuleBuilder'
import { CreateForm } from './rules-manager/CraeteForm'


Copilot is powered by AI and may make mistakes. Always verify output.
import { CreateForm } from './rules-manager/CraeteForm'


export const RulesManagerView = ({ viewProps }) => (
<View maxWidth="size-6000">
<View>
<Content>
<Flex direction='column' gap='size-300'>
<Heading level={1}>Rules Manager</Heading>

<Divider size="S" />

<IllustratedMessage
UNSAFE_className="spectrum-IllustratedMessage--cta"
heading="Coming Soon"
description="The Rules Manager feature is currently under development. This will allow you to configure and manage business rules for brand relationships and asset synchronization."
/>

<View
backgroundColor="blue-100"
padding="size-200"
borderRadius="medium"
borderWidth="thin"
borderColor="blue-300"
>
<Flex direction="column" gap="size-100">
<Heading level={3}>Planned Features</Heading>
<Text>
• <strong>Business Rule Configuration</strong>: Define custom rules for brand interactions<br/>
• <strong>Automated Workflows</strong>: Set up automated processes for asset management<br/>
• <strong>Conditional Logic</strong>: Create if-then scenarios for different brand requirements<br/>
• <strong>Rule Templates</strong>: Pre-built rule sets for common use cases<br/>
• <strong>Validation & Testing</strong>: Test rules before applying them to production
</Text>
</Flex>
</View>

<Flex direction="column" gap="size-200">
<Heading level={2}>What to Expect</Heading>
<Text>
The Rules Manager will provide a comprehensive interface for configuring how your agency
interacts with different brands. You'll be able to set up automated workflows, define
business rules, and ensure consistent processes across all brand relationships.
</Text>
</Flex>
<CreateForm/>
</Flex>
</Content>
</View>
Expand Down
Loading
Loading