@memberjunction/react-runtime 2.111.0 → 2.112.0
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 +10 -11
- package/CHANGELOG.md +6 -6
- package/dist/compiler/component-compiler.d.ts.map +1 -1
- package/dist/compiler/component-compiler.js +66 -56
- 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 +48 -42
- 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 +10 -11
- 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 +22 -24
- package/dist/runtime/prop-builder.js.map +1 -1
- package/dist/runtime.umd.js +494 -511
- 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 +5 -6
- package/src/compiler/component-compiler.ts +186 -164
- package/src/component-manager/component-manager.ts +162 -216
- package/src/component-manager/types.ts +27 -27
- package/src/registry/component-registry-service.ts +190 -218
- package/src/registry/component-resolver.ts +87 -98
- package/src/runtime/component-hierarchy.ts +57 -94
- package/src/runtime/prop-builder.ts +28 -33
- package/src/types/index.ts +3 -4
- package/src/utilities/library-registry.ts +14 -19
|
@@ -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/global';
|
|
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,8 +78,7 @@ export class LibraryRegistry {
|
|
|
78
78
|
* Get library definition by name
|
|
79
79
|
*/
|
|
80
80
|
static getLibrary(name: string): LibraryDefinition | undefined {
|
|
81
|
-
if (!this._configured)
|
|
82
|
-
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
81
|
+
if (!this._configured) throw new Error('LibraryRegistry is not configured, call LibraryRegistry.Config() before using!');
|
|
83
82
|
|
|
84
83
|
return this.libraries.get(name?.trim().toLowerCase());
|
|
85
84
|
}
|
|
@@ -91,8 +90,7 @@ export class LibraryRegistry {
|
|
|
91
90
|
* @returns CDN URL or undefined if library/version not found
|
|
92
91
|
*/
|
|
93
92
|
static getCdnUrl(name: string, version?: string): string | undefined {
|
|
94
|
-
if (!this._configured)
|
|
95
|
-
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
93
|
+
if (!this._configured) throw new Error('LibraryRegistry is not configured, call LibraryRegistry.Config() before using!');
|
|
96
94
|
|
|
97
95
|
const library = this.libraries.get(name?.trim().toLowerCase());
|
|
98
96
|
if (!library) return undefined;
|
|
@@ -105,8 +103,7 @@ export class LibraryRegistry {
|
|
|
105
103
|
* Check if a library is approved
|
|
106
104
|
*/
|
|
107
105
|
static isApproved(name: string): boolean {
|
|
108
|
-
if (!this._configured)
|
|
109
|
-
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
106
|
+
if (!this._configured) throw new Error('LibraryRegistry is not configured, call LibraryRegistry.Config() before using!');
|
|
110
107
|
|
|
111
108
|
return this.libraries.has(name?.trim().toLowerCase());
|
|
112
109
|
}
|
|
@@ -117,8 +114,7 @@ export class LibraryRegistry {
|
|
|
117
114
|
* TODO: Implement proper semver resolution
|
|
118
115
|
*/
|
|
119
116
|
static resolveVersion(name: string, versionPattern?: string): string | undefined {
|
|
120
|
-
if (!this._configured)
|
|
121
|
-
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
117
|
+
if (!this._configured) throw new Error('LibraryRegistry is not configured, call LibraryRegistry.Config() before using!');
|
|
122
118
|
|
|
123
119
|
const library = this.libraries.get(name?.trim().toLowerCase());
|
|
124
120
|
if (!library) return undefined;
|
|
@@ -141,9 +137,8 @@ export class LibraryRegistry {
|
|
|
141
137
|
* with libraries loaded from a database
|
|
142
138
|
*/
|
|
143
139
|
static registerLibrary(definition: LibraryDefinition): void {
|
|
144
|
-
if (!this._configured)
|
|
145
|
-
throw new Error("LibraryRegistry is not configured, call LibraryRegistry.Config() before using!");
|
|
140
|
+
if (!this._configured) throw new Error('LibraryRegistry is not configured, call LibraryRegistry.Config() before using!');
|
|
146
141
|
|
|
147
142
|
this.libraries.set(definition.name?.trim().toLowerCase(), definition);
|
|
148
143
|
}
|
|
149
|
-
}
|
|
144
|
+
}
|