@qoh/core-react 0.0.7 → 1.0.0-rc.11
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/README.md +31 -2
- package/lib/index.d.mts +123 -0
- package/lib/index.d.ts +123 -4
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -0
- package/package.json +52 -40
- package/CHANGELOG.md +0 -5
- package/lib/ApiError.d.ts +0 -11
- package/lib/ApiError.js +0 -1
- package/lib/QueenofheartsService.d.ts +0 -78
- package/lib/QueenofheartsService.js +0 -6
- package/lib/QueenofheartsService.test.js +0 -1
- package/lib/QueenofheartsService.testData.d.ts +0 -141
- package/lib/QueenofheartsService.testData.js +0 -1
- package/lib/backend/Backend.d.ts +0 -5
- package/lib/backend/Backend.js +0 -1
- package/lib/backend/DatoCMS.d.ts +0 -8
- package/lib/backend/DatoCMS.js +0 -1
- package/lib/backend/StrapiCMS.d.ts +0 -8
- package/lib/backend/StrapiCMS.js +0 -1
- package/lib/backend/index.d.ts +0 -3
- package/lib/backend/index.js +0 -1
- package/lib/components/Dodo.d.ts +0 -2
- package/lib/components/Dodo.js +0 -1
- package/lib/components/QueenofheartsRenderComponent.d.ts +0 -5
- package/lib/components/QueenofheartsRenderComponent.js +0 -1
- package/lib/declaration.d.js +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
#Queen of hearts client core package
|
|
1
|
+
# Queen of hearts client core package
|
|
2
|
+
|
|
3
|
+
> [!WARNING] This readme should not be deployed to npm.
|
|
4
|
+
|
|
2
5
|
This package is providing the core client packages in react.
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
# Running locally
|
|
8
|
+
|
|
9
|
+
Run
|
|
10
|
+
|
|
11
|
+
`npx nx serve server-vercel`
|
|
12
|
+
|
|
13
|
+
from the root directory.
|
|
14
|
+
|
|
15
|
+
## Reading Vercel logs from CLI
|
|
16
|
+
|
|
17
|
+
Vercel logs can be read on the web-interface but vercel also provides a cli-tool that can be setup to show the server logs in the cli.
|
|
18
|
+
|
|
19
|
+
### installation
|
|
20
|
+
|
|
21
|
+
`npm i -g vercel`
|
|
22
|
+
|
|
23
|
+
### Setup team
|
|
24
|
+
|
|
25
|
+
Make sure you are on the right team by switching to gravityandstorm:
|
|
26
|
+
|
|
27
|
+
`vercel switch gravityandstorm`
|
|
28
|
+
|
|
29
|
+
### showing logs in cli
|
|
30
|
+
|
|
31
|
+
Make sure you get the url of the deployment you want to watch. For example:
|
|
32
|
+
|
|
33
|
+
`vercel logs queenofhearts-9qnjgvnfw-gravityandstorm.vercel.app`
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { JSX } from 'react';
|
|
3
|
+
|
|
4
|
+
declare function QueenofheartsRenderComponent(props: Readonly<{
|
|
5
|
+
data: {} | [];
|
|
6
|
+
contextProps?: any;
|
|
7
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
declare enum Filter {
|
|
10
|
+
eq = "eq",
|
|
11
|
+
in = "in",
|
|
12
|
+
neq = "neq",
|
|
13
|
+
notIn = "notIn"
|
|
14
|
+
}
|
|
15
|
+
interface QohResponse {
|
|
16
|
+
pages: {} | null;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
type ComponentTypes = Array<{
|
|
20
|
+
typename: string;
|
|
21
|
+
props: {
|
|
22
|
+
__typename: string;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
interface IFCDictionary {
|
|
26
|
+
[index: string]: ReactFCWithFieldNames;
|
|
27
|
+
}
|
|
28
|
+
interface ReactFCWithFieldNames {
|
|
29
|
+
component?: React.FC<any>;
|
|
30
|
+
fieldNames?: string[];
|
|
31
|
+
loader?: () => any;
|
|
32
|
+
}
|
|
33
|
+
declare let componentRegistry: IFCDictionary;
|
|
34
|
+
declare function unregisterComponent(name: string): void;
|
|
35
|
+
declare function registerComponent(functionalComponent: React.FC<any>, typeName: string, fieldNames?: string[], overwrite?: false): void;
|
|
36
|
+
declare function registerLazyComponent(loader: () => any, typeName: string, fieldNames?: string[], overwrite?: boolean): void;
|
|
37
|
+
declare function getAllregisteredComponents(): IFCDictionary;
|
|
38
|
+
declare const fetchDynamicComponents: (props: any) => Promise<string[]>;
|
|
39
|
+
declare class QueenofheartsService {
|
|
40
|
+
private static instance;
|
|
41
|
+
data: any;
|
|
42
|
+
debug: boolean;
|
|
43
|
+
apiToken: string;
|
|
44
|
+
localServer?: string;
|
|
45
|
+
latestUrl: string;
|
|
46
|
+
latestData: Object;
|
|
47
|
+
private constructor();
|
|
48
|
+
/**
|
|
49
|
+
* Initialize headlessli client
|
|
50
|
+
* @param apiToken headlessli api-token
|
|
51
|
+
* @param localServer optional
|
|
52
|
+
*/
|
|
53
|
+
static init(apiToken: string, localServer?: string): void;
|
|
54
|
+
static getInstance(): QueenofheartsService;
|
|
55
|
+
findComponentsInProps: (props: any) => string[];
|
|
56
|
+
fetchDynamicComponents: (componentsToLoad: string[]) => Promise<(string | null)[]>;
|
|
57
|
+
private loadAsyncComponent;
|
|
58
|
+
createComponent(props: any): JSX.Element | null;
|
|
59
|
+
private readonly buildUrl;
|
|
60
|
+
queryGraphql: (graphqlQuery: string) => Promise<any>;
|
|
61
|
+
query: (queryName: string, options?: {
|
|
62
|
+
filter?: {
|
|
63
|
+
name: string;
|
|
64
|
+
operator: Filter;
|
|
65
|
+
value: string;
|
|
66
|
+
}[];
|
|
67
|
+
components?: string;
|
|
68
|
+
ignoreProperties?: string[];
|
|
69
|
+
variables?: {
|
|
70
|
+
filter?: {
|
|
71
|
+
name: string;
|
|
72
|
+
operator: Filter;
|
|
73
|
+
value: string;
|
|
74
|
+
}[];
|
|
75
|
+
locale?: string;
|
|
76
|
+
[x: string]: unknown;
|
|
77
|
+
};
|
|
78
|
+
locale?: string;
|
|
79
|
+
depth?: number;
|
|
80
|
+
}) => Promise<any>;
|
|
81
|
+
private readonly getRegisteredComponentsWithFields;
|
|
82
|
+
getQueries: () => Promise<any>;
|
|
83
|
+
private injectIds;
|
|
84
|
+
private sendDebugEvent;
|
|
85
|
+
private sendQueriesEvent;
|
|
86
|
+
private sendComponentHTML;
|
|
87
|
+
private highlightComponent;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface Backend {
|
|
91
|
+
token: string;
|
|
92
|
+
uri: string;
|
|
93
|
+
normalize(data: any): any;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class DatoCMS implements Backend {
|
|
97
|
+
token: string;
|
|
98
|
+
uri: string;
|
|
99
|
+
constructor(token: string);
|
|
100
|
+
renameSEOMetaTags(props: any): void;
|
|
101
|
+
normalize(data: any): any;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare class StrapiCMS implements Backend {
|
|
105
|
+
token: string;
|
|
106
|
+
uri: string;
|
|
107
|
+
constructor(token: string, strapiUrl: string);
|
|
108
|
+
renameSEOMetaTags(props: any): void;
|
|
109
|
+
normalize(data: any): any;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type Body = {
|
|
113
|
+
id: string;
|
|
114
|
+
summary: string;
|
|
115
|
+
details: string;
|
|
116
|
+
};
|
|
117
|
+
declare class ApiError extends Error {
|
|
118
|
+
status: number;
|
|
119
|
+
body: Body;
|
|
120
|
+
constructor(status: number, body: Body);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { ApiError, type Backend, type ComponentTypes, DatoCMS, Filter, type IFCDictionary, type QohResponse, QueenofheartsRenderComponent, QueenofheartsService, type ReactFCWithFieldNames, StrapiCMS, componentRegistry, fetchDynamicComponents, getAllregisteredComponents, registerComponent, registerLazyComponent, unregisterComponent };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { JSX } from 'react';
|
|
3
|
+
|
|
4
|
+
declare function QueenofheartsRenderComponent(props: Readonly<{
|
|
5
|
+
data: {} | [];
|
|
6
|
+
contextProps?: any;
|
|
7
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
declare enum Filter {
|
|
10
|
+
eq = "eq",
|
|
11
|
+
in = "in",
|
|
12
|
+
neq = "neq",
|
|
13
|
+
notIn = "notIn"
|
|
14
|
+
}
|
|
15
|
+
interface QohResponse {
|
|
16
|
+
pages: {} | null;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
type ComponentTypes = Array<{
|
|
20
|
+
typename: string;
|
|
21
|
+
props: {
|
|
22
|
+
__typename: string;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
interface IFCDictionary {
|
|
26
|
+
[index: string]: ReactFCWithFieldNames;
|
|
27
|
+
}
|
|
28
|
+
interface ReactFCWithFieldNames {
|
|
29
|
+
component?: React.FC<any>;
|
|
30
|
+
fieldNames?: string[];
|
|
31
|
+
loader?: () => any;
|
|
32
|
+
}
|
|
33
|
+
declare let componentRegistry: IFCDictionary;
|
|
34
|
+
declare function unregisterComponent(name: string): void;
|
|
35
|
+
declare function registerComponent(functionalComponent: React.FC<any>, typeName: string, fieldNames?: string[], overwrite?: false): void;
|
|
36
|
+
declare function registerLazyComponent(loader: () => any, typeName: string, fieldNames?: string[], overwrite?: boolean): void;
|
|
37
|
+
declare function getAllregisteredComponents(): IFCDictionary;
|
|
38
|
+
declare const fetchDynamicComponents: (props: any) => Promise<string[]>;
|
|
39
|
+
declare class QueenofheartsService {
|
|
40
|
+
private static instance;
|
|
41
|
+
data: any;
|
|
42
|
+
debug: boolean;
|
|
43
|
+
apiToken: string;
|
|
44
|
+
localServer?: string;
|
|
45
|
+
latestUrl: string;
|
|
46
|
+
latestData: Object;
|
|
47
|
+
private constructor();
|
|
48
|
+
/**
|
|
49
|
+
* Initialize headlessli client
|
|
50
|
+
* @param apiToken headlessli api-token
|
|
51
|
+
* @param localServer optional
|
|
52
|
+
*/
|
|
53
|
+
static init(apiToken: string, localServer?: string): void;
|
|
54
|
+
static getInstance(): QueenofheartsService;
|
|
55
|
+
findComponentsInProps: (props: any) => string[];
|
|
56
|
+
fetchDynamicComponents: (componentsToLoad: string[]) => Promise<(string | null)[]>;
|
|
57
|
+
private loadAsyncComponent;
|
|
58
|
+
createComponent(props: any): JSX.Element | null;
|
|
59
|
+
private readonly buildUrl;
|
|
60
|
+
queryGraphql: (graphqlQuery: string) => Promise<any>;
|
|
61
|
+
query: (queryName: string, options?: {
|
|
62
|
+
filter?: {
|
|
63
|
+
name: string;
|
|
64
|
+
operator: Filter;
|
|
65
|
+
value: string;
|
|
66
|
+
}[];
|
|
67
|
+
components?: string;
|
|
68
|
+
ignoreProperties?: string[];
|
|
69
|
+
variables?: {
|
|
70
|
+
filter?: {
|
|
71
|
+
name: string;
|
|
72
|
+
operator: Filter;
|
|
73
|
+
value: string;
|
|
74
|
+
}[];
|
|
75
|
+
locale?: string;
|
|
76
|
+
[x: string]: unknown;
|
|
77
|
+
};
|
|
78
|
+
locale?: string;
|
|
79
|
+
depth?: number;
|
|
80
|
+
}) => Promise<any>;
|
|
81
|
+
private readonly getRegisteredComponentsWithFields;
|
|
82
|
+
getQueries: () => Promise<any>;
|
|
83
|
+
private injectIds;
|
|
84
|
+
private sendDebugEvent;
|
|
85
|
+
private sendQueriesEvent;
|
|
86
|
+
private sendComponentHTML;
|
|
87
|
+
private highlightComponent;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface Backend {
|
|
91
|
+
token: string;
|
|
92
|
+
uri: string;
|
|
93
|
+
normalize(data: any): any;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class DatoCMS implements Backend {
|
|
97
|
+
token: string;
|
|
98
|
+
uri: string;
|
|
99
|
+
constructor(token: string);
|
|
100
|
+
renameSEOMetaTags(props: any): void;
|
|
101
|
+
normalize(data: any): any;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare class StrapiCMS implements Backend {
|
|
105
|
+
token: string;
|
|
106
|
+
uri: string;
|
|
107
|
+
constructor(token: string, strapiUrl: string);
|
|
108
|
+
renameSEOMetaTags(props: any): void;
|
|
109
|
+
normalize(data: any): any;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type Body = {
|
|
113
|
+
id: string;
|
|
114
|
+
summary: string;
|
|
115
|
+
details: string;
|
|
116
|
+
};
|
|
117
|
+
declare class ApiError extends Error {
|
|
118
|
+
status: number;
|
|
119
|
+
body: Body;
|
|
120
|
+
constructor(status: number, body: Body);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { ApiError, type Backend, type ComponentTypes, DatoCMS, Filter, type IFCDictionary, type QohResponse, QueenofheartsRenderComponent, QueenofheartsService, type ReactFCWithFieldNames, StrapiCMS, componentRegistry, fetchDynamicComponents, getAllregisteredComponents, registerComponent, registerLazyComponent, unregisterComponent };
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _QueenofheartsRenderComponent=require("./components/QueenofheartsRenderComponent");var _QueenofheartsService=require("./QueenofheartsService");var _backend=require("./backend");var _ApiError=require("./ApiError");Object.defineProperty(exports,"__esModule",{value:!0});Object.keys(_QueenofheartsRenderComponent).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_QueenofheartsRenderComponent[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function(){return _QueenofheartsRenderComponent[a]}})});Object.keys(_QueenofheartsService).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_QueenofheartsService[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function(){return _QueenofheartsService[a]}})});Object.keys(_backend).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_backend[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function(){return _backend[a]}})});Object.keys(_ApiError).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_ApiError[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function(){return _ApiError[a]}})});
|
|
1
|
+
"use strict";var M=Object.create;var g=Object.defineProperty,z=Object.defineProperties,B=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,J=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var q=(t,e,n)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))j.call(e,n)&&q(t,n,e[n]);if(O)for(var n of O(e))N.call(e,n)&&q(t,n,e[n]);return t},E=(t,e)=>z(t,H(e));var X=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},R=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of U(e))!j.call(t,i)&&i!==n&&g(t,i,{get:()=>e[i],enumerable:!(r=B(e,i))||r.enumerable});return t};var f=(t,e,n)=>(n=t!=null?M(J(t)):{},R(e||!t||!t.__esModule?g(n,"default",{value:t,enumerable:!0}):n,t)),W=t=>R(g({},"__esModule",{value:!0}),t);var u=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{s(n.next(c))}catch(y){i(y)}},l=c=>{try{s(n.throw(c))}catch(y){i(y)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,l);s((n=n.apply(t,e)).next())});var ce={};X(ce,{ApiError:()=>m,DatoCMS:()=>w,Filter:()=>P,QueenofheartsRenderComponent:()=>G,QueenofheartsService:()=>h,StrapiCMS:()=>C,componentRegistry:()=>d,fetchDynamicComponents:()=>ae,getAllregisteredComponents:()=>$,registerComponent:()=>oe,registerLazyComponent:()=>se,unregisterComponent:()=>ie});module.exports=W(ce);var A=require("react");var v=require("react/jsx-runtime");function G(t){let e=h.getInstance(),{data:n,contextProps:r}=t;return n&&e?Array.isArray(n)?(0,v.jsx)(A.Suspense,{fallback:null,children:n.map((i,o)=>e.createComponent({data:i,contextProps:r}))}):(0,v.jsx)(A.Suspense,{fallback:null,children:e.createComponent({data:n,contextProps:r})}):e?(0,v.jsx)("div",{className:"error",children:"QueenofheartsRenderComponent: Invalid data received."}):(0,v.jsx)("div",{children:"QueenofheartsService is not initialized"})}var m=class extends Error{constructor(e,n){super(n.summary),this.name="ApiError",this.status=e,this.body=n}};var x=f(require("react"));var p=f(require("react"));var a=require("react/jsx-runtime"),V=({children:t,style:e})=>(0,a.jsx)("details",{style:e,children:t}),K=({children:t})=>(0,a.jsx)("summary",{children:t}),Y=({children:t})=>(0,a.jsx)("div",{style:{paddingLeft:"1em"},children:t}),_=({children:t,style:e})=>(0,a.jsx)("div",{style:E(b({},e),{border:"1px solid #ccc",padding:".5em"}),children:t}),Z=()=>(0,a.jsx)("span",{children:"\u25BC"}),D=p.lazy(()=>import("@mui/material/Accordion").catch(()=>({default:V}))),Q=p.lazy(()=>import("@mui/material/AccordionSummary").catch(()=>({default:K}))),k=p.lazy(()=>import("@mui/material/AccordionDetails").catch(()=>({default:Y}))),ee=p.lazy(()=>import("@mui/material/Paper").catch(()=>({default:_}))),F=p.lazy(()=>import("@mui/icons-material/ExpandMore").catch(()=>({default:Z})));function ne(t,e,n){return(0,a.jsxs)(D,{style:{width:"100%"},children:[(0,a.jsxs)(Q,{style:{padding:0},expandIcon:(0,a.jsx)(F,{}),children:[t,": Array[",e.length,"]"]}),(0,a.jsx)(k,{children:e.map((r,i)=>S("",r,i))})]},`${t}_${n}`)}function te(t,e,n){return(0,a.jsxs)(D,{style:{width:"100%"},children:[(0,a.jsx)(Q,{expandIcon:(0,a.jsx)(F,{}),children:t}),(0,a.jsx)(k,{children:Object.entries(e).map((r,i)=>S(r[0],r[1],i))})]},`${t}_${n}`)}function I(t,e,n){return(0,a.jsxs)("div",{children:[t,": ",`${e}`]},`${t}_${n}`)}function S(t,e,n){var i;if(Array.isArray(e))return ne(t,e,n);if(!e||["string","number"].includes(typeof e))return I(t,e,n);if(typeof e=="boolean")return I(t,e?"true":"false",n);let r=`${t?t+": ":""}${(i=e.__typename)!=null?i:"object"}`;return te(r,e,n)}function T(t){return typeof t.data=="object"?(0,a.jsx)(p.Suspense,{fallback:(0,a.jsx)(_,{style:{margin:".5em",width:"calc(100% - 1em)"},children:S("",t.data,1)}),children:(0,a.jsx)(ee,{style:{margin:".5em",width:"calc(100% - 1em)"},children:S("",t.data,1)})}):null}var P=(i=>(i.eq="eq",i.in="in",i.neq="neq",i.notIn="notIn",i))(P||{}),re="https://headless.li/api",d={};function ie(t){delete d[t]}function oe(t,e,n,r){if(e!==void 0&&(r||d[e]===void 0)){let i={component:t,fieldNames:n};d[e]=i}}function se(t,e,n,r=!1){e?(r||d[e]===void 0)&&(d[e]={fieldNames:n,loader:t}):console.warn("registerComponent failed: undefined typeName ")}function $(){return d}var ae=t=>u(null,null,function*(){let e=h.getInstance(),n=e.findComponentsInProps(t).filter((i,o,l)=>l.indexOf(i)===o);return(yield e.fetchDynamicComponents(n)).filter(i=>i!==null)}),h=class t{constructor(e,n){this.latestUrl="";this.latestData={};this.findComponentsInProps=e=>{if(e&&typeof e!="string"){let n=e.__typename?[e.__typename]:[],r=Array.isArray(e)?e:Object.values(e);return[...n,...r.reduce((o,l)=>{let s=this.findComponentsInProps(l);return s&&(o=[...o,...s]),o},[])]}return[]};this.fetchDynamicComponents=e=>u(this,null,function*(){let n=!1,r=!1,i=Promise.all(e.map(o=>u(this,null,function*(){var l;return d[o]&&d[o].component===void 0?(n=!0,yield this.loadAsyncComponent(o)):(l=d[o])!=null&&l.loader?o:null})));return r=!0,i});this.buildUrl=e=>{var r;return`${(r=this.localServer)!=null?r:re}/${e}`};this.queryGraphql=e=>u(this,null,function*(){let n=this.buildUrl("execGraphqlQuery");if(console.info(`using url : ${n}`),n){let r=yield fetch(n,{method:"POST",headers:{Authorization:`Bearer ${this.apiToken}`,"Content-Type":"application/json"},body:JSON.stringify({query:e})});if(r.ok){let i=yield r.json();return this.sendDebugEvent(),i}else{let i=yield r.json();throw console.log(i),new m(r.status,i)}}throw new m(500,{id:"99",summary:"queryUrl was not set",details:`LocalServer: ${this.localServer}`})});this.query=(e,n)=>u(this,null,function*(){var o,l;let r=this.buildUrl("execQuery"),i=n!=null&&n.variables?b({},n.variables):{};if(n!=null&&n.locale&&(i.locale=n.locale),n!=null&&n.filter&&Array.isArray(n.filter)&&(i.filter||(i.filter=[]),i.filter.push(...n.filter),(o=n==null?void 0:n.variables)!=null&&o.filter&&Array.isArray(n.variables.filter)&&i.filter.push(...n.variables.filter)),r&&n){let s=yield fetch(r,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiToken}`},method:"POST",credentials:"include",body:JSON.stringify({queryname:e,variables:i,components:this.getRegisteredComponentsWithFields(),ignoreProperties:n.ignoreProperties,depth:n.depth})});if(s.ok){let c=(l=yield s.json())==null?void 0:l.data,y=this.debug?this.injectIds(c):c;return this.latestData=y,this.sendDebugEvent(),y}else try{let c=yield s.json();throw console.log(c),new m(s.status,c)}catch(c){throw new m(s.status,c.toString())}}else throw new m(500,{id:"99",summary:`Query: queryUrl (${r}) or options are invalid`,details:`queryUrl: ${r}`})});this.getRegisteredComponentsWithFields=()=>{let e={},n=Object.entries($());return n&&Array.isArray(n)&&n.forEach(([r,i])=>{let o={},l=i.fieldNames,s=!1;l&&Array.isArray(l)&&l.forEach(c=>{o[c]=!0,s=!0}),s?e[r]=o:e[r]={__all:!0}}),e};this.getQueries=()=>u(this,null,function*(){let e=this.buildUrl("queries");if(e){let n=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}});if(n.ok)try{return yield n.json()}catch(r){console.error(r)}}else console.error("api, uri and CMSToken have to be provided");return""});this.apiToken=e,this.localServer=n,this.debug=typeof document!="undefined"&&document.getElementsByTagName("body")[0].classList.contains("qoh-inject-ids"),this.debug&&typeof globalThis.window!="undefined"&&(globalThis.window.addEventListener("QueenOfHearts-RequestData",()=>{this.sendDebugEvent()}),globalThis.window.addEventListener("QueenOfHearts-RequestQueries",()=>{this.sendQueriesEvent()}),globalThis.window.addEventListener("QueenOfHearts-HighlightComponent",(r=>{this.highlightComponent(r.detail)})),globalThis.window.addEventListener("QueenOfHearts-RequestComponentHTML",(r=>{this.sendComponentHTML(r.detail)})))}static init(e,n){t.instance=new t(e,n)}static getInstance(){return t.instance||console.error("QueenofheartsService was not initialized using QueenofheartsService.init(backend, apiToken)"),t.instance}loadAsyncComponent(e){return u(this,null,function*(){let n=d[e];if(n&&n.component===void 0){if(!(n!=null&&n.component)&&n.loader){let r=n.loader,i=yield r();i?d[e].component=i.default:(console.error(`error loading ${e}`),console.error(i))}return e}return null})}createComponent(e){var s;let{data:n,contextProps:r={}}=e,i=n.__typename,o=d[i];o&&o.loader&&(0,x.lazy)(o.loader);let l=(s=o==null?void 0:o.component)!=null?s:T;return x.default.createElement(l,E(b({},n),{contextProps:r}))}injectIds(e){if(Array.isArray(e))e.forEach(n=>this.injectIds(n));else if(e&&typeof e=="object"){if(e.hasOwnProperty("__typename")){let n=Math.random().toString();e.__qohId=n.substr(n.indexOf(".")+1)}Object.keys(e).forEach(n=>e[n]=this.injectIds(e[n]))}return e}sendDebugEvent(){if(typeof window=="undefined")return;let e={registeredComponents:Object.keys(d),url:this.latestUrl,data:this.latestData},n=new CustomEvent("QueenOfHearts-DebuggingData",{detail:e});window.dispatchEvent(n)}sendQueriesEvent(){return u(this,null,function*(){if(typeof window=="undefined")return;let e=new CustomEvent("QueenOfHearts-AvailableQueries",{detail:yield this.getQueries()});window.dispatchEvent(e)})}sendComponentHTML(e){var r;if(typeof window=="undefined")return;let n=(r=document.querySelector(`[qohId='${e}']`))==null?void 0:r.nextElementSibling;if(n){let i=new CustomEvent("QueenOfHearts-SelectedComponentHTML",{detail:{qohId:e,html:n.outerHTML}});window.dispatchEvent(i)}}highlightComponent(e){var o;let n=[{outline:"thick auto white"},{outline:"thick auto red"}],r={duration:1e3,iterations:2},i=(o=document.querySelector(`[qohId='${e}']`))==null?void 0:o.nextElementSibling;i&&i.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),i&&i.animate(n,r)}};var w=class{constructor(e){this.token="";this.uri="https://graphql.datocms.com/";this.token=e}renameSEOMetaTags(e){e.forEach(function(n,r,i){i[r].__typename="SEOMetaTag"})}normalize(e){if(e)return e._seoMetaTags&&this.renameSEOMetaTags(e._seoMetaTags),Object.keys(e).forEach(n=>{Array.isArray(e[n])&&(e[n]=e[n].map(r=>this.normalize(r))),e[n]&&typeof e[n]=="object"&&(e[n]=this.normalize(e[n]))}),e}};var L=f(require("dotenv"));L.default.config();var C=class{constructor(e,n){this.token="";this.uri="";this.token=e,this.uri=n}renameSEOMetaTags(e){e.forEach(function(n,r,i){i[r].__typename="SEOMetaTag"})}normalize(e){return e&&(e._seoMetaTags&&this.renameSEOMetaTags(e._seoMetaTags),Object.keys(e).forEach(n=>{Array.isArray(e[n])&&(e[n]=e[n].map(r=>this.normalize(r))),e[n]&&typeof e[n]=="object"&&(e[n]=this.normalize(e[n]))}),e)}};0&&(module.exports={ApiError,DatoCMS,Filter,QueenofheartsRenderComponent,QueenofheartsService,StrapiCMS,componentRegistry,fetchDynamicComponents,getAllregisteredComponents,registerComponent,registerLazyComponent,unregisterComponent});
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D=Object.defineProperty,Q=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var A=(r,e,n)=>e in r?D(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,y=(r,e)=>{for(var n in e||(e={}))F.call(e,n)&&A(r,n,e[n]);if(x)for(var n of x(e))P.call(e,n)&&A(r,n,e[n]);return r},g=(r,e)=>Q(r,k(e));var u=(r,e,n)=>new Promise((t,i)=>{var o=a=>{try{s(n.next(a))}catch(p){i(p)}},c=a=>{try{s(n.throw(a))}catch(p){i(p)}},s=a=>a.done?t(a.value):Promise.resolve(a.value).then(o,c);s((n=n.apply(r,e)).next())});import{Suspense as T}from"react";import{jsx as b}from"react/jsx-runtime";function ne(r){let e=h.getInstance(),{data:n,contextProps:t}=r;return n&&e?Array.isArray(n)?b(T,{fallback:null,children:n.map((i,o)=>e.createComponent({data:i,contextProps:t}))}):b(T,{fallback:null,children:e.createComponent({data:n,contextProps:t})}):e?b("div",{className:"error",children:"QueenofheartsRenderComponent: Invalid data received."}):b("div",{children:"QueenofheartsService is not initialized"})}var m=class extends Error{constructor(e,n){super(n.summary),this.name="ApiError",this.status=e,this.body=n}};import J,{lazy as N}from"react";import*as f from"react";import{jsx as l,jsxs as w}from"react/jsx-runtime";var $=({children:r,style:e})=>l("details",{style:e,children:r}),L=({children:r})=>l("summary",{children:r}),M=({children:r})=>l("div",{style:{paddingLeft:"1em"},children:r}),q=({children:r,style:e})=>l("div",{style:g(y({},e),{border:"1px solid #ccc",padding:".5em"}),children:r}),z=()=>l("span",{children:"\u25BC"}),j=f.lazy(()=>import("@mui/material/Accordion").catch(()=>({default:$}))),R=f.lazy(()=>import("@mui/material/AccordionSummary").catch(()=>({default:L}))),I=f.lazy(()=>import("@mui/material/AccordionDetails").catch(()=>({default:M}))),B=f.lazy(()=>import("@mui/material/Paper").catch(()=>({default:q}))),_=f.lazy(()=>import("@mui/icons-material/ExpandMore").catch(()=>({default:z})));function H(r,e,n){return w(j,{style:{width:"100%"},children:[w(R,{style:{padding:0},expandIcon:l(_,{}),children:[r,": Array[",e.length,"]"]}),l(I,{children:e.map((t,i)=>v("",t,i))})]},`${r}_${n}`)}function U(r,e,n){return w(j,{style:{width:"100%"},children:[l(R,{expandIcon:l(_,{}),children:r}),l(I,{children:Object.entries(e).map((t,i)=>v(t[0],t[1],i))})]},`${r}_${n}`)}function O(r,e,n){return w("div",{children:[r,": ",`${e}`]},`${r}_${n}`)}function v(r,e,n){var i;if(Array.isArray(e))return H(r,e,n);if(!e||["string","number"].includes(typeof e))return O(r,e,n);if(typeof e=="boolean")return O(r,e?"true":"false",n);let t=`${r?r+": ":""}${(i=e.__typename)!=null?i:"object"}`;return U(t,e,n)}function S(r){return typeof r.data=="object"?l(f.Suspense,{fallback:l(q,{style:{margin:".5em",width:"calc(100% - 1em)"},children:v("",r.data,1)}),children:l(B,{style:{margin:".5em",width:"calc(100% - 1em)"},children:v("",r.data,1)})}):null}var X=(i=>(i.eq="eq",i.in="in",i.neq="neq",i.notIn="notIn",i))(X||{}),W="https://headless.li/api",d={};function me(r){delete d[r]}function fe(r,e,n,t){if(e!==void 0&&(t||d[e]===void 0)){let i={component:r,fieldNames:n};d[e]=i}}function pe(r,e,n,t=!1){e?(t||d[e]===void 0)&&(d[e]={fieldNames:n,loader:r}):console.warn("registerComponent failed: undefined typeName ")}function G(){return d}var ye=r=>u(null,null,function*(){let e=h.getInstance(),n=e.findComponentsInProps(r).filter((i,o,c)=>c.indexOf(i)===o);return(yield e.fetchDynamicComponents(n)).filter(i=>i!==null)}),h=class r{constructor(e,n){this.latestUrl="";this.latestData={};this.findComponentsInProps=e=>{if(e&&typeof e!="string"){let n=e.__typename?[e.__typename]:[],t=Array.isArray(e)?e:Object.values(e);return[...n,...t.reduce((o,c)=>{let s=this.findComponentsInProps(c);return s&&(o=[...o,...s]),o},[])]}return[]};this.fetchDynamicComponents=e=>u(this,null,function*(){let n=!1,t=!1,i=Promise.all(e.map(o=>u(this,null,function*(){var c;return d[o]&&d[o].component===void 0?(n=!0,yield this.loadAsyncComponent(o)):(c=d[o])!=null&&c.loader?o:null})));return t=!0,i});this.buildUrl=e=>{var t;return`${(t=this.localServer)!=null?t:W}/${e}`};this.queryGraphql=e=>u(this,null,function*(){let n=this.buildUrl("execGraphqlQuery");if(console.info(`using url : ${n}`),n){let t=yield fetch(n,{method:"POST",headers:{Authorization:`Bearer ${this.apiToken}`,"Content-Type":"application/json"},body:JSON.stringify({query:e})});if(t.ok){let i=yield t.json();return this.sendDebugEvent(),i}else{let i=yield t.json();throw console.log(i),new m(t.status,i)}}throw new m(500,{id:"99",summary:"queryUrl was not set",details:`LocalServer: ${this.localServer}`})});this.query=(e,n)=>u(this,null,function*(){var o,c;let t=this.buildUrl("execQuery"),i=n!=null&&n.variables?y({},n.variables):{};if(n!=null&&n.locale&&(i.locale=n.locale),n!=null&&n.filter&&Array.isArray(n.filter)&&(i.filter||(i.filter=[]),i.filter.push(...n.filter),(o=n==null?void 0:n.variables)!=null&&o.filter&&Array.isArray(n.variables.filter)&&i.filter.push(...n.variables.filter)),t&&n){let s=yield fetch(t,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiToken}`},method:"POST",credentials:"include",body:JSON.stringify({queryname:e,variables:i,components:this.getRegisteredComponentsWithFields(),ignoreProperties:n.ignoreProperties,depth:n.depth})});if(s.ok){let a=(c=yield s.json())==null?void 0:c.data,p=this.debug?this.injectIds(a):a;return this.latestData=p,this.sendDebugEvent(),p}else try{let a=yield s.json();throw console.log(a),new m(s.status,a)}catch(a){throw new m(s.status,a.toString())}}else throw new m(500,{id:"99",summary:`Query: queryUrl (${t}) or options are invalid`,details:`queryUrl: ${t}`})});this.getRegisteredComponentsWithFields=()=>{let e={},n=Object.entries(G());return n&&Array.isArray(n)&&n.forEach(([t,i])=>{let o={},c=i.fieldNames,s=!1;c&&Array.isArray(c)&&c.forEach(a=>{o[a]=!0,s=!0}),s?e[t]=o:e[t]={__all:!0}}),e};this.getQueries=()=>u(this,null,function*(){let e=this.buildUrl("queries");if(e){let n=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}});if(n.ok)try{return yield n.json()}catch(t){console.error(t)}}else console.error("api, uri and CMSToken have to be provided");return""});this.apiToken=e,this.localServer=n,this.debug=typeof document!="undefined"&&document.getElementsByTagName("body")[0].classList.contains("qoh-inject-ids"),this.debug&&typeof globalThis.window!="undefined"&&(globalThis.window.addEventListener("QueenOfHearts-RequestData",()=>{this.sendDebugEvent()}),globalThis.window.addEventListener("QueenOfHearts-RequestQueries",()=>{this.sendQueriesEvent()}),globalThis.window.addEventListener("QueenOfHearts-HighlightComponent",(t=>{this.highlightComponent(t.detail)})),globalThis.window.addEventListener("QueenOfHearts-RequestComponentHTML",(t=>{this.sendComponentHTML(t.detail)})))}static init(e,n){r.instance=new r(e,n)}static getInstance(){return r.instance||console.error("QueenofheartsService was not initialized using QueenofheartsService.init(backend, apiToken)"),r.instance}loadAsyncComponent(e){return u(this,null,function*(){let n=d[e];if(n&&n.component===void 0){if(!(n!=null&&n.component)&&n.loader){let t=n.loader,i=yield t();i?d[e].component=i.default:(console.error(`error loading ${e}`),console.error(i))}return e}return null})}createComponent(e){var s;let{data:n,contextProps:t={}}=e,i=n.__typename,o=d[i];o&&o.loader&&N(o.loader);let c=(s=o==null?void 0:o.component)!=null?s:S;return J.createElement(c,g(y({},n),{contextProps:t}))}injectIds(e){if(Array.isArray(e))e.forEach(n=>this.injectIds(n));else if(e&&typeof e=="object"){if(e.hasOwnProperty("__typename")){let n=Math.random().toString();e.__qohId=n.substr(n.indexOf(".")+1)}Object.keys(e).forEach(n=>e[n]=this.injectIds(e[n]))}return e}sendDebugEvent(){if(typeof window=="undefined")return;let e={registeredComponents:Object.keys(d),url:this.latestUrl,data:this.latestData},n=new CustomEvent("QueenOfHearts-DebuggingData",{detail:e});window.dispatchEvent(n)}sendQueriesEvent(){return u(this,null,function*(){if(typeof window=="undefined")return;let e=new CustomEvent("QueenOfHearts-AvailableQueries",{detail:yield this.getQueries()});window.dispatchEvent(e)})}sendComponentHTML(e){var t;if(typeof window=="undefined")return;let n=(t=document.querySelector(`[qohId='${e}']`))==null?void 0:t.nextElementSibling;if(n){let i=new CustomEvent("QueenOfHearts-SelectedComponentHTML",{detail:{qohId:e,html:n.outerHTML}});window.dispatchEvent(i)}}highlightComponent(e){var o;let n=[{outline:"thick auto white"},{outline:"thick auto red"}],t={duration:1e3,iterations:2},i=(o=document.querySelector(`[qohId='${e}']`))==null?void 0:o.nextElementSibling;i&&i.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),i&&i.animate(n,t)}};var C=class{constructor(e){this.token="";this.uri="https://graphql.datocms.com/";this.token=e}renameSEOMetaTags(e){e.forEach(function(n,t,i){i[t].__typename="SEOMetaTag"})}normalize(e){if(e)return e._seoMetaTags&&this.renameSEOMetaTags(e._seoMetaTags),Object.keys(e).forEach(n=>{Array.isArray(e[n])&&(e[n]=e[n].map(t=>this.normalize(t))),e[n]&&typeof e[n]=="object"&&(e[n]=this.normalize(e[n]))}),e}};import V from"dotenv";V.config();var E=class{constructor(e,n){this.token="";this.uri="";this.token=e,this.uri=n}renameSEOMetaTags(e){e.forEach(function(n,t,i){i[t].__typename="SEOMetaTag"})}normalize(e){return e&&(e._seoMetaTags&&this.renameSEOMetaTags(e._seoMetaTags),Object.keys(e).forEach(n=>{Array.isArray(e[n])&&(e[n]=e[n].map(t=>this.normalize(t))),e[n]&&typeof e[n]=="object"&&(e[n]=this.normalize(e[n]))}),e)}};export{m as ApiError,C as DatoCMS,X as Filter,ne as QueenofheartsRenderComponent,h as QueenofheartsService,E as StrapiCMS,d as componentRegistry,ye as fetchDynamicComponents,G as getAllregisteredComponents,fe as registerComponent,pe as registerLazyComponent,me as unregisterComponent};
|
package/package.json
CHANGED
|
@@ -1,57 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoh/core-react",
|
|
3
|
-
"description": "Queen of hearts Core API",
|
|
4
|
-
"version": "0.0.
|
|
3
|
+
"description": "Queen of hearts Core React API",
|
|
4
|
+
"version": "1.0.0-rc.11",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
|
-
"module": "lib/index.
|
|
7
|
+
"module": "lib/index.mjs",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./lib/index.d.ts",
|
|
12
|
+
"import": "./lib/index.mjs",
|
|
13
|
+
"require": "./lib/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
9
16
|
"files": [
|
|
10
|
-
"
|
|
11
|
-
"
|
|
17
|
+
"lib",
|
|
18
|
+
"README.md"
|
|
12
19
|
],
|
|
13
20
|
"scripts": {
|
|
14
21
|
"test": "jest --passWithNoTests",
|
|
15
|
-
"build:prod": "
|
|
16
|
-
"build": "npm run build:
|
|
17
|
-
"build:dev": "
|
|
18
|
-
"
|
|
22
|
+
"build:prod": "tsup",
|
|
23
|
+
"build": "npm run build:prod",
|
|
24
|
+
"build:dev": "tsup --no-minify",
|
|
25
|
+
"prepublishOnly": "npm run build:prod",
|
|
26
|
+
"release": "npm publish --access public"
|
|
19
27
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@mui/icons-material": "^5.16.7 || ^6.0.0",
|
|
30
|
+
"@mui/material": "^5.16.7 || ^6.0.0",
|
|
31
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
32
|
+
"react-dom": " ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"@mui/icons-material": {
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
"@mui/material": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
27
41
|
},
|
|
28
42
|
"devDependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@babel/preset-typescript": "^7.23.3",
|
|
37
|
-
"@types/react": "^18.3.3",
|
|
38
|
-
"babel-jest": "^26.6.3",
|
|
39
|
-
"babel-plugin-import": "^1.13.8",
|
|
40
|
-
"babel-plugin-transform-react-jsx": "^6.24.1",
|
|
41
|
-
"babel-plugin-transform-scss": "^1.2.0",
|
|
42
|
-
"babel-preset-minify": "^0.5.2",
|
|
43
|
-
"decamelize": "^1.2.0",
|
|
44
|
-
"i": "^0.3.7",
|
|
43
|
+
"@mui/icons-material": "^5.16.7",
|
|
44
|
+
"@mui/material": "^5.16.7",
|
|
45
|
+
"@types/jest": "^29.5.14",
|
|
46
|
+
"@types/react": "^17.0.0",
|
|
47
|
+
"@types/react-dom": "^17.0.0",
|
|
48
|
+
"cross-env": "^7.0.3",
|
|
49
|
+
"dotenv": "^16.4.5",
|
|
45
50
|
"identity-obj-proxy": "^3.0.0",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
+
"jest": "^29.7.0",
|
|
52
|
+
"next": "^16.2.4",
|
|
53
|
+
"prettier": "^3.3.3",
|
|
54
|
+
"ts-jest": "^29.1.0",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"typescript": "^5.0.0"
|
|
51
57
|
},
|
|
52
58
|
"jest": {
|
|
53
|
-
"
|
|
54
|
-
|
|
59
|
+
"preset": "ts-jest",
|
|
60
|
+
"testEnvironment": "jsdom",
|
|
61
|
+
"testPathIgnorePatterns": [
|
|
62
|
+
"<rootDir>/.next/",
|
|
63
|
+
"<rootDir>/node_modules/"
|
|
64
|
+
],
|
|
65
|
+
"moduleNameMapper": {
|
|
66
|
+
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
|
|
55
67
|
}
|
|
56
68
|
}
|
|
57
|
-
}
|
|
69
|
+
}
|
package/CHANGELOG.md
DELETED
package/lib/ApiError.d.ts
DELETED
package/lib/ApiError.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiError=void 0;var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_wrapNativeSuper2=_interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));function _callSuper(a,b,c){return b=(0,_getPrototypeOf2["default"])(b),(0,_possibleConstructorReturn2["default"])(a,_isNativeReflectConstruct()?Reflect.construct(b,c||[],(0,_getPrototypeOf2["default"])(a).constructor):b.apply(a,c))}function _isNativeReflectConstruct(){try{var a=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(a){}return(_isNativeReflectConstruct=function(){return!!a})()}var ApiError=exports.ApiError=/*#__PURE__*/function(a){function b(a,c){var d;return(0,_classCallCheck2["default"])(this,b),d=_callSuper(this,b,[c.summary]),(0,_defineProperty2["default"])(d,"status",void 0),(0,_defineProperty2["default"])(d,"body",void 0),d.name="ApiError",d.status=a,d.body=c,d}return(0,_inherits2["default"])(b,a),(0,_createClass2["default"])(b)}(/*#__PURE__*/(0,_wrapNativeSuper2["default"])(Error));
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Backend from './backend/Backend';
|
|
3
|
-
export declare enum Filter {
|
|
4
|
-
eq = "eq",
|
|
5
|
-
in = "in",
|
|
6
|
-
neq = "neq",
|
|
7
|
-
notIn = "notIn"
|
|
8
|
-
}
|
|
9
|
-
export interface QohResponse {
|
|
10
|
-
pages: any | null;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
export type ComponentTypes = Array<{
|
|
14
|
-
typename: string;
|
|
15
|
-
props: {
|
|
16
|
-
__typename: string;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
export interface IFCDictionary {
|
|
20
|
-
[index: string]: ReactFCWithFieldNames;
|
|
21
|
-
}
|
|
22
|
-
export interface ReactFCWithFieldNames {
|
|
23
|
-
component?: React.FC<any>;
|
|
24
|
-
fieldNames?: string[];
|
|
25
|
-
loader?: () => any;
|
|
26
|
-
}
|
|
27
|
-
export declare let componentRegistry: IFCDictionary;
|
|
28
|
-
export declare function unregisterComponent(name: string): void;
|
|
29
|
-
export declare function registerComponent(functionalComponent: React.FC<any>, typeName: string, fieldNames?: string[], overwrite?: false): void;
|
|
30
|
-
export declare function registerLazyComponent(loader: () => any, typeName: string, fieldNames?: string[], overwrite?: boolean): void;
|
|
31
|
-
export declare function getAllregisteredComponents(): IFCDictionary;
|
|
32
|
-
export declare const fetchDynamicComponents: (props: any) => Promise<(string | null)[]>;
|
|
33
|
-
export declare class QueenofheartsService {
|
|
34
|
-
private static instance;
|
|
35
|
-
data: any;
|
|
36
|
-
debug: boolean;
|
|
37
|
-
backend: Backend;
|
|
38
|
-
apiToken: string | null;
|
|
39
|
-
localServer?: string;
|
|
40
|
-
latestUrl: string;
|
|
41
|
-
latestData: Object;
|
|
42
|
-
private constructor();
|
|
43
|
-
static init(backend: Backend, apiToken: string | null, localServer?: string): void;
|
|
44
|
-
static getInstance(): QueenofheartsService;
|
|
45
|
-
findComponentsInProps: (props: any) => string[];
|
|
46
|
-
fetchDynamicComponents: (componentsToLoad: string[]) => Promise<(string | null)[]>;
|
|
47
|
-
private loadAsyncComponent;
|
|
48
|
-
createComponent(props: any): JSX.Element | null;
|
|
49
|
-
private buildUrl;
|
|
50
|
-
queryGraphql: (graphqlQuery: string) => Promise<any>;
|
|
51
|
-
query: (queryName: string, options?: {
|
|
52
|
-
filter?: {
|
|
53
|
-
name: string;
|
|
54
|
-
operator: Filter;
|
|
55
|
-
value: string;
|
|
56
|
-
}[] | undefined;
|
|
57
|
-
components?: string | undefined;
|
|
58
|
-
ignoreProperties?: string[] | undefined;
|
|
59
|
-
variables?: {
|
|
60
|
-
[x: string]: unknown;
|
|
61
|
-
filter?: {
|
|
62
|
-
name: string;
|
|
63
|
-
operator: Filter;
|
|
64
|
-
value: string;
|
|
65
|
-
}[] | undefined;
|
|
66
|
-
locale?: string | undefined;
|
|
67
|
-
} | undefined;
|
|
68
|
-
locale?: string | undefined;
|
|
69
|
-
depth?: number | undefined;
|
|
70
|
-
} | undefined) => Promise<any>;
|
|
71
|
-
private getRegisteredComponentsWithFields;
|
|
72
|
-
getQueries: () => Promise<any>;
|
|
73
|
-
private injectIds;
|
|
74
|
-
private sendDebugEvent;
|
|
75
|
-
private sendQueriesEvent;
|
|
76
|
-
private sendComponentHTML;
|
|
77
|
-
private highlightComponent;
|
|
78
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_typeof3=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:!0}),exports.fetchDynamicComponents=exports.componentRegistry=exports.QueenofheartsService=exports.Filter=void 0,exports.getAllregisteredComponents=getAllregisteredComponents,exports.registerComponent=registerComponent,exports.registerLazyComponent=registerLazyComponent,exports.unregisterComponent=unregisterComponent;var _QueenofheartsService,_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_ApiError=require("./ApiError"),_react=_interopRequireWildcard(require("react")),_Dodo=_interopRequireDefault(require("./components/Dodo"));//TODO: remove????
|
|
2
|
-
function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=_typeof3(b)&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){(0,_defineProperty2["default"])(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var Filter=exports.Filter=/*#__PURE__*/function(a){return a.eq="eq",a["in"]="in",a.neq="neq",a.notIn="notIn",a}({}),qohUri="https://qoh.azurewebsites.net/api",componentRegistry=exports.componentRegistry={};//const qohUri = 'http://localhost:3000/api';
|
|
3
|
-
function unregisterComponent(a){delete componentRegistry[a]}function registerComponent(a,b,c,d){if(b!==void 0&&(d||void 0===componentRegistry[b])){componentRegistry[b]={component:a,fieldNames:c}}}function registerLazyComponent(a,b,c){var d=!!(3<arguments.length&&arguments[3]!==void 0)&&arguments[3];!b?console.warn("registerComponent failed: undefined typeName "):(d||componentRegistry[b]===void 0)&&(componentRegistry[b]={fieldNames:c,loader:a})}function getAllregisteredComponents(){return componentRegistry}var fetchDynamicComponents=exports.fetchDynamicComponents=/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(a){var c,d,e;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=QueenofheartsService.getInstance(),d=c.findComponentsInProps(a).filter(function(a,b,c){return c.indexOf(a)===b}),b.next=4,c.fetchDynamicComponents(d);case 4:return e=b.sent,b.abrupt("return",e.filter(function(a){return null!==a}));case 6:case"end":return b.stop()}},b)}));return function(){return a.apply(this,arguments)}}(),QueenofheartsService=exports.QueenofheartsService=/*#__PURE__*/function(){function a(b,c,d){var e=this;//debugger-data:
|
|
4
|
-
// devtools-panel events and debug-option
|
|
5
|
-
(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"data",void 0),(0,_defineProperty2["default"])(this,"debug",void 0),(0,_defineProperty2["default"])(this,"backend",void 0),(0,_defineProperty2["default"])(this,"apiToken",void 0),(0,_defineProperty2["default"])(this,"localServer",void 0),(0,_defineProperty2["default"])(this,"latestUrl",""),(0,_defineProperty2["default"])(this,"latestData",{}),(0,_defineProperty2["default"])(this,"findComponentsInProps",function(a){// returns unique list of components in props and it's children
|
|
6
|
-
if(a&&"string"!=typeof a){var b=a.__typename?[a.__typename]:[],c=Array.isArray(a)?a:Object.values(a),d=[].concat(b,(0,_toConsumableArray2["default"])(c.reduce(function(a,b){var c=e.findComponentsInProps(b);return c&&(a=[].concat((0,_toConsumableArray2["default"])(a),(0,_toConsumableArray2["default"])(c))),a},[])));return d}return[]}),(0,_defineProperty2["default"])(this,"fetchDynamicComponents",/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(a){var c,d,f;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=!1,d=!1,f=Promise.all(a.map(/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(a){var d,f,g;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(!componentRegistry[a]){b.next=8;break}if(f=componentRegistry[a].component,void 0!==f){b.next=8;break}return c=!0,b.next=6,e.loadAsyncComponent(a);case 6:return g=b.sent,b.abrupt("return",g);case 8:if(!(null!==(d=componentRegistry[a])&&void 0!==d&&d.loader)){b.next=10;break}return b.abrupt("return",a);case 10:return b.abrupt("return",null);case 11:case"end":return b.stop()}},b)}));return function(){return a.apply(this,arguments)}}())),d=!0,b.abrupt("return",f);case 5:case"end":return b.stop()}},b)}));return function(){return a.apply(this,arguments)}}()),(0,_defineProperty2["default"])(this,"buildUrl",function(a){var b,c=null!==(b=e.localServer)&&void 0!==b?b:qohUri,d=e.apiToken?"?code=".concat(e.apiToken):"";return"".concat(c,"/").concat(a).concat(d)}),(0,_defineProperty2["default"])(this,"queryGraphql",/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(a){var c,d,f,g;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=e.buildUrl("execGraphqlQuery"),console.warn("using url : ".concat(c)),!c){b.next=19;break}return b.next=5,fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uri:e.backend.uri,query:a,token:e.backend.token})});case 5:if(d=b.sent,!d.ok){b.next=14;break}return b.next=9,d.json();case 9:return f=b.sent,e.sendDebugEvent(),b.abrupt("return",f);case 14:return b.next=16,d.json();case 16:throw g=b.sent,console.log(g),new _ApiError.ApiError(d.status,g);case 19:throw new _ApiError.ApiError(500,{id:"99",summary:"queryUrl was not set",details:"LocalServer: ".concat(e.localServer)});case 20:case"end":return b.stop()}},b)}));return function(){return a.apply(this,arguments)}}()),(0,_defineProperty2["default"])(this,"query",/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function c(a,b){var d,f,g,h,i,j,k,l,m,n,o;return _regenerator["default"].wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(d=e.buildUrl("execQuery"),f=null!==b&&void 0!==b&&b.variables?_objectSpread({},b.variables):{},null!==b&&void 0!==b&&b.locale&&(f.locale=b.locale),null!==b&&void 0!==b&&b.filter&&Array.isArray(b.filter)&&(!f.filter&&(f.filter=[]),(g=f.filter).push.apply(g,(0,_toConsumableArray2["default"])(b.filter)),null!==b&&void 0!==b&&null!==(h=b.variables)&&void 0!==h&&h.filter&&Array.isArray(b.variables.filter)&&(i=f.filter).push.apply(i,(0,_toConsumableArray2["default"])(b.variables.filter))),!d||!b){c.next=36;break}return console.warn("credentials: ".concat(process.env.QOH_VERCEL_SERVER?"same-origin":"none")),c.next=8,fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({uri:e.backend.uri,queryname:a,token:e.backend.token,variables:f,components:e.getRegisteredComponentsWithFields(),ignoreProperties:b.ignoreProperties,depth:b.depth})});case 8:if(j=c.sent,!j.ok){c.next=29;break}return c.next=12,j.json();case 12:if(c.t1=k=c.sent,c.t0=null===c.t1,c.t0){c.next=16;break}c.t0=void 0===k;case 16:if(!c.t0){c.next=20;break}c.t2=void 0,c.next=21;break;case 20:c.t2=k.data;case 21:return l=c.t2,m=e.backend.normalize(l),n=e.debug?e.injectIds(m):m,e.latestData=n,e.sendDebugEvent(),c.abrupt("return",n);case 29:return c.next=31,j.json();case 31:throw o=c.sent,console.log(o),new _ApiError.ApiError(j.status,o);case 34:c.next=37;break;case 36:throw new _ApiError.ApiError(500,{id:"99",summary:"Query: queryUrl (".concat(d,") or options are invalid"),details:"queryUrl: ".concat(d)});case 37:case"end":return c.stop()}},c)}));return function(){return a.apply(this,arguments)}}()),(0,_defineProperty2["default"])(this,"getRegisteredComponentsWithFields",function(){var a={},b=Object.entries(getAllregisteredComponents());return b&&Array.isArray(b)&&b.forEach(function(b){var c=(0,_slicedToArray2["default"])(b,2),d=c[0],e=c[1],f={},g=e.fieldNames,h=!1;g&&Array.isArray(g)&&g.forEach(function(a){f[a]=!0,h=!0}),a[d]=h?f:{__all:!0}}),a}),(0,_defineProperty2["default"])(this,"getQueries",/*#__PURE__*/(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(){var b,c,d;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(b=e.buildUrl("queries"),!(b&&e.backend&&(e.localServer||e.backend.token))){a.next=18;break}return a.next=4,fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uri:e.backend.uri,token:e.backend.token||null})});case 4:if(c=a.sent,!c.ok){a.next=16;break}return a.prev=6,a.next=9,c.json();case 9:return d=a.sent,a.abrupt("return",d);case 13:a.prev=13,a.t0=a["catch"](6),console.error(a.t0);case 16:a.next=19;break;case 18:console.error("api, uri and CMSToken have to be provided");case 19:return a.abrupt("return","");case 20:case"end":return a.stop()}},a,null,[[6,13]])}))),this.backend=b,this.apiToken=c,this.localServer=d,this.debug="undefined"!=typeof document&&document.getElementsByTagName("body")[0].classList.contains("qoh-inject-ids"),this.debug&&"undefined"!=typeof window&&(window.addEventListener("QueenOfHearts-RequestData",function(){e.sendDebugEvent()}),window.addEventListener("QueenOfHearts-RequestQueries",function(){e.sendQueriesEvent()}),window.addEventListener("QueenOfHearts-HighlightComponent",function(a){e.highlightComponent(a.detail)}),window.addEventListener("QueenOfHearts-RequestComponentHTML",function(a){e.sendComponentHTML(a.detail)}))}return(0,_createClass2["default"])(a,[{key:"loadAsyncComponent",value:function(){function a(){return b.apply(this,arguments)}var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(a){var c,d,e;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=componentRegistry[a],!(c&&void 0===c.component)){b.next=10;break}if(null!==c&&void 0!==c&&c.component){b.next=9;break}if(!c.loader){b.next=9;break}return d=c.loader,b.next=7,d();case 7:e=b.sent,e?componentRegistry[a].component=e["default"]:(console.error("error loading ".concat(a)),console.error(e));case 9:return b.abrupt("return",a);case 10:return b.abrupt("return",null);case 11:case"end":return b.stop()}},b)}));return a}()},{key:"createComponent",value:function(a){var b,c=a.data,d=a.contextProps,e=void 0===d?{}:d,f=c.__typename,g=componentRegistry[f];g&&g.loader&&(0,_react.lazy)(g.loader);var h=null!==(b=null===g||void 0===g?void 0:g.component)&&void 0!==b?b:_Dodo["default"];return/*#__PURE__*/_react["default"].createElement(h,_objectSpread(_objectSpread({},c),{},{contextProps:e}))}},{key:"injectIds",value:function(a){var b=this;if(Array.isArray(a))a.forEach(function(a){return b.injectIds(a)});else if(a&&"object"===(0,_typeof2["default"])(a)){if(a.hasOwnProperty("__typename")){var c=Math.random().toString();a.__qohId=c.substr(c.indexOf(".")+1)}Object.keys(a).forEach(function(c){return a[c]=b.injectIds(a[c])})}return a}},{key:"sendDebugEvent",value:function(){if("undefined"!=typeof window){var a={registeredComponents:Object.keys(componentRegistry),url:this.latestUrl,data:this.latestData},b=new CustomEvent("QueenOfHearts-DebuggingData",{detail:a});window.dispatchEvent(b)}}},{key:"sendQueriesEvent",value:function(){function a(){return b.apply(this,arguments)}var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(){var b;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if("undefined"!=typeof window){a.next=2;break}return a.abrupt("return");case 2:return a.t0=CustomEvent,a.next=5,this.getQueries();case 5:a.t1=a.sent,a.t2={detail:a.t1},b=new a.t0("QueenOfHearts-AvailableQueries",a.t2),window.dispatchEvent(b);case 9:case"end":return a.stop()}},a,this)}));return a}()},{key:"sendComponentHTML",value:function(a){var b;if("undefined"!=typeof window){var c=null===(b=document.querySelector("[qohId='".concat(a,"']")))||void 0===b?void 0:b.nextElementSibling;if(c){var d=new CustomEvent("QueenOfHearts-SelectedComponentHTML",{detail:{qohId:a,html:c.outerHTML}});window.dispatchEvent(d)}}}},{key:"highlightComponent",value:function(a){var b,c=null===(b=document.querySelector("[qohId='".concat(a,"']")))||void 0===b?void 0:b.nextElementSibling;c&&c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),c&&c.animate([{outline:"thick auto white"},{outline:"thick auto red"}],{duration:1e3,iterations:2})}}],[{key:"init",value:function(b,c,d){a.instance=new a(b,c,d)}},{key:"getInstance",value:function(){return a.instance||console.error("QueenofheartsService was not initialized using QueenofheartsService.init(backend, apiToken)"),a.instance}}])}();_QueenofheartsService=QueenofheartsService,(0,_defineProperty2["default"])(QueenofheartsService,"instance",void 0);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_QueenofheartsService=require("./QueenofheartsService"),_QueenofheartsService2=_interopRequireDefault(require("./QueenofheartsService.testData"));describe("service",function(){it("findComponentsInProps",function(){var a=/*#__PURE__*/function(){function a(){(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"token",void 0),(0,_defineProperty2["default"])(this,"uri",void 0)}return(0,_createClass2["default"])(a,[{key:"normalize",value:function(a){return a}}])}();_QueenofheartsService.QueenofheartsService.init(new a,"test");var b=_QueenofheartsService.QueenofheartsService.getInstance(),c=b.findComponentsInProps(_QueenofheartsService2["default"]).filter(function(a,b,c){return c.indexOf(a)===b});expect(c).toEqual(["PageRecord","SEOMetaTag","BannerRecord","FullpageJumbotronRecord","FullpageSubpageRecord","HomepageTilesSubpageRecord"])})});
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
declare const testData: {
|
|
2
|
-
__typename: string;
|
|
3
|
-
_createdAt: string;
|
|
4
|
-
_firstPublishedAt: string;
|
|
5
|
-
_isValid: boolean;
|
|
6
|
-
_modelApiKey: string;
|
|
7
|
-
_publicationScheduledAt: null;
|
|
8
|
-
_publishedAt: string;
|
|
9
|
-
_seoMetaTags: ({
|
|
10
|
-
__typename: string;
|
|
11
|
-
attributes: null;
|
|
12
|
-
content: string;
|
|
13
|
-
tag: string;
|
|
14
|
-
} | {
|
|
15
|
-
__typename: string;
|
|
16
|
-
attributes: ObjectConstructor[];
|
|
17
|
-
content: null;
|
|
18
|
-
tag: string;
|
|
19
|
-
})[];
|
|
20
|
-
_status: string;
|
|
21
|
-
_unpublishingScheduledAt: null;
|
|
22
|
-
_updatedAt: string;
|
|
23
|
-
banner: {
|
|
24
|
-
__typename: string;
|
|
25
|
-
_createdAt: string;
|
|
26
|
-
_firstPublishedAt: string;
|
|
27
|
-
_isValid: boolean;
|
|
28
|
-
_modelApiKey: string;
|
|
29
|
-
_publicationScheduledAt: null;
|
|
30
|
-
_publishedAt: string;
|
|
31
|
-
_seoMetaTags: ArrayConstructor[];
|
|
32
|
-
_status: string;
|
|
33
|
-
_unpublishingScheduledAt: null;
|
|
34
|
-
_updatedAt: string;
|
|
35
|
-
chevron: boolean;
|
|
36
|
-
createdAt: string;
|
|
37
|
-
id: string;
|
|
38
|
-
target: string;
|
|
39
|
-
text: string;
|
|
40
|
-
updatedAt: string;
|
|
41
|
-
}[];
|
|
42
|
-
createdAt: string;
|
|
43
|
-
myTitle: string;
|
|
44
|
-
paragraphs: ({
|
|
45
|
-
__typename: string;
|
|
46
|
-
_createdAt: string;
|
|
47
|
-
_firstPublishedAt: string;
|
|
48
|
-
_isValid: boolean;
|
|
49
|
-
_modelApiKey: string;
|
|
50
|
-
_publicationScheduledAt: null;
|
|
51
|
-
_publishedAt: string;
|
|
52
|
-
_seoMetaTags: ArrayConstructor[];
|
|
53
|
-
_status: string;
|
|
54
|
-
_unpublishingScheduledAt: null;
|
|
55
|
-
_updatedAt: string;
|
|
56
|
-
backgroundImageJumbotron: ObjectConstructor[];
|
|
57
|
-
createdAt: string;
|
|
58
|
-
id: string;
|
|
59
|
-
subline: string;
|
|
60
|
-
tagline: string;
|
|
61
|
-
updatedAt: string;
|
|
62
|
-
whiteTextColor: boolean;
|
|
63
|
-
backgroundImageSubpage?: undefined;
|
|
64
|
-
backgroundImageThreeTiles?: undefined;
|
|
65
|
-
column?: undefined;
|
|
66
|
-
tiles?: undefined;
|
|
67
|
-
} | {
|
|
68
|
-
__typename: string;
|
|
69
|
-
_createdAt: string;
|
|
70
|
-
_firstPublishedAt: string;
|
|
71
|
-
_isValid: boolean;
|
|
72
|
-
_modelApiKey: string;
|
|
73
|
-
_publicationScheduledAt: null;
|
|
74
|
-
_publishedAt: string;
|
|
75
|
-
_seoMetaTags: ArrayConstructor[];
|
|
76
|
-
_status: string;
|
|
77
|
-
_unpublishingScheduledAt: null;
|
|
78
|
-
_updatedAt: string;
|
|
79
|
-
backgroundImageSubpage: ObjectConstructor[];
|
|
80
|
-
createdAt: string;
|
|
81
|
-
id: string;
|
|
82
|
-
subline: string;
|
|
83
|
-
tagline: string;
|
|
84
|
-
updatedAt: string;
|
|
85
|
-
backgroundImageJumbotron?: undefined;
|
|
86
|
-
whiteTextColor?: undefined;
|
|
87
|
-
backgroundImageThreeTiles?: undefined;
|
|
88
|
-
column?: undefined;
|
|
89
|
-
tiles?: undefined;
|
|
90
|
-
} | {
|
|
91
|
-
__typename: string;
|
|
92
|
-
_createdAt: string;
|
|
93
|
-
_firstPublishedAt: string;
|
|
94
|
-
_isValid: boolean;
|
|
95
|
-
_modelApiKey: string;
|
|
96
|
-
_publicationScheduledAt: null;
|
|
97
|
-
_publishedAt: string;
|
|
98
|
-
_seoMetaTags: ArrayConstructor[];
|
|
99
|
-
_status: string;
|
|
100
|
-
_unpublishingScheduledAt: null;
|
|
101
|
-
_updatedAt: string;
|
|
102
|
-
backgroundImageThreeTiles: ObjectConstructor[];
|
|
103
|
-
column: null;
|
|
104
|
-
createdAt: string;
|
|
105
|
-
id: string;
|
|
106
|
-
tiles: ArrayConstructor[];
|
|
107
|
-
updatedAt: string;
|
|
108
|
-
backgroundImageJumbotron?: undefined;
|
|
109
|
-
subline?: undefined;
|
|
110
|
-
tagline?: undefined;
|
|
111
|
-
whiteTextColor?: undefined;
|
|
112
|
-
backgroundImageSubpage?: undefined;
|
|
113
|
-
} | {
|
|
114
|
-
__typename: string;
|
|
115
|
-
_createdAt: string;
|
|
116
|
-
_firstPublishedAt: string;
|
|
117
|
-
_isValid: boolean;
|
|
118
|
-
_modelApiKey: string;
|
|
119
|
-
_publicationScheduledAt: null;
|
|
120
|
-
_publishedAt: string;
|
|
121
|
-
_seoMetaTags: ArrayConstructor[];
|
|
122
|
-
_status: string;
|
|
123
|
-
_unpublishingScheduledAt: null;
|
|
124
|
-
_updatedAt: string;
|
|
125
|
-
backgroundImageThreeTiles: ObjectConstructor[];
|
|
126
|
-
column: boolean;
|
|
127
|
-
createdAt: string;
|
|
128
|
-
id: string;
|
|
129
|
-
tiles: ArrayConstructor[];
|
|
130
|
-
updatedAt: string;
|
|
131
|
-
backgroundImageJumbotron?: undefined;
|
|
132
|
-
subline?: undefined;
|
|
133
|
-
tagline?: undefined;
|
|
134
|
-
whiteTextColor?: undefined;
|
|
135
|
-
backgroundImageSubpage?: undefined;
|
|
136
|
-
})[];
|
|
137
|
-
seo: null;
|
|
138
|
-
slug: string;
|
|
139
|
-
updatedAt: string;
|
|
140
|
-
};
|
|
141
|
-
export default testData;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var testData={__typename:"PageRecord",_createdAt:"2022-01-26T16:05:44+00:00",_firstPublishedAt:"2022-01-26T16:05:44+00:00",_isValid:!0,_modelApiKey:"page",_publicationScheduledAt:null,_publishedAt:"2024-08-15T14:29:41+01:00",_seoMetaTags:[{__typename:"SEOMetaTag",attributes:null,content:"Home",tag:"title"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"},{__typename:"SEOMetaTag",attributes:[Object],content:null,tag:"meta"}],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-08-15T14:28:43+01:00",banner:[{__typename:"BannerRecord",_createdAt:"2023-03-29T09:47:42+01:00",_firstPublishedAt:"2023-03-29T09:47:43+01:00",_isValid:!0,_modelApiKey:"banner",_publicationScheduledAt:null,_publishedAt:"2024-05-29T15:57:15+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-05-29T15:57:14+01:00",chevron:!0,createdAt:"2023-03-29T09:47:42+01:00",id:"147526070",target:"/coaching",text:"<i>Next Workshop:</i><br /><em>Design Thinking</em>",updatedAt:"2024-05-29T15:57:14+01:00"}],createdAt:"2022-01-26T16:05:44+00:00",myTitle:"Home",paragraphs:[{__typename:"FullpageJumbotronRecord",_createdAt:"2022-02-25T14:48:48+00:00",_firstPublishedAt:"2022-02-25T14:48:48+00:00",_isValid:!0,_modelApiKey:"fullpage_jumbotron",_publicationScheduledAt:null,_publishedAt:"2024-08-15T14:29:41+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-08-15T14:28:43+01:00",backgroundImageJumbotron:[Object],createdAt:"2022-02-25T14:48:48+00:00",id:"111913781",subline:"Softwareentwicklung von der Idee<br/>bis zum fertigen Produkt",tagline:"",updatedAt:"2024-08-15T14:28:43+01:00",whiteTextColor:!1},{__typename:"FullpageSubpageRecord",_createdAt:"2022-06-15T07:56:25+01:00",_firstPublishedAt:"2022-06-15T07:56:26+01:00",_isValid:!0,_modelApiKey:"fullpage_subpage",_publicationScheduledAt:null,_publishedAt:"2024-05-14T14:05:30+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-05-14T14:05:28+01:00",backgroundImageSubpage:[Object],createdAt:"2022-06-15T07:56:25+01:00",id:"122230963",subline:"Sie fragen sich, ob Sie wirklich so viele verschiedene Dienstleister f\xFCr Ihr Produkt ben\xF6tigen? Disziplinen und Silos aufzubrechen ist unsere St\xE4rke.",tagline:"storm out of the box",updatedAt:"2024-05-14T14:05:28+01:00"},{__typename:"FullpageSubpageRecord",_createdAt:"2022-06-15T07:56:25+01:00",_firstPublishedAt:"2022-06-15T07:56:26+01:00",_isValid:!0,_modelApiKey:"fullpage_subpage",_publicationScheduledAt:null,_publishedAt:"2024-05-14T14:05:30+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-05-14T14:05:28+01:00",backgroundImageSubpage:[Object],createdAt:"2022-06-15T07:56:25+01:00",id:"122230964",subline:"Von der Idee bis zum Launch bieten wir Strategie, Design und Softwareentwicklung ohne Informationsverluste aus einer Hand!",tagline:"focus on what has gravity",updatedAt:"2024-05-14T14:05:28+01:00"},{__typename:"FullpageSubpageRecord",_createdAt:"2022-02-25T14:48:48+00:00",_firstPublishedAt:"2022-02-25T14:48:48+00:00",_isValid:!0,_modelApiKey:"fullpage_subpage",_publicationScheduledAt:null,_publishedAt:"2024-05-14T14:05:30+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-05-14T14:05:28+01:00",backgroundImageSubpage:[Object],createdAt:"2022-02-25T14:48:48+00:00",id:"111913782",subline:"Wir entwickeln Produkte und Marken, die Ihre Kunden lieben werden! Unser In-House Team von Entwicklern, Strategen und Designern steht f\xFCr Sie bereit.",tagline:"make it fly",updatedAt:"2024-05-14T14:05:28+01:00"},{__typename:"HomepageTilesSubpageRecord",_createdAt:"2022-02-25T16:25:38+00:00",_firstPublishedAt:"2022-02-25T16:25:38+00:00",_isValid:!0,_modelApiKey:"homepage_tiles_subpage",_publicationScheduledAt:null,_publishedAt:"2023-03-28T12:35:52+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2023-03-28T12:35:46+01:00",backgroundImageThreeTiles:[Object],column:null,createdAt:"2022-02-25T16:25:38+00:00",id:"111937859",tiles:[Array],updatedAt:"2023-03-28T12:35:46+01:00"},{__typename:"HomepageTilesSubpageRecord",_createdAt:"2024-06-19T11:07:46+01:00",_firstPublishedAt:"2024-06-19T11:07:49+01:00",_isValid:!0,_modelApiKey:"homepage_tiles_subpage",_publicationScheduledAt:null,_publishedAt:"2024-07-23T18:02:11+01:00",_seoMetaTags:[Array],_status:"published",_unpublishingScheduledAt:null,_updatedAt:"2024-07-23T18:02:10+01:00",backgroundImageThreeTiles:[Object],column:!0,createdAt:"2024-06-19T11:07:46+01:00",id:"YZM_vT1aSzWqzNGpQORYYw",tiles:[Array],updatedAt:"2024-07-23T18:02:10+01:00"}],seo:null,slug:"home",updatedAt:"2024-08-15T14:28:43+01:00"},_default=exports["default"]=testData;
|
package/lib/backend/Backend.d.ts
DELETED
package/lib/backend/Backend.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/lib/backend/DatoCMS.d.ts
DELETED
package/lib/backend/DatoCMS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),DatoCMS=exports["default"]=/*#__PURE__*/function(){function a(b){(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"token",""),(0,_defineProperty2["default"])(this,"uri","https://graphql.datocms.com/"),this.token=b}return(0,_createClass2["default"])(a,[{key:"renameSEOMetaTags",value:function(a){a.forEach(function(a,b,c){c[b].__typename="SEOMetaTag"})}},{key:"normalize",value:function(a){var b=this;if(a)return a._seoMetaTags&&this.renameSEOMetaTags(a._seoMetaTags),Object.keys(a).forEach(function(c){Array.isArray(a[c])&&(a[c]=a[c].map(function(a){return b.normalize(a)})),!a[c]||"object"!==(0,_typeof2["default"])(a[c])||(a[c]=b.normalize(a[c]))}),a}}])}();
|
package/lib/backend/StrapiCMS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_dotenv=_interopRequireDefault(require("dotenv"));_dotenv["default"].config();var StrapiCMS=exports["default"]=/*#__PURE__*/function(){function a(b,c){(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"token",""),(0,_defineProperty2["default"])(this,"uri",""),this.token=b,this.uri=c}return(0,_createClass2["default"])(a,[{key:"renameSEOMetaTags",value:function(a){a.forEach(function(a,b,c){c[b].__typename="SEOMetaTag"})}},{key:"normalize",value:function(a){var b=this;return a?(a._seoMetaTags&&this.renameSEOMetaTags(a._seoMetaTags),Object.keys(a).forEach(function(c){Array.isArray(a[c])&&(a[c]=a[c].map(function(a){return b.normalize(a)})),!a[c]||"object"!==(0,_typeof2["default"])(a[c])||(a[c]=b.normalize(a[c]))}),a):a}}])}();
|
package/lib/backend/index.d.ts
DELETED
package/lib/backend/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DatoCMS",{enumerable:!0,get:function(){return _DatoCMS["default"]}}),Object.defineProperty(exports,"StrapiCMS",{enumerable:!0,get:function(){return _StrapiCMS["default"]}});var _DatoCMS=_interopRequireDefault(require("./DatoCMS")),_StrapiCMS=_interopRequireDefault(require("./StrapiCMS"));
|
package/lib/components/Dodo.d.ts
DELETED
package/lib/components/Dodo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_typeof3=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=DodoComponent;var _Paper2=_interopRequireDefault(require("@mui/material/Paper")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_Accordion2=_interopRequireDefault(require("@mui/material/Accordion")),_AccordionDetails2=_interopRequireDefault(require("@mui/material/AccordionDetails")),_AccordionSummary2=_interopRequireDefault(require("@mui/material/AccordionSummary")),React=_interopRequireWildcard(require("react")),_ExpandMore=_interopRequireDefault(require("@mui/icons-material/ExpandMore"));function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=_typeof3(b)&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}function renderArray(a,b,c){return/*#__PURE__*/React.createElement(_Accordion2["default"],{key:"".concat(a,"_").concat(c),style:{width:"100%"}},/*#__PURE__*/React.createElement(_AccordionSummary2["default"],{style:{padding:0},expandIcon:/*#__PURE__*/React.createElement(_ExpandMore["default"],null)},a,": Array[",b.length,"]"),/*#__PURE__*/React.createElement(_AccordionDetails2["default"],null,b.map(function(a,b){return renderData("",a,b)})))}function renderObject(a,b,c){return/*#__PURE__*/React.createElement(_Accordion2["default"],{key:"".concat(a,"_").concat(c),style:{width:"100%"}},/*#__PURE__*/React.createElement(_AccordionSummary2["default"],{expandIcon:/*#__PURE__*/React.createElement(_ExpandMore["default"],null)},a),/*#__PURE__*/React.createElement(_AccordionDetails2["default"],null,Object.entries(b).map(function(a,b){return renderData(a[0],a[1],b)})))}function renderSimple(a,b,c){return/*#__PURE__*/React.createElement("div",{key:"".concat(a,"_").concat(c)},a,": ","".concat(b))}function renderData(a,b,c){var d;if(Array.isArray(b))return renderArray(a,b,c);if(!b||["string","number"].includes((0,_typeof2["default"])(b)))return renderSimple(a,b,c);if("boolean"==typeof b)return renderSimple(a,b?"true":"false",c);var e="".concat(a?a+": ":"").concat(null!==(d=b.__typename)&&void 0!==d?d:"object");return renderObject(e,b,c)}function DodoComponent(a){return"object"===(0,_typeof2["default"])(a.data)?/*#__PURE__*/React.createElement(_Paper2["default"],{style:{margin:".5em",width:"calc(100% - 1em)"}},renderData("",a.data,1)):null}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueenofheartsRenderComponent=QueenofheartsRenderComponent;var _react=_interopRequireWildcard(require("react")),_index=require("../index");function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=_typeof(b)&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}function QueenofheartsRenderComponent(a){var b=_index.QueenofheartsService.getInstance(),c=a.data,d=a.contextProps;if(c&&b)return Array.isArray(c)?/*#__PURE__*/_react["default"].createElement(_react.Suspense,null,c.map(function(a){return b.createComponent({data:a,contextProps:d})})):/*#__PURE__*/_react["default"].createElement(_react.Suspense,null,b.createComponent({data:c,contextProps:d}));return b?/*#__PURE__*/_react["default"].createElement("div",{className:"error"},"QueenofheartsRenderComponent: Invalid data received."):/*#__PURE__*/_react["default"].createElement("div",null,"QueenofheartsService is not initialized")}
|
package/lib/declaration.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|