@qoh/core-react 1.0.0-rc.5 → 1.0.0-rc.6
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/CHANGELOG.md +5 -0
- package/LICENSE.md +21 -0
- package/README.md +33 -0
- package/lib/ApiError.d.ts +11 -0
- package/lib/ApiError.js +31 -0
- package/lib/QueenofheartsService.d.ts +78 -0
- package/lib/QueenofheartsService.js +662 -0
- package/lib/QueenofheartsService.test.js +31 -0
- package/lib/QueenofheartsService.testData.d.ts +141 -0
- package/lib/QueenofheartsService.testData.js +214 -0
- package/lib/backend/Backend.d.ts +5 -0
- package/lib/backend/Backend.js +1 -0
- package/lib/backend/DatoCMS.d.ts +8 -0
- package/lib/backend/DatoCMS.js +48 -0
- package/lib/backend/StrapiCMS.d.ts +8 -0
- package/lib/backend/StrapiCMS.js +52 -0
- package/lib/backend/index.d.ts +5 -0
- package/lib/backend/index.js +20 -0
- package/lib/components/Dodo.d.ts +2 -0
- package/lib/components/Dodo.js +68 -0
- package/lib/components/QueenofheartsRenderComponent.d.ts +5 -0
- package/lib/components/QueenofheartsRenderComponent.js +36 -0
- package/lib/declaration.d.js +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +49 -0
- package/lib/package.json +21 -0
- package/package.json +65 -20
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
5
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
6
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
|
+
var _QueenofheartsService = require("./QueenofheartsService");
|
|
8
|
+
var _QueenofheartsService2 = _interopRequireDefault(require("./QueenofheartsService.testData"));
|
|
9
|
+
describe('service', function () {
|
|
10
|
+
it('findComponentsInProps', function () {
|
|
11
|
+
var TestBackend = /*#__PURE__*/function () {
|
|
12
|
+
function TestBackend() {
|
|
13
|
+
(0, _classCallCheck2["default"])(this, TestBackend);
|
|
14
|
+
(0, _defineProperty2["default"])(this, "token", void 0);
|
|
15
|
+
(0, _defineProperty2["default"])(this, "uri", void 0);
|
|
16
|
+
}
|
|
17
|
+
return (0, _createClass2["default"])(TestBackend, [{
|
|
18
|
+
key: "normalize",
|
|
19
|
+
value: function normalize(data) {
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
}]);
|
|
23
|
+
}();
|
|
24
|
+
_QueenofheartsService.QueenofheartsService.init(new TestBackend(), 'test');
|
|
25
|
+
var instance = _QueenofheartsService.QueenofheartsService.getInstance();
|
|
26
|
+
var data = instance.findComponentsInProps(_QueenofheartsService2["default"]).filter(function (value, index, arr) {
|
|
27
|
+
return arr.indexOf(value) === index;
|
|
28
|
+
});
|
|
29
|
+
expect(data).toEqual(['PageRecord', 'SEOMetaTag', 'BannerRecord', 'FullpageJumbotronRecord', 'FullpageSubpageRecord', 'HomepageTilesSubpageRecord']);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,141 @@
|
|
|
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;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var testData = {
|
|
8
|
+
__typename: 'PageRecord',
|
|
9
|
+
_createdAt: '2022-01-26T16:05:44+00:00',
|
|
10
|
+
_firstPublishedAt: '2022-01-26T16:05:44+00:00',
|
|
11
|
+
_isValid: true,
|
|
12
|
+
_modelApiKey: 'page',
|
|
13
|
+
_publicationScheduledAt: null,
|
|
14
|
+
_publishedAt: '2024-08-15T14:29:41+01:00',
|
|
15
|
+
_seoMetaTags: [{
|
|
16
|
+
__typename: 'SEOMetaTag',
|
|
17
|
+
attributes: null,
|
|
18
|
+
content: 'Home',
|
|
19
|
+
tag: 'title'
|
|
20
|
+
}, {
|
|
21
|
+
__typename: 'SEOMetaTag',
|
|
22
|
+
attributes: [Object],
|
|
23
|
+
content: null,
|
|
24
|
+
tag: 'meta'
|
|
25
|
+
}, {
|
|
26
|
+
__typename: 'SEOMetaTag',
|
|
27
|
+
attributes: [Object],
|
|
28
|
+
content: null,
|
|
29
|
+
tag: 'meta'
|
|
30
|
+
}, {
|
|
31
|
+
__typename: 'SEOMetaTag',
|
|
32
|
+
attributes: [Object],
|
|
33
|
+
content: null,
|
|
34
|
+
tag: 'meta'
|
|
35
|
+
}, {
|
|
36
|
+
__typename: 'SEOMetaTag',
|
|
37
|
+
attributes: [Object],
|
|
38
|
+
content: null,
|
|
39
|
+
tag: 'meta'
|
|
40
|
+
}, {
|
|
41
|
+
__typename: 'SEOMetaTag',
|
|
42
|
+
attributes: [Object],
|
|
43
|
+
content: null,
|
|
44
|
+
tag: 'meta'
|
|
45
|
+
}, {
|
|
46
|
+
__typename: 'SEOMetaTag',
|
|
47
|
+
attributes: [Object],
|
|
48
|
+
content: null,
|
|
49
|
+
tag: 'meta'
|
|
50
|
+
}, {
|
|
51
|
+
__typename: 'SEOMetaTag',
|
|
52
|
+
attributes: [Object],
|
|
53
|
+
content: null,
|
|
54
|
+
tag: 'meta'
|
|
55
|
+
}, {
|
|
56
|
+
__typename: 'SEOMetaTag',
|
|
57
|
+
attributes: [Object],
|
|
58
|
+
content: null,
|
|
59
|
+
tag: 'meta'
|
|
60
|
+
}, {
|
|
61
|
+
__typename: 'SEOMetaTag',
|
|
62
|
+
attributes: [Object],
|
|
63
|
+
content: null,
|
|
64
|
+
tag: 'meta'
|
|
65
|
+
}, {
|
|
66
|
+
__typename: 'SEOMetaTag',
|
|
67
|
+
attributes: [Object],
|
|
68
|
+
content: null,
|
|
69
|
+
tag: 'meta'
|
|
70
|
+
}, {
|
|
71
|
+
__typename: 'SEOMetaTag',
|
|
72
|
+
attributes: [Object],
|
|
73
|
+
content: null,
|
|
74
|
+
tag: 'meta'
|
|
75
|
+
}],
|
|
76
|
+
_status: 'published',
|
|
77
|
+
_unpublishingScheduledAt: null,
|
|
78
|
+
_updatedAt: '2024-08-15T14:28:43+01:00',
|
|
79
|
+
banner: [{
|
|
80
|
+
__typename: 'BannerRecord',
|
|
81
|
+
_createdAt: '2023-03-29T09:47:42+01:00',
|
|
82
|
+
_firstPublishedAt: '2023-03-29T09:47:43+01:00',
|
|
83
|
+
_isValid: true,
|
|
84
|
+
_modelApiKey: 'banner',
|
|
85
|
+
_publicationScheduledAt: null,
|
|
86
|
+
_publishedAt: '2024-05-29T15:57:15+01:00',
|
|
87
|
+
_seoMetaTags: [Array],
|
|
88
|
+
_status: 'published',
|
|
89
|
+
_unpublishingScheduledAt: null,
|
|
90
|
+
_updatedAt: '2024-05-29T15:57:14+01:00',
|
|
91
|
+
chevron: true,
|
|
92
|
+
createdAt: '2023-03-29T09:47:42+01:00',
|
|
93
|
+
id: '147526070',
|
|
94
|
+
target: '/coaching',
|
|
95
|
+
text: '<i>Next Workshop:</i><br /><em>Design Thinking</em>',
|
|
96
|
+
updatedAt: '2024-05-29T15:57:14+01:00'
|
|
97
|
+
}],
|
|
98
|
+
createdAt: '2022-01-26T16:05:44+00:00',
|
|
99
|
+
myTitle: 'Home',
|
|
100
|
+
paragraphs: [{
|
|
101
|
+
__typename: 'FullpageJumbotronRecord',
|
|
102
|
+
_createdAt: '2022-02-25T14:48:48+00:00',
|
|
103
|
+
_firstPublishedAt: '2022-02-25T14:48:48+00:00',
|
|
104
|
+
_isValid: true,
|
|
105
|
+
_modelApiKey: 'fullpage_jumbotron',
|
|
106
|
+
_publicationScheduledAt: null,
|
|
107
|
+
_publishedAt: '2024-08-15T14:29:41+01:00',
|
|
108
|
+
_seoMetaTags: [Array],
|
|
109
|
+
_status: 'published',
|
|
110
|
+
_unpublishingScheduledAt: null,
|
|
111
|
+
_updatedAt: '2024-08-15T14:28:43+01:00',
|
|
112
|
+
backgroundImageJumbotron: [Object],
|
|
113
|
+
createdAt: '2022-02-25T14:48:48+00:00',
|
|
114
|
+
id: '111913781',
|
|
115
|
+
subline: 'Softwareentwicklung von der Idee<br/>bis zum fertigen Produkt',
|
|
116
|
+
tagline: '',
|
|
117
|
+
updatedAt: '2024-08-15T14:28:43+01:00',
|
|
118
|
+
whiteTextColor: false
|
|
119
|
+
}, {
|
|
120
|
+
__typename: 'FullpageSubpageRecord',
|
|
121
|
+
_createdAt: '2022-06-15T07:56:25+01:00',
|
|
122
|
+
_firstPublishedAt: '2022-06-15T07:56:26+01:00',
|
|
123
|
+
_isValid: true,
|
|
124
|
+
_modelApiKey: 'fullpage_subpage',
|
|
125
|
+
_publicationScheduledAt: null,
|
|
126
|
+
_publishedAt: '2024-05-14T14:05:30+01:00',
|
|
127
|
+
_seoMetaTags: [Array],
|
|
128
|
+
_status: 'published',
|
|
129
|
+
_unpublishingScheduledAt: null,
|
|
130
|
+
_updatedAt: '2024-05-14T14:05:28+01:00',
|
|
131
|
+
backgroundImageSubpage: [Object],
|
|
132
|
+
createdAt: '2022-06-15T07:56:25+01:00',
|
|
133
|
+
id: '122230963',
|
|
134
|
+
subline: 'Sie fragen sich, ob Sie wirklich so viele verschiedene Dienstleister für Ihr Produkt benötigen? Disziplinen und Silos aufzubrechen ist unsere Stärke.',
|
|
135
|
+
tagline: 'storm out of the box',
|
|
136
|
+
updatedAt: '2024-05-14T14:05:28+01:00'
|
|
137
|
+
}, {
|
|
138
|
+
__typename: 'FullpageSubpageRecord',
|
|
139
|
+
_createdAt: '2022-06-15T07:56:25+01:00',
|
|
140
|
+
_firstPublishedAt: '2022-06-15T07:56:26+01:00',
|
|
141
|
+
_isValid: true,
|
|
142
|
+
_modelApiKey: 'fullpage_subpage',
|
|
143
|
+
_publicationScheduledAt: null,
|
|
144
|
+
_publishedAt: '2024-05-14T14:05:30+01:00',
|
|
145
|
+
_seoMetaTags: [Array],
|
|
146
|
+
_status: 'published',
|
|
147
|
+
_unpublishingScheduledAt: null,
|
|
148
|
+
_updatedAt: '2024-05-14T14:05:28+01:00',
|
|
149
|
+
backgroundImageSubpage: [Object],
|
|
150
|
+
createdAt: '2022-06-15T07:56:25+01:00',
|
|
151
|
+
id: '122230964',
|
|
152
|
+
subline: 'Von der Idee bis zum Launch bieten wir Strategie, Design und Softwareentwicklung ohne Informationsverluste aus einer Hand!',
|
|
153
|
+
tagline: 'focus on what has gravity',
|
|
154
|
+
updatedAt: '2024-05-14T14:05:28+01:00'
|
|
155
|
+
}, {
|
|
156
|
+
__typename: 'FullpageSubpageRecord',
|
|
157
|
+
_createdAt: '2022-02-25T14:48:48+00:00',
|
|
158
|
+
_firstPublishedAt: '2022-02-25T14:48:48+00:00',
|
|
159
|
+
_isValid: true,
|
|
160
|
+
_modelApiKey: 'fullpage_subpage',
|
|
161
|
+
_publicationScheduledAt: null,
|
|
162
|
+
_publishedAt: '2024-05-14T14:05:30+01:00',
|
|
163
|
+
_seoMetaTags: [Array],
|
|
164
|
+
_status: 'published',
|
|
165
|
+
_unpublishingScheduledAt: null,
|
|
166
|
+
_updatedAt: '2024-05-14T14:05:28+01:00',
|
|
167
|
+
backgroundImageSubpage: [Object],
|
|
168
|
+
createdAt: '2022-02-25T14:48:48+00:00',
|
|
169
|
+
id: '111913782',
|
|
170
|
+
subline: 'Wir entwickeln Produkte und Marken, die Ihre Kunden lieben werden! Unser In-House Team von Entwicklern, Strategen und Designern steht für Sie bereit.',
|
|
171
|
+
tagline: 'make it fly',
|
|
172
|
+
updatedAt: '2024-05-14T14:05:28+01:00'
|
|
173
|
+
}, {
|
|
174
|
+
__typename: 'HomepageTilesSubpageRecord',
|
|
175
|
+
_createdAt: '2022-02-25T16:25:38+00:00',
|
|
176
|
+
_firstPublishedAt: '2022-02-25T16:25:38+00:00',
|
|
177
|
+
_isValid: true,
|
|
178
|
+
_modelApiKey: 'homepage_tiles_subpage',
|
|
179
|
+
_publicationScheduledAt: null,
|
|
180
|
+
_publishedAt: '2023-03-28T12:35:52+01:00',
|
|
181
|
+
_seoMetaTags: [Array],
|
|
182
|
+
_status: 'published',
|
|
183
|
+
_unpublishingScheduledAt: null,
|
|
184
|
+
_updatedAt: '2023-03-28T12:35:46+01:00',
|
|
185
|
+
backgroundImageThreeTiles: [Object],
|
|
186
|
+
column: null,
|
|
187
|
+
createdAt: '2022-02-25T16:25:38+00:00',
|
|
188
|
+
id: '111937859',
|
|
189
|
+
tiles: [Array],
|
|
190
|
+
updatedAt: '2023-03-28T12:35:46+01:00'
|
|
191
|
+
}, {
|
|
192
|
+
__typename: 'HomepageTilesSubpageRecord',
|
|
193
|
+
_createdAt: '2024-06-19T11:07:46+01:00',
|
|
194
|
+
_firstPublishedAt: '2024-06-19T11:07:49+01:00',
|
|
195
|
+
_isValid: true,
|
|
196
|
+
_modelApiKey: 'homepage_tiles_subpage',
|
|
197
|
+
_publicationScheduledAt: null,
|
|
198
|
+
_publishedAt: '2024-07-23T18:02:11+01:00',
|
|
199
|
+
_seoMetaTags: [Array],
|
|
200
|
+
_status: 'published',
|
|
201
|
+
_unpublishingScheduledAt: null,
|
|
202
|
+
_updatedAt: '2024-07-23T18:02:10+01:00',
|
|
203
|
+
backgroundImageThreeTiles: [Object],
|
|
204
|
+
column: true,
|
|
205
|
+
createdAt: '2024-06-19T11:07:46+01:00',
|
|
206
|
+
id: 'YZM_vT1aSzWqzNGpQORYYw',
|
|
207
|
+
tiles: [Array],
|
|
208
|
+
updatedAt: '2024-07-23T18:02:10+01:00'
|
|
209
|
+
}],
|
|
210
|
+
seo: null,
|
|
211
|
+
slug: 'home',
|
|
212
|
+
updatedAt: '2024-08-15T14:28:43+01:00'
|
|
213
|
+
};
|
|
214
|
+
var _default = exports["default"] = testData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var DatoCMS = exports["default"] = /*#__PURE__*/function () {
|
|
13
|
+
function DatoCMS(token) {
|
|
14
|
+
(0, _classCallCheck2["default"])(this, DatoCMS);
|
|
15
|
+
(0, _defineProperty2["default"])(this, "token", '');
|
|
16
|
+
(0, _defineProperty2["default"])(this, "uri", 'https://graphql.datocms.com/');
|
|
17
|
+
this.token = token;
|
|
18
|
+
}
|
|
19
|
+
return (0, _createClass2["default"])(DatoCMS, [{
|
|
20
|
+
key: "renameSEOMetaTags",
|
|
21
|
+
value: function renameSEOMetaTags(props) {
|
|
22
|
+
props.forEach(function (_, i, tags) {
|
|
23
|
+
tags[i].__typename = 'SEOMetaTag';
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "normalize",
|
|
28
|
+
value: function normalize(data) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
if (data) {
|
|
31
|
+
if (data['_seoMetaTags']) {
|
|
32
|
+
this.renameSEOMetaTags(data['_seoMetaTags']);
|
|
33
|
+
}
|
|
34
|
+
Object.keys(data).forEach(function (key) {
|
|
35
|
+
if (Array.isArray(data[key])) {
|
|
36
|
+
data[key] = data[key].map(function (value) {
|
|
37
|
+
return _this.normalize(value);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (!!data[key] && (0, _typeof2["default"])(data[key]) === 'object') {
|
|
41
|
+
data[key] = _this.normalize(data[key]);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}]);
|
|
48
|
+
}();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
13
|
+
_dotenv["default"].config();
|
|
14
|
+
var StrapiCMS = exports["default"] = /*#__PURE__*/function () {
|
|
15
|
+
function StrapiCMS(token, strapiUrl) {
|
|
16
|
+
(0, _classCallCheck2["default"])(this, StrapiCMS);
|
|
17
|
+
(0, _defineProperty2["default"])(this, "token", '');
|
|
18
|
+
(0, _defineProperty2["default"])(this, "uri", '');
|
|
19
|
+
this.token = token;
|
|
20
|
+
this.uri = strapiUrl;
|
|
21
|
+
}
|
|
22
|
+
return (0, _createClass2["default"])(StrapiCMS, [{
|
|
23
|
+
key: "renameSEOMetaTags",
|
|
24
|
+
value: function renameSEOMetaTags(props) {
|
|
25
|
+
props.forEach(function (_, i, tags) {
|
|
26
|
+
tags[i].__typename = 'SEOMetaTag';
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "normalize",
|
|
31
|
+
value: function normalize(data) {
|
|
32
|
+
var _this = this;
|
|
33
|
+
if (!data) {
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
if (data['_seoMetaTags']) {
|
|
37
|
+
this.renameSEOMetaTags(data['_seoMetaTags']);
|
|
38
|
+
}
|
|
39
|
+
Object.keys(data).forEach(function (key) {
|
|
40
|
+
if (Array.isArray(data[key])) {
|
|
41
|
+
data[key] = data[key].map(function (value) {
|
|
42
|
+
return _this.normalize(value);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (!!data[key] && (0, _typeof2["default"])(data[key]) === 'object') {
|
|
46
|
+
data[key] = _this.normalize(data[key]);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
}]);
|
|
52
|
+
}();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "DatoCMS", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _DatoCMS["default"];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "StrapiCMS", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _StrapiCMS["default"];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _DatoCMS = _interopRequireDefault(require("./DatoCMS"));
|
|
20
|
+
var _StrapiCMS = _interopRequireDefault(require("./StrapiCMS"));
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = DodoComponent;
|
|
9
|
+
var _Paper2 = _interopRequireDefault(require("@mui/material/Paper"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
var _Accordion2 = _interopRequireDefault(require("@mui/material/Accordion"));
|
|
12
|
+
var _AccordionDetails2 = _interopRequireDefault(require("@mui/material/AccordionDetails"));
|
|
13
|
+
var _AccordionSummary2 = _interopRequireDefault(require("@mui/material/AccordionSummary"));
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function renderArray(key, value, i) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(_Accordion2["default"], {
|
|
20
|
+
key: "".concat(key, "_").concat(i),
|
|
21
|
+
style: {
|
|
22
|
+
width: '100%'
|
|
23
|
+
}
|
|
24
|
+
}, /*#__PURE__*/React.createElement(_AccordionSummary2["default"], {
|
|
25
|
+
style: {
|
|
26
|
+
padding: 0
|
|
27
|
+
},
|
|
28
|
+
expandIcon: /*#__PURE__*/React.createElement(_ExpandMore["default"], null)
|
|
29
|
+
}, key, ": Array[", value.length, "]"), /*#__PURE__*/React.createElement(_AccordionDetails2["default"], null, value.map(function (element, i) {
|
|
30
|
+
return renderData('', element, i);
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
33
|
+
function renderObject(key, value, i) {
|
|
34
|
+
return /*#__PURE__*/React.createElement(_Accordion2["default"], {
|
|
35
|
+
key: "".concat(key, "_").concat(i),
|
|
36
|
+
style: {
|
|
37
|
+
width: '100%'
|
|
38
|
+
}
|
|
39
|
+
}, /*#__PURE__*/React.createElement(_AccordionSummary2["default"], {
|
|
40
|
+
expandIcon: /*#__PURE__*/React.createElement(_ExpandMore["default"], null)
|
|
41
|
+
}, key), /*#__PURE__*/React.createElement(_AccordionDetails2["default"], null, Object.entries(value).map(function (entry, i) {
|
|
42
|
+
return renderData(entry[0], entry[1], i);
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
function renderSimple(key, value, i) {
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
key: "".concat(key, "_").concat(i)
|
|
48
|
+
}, key, ": ", "".concat(value));
|
|
49
|
+
}
|
|
50
|
+
function renderData(key, value, i) {
|
|
51
|
+
var _value$__typename;
|
|
52
|
+
if (Array.isArray(value)) return renderArray(key, value, i);
|
|
53
|
+
if (!value || ['string', 'number'].includes((0, _typeof2["default"])(value))) return renderSimple(key, value, i);
|
|
54
|
+
if (typeof value === 'boolean') return renderSimple(key, value ? 'true' : 'false', i);
|
|
55
|
+
var objectKey = "".concat(key ? key + ': ' : '').concat((_value$__typename = value.__typename) !== null && _value$__typename !== void 0 ? _value$__typename : 'object');
|
|
56
|
+
return renderObject(objectKey, value, i);
|
|
57
|
+
}
|
|
58
|
+
function DodoComponent(props) {
|
|
59
|
+
if ((0, _typeof2["default"])(props.data) === 'object') {
|
|
60
|
+
return /*#__PURE__*/React.createElement(_Paper2["default"], {
|
|
61
|
+
style: {
|
|
62
|
+
margin: '.5em',
|
|
63
|
+
width: 'calc(100% - 1em)'
|
|
64
|
+
}
|
|
65
|
+
}, renderData('', props.data, 1));
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.QueenofheartsRenderComponent = QueenofheartsRenderComponent;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _index = require("../index");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
12
|
+
function QueenofheartsRenderComponent(props) {
|
|
13
|
+
var instance = _index.QueenofheartsService.getInstance();
|
|
14
|
+
var data = props.data,
|
|
15
|
+
contextProps = props.contextProps;
|
|
16
|
+
if (data && instance) {
|
|
17
|
+
if (Array.isArray(data)) {
|
|
18
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Suspense, null, data.map(function (item, index) {
|
|
19
|
+
return instance.createComponent({
|
|
20
|
+
data: item,
|
|
21
|
+
contextProps: contextProps
|
|
22
|
+
});
|
|
23
|
+
}));
|
|
24
|
+
} else {
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Suspense, null, instance.createComponent({
|
|
26
|
+
data: data,
|
|
27
|
+
contextProps: contextProps
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
} else if (!instance) {
|
|
31
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, "QueenofheartsService is not initialized");
|
|
32
|
+
}
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
|
+
className: "error"
|
|
35
|
+
}, "QueenofheartsRenderComponent: Invalid data received.");
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/index.d.ts
ADDED