@memberjunction/react-runtime 2.112.0 → 2.113.1
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/.turbo/turbo-build.log +11 -10
- package/CHANGELOG.md +14 -1
- package/dist/compiler/component-compiler.d.ts.map +1 -1
- package/dist/compiler/component-compiler.js +56 -66
- package/dist/compiler/component-compiler.js.map +1 -1
- package/dist/component-manager/component-manager.d.ts.map +1 -1
- package/dist/component-manager/component-manager.js +42 -48
- package/dist/component-manager/component-manager.js.map +1 -1
- package/dist/component-manager/types.d.ts +1 -1
- package/dist/component-manager/types.d.ts.map +1 -1
- package/dist/component-manager/types.js.map +1 -1
- package/dist/registry/component-registry-service.d.ts +1 -1
- package/dist/registry/component-registry-service.d.ts.map +1 -1
- package/dist/registry/component-registry-service.js +34 -34
- package/dist/registry/component-registry-service.js.map +1 -1
- package/dist/registry/component-resolver.d.ts +1 -1
- package/dist/registry/component-resolver.d.ts.map +1 -1
- package/dist/registry/component-resolver.js +11 -10
- package/dist/registry/component-resolver.js.map +1 -1
- package/dist/runtime/component-hierarchy.d.ts +1 -1
- package/dist/runtime/component-hierarchy.d.ts.map +1 -1
- package/dist/runtime/component-hierarchy.js +43 -43
- package/dist/runtime/component-hierarchy.js.map +1 -1
- package/dist/runtime/prop-builder.d.ts.map +1 -1
- package/dist/runtime/prop-builder.js +24 -22
- package/dist/runtime/prop-builder.js.map +1 -1
- package/dist/runtime.umd.js +511 -494
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/library-registry.d.ts +1 -1
- package/dist/utilities/library-registry.d.ts.map +1 -1
- package/dist/utilities/library-registry.js +10 -10
- package/dist/utilities/library-registry.js.map +1 -1
- package/package.json +6 -5
- package/src/compiler/component-compiler.ts +164 -186
- package/src/component-manager/component-manager.ts +216 -162
- package/src/component-manager/types.ts +27 -27
- package/src/registry/component-registry-service.ts +218 -190
- package/src/registry/component-resolver.ts +98 -87
- package/src/runtime/component-hierarchy.ts +94 -57
- package/src/runtime/prop-builder.ts +33 -28
- package/src/types/index.ts +4 -3
- package/src/utilities/library-registry.ts +19 -14
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @module @memberjunction/react-runtime/utilities
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { UserInfo } from
|
|
8
|
-
import { ComponentLibraryEntity, ComponentMetadataEngine } from
|
|
7
|
+
import { UserInfo } from "@memberjunction/core";
|
|
8
|
+
import { ComponentLibraryEntity, ComponentMetadataEngine } from "@memberjunction/core-entities";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Library definition in the registry
|
|
@@ -38,7 +38,7 @@ export class LibraryRegistry {
|
|
|
38
38
|
private static _configured: boolean = false;
|
|
39
39
|
public static async Config(forceRefresh: boolean = false, componentLibraries: ComponentLibraryEntity[]) {
|
|
40
40
|
if (!this._configured || forceRefresh) {
|
|
41
|
-
// next up, we need to map the component metadata to the library definitions
|
|
41
|
+
// next up, we need to map the component metadata to the library definitions
|
|
42
42
|
// with two steps - first step is that we need to group the libraries in the engine
|
|
43
43
|
// by name and then we'll have all the versions for that particular library we can break
|
|
44
44
|
// into versions in our structure
|
|
@@ -55,15 +55,15 @@ export class LibraryRegistry {
|
|
|
55
55
|
for (const [name, versions] of libraryGroups) {
|
|
56
56
|
const libDef: LibraryDefinition = {
|
|
57
57
|
name,
|
|
58
|
-
globalVariable: versions[0].GlobalVariable ||
|
|
59
|
-
category: versions[0].Category ||
|
|
58
|
+
globalVariable: versions[0].GlobalVariable || "",
|
|
59
|
+
category: versions[0].Category || "",
|
|
60
60
|
versions: {},
|
|
61
|
-
defaultVersion: versions[0].Version ||
|
|
61
|
+
defaultVersion: versions[0].Version || ""
|
|
62
62
|
};
|
|
63
63
|
for (const version of versions) {
|
|
64
64
|
libDef.versions[version.Version!] = {
|
|
65
|
-
cdnUrl: version.CDNUrl ||
|
|
66
|
-
cssUrls: version.CDNCssUrl?.split(
|
|
65
|
+
cdnUrl: version.CDNUrl || "",
|
|
66
|
+
cssUrls: version.CDNCssUrl?.split(",") || []
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
this.libraries.set(name, libDef);
|
|
@@ -78,7 +78,8 @@ export class LibraryRegistry {
|
|
|
78
78
|
* Get library definition by name
|
|
79
79
|
*/
|
|
80
80
|
static getLibrary(name: string): LibraryDefinition | undefined {
|
|
81
|
-
if (!this._configured)
|
|
81
|
+
if (!this._configured)
|
|
82
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
82
83
|
|
|
83
84
|
return this.libraries.get(name?.trim().toLowerCase());
|
|
84
85
|
}
|
|
@@ -90,7 +91,8 @@ export class LibraryRegistry {
|
|
|
90
91
|
* @returns CDN URL or undefined if library/version not found
|
|
91
92
|
*/
|
|
92
93
|
static getCdnUrl(name: string, version?: string): string | undefined {
|
|
93
|
-
if (!this._configured)
|
|
94
|
+
if (!this._configured)
|
|
95
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
94
96
|
|
|
95
97
|
const library = this.libraries.get(name?.trim().toLowerCase());
|
|
96
98
|
if (!library) return undefined;
|
|
@@ -103,7 +105,8 @@ export class LibraryRegistry {
|
|
|
103
105
|
* Check if a library is approved
|
|
104
106
|
*/
|
|
105
107
|
static isApproved(name: string): boolean {
|
|
106
|
-
if (!this._configured)
|
|
108
|
+
if (!this._configured)
|
|
109
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
107
110
|
|
|
108
111
|
return this.libraries.has(name?.trim().toLowerCase());
|
|
109
112
|
}
|
|
@@ -114,7 +117,8 @@ export class LibraryRegistry {
|
|
|
114
117
|
* TODO: Implement proper semver resolution
|
|
115
118
|
*/
|
|
116
119
|
static resolveVersion(name: string, versionPattern?: string): string | undefined {
|
|
117
|
-
if (!this._configured)
|
|
120
|
+
if (!this._configured)
|
|
121
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
118
122
|
|
|
119
123
|
const library = this.libraries.get(name?.trim().toLowerCase());
|
|
120
124
|
if (!library) return undefined;
|
|
@@ -137,8 +141,9 @@ export class LibraryRegistry {
|
|
|
137
141
|
* with libraries loaded from a database
|
|
138
142
|
*/
|
|
139
143
|
static registerLibrary(definition: LibraryDefinition): void {
|
|
140
|
-
if (!this._configured)
|
|
144
|
+
if (!this._configured)
|
|
145
|
+
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
141
146
|
|
|
142
147
|
this.libraries.set(definition.name?.trim().toLowerCase(), definition);
|
|
143
148
|
}
|
|
144
|
-
}
|
|
149
|
+
}
|