Skip to content

Commit 98b6a1b

Browse files
chore: auto update client extensions samples
1 parent 9eb16ef commit 98b6a1b

File tree

17 files changed

+34
-9470
lines changed

17 files changed

+34
-9470
lines changed

internal/assets/tpl/client_extension/liferay-client-extensions-samples/liferay-sample-custom-element-react-scripts/.env

Lines changed: 0 additions & 2 deletions
This file was deleted.

internal/assets/tpl/client_extension/liferay-client-extensions-samples/liferay-sample-custom-element-react-scripts/.gitignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

internal/assets/tpl/client_extension/liferay-client-extensions-samples/liferay-sample-custom-element-react-scripts/README.markdown

Lines changed: 0 additions & 70 deletions
This file was deleted.

internal/assets/tpl/client_extension/liferay-client-extensions-samples/liferay-sample-custom-element-react-scripts/client-extension.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ assemble:
22
- from: build/static
33
into: static
44
liferay-sample-custom-element-2:
5-
cssURLs:
6-
- css/main.*.css
75
friendlyURLMapping: liferay-sample-custom-element-2
86
htmlElementName: liferay-sample-custom-element-2
97
instanceable: false
108
name: Liferay Sample Custom Element 2
119
portletCategoryName: category.client-extensions
1210
type: customElement
1311
urls:
14-
- js/main.*.js
12+
- index.*.js
1513
useESM: true
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,12 @@
11
{
2-
"browserslist": {
3-
"development": [
4-
"last 1 chrome version",
5-
"last 1 firefox version",
6-
"last 1 safari version"
7-
],
8-
"production": [
9-
">0.2%",
10-
"not dead",
11-
"not op_mini all"
12-
]
13-
},
142
"dependencies": {
153
"react": "^18.2.0",
16-
"react-dom": "^18.2.0",
17-
"react-scripts": "5.0.1",
18-
"sass": "^1.66.1"
4+
"react-dom": "^18.2.0"
195
},
206
"name": "@liferay/liferay-sample-custom-element-2",
217
"private": true,
228
"scripts": {
23-
"build": "react-scripts build",
24-
"eject": "react-scripts eject",
25-
"start": "react-scripts start",
26-
"test": "react-scripts test --passWithNoTests --watchAll=false"
9+
"build": "esbuild src/index.js --outdir=build/static --bundle --entry-names=[name].[hash] --format=esm --external:react --external:react-dom --external:@liferay/oauth2-provider-web/client --loader:.js=jsx"
2710
},
2811
"version": "0.0.0"
2912
}

internal/assets/tpl/client_extension/liferay-client-extensions-samples/liferay-sample-custom-element-react-scripts/public/index.html

Lines changed: 0 additions & 47 deletions
This file was deleted.

internal/assets/tpl/client_extension/liferay-client-extensions-samples/liferay-sample-custom-element-react-scripts/src/common/components/Comic.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,26 @@
33
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
44
*/
55

6+
import * as OAuth2 from '@liferay/oauth2-provider-web/client';
67
import React from 'react';
78

8-
import {Liferay} from '../services/liferay/liferay.js';
9-
10-
let oAuth2Client;
11-
12-
try {
13-
oAuth2Client = Liferay.OAuth2Client.FromUserAgentApplication(
14-
'liferay-sample-etc-node-oauth-application-user-agent'
15-
);
16-
}
17-
catch (error) {
18-
console.error(error);
19-
}
20-
219
function Comic() {
2210
const [comicData, setComicData] = React.useState(null);
2311

2412
React.useEffect(() => {
25-
oAuth2Client?.fetch('/comic').then((comic) => {
26-
setComicData({
27-
alt: comic.alt,
28-
img: comic.img,
29-
title: comic.safe_title,
30-
});
31-
});
13+
OAuth2.FromUserAgentApplication(
14+
'liferay-sample-etc-node-oauth-application-user-agent'
15+
)
16+
.then((oAuth2Client) => {
17+
oAuth2Client?.fetch('/comic').then((comic) => {
18+
setComicData({
19+
alt: comic.alt,
20+
img: comic.img,
21+
title: comic.safe_title,
22+
});
23+
});
24+
})
25+
.catch();
3226
}, []);
3327

3428
return !comicData ? (

0 commit comments

Comments
 (0)