@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 ADDED
@@ -0,0 +1,5 @@
1
+ # **0.0.1** feature parity _(2023-03-20)_
2
+
3
+ #### changes:
4
+
5
+ - use the same features and names as the angular version
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 gravity&storm GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Queen of hearts client core package
2
+
3
+ > [!WARNING] This readme should not be deployed to npm.
4
+
5
+ This package is providing the core client packages in react.
6
+
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`
@@ -0,0 +1,11 @@
1
+ type Body = {
2
+ id: string;
3
+ summary: string;
4
+ details: string;
5
+ };
6
+ export declare class ApiError extends Error {
7
+ status: number;
8
+ body: Body;
9
+ constructor(status: number, body: Body);
10
+ }
11
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ApiError = void 0;
8
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
+ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
16
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
17
+ var ApiError = exports.ApiError = /*#__PURE__*/function (_Error) {
18
+ function ApiError(status, body) {
19
+ var _this;
20
+ (0, _classCallCheck2["default"])(this, ApiError);
21
+ _this = _callSuper(this, ApiError, [body.summary]);
22
+ (0, _defineProperty2["default"])(_this, "status", void 0);
23
+ (0, _defineProperty2["default"])(_this, "body", void 0);
24
+ _this.name = 'ApiError';
25
+ _this.status = status;
26
+ _this.body = body;
27
+ return _this;
28
+ }
29
+ (0, _inherits2["default"])(ApiError, _Error);
30
+ return (0, _createClass2["default"])(ApiError);
31
+ }(/*#__PURE__*/(0, _wrapNativeSuper2["default"])(Error));
@@ -0,0 +1,78 @@
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
+ }