@sitecore-content-sdk/react 1.3.0-canary.5 → 1.3.0-canary.7
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.
|
@@ -133,6 +133,9 @@ function getAppComponentProps(placeholderProps, componentRendering) {
|
|
|
133
133
|
*/
|
|
134
134
|
const getComponentForRendering = (renderingDefinition, placeholderName, componentMap, hiddenRenderingComponent, missingComponentComponent) => {
|
|
135
135
|
var _a, _b;
|
|
136
|
+
const logUnknownComponentError = (variant) => {
|
|
137
|
+
console.error(`Placeholder ${placeholderName} contains unknown component ${renderingDefinition.componentName}${variant ? ` (${variant})` : ''}. Ensure that a React component exists for it, and that it is registered in your component-map file.`);
|
|
138
|
+
};
|
|
136
139
|
if (renderingDefinition.componentName === core_1.constants.HIDDEN_RENDERING_NAME) {
|
|
137
140
|
return {
|
|
138
141
|
component: hiddenRenderingComponent !== null && hiddenRenderingComponent !== void 0 ? hiddenRenderingComponent : HiddenRendering_1.HiddenRendering,
|
|
@@ -141,7 +144,6 @@ const getComponentForRendering = (renderingDefinition, placeholderName, componen
|
|
|
141
144
|
};
|
|
142
145
|
}
|
|
143
146
|
else if (!renderingDefinition.componentName) {
|
|
144
|
-
console.error(`Placeholder ${placeholderName} contains unknown component ${renderingDefinition.componentName}. Ensure that a React component exists for it, and that it is registered in your component-map file.`);
|
|
145
147
|
return {
|
|
146
148
|
component: () => react_1.default.createElement(react_1.default.Fragment, null),
|
|
147
149
|
isEmpty: true,
|
|
@@ -188,6 +190,7 @@ const getComponentForRendering = (renderingDefinition, placeholderName, componen
|
|
|
188
190
|
isEmpty: false,
|
|
189
191
|
};
|
|
190
192
|
}
|
|
193
|
+
logUnknownComponentError();
|
|
191
194
|
return {
|
|
192
195
|
component: missingComponentComponent !== null && missingComponentComponent !== void 0 ? missingComponentComponent : MissingComponent_1.MissingComponent,
|
|
193
196
|
isEmpty: true,
|
|
@@ -201,6 +204,14 @@ const getComponentForRendering = (renderingDefinition, placeholderName, componen
|
|
|
201
204
|
: component.default ||
|
|
202
205
|
component.Default ||
|
|
203
206
|
component;
|
|
207
|
+
if (!renderedComponent) {
|
|
208
|
+
logUnknownComponentError(exportName !== sharedTypes_1.DEFAULT_EXPORT_NAME ? exportName : undefined);
|
|
209
|
+
return {
|
|
210
|
+
component: missingComponentComponent !== null && missingComponentComponent !== void 0 ? missingComponentComponent : MissingComponent_1.MissingComponent,
|
|
211
|
+
isEmpty: true,
|
|
212
|
+
componentType: 'universal',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
204
215
|
const dynamic = !!((_b = renderedComponent.render) === null || _b === void 0 ? void 0 : _b.preload) ||
|
|
205
216
|
renderingDefinition.componentName === FEaaS_1.BYOC_WRAPPER_RENDERING_NAME;
|
|
206
217
|
// all dynamic elements will have a separate render prop
|
|
@@ -122,6 +122,9 @@ export function getAppComponentProps(placeholderProps, componentRendering) {
|
|
|
122
122
|
*/
|
|
123
123
|
export const getComponentForRendering = (renderingDefinition, placeholderName, componentMap, hiddenRenderingComponent, missingComponentComponent) => {
|
|
124
124
|
var _a, _b;
|
|
125
|
+
const logUnknownComponentError = (variant) => {
|
|
126
|
+
console.error(`Placeholder ${placeholderName} contains unknown component ${renderingDefinition.componentName}${variant ? ` (${variant})` : ''}. Ensure that a React component exists for it, and that it is registered in your component-map file.`);
|
|
127
|
+
};
|
|
125
128
|
if (renderingDefinition.componentName === constants.HIDDEN_RENDERING_NAME) {
|
|
126
129
|
return {
|
|
127
130
|
component: hiddenRenderingComponent !== null && hiddenRenderingComponent !== void 0 ? hiddenRenderingComponent : HiddenRendering,
|
|
@@ -130,7 +133,6 @@ export const getComponentForRendering = (renderingDefinition, placeholderName, c
|
|
|
130
133
|
};
|
|
131
134
|
}
|
|
132
135
|
else if (!renderingDefinition.componentName) {
|
|
133
|
-
console.error(`Placeholder ${placeholderName} contains unknown component ${renderingDefinition.componentName}. Ensure that a React component exists for it, and that it is registered in your component-map file.`);
|
|
134
136
|
return {
|
|
135
137
|
component: () => React.createElement(React.Fragment, null),
|
|
136
138
|
isEmpty: true,
|
|
@@ -177,6 +179,7 @@ export const getComponentForRendering = (renderingDefinition, placeholderName, c
|
|
|
177
179
|
isEmpty: false,
|
|
178
180
|
};
|
|
179
181
|
}
|
|
182
|
+
logUnknownComponentError();
|
|
180
183
|
return {
|
|
181
184
|
component: missingComponentComponent !== null && missingComponentComponent !== void 0 ? missingComponentComponent : MissingComponent,
|
|
182
185
|
isEmpty: true,
|
|
@@ -190,6 +193,14 @@ export const getComponentForRendering = (renderingDefinition, placeholderName, c
|
|
|
190
193
|
: component.default ||
|
|
191
194
|
component.Default ||
|
|
192
195
|
component;
|
|
196
|
+
if (!renderedComponent) {
|
|
197
|
+
logUnknownComponentError(exportName !== DEFAULT_EXPORT_NAME ? exportName : undefined);
|
|
198
|
+
return {
|
|
199
|
+
component: missingComponentComponent !== null && missingComponentComponent !== void 0 ? missingComponentComponent : MissingComponent,
|
|
200
|
+
isEmpty: true,
|
|
201
|
+
componentType: 'universal',
|
|
202
|
+
};
|
|
203
|
+
}
|
|
193
204
|
const dynamic = !!((_b = renderedComponent.render) === null || _b === void 0 ? void 0 : _b.preload) ||
|
|
194
205
|
renderingDefinition.componentName === BYOC_WRAPPER_RENDERING_NAME;
|
|
195
206
|
// all dynamic elements will have a separate render prop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/react",
|
|
3
|
-
"version": "1.3.0-canary.
|
|
3
|
+
"version": "1.3.0-canary.7",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"react-dom": "^19.1.0"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@sitecore-content-sdk/core": "1.3.0-canary.
|
|
77
|
+
"@sitecore-content-sdk/core": "1.3.0-canary.7",
|
|
78
78
|
"fast-deep-equal": "^3.1.3"
|
|
79
79
|
},
|
|
80
80
|
"description": "",
|
|
81
81
|
"types": "types/index.d.ts",
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "6491bd1951409ae27085c7119e408c6483be0295",
|
|
83
83
|
"files": [
|
|
84
84
|
"dist",
|
|
85
85
|
"types"
|