Skip to content

Commit

Permalink
Merge branch 'main' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
sharanyavinod committed Dec 12, 2024
2 parents 4ceb11c + 204bd4c commit a04993f
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Per Default the content is retrieved and written back to our Production Demo Env
```
authorHost=https://author-p7452-e12433.adobeaemcloud.com
publishHost=https://publish-p7452-e12433.adobeaemcloud.com
service=<null> // using defualt built in Universal Editor
protocol=aem // protocol to work on AEMCS
```
If you'd like to retrieve content from another environment add authorHost & publishHost as query parameters, e.g.

Expand All @@ -15,7 +17,6 @@ respectively if run on local dev environment:

[https://localhost:3000?authorHost=https://author-p15902-e145656-cmstg.adobeaemcloud.com&publishHost=https://publish-p15902-e145656-cmstg.adobeaemcloud.com](https://localhost:3000?authorHost=https://author-p15902-e145656-cmstg.adobeaemcloud.com&publishHost=https://publish-p15902-e145656-cmstg.adobeaemcloud.com)


## Prerequisites

- AEMCS instance is available
Expand Down
4 changes: 2 additions & 2 deletions build/index.html

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions build/static/component-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"text": "Default Text"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/text",
"template": {
"text": "Default Text"
}
}
}
}
},
Expand All @@ -29,6 +37,14 @@
"jcr:title": "Default Title"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/title",
"template": {
"jcr:title": "Default Title"
}
}
}
}
},
Expand All @@ -43,6 +59,14 @@
"fileReference": "/content/dam/wknd-shared/en/magazine/arctic-surfing/camp-tent.jpg"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/image",
"template": {
"fileReference": "/content/dam/wknd-shared/en/magazine/arctic-surfing/camp-tent.jpg"
}
}
}
}
},
Expand All @@ -63,6 +87,11 @@
"page": {
"resourceType": "wknd/components/container"
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/container"
}
}
}
}
Expand All @@ -84,6 +113,15 @@
"text": "<p>Default Richtext</p>"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/text",
"template": {
"textIsRich": true,
"text": "<p>Default Richtext</p>"
}
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"dependencies": {
"@adobe/aem-headless-client-js": "^3.1.0",
"@adobe/aem-headless-client-nodejs": "^1.1.0",
"@adobe/universal-editor-cors": "^2.3.7",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
src="/static/model-definition.json"
></script>
<title>React App</title>
<script src="https://universal-editor-service.adobe.io/cors.js" async></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
38 changes: 38 additions & 0 deletions public/static/component-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"text": "Default Text"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/text",
"template": {
"text": "Default Text"
}
}
}
}
},
Expand All @@ -29,6 +37,14 @@
"jcr:title": "Default Title"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/title",
"template": {
"jcr:title": "Default Title"
}
}
}
}
},
Expand All @@ -43,6 +59,14 @@
"fileReference": "/content/dam/wknd-shared/en/magazine/arctic-surfing/camp-tent.jpg"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/image",
"template": {
"fileReference": "/content/dam/wknd-shared/en/magazine/arctic-surfing/camp-tent.jpg"
}
}
}
}
},
Expand All @@ -63,6 +87,11 @@
"page": {
"resourceType": "wknd/components/container"
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/container"
}
}
}
}
Expand All @@ -84,6 +113,15 @@
"text": "<p>Default Richtext</p>"
}
}
},
"aem65": {
"page": {
"resourceType": "wknd/components/text",
"template": {
"textIsRich": true,
"text": "<p>Default Richtext</p>"
}
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AdventureDetail from "./components/AdventureDetail";
import Articles from "./components/Articles";
import ArticleDetail from "./components/ArticleDetail";
import About from "./components/About";
import {getAuthorHost} from "./utils/fetchData";
import {getAuthorHost, getProtocol, getService} from "./utils/fetchData";
import logo from "./images/wknd-logo-dk.svg";
import "./App.scss";
// import { useSparkleAppUrl } from "./hooks";
Expand Down Expand Up @@ -47,8 +47,9 @@ function App() {
<HelmetProvider>
<div className="App">
<Helmet>
<meta name="urn:adobe:aue:system:aemconnection" content={`aem:${getAuthorHost()}`}/>
<meta name="urn:adobe:aue:system:aemconnection" content={`${getProtocol()}:${getAuthorHost()}`}/>
<meta name="urn:adobe:aue:config:extensions" content="https://47679-workflowextension.adobeio-static.net"/>
{ getService() && <meta name="urn:adobe:aue:config:service" content={getService()}/> }
</Helmet>
<Router>
<Header />
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import ReactDOM from "react-dom/client";
import "@adobe/universal-editor-cors";
import App from "./App";
import "./index.css";

Expand Down
19 changes: 19 additions & 0 deletions src/utils/fetchData.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ export const getAuthorHost = () => {
}
}

export const getProtocol = () => {
const url = new URL(window.location.href);
const searchParams = new URLSearchParams(url.search);
if (searchParams.has("protocol")) {
return searchParams.get("protocol");
} else {
return "aem";
}
}

export const getService = () => {
const url = new URL(window.location.href);
const searchParams = new URLSearchParams(url.search);
if (searchParams.has("service")) {
return searchParams.get("service");
}
return null;
}

export const getPublishHost = () => {
const url = new URL(window.location.href);
const searchParams = new URLSearchParams(url.search);
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@
resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.2.0.tgz#e1a84fca468f4b337816fcb7f0964beb620ba855"
integrity sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==

"@adobe/universal-editor-cors@^2.3.7":
version "2.3.7"
resolved "https://registry.yarnpkg.com/@adobe/universal-editor-cors/-/universal-editor-cors-2.3.7.tgz#2f3520427670a516caf16273c7fd6165f0cc023a"
integrity sha512-bZ36OyGp63hfOT9gPUDSn2iCzBdPXn8fg2iwpUEbektRM14Pkwoaxt518KQRblOj7w4i3UJUMGDsmQR+RSw2xQ==

"@ampproject/remapping@^2.2.0":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630"
Expand Down

1 comment on commit a04993f

@comanV
Copy link
Collaborator

@comanV comanV commented on a04993f Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.