@pronto-tools-and-more/pronto 12.1.0 → 12.3.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/pronto",
3
- "version": "12.1.0",
3
+ "version": "12.3.0",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
@@ -17,16 +17,16 @@
17
17
  "@lvce-editor/ipc": "^12.0.0",
18
18
  "@lvce-editor/json-rpc": "^5.3.0",
19
19
  "@lvce-editor/verror": "^1.6.0",
20
- "@pronto-tools-and-more/file-watcher": "12.1.0",
21
- "@pronto-tools-and-more/files": "12.1.0",
22
- "@pronto-tools-and-more/network-process": "12.1.0",
23
- "@pronto-tools-and-more/sass-compiler": "12.1.0",
24
- "@pronto-tools-and-more/components-renderer": "12.1.0",
25
- "@pronto-tools-and-more/components": "12.1.0",
26
- "@pronto-tools-and-more/schema-process": "12.1.0",
27
- "@pronto-tools-and-more/diff-process": "12.1.0",
28
- "@pronto-tools-and-more/type-checker": "12.1.0",
29
- "@pronto-tools-and-more/custom-js-functions": "12.1.0",
20
+ "@pronto-tools-and-more/file-watcher": "12.3.0",
21
+ "@pronto-tools-and-more/files": "12.3.0",
22
+ "@pronto-tools-and-more/network-process": "12.3.0",
23
+ "@pronto-tools-and-more/sass-compiler": "12.3.0",
24
+ "@pronto-tools-and-more/components-renderer": "12.3.0",
25
+ "@pronto-tools-and-more/components": "12.3.0",
26
+ "@pronto-tools-and-more/schema-process": "12.3.0",
27
+ "@pronto-tools-and-more/diff-process": "12.3.0",
28
+ "@pronto-tools-and-more/type-checker": "12.3.0",
29
+ "@pronto-tools-and-more/custom-js-functions": "12.3.0",
30
30
  "execa": "^9.5.2",
31
31
  "express": "^4.21.2"
32
32
  },
@@ -9,6 +9,8 @@ import * as HandleIndex from "../HandleIndex/HandleIndex.js";
9
9
  import * as HandleMainJs from "../HandleMainJs/HandleMainJs.js";
10
10
  import * as HandleViews from "../HandleViews/HandleViews.js";
11
11
  import * as ProxyPath from "../ProxyPath/ProxyPath.js";
12
+ import * as HandleTaxonomies from "../HandleTaxonomies/HandleTaxonomies.js";
13
+ import * as HandleCategories from "../HandleCategories/HandleCategories.js";
12
14
 
