@webbio/strapi-plugin-page-builder 0.11.16-platform → 0.12.0-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.
@@ -10,7 +10,7 @@ import { useHasPlatformRelation } from '../../api/has-platform-relation';
10
10
 
11
11
  const PageFiltersContainer = () => {
12
12
  const { pathname } = useLocation();
13
- const uid = pathname.split('/').find((x) => x.startsWith('api::')) || '';
13
+ const uid = pathname.split('/').find((x) => x.startsWith('api::') || x.startsWith('plugin::')) || '';
14
14
  const isPageCollectionType = uid === PAGE_UID;
15
15
 
16
16
  const { data: hasPageRelation, isLoading } = useHasPageRelation({
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbio/strapi-plugin-page-builder",
3
- "version": "0.11.16-platform",
3
+ "version": "0.12.0-platform",
4
4
  "description": "This is the description of the plugin.",
5
5
  "scripts": {
6
6
  "develop": "tsc -p tsconfig.server.json -w",
@@ -18,7 +18,7 @@ exports.default = async ({ strapi }) => {
18
18
  plugin: 'page-builder',
19
19
  name,
20
20
  displayName,
21
- category: `Platform`,
21
+ category: 'Platform',
22
22
  handler: async (x) => {
23
23
  var _a, _b, _c, _d;
24
24
  if (((_a = x === null || x === void 0 ? void 0 : x.permission) === null || _a === void 0 ? void 0 : _a.subject) === 'api::platform.platform') {
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const schema_json_1 = __importDefault(require("./category/schema.json"));
6
+ const schema_json_1 = __importDefault(require("./user-category/schema.json"));
7
7
  exports.default = {
8
- category: {
8
+ 'user-category': {
9
9
  schema: schema_json_1.default
10
10
  }
11
11
  };
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "kind": "collectionType",
3
- "collectionName": "categories",
3
+ "collectionName": "user-categories",
4
4
  "info": {
5
- "singularName": "category",
6
- "pluralName": "categories",
7
- "displayName": "category"
5
+ "singularName": "user-category",
6
+ "pluralName": "user-categories",
7
+ "displayName": "User Categories"
8
8
  },
9
9
  "options": {
10
10
  "draftAndPublish": false,
@@ -0,0 +1,23 @@
1
+ {
2
+ "kind": "collectionType",
3
+ "collectionName": "user-categories",
4
+ "info": {
5
+ "singularName": "user-category",
6
+ "pluralName": "user-categories",
7
+ "displayName": "User Categories"
8
+ },
9
+ "options": {
10
+ "draftAndPublish": false,
11
+ "comment": ""
12
+ },
13
+ "attributes": {
14
+ "title": {
15
+ "type": "string"
16
+ },
17
+ "platform": {
18
+ "type": "relation",
19
+ "relation": "oneToOne",
20
+ "target": "api::platform.platform"
21
+ }
22
+ }
23
+ }
@@ -7,6 +7,11 @@ const extendPage = () => {
7
7
  pageContentType.attributes = {
8
8
  ...pageContentType.attributes,
9
9
  isPrivate: {
10
+ pluginOptions: {
11
+ i18n: {
12
+ localized: true
13
+ }
14
+ },
10
15
  type: 'boolean',
11
16
  required: false,
12
17
  default: false
@@ -56,7 +56,17 @@ const extendUser = () => {
56
56
  categories: {
57
57
  type: 'relation',
58
58
  relation: 'oneToMany',
59
- target: 'plugin::page-builder.category'
59
+ target: 'plugin::page-builder.user-category'
60
+ },
61
+ filteredCategories: {
62
+ pluginOptions: {
63
+ filteredSelect: {
64
+ targetField: 'categories'
65
+ }
66
+ },
67
+ // @ts-expect-error
68
+ type: 'customField',
69
+ customField: 'plugin::page-builder.filtered-select'
60
70
  },
61
71
  confirmMailSend: {
62
72
  type: 'boolean',
@@ -5,28 +5,10 @@ const constants_1 = require("../../shared/utils/constants");
5
5
  exports.default = {
6
6
  async generateSitemap(domain) {
7
7
  try {
8
- const entities = await strapi.query(constants_1.PAGE_UID).findMany({
9
- select: ['path', 'updatedAt'],
10
- filters: {
11
- $and: [
12
- {
13
- platform: {
14
- domain
15
- }
16
- },
17
- {
18
- path: {
19
- $notNull: true
20
- }
21
- },
22
- {
23
- publishedAt: {
24
- $notNull: true
25
- }
26
- }
27
- ]
28
- }
29
- });
8
+ const entities = await this.fetchPages(domain);
9
+ if (entities.length === 0) {
10
+ throw new Error('Cannot generate a sitemap with 0 pages');
11
+ }
30
12
  const sitemapStream = new sitemap_1.SitemapStream();
31
13
  for (const entity of entities) {
32
14
  const { path, updatedAt } = entity;
@@ -47,5 +29,50 @@ exports.default = {
47
29
  console.error(error);
48
30
  throw new Error(`Error generating sitemap for domain ${domain}`);
49
31
  }
32
+ },
33
+ async fetchPages(domain) {
34
+ const entities = await strapi.query(constants_1.PAGE_UID).findMany({
35
+ select: ['path', 'updatedAt'],
36
+ where: {
37
+ $and: [
38
+ {
39
+ platform: {
40
+ domain: {
41
+ $eq: domain
42
+ }
43
+ }
44
+ },
45
+ {
46
+ path: {
47
+ $notNull: true
48
+ }
49
+ },
50
+ {
51
+ publishedAt: {
52
+ $notNull: true
53
+ }
54
+ },
55
+ {
56
+ $or: [
57
+ {
58
+ seo: {
59
+ metaRobots: {
60
+ $notContainsi: 'noindex'
61
+ }
62
+ }
63
+ },
64
+ {
65
+ seo: {
66
+ metaRobots: {
67
+ $null: true
68
+ }
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ }
75
+ });
76
+ return entities;
50
77
  }
51
78
  };