@webbio/strapi-plugin-page-builder 0.3.5-platform → 0.3.7-platform
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/api/has-platform-relation.ts +37 -0
- package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +43 -27
- package/admin/src/components/EditView/Details/index.tsx +12 -1
- package/admin/src/components/EditView/PageSettings/index.tsx +1 -0
- package/admin/src/components/EditView/Platform/platform-select.tsx +3 -2
- package/admin/src/components/EditView/index.tsx +8 -2
- package/dist/package.json +2 -2
- package/dist/server/controllers/collection-types.js +5 -0
- package/dist/server/graphql/index.js +2 -2
- package/dist/server/graphql/page-by-path.js +89 -0
- package/dist/server/register.js +2 -2
- package/dist/server/routes/index.js +5 -0
- package/dist/server/services/collection-types.js +7 -0
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/controllers/collection-types.ts +5 -0
- package/server/graphql/index.ts +2 -2
- package/server/graphql/{page-by-slug.ts → page-by-path.ts} +6 -6
- package/server/register.ts +2 -2
- package/server/routes/index.ts +5 -0
- package/server/services/collection-types.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webbio/strapi-plugin-page-builder",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7-platform",
|
|
4
4
|
"description": "This is the description of the plugin.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"develop": "tsc -p tsconfig.server.json -w",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@strapi/strapi": "^4.15.0",
|
|
43
|
-
"@webbio/strapi-plugin-slug": "^2.0.
|
|
43
|
+
"@webbio/strapi-plugin-slug": "^2.0.5",
|
|
44
44
|
"react": "^17.0.0 || ^18.0.0",
|
|
45
45
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
46
46
|
"react-router-dom": "^5.3.4",
|
|
@@ -6,6 +6,11 @@ export default {
|
|
|
6
6
|
|
|
7
7
|
return (strapi as Strapi).service('plugin::page-builder.collection-types').hasPageRelation(uid);
|
|
8
8
|
},
|
|
9
|
+
async hasPlatformRelation(ctx: any) {
|
|
10
|
+
const uid = ctx.params?.uid;
|
|
11
|
+
|
|
12
|
+
return (strapi as Strapi).service('plugin::page-builder.collection-types').hasPlatformRelation(uid);
|
|
13
|
+
},
|
|
9
14
|
async getTranslationPageLinks(ctx: any): Promise<IGetTranslationPageLinks[] | undefined> {
|
|
10
15
|
const { uid, ids } = ctx.params || {};
|
|
11
16
|
const idsArr = (ids as string)
|
package/server/graphql/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Strapi } from '@strapi/strapi';
|
|
|
3
3
|
import { filterUnderscoreArguments } from '../utils/filter-underscore-arguments';
|
|
4
4
|
import { PAGE_UID } from '../../shared/utils/constants';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const getPageByPath = (strapi: Strapi) => {
|
|
7
7
|
const typeDefs = () => {
|
|
8
8
|
return `
|
|
9
9
|
extend type Page {
|
|
@@ -11,7 +11,7 @@ const getPageBySlug = (strapi: Strapi) => {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
type Query {
|
|
14
|
-
|
|
14
|
+
getPageByPath(path: String, _domain: String, _locale: String, _publicationState: PublicationState): PageEntity
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
`;
|
|
@@ -22,7 +22,7 @@ const getPageBySlug = (strapi: Strapi) => {
|
|
|
22
22
|
|
|
23
23
|
return {
|
|
24
24
|
Query: {
|
|
25
|
-
|
|
25
|
+
getPageByPath: {
|
|
26
26
|
resolve: async (_parent: any, args: Record<string, any>, ctx: any) => {
|
|
27
27
|
try {
|
|
28
28
|
const filteredArgs = {
|
|
@@ -79,7 +79,7 @@ const getPageBySlug = (strapi: Strapi) => {
|
|
|
79
79
|
throw new Error(ctx.koaContext.response.message);
|
|
80
80
|
}
|
|
81
81
|
} catch (error) {
|
|
82
|
-
console.log('Error in
|
|
82
|
+
console.log('Error in getPageByPath:', error);
|
|
83
83
|
|
|
84
84
|
throw new Error(ctx.koaContext.response.message);
|
|
85
85
|
}
|
|
@@ -90,7 +90,7 @@ const getPageBySlug = (strapi: Strapi) => {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
const resolversConfig = {
|
|
93
|
-
'Query.
|
|
93
|
+
'Query.getPageByPath': {
|
|
94
94
|
auth: false
|
|
95
95
|
}
|
|
96
96
|
};
|
|
@@ -102,4 +102,4 @@ const getPageBySlug = (strapi: Strapi) => {
|
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export default
|
|
105
|
+
export default getPageByPath;
|
package/server/register.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Strapi } from '@strapi/strapi';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import getPageByPath from './graphql/page-by-path';
|
|
4
4
|
import pageType from './graphql/page-type';
|
|
5
5
|
import getPageInfoFromUID from './graphql/pages-by-uid';
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ export default async ({ strapi }: { strapi: Strapi }) => {
|
|
|
8
8
|
const extensionService = strapi.plugin('graphql').service('extension');
|
|
9
9
|
|
|
10
10
|
extensionService.use(pageType);
|
|
11
|
-
extensionService.use(
|
|
11
|
+
extensionService.use(getPageByPath(strapi));
|
|
12
12
|
extensionService.use(getPageInfoFromUID(strapi));
|
|
13
13
|
|
|
14
14
|
await strapi.services?.['plugin::page-builder.builder']?.buildContentTypes();
|
package/server/routes/index.ts
CHANGED
|
@@ -34,6 +34,11 @@ const routes = {
|
|
|
34
34
|
method: 'GET',
|
|
35
35
|
path: '/collection-types-page-links/:uid/:ids?',
|
|
36
36
|
handler: 'collection-types.getTranslationPageLinks'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
method: 'GET',
|
|
40
|
+
path: '/collection-types/hasPlatform/:uid',
|
|
41
|
+
handler: 'collection-types.hasPlatformRelation'
|
|
37
42
|
}
|
|
38
43
|
]
|
|
39
44
|
},
|
|
@@ -2,7 +2,7 @@ import uniqBy from 'lodash/uniqBy';
|
|
|
2
2
|
import { Common } from '@strapi/strapi';
|
|
3
3
|
|
|
4
4
|
import { IGetTranslationPageLinks } from '../controllers/collection-types';
|
|
5
|
-
import { PAGE_TYPE_UID } from '../../shared/utils/constants';
|
|
5
|
+
import { PAGE_TYPE_UID, PLATFORM_UID } from '../../shared/utils/constants';
|
|
6
6
|
|
|
7
7
|
export interface ICollectionTypeGL {
|
|
8
8
|
uid: string;
|
|
@@ -30,6 +30,13 @@ export default {
|
|
|
30
30
|
)
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
|
+
async hasPlatformRelation(uid: string): Promise<{ hasPlatformRelation: boolean }> {
|
|
34
|
+
const contentType = strapi.contentTypes?.[uid];
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
hasPlatformRelation: Boolean(contentType?.attributes?.platform?.target === PLATFORM_UID)
|
|
38
|
+
};
|
|
39
|
+
},
|
|
33
40
|
withPageMorph(): ICollectionTypeGL[] {
|
|
34
41
|
const { getTypeName, getFiltersInputTypeName } = strapi.plugin('graphql').service('utils').naming;
|
|
35
42
|
|