13
15
  export const create = ({
14
16
  root,
@@ -89,6 +91,7 @@ export const create = ({
89
91
  injectCustomJs,
90
92
  })
91
93
  );
94
+ app.get("/api/categories", HandleCategories.handleCategories(appId));
92
95
  app.use("*", HandleCss.handleCss(storeFrontPath, rootSassFile));
93
96
  app.use(express.static(FilesPath.filesPath));
94
97
  app.use(express.static(storeFrontPath));
@@ -0,0 +1,66 @@
1
+ export const top = `query CatalogContentsQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $first: Int, $after: String, ) {
2
+ catalog(
3
+ appInfo: $appInfo
4
+ deviceInfo: $deviceInfo
5
+ authorization: $authorization
6
+ ) {
7
+ taxonomiesConnection(first: $first, after: $after, filter:{type:{
8
+ value:"category"
9
+ }}) {
10
+ pageInfo {
11
+ hasNextPage
12
+ __typename
13
+ }
14
+ totalCount
15
+ edges {
16
+ cursor
17
+ node {
18
+ name
19
+ properties {
20
+ key
21
+ value
22
+ }
23
+ thumbnails {
24
+ properties {
25
+ key
26
+ value
27
+ }
28
+ }
29
+
30
+ __typename
31
+ }
32
+ __typename
33
+ }
34
+ __typename
35
+ }
36
+ __typename
37
+ }
38
+ }`;
39
+
40
+ export const bottom = {
41
+ appInfo: {
42
+ appId: "",
43
+ appVersion: "1.0-SNAPSHOT",
44
+ preview: true,
45
+ },
46
+ deviceInfo: {
47
+ deviceId: "editor-preview",
48
+ deviceModel: "web",
49
+ locale: "de_DE",
50
+ deviceOs: "web",
51
+ platform: "WEB",
52
+ },
53
+ comparators: [
54
+ {
55
+ publicationDate: {
56
+ direction: "DESC",
57
+ },
58
+ },
59
+ ],
60
+ first: 99999,
61
+ includeBlocks: false,
62
+ includeHtml: false,
63
+ includeResources: false,
64
+ includeBundledContent: false,
65
+ authorization: {},
66
+ };
@@ -0,0 +1,66 @@
1
+ export const top = `query CatalogContentsQuery($appInfo: AppInfo!, $deviceInfo: DeviceInfo!, $authorization: Authorization!, $first: Int, $after: String, ) {
2
+ catalog(
3
+ appInfo: $appInfo
4
+ deviceInfo: $deviceInfo
5
+ authorization: $authorization
6
+ ) {
7
+ taxonomiesConnection(first: $first, after: $after, filter:{type:{
8
+ value:"category"
9
+ }}) {
10
+ pageInfo {
11
+ hasNextPage
12
+ __typename
13
+ }
14
+ totalCount
15
+ edges {
16
+ cursor
17
+ node {
18
+ name
19
+ properties {
20
+ key
21
+ value
22
+ }
23
+ thumbnails {
24
+ properties {
25
+ key
26
+ value
27
+ }
28
+ }
29
+
30
+ __typename
31
+ }
32
+ __typename
33
+ }
34
+ __typename
35
+ }
36
+ __typename
37
+ }
38
+ }`;
39
+
40
+ export const bottom = {
41
+ appInfo: {
42
+ appId: "",
43
+ appVersion: "1.0-SNAPSHOT",
44
+ preview: true,
45
+ },
46
+ deviceInfo: {
47
+ deviceId: "editor-preview",
48
+ deviceModel: "web",
49
+ locale: "de_DE",
50
+ deviceOs: "web",
51
+ platform: "WEB",
52
+ },
53
+ comparators: [
54
+ {
55
+ publicationDate: {
56
+ direction: "DESC",
57
+ },
58
+ },
59
+ ],
60
+ first: 99999,
61
+ includeBlocks: false,
62
+ includeHtml: false,
63
+ includeResources: false,
64
+ includeBundledContent: false,
65
+ authorization: {},
66
+ };
@@ -0,0 +1,33 @@
1
+ import * as GraphQlQueryCategories from "../GraphQlQueryCategories/GraphQlQueryCategories.js";
2
+
3
+ export const handleCategories = (appId) => async (req, res, next) => {
4
+ const url = `https://catalog.purplemanager.com/graphql`;
5
+ const realBottom = {
6
+ ...GraphQlQueryCategories.bottom,
7
+ appInfo: {
8
+ ...GraphQlQueryCategories.bottom.appInfo,
9
+ appId,
10
+ },
11
+ };
12
+ const response = await fetch(url, {
13
+ method: "POST",
14
+ headers: {
15
+ Accept: "application/json",
16
+ "Content-Type": "application/json",
17
+ },
18
+ body: JSON.stringify({
19
+ operationName: "CatalogContentsQuery",
20
+ query: GraphQlQueryCategories.top,
21
+ variables: realBottom,
22
+ }),
23
+ });
24
+ const result = await response.json();
25
+ // @ts-ignore
26
+ const realData = result.data.catalog.taxonomiesConnection.edges
27
+ .map((edge) => edge.node)
28
+ .map((node) => {
29
+ const { __typename, ...rest } = node;
30
+ return rest;
31
+ });
32
+ res.end(JSON.stringify(realData, null, 2));
33
+ };
@@ -0,0 +1,33 @@
1
+ import * as GraphQlQueryCategories from "../GraphQlQueryCategories/GraphQlQueryCategories.js";
2
+
3
+ export const handleTaxonomies = (appId) => async (req, res, next) => {
4
+ const url = `https://catalog.purplemanager.com/graphql`;
5
+ const realBottom = {
6
+ ...GraphQlQueryCategories.bottom,
7
+ appInfo: {
8
+ ...GraphQlQueryCategories.bottom.appInfo,
9
+ appId,
10
+ },
11
+ };
12
+ const response = await fetch(url, {
13
+ method: "POST",
14
+ headers: {
15
+ Accept: "application/json",
16
+ "Content-Type": "application/json",
17
+ },
18
+ body: JSON.stringify({
19
+ operationName: "CatalogContentsQuery",
20
+ query: GraphQlQueryCategories.top,
21
+ variables: realBottom,
22
+ }),
23
+ });
24
+ const result = await response.json();
25
+ // @ts-ignore
26
+ const realData = result.data.catalog.taxonomiesConnection.edges
27
+ .map((edge) => edge.node)
28
+ .map((node) => {
29
+ const { __typename, ...rest } = node;
30
+ return rest;
31
+ });
32
+ res.end(JSON.stringify(realData, null, 2));
33
+ };
@@ -1 +1 @@
1
- export const version = '12.1.0'
1
+ export const version = '12.3.0'