@embeddable.com/sdk-react 2.2.26 → 2.2.28
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/lib/index.esm.js +23 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +23 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -541,15 +541,35 @@ const validateComponentProps = (metaInfo) => {
|
|
|
541
541
|
// There is no props defined
|
|
542
542
|
if (!propsNode)
|
|
543
543
|
return;
|
|
544
|
-
|
|
544
|
+
let functionBody;
|
|
545
|
+
// if propsNode is a function defined elsewhere
|
|
546
|
+
if (propsNode.value.type === "Identifier") {
|
|
547
|
+
const functionName = propsNode.value.name;
|
|
548
|
+
path
|
|
549
|
+
.findParent((path) => path.isProgram())
|
|
550
|
+
.traverse({
|
|
551
|
+
VariableDeclarator(path) {
|
|
552
|
+
if (path.node.id.name === functionName &&
|
|
553
|
+
(path.node.init.type === "FunctionExpression" ||
|
|
554
|
+
path.node.init.type === "ArrowFunctionExpression")) {
|
|
555
|
+
functionBody = path.node.init.body.body;
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
// assume that propsNode is anonymous function
|
|
562
|
+
functionBody = propsNode.value.body.body;
|
|
563
|
+
}
|
|
564
|
+
const propsReturnStatement = functionBody === null || functionBody === void 0 ? void 0 : functionBody.find((x) => x.type === "ReturnStatement");
|
|
545
565
|
const results = (_b = propsReturnStatement === null || propsReturnStatement === void 0 ? void 0 : propsReturnStatement.argument) === null || _b === void 0 ? void 0 : _b.properties.find((x) => { var _a; return ((_a = x === null || x === void 0 ? void 0 : x.key) === null || _a === void 0 ? void 0 : _a.name) === "results"; });
|
|
546
566
|
// There is no results defined inside props
|
|
547
567
|
if (results === undefined) {
|
|
548
568
|
return;
|
|
549
569
|
}
|
|
550
570
|
const loadDataProperties = (_c = results === null || results === void 0 ? void 0 : results.value) === null || _c === void 0 ? void 0 : _c.arguments[0].properties;
|
|
551
|
-
const dimensions = loadDataProperties.find((prop) => prop.key.name === "dimensions");
|
|
552
|
-
const timeDimensions = loadDataProperties.find((prop) => prop.key.name === "timeDimensions");
|
|
571
|
+
const dimensions = loadDataProperties === null || loadDataProperties === void 0 ? void 0 : loadDataProperties.find((prop) => prop.key.name === "dimensions");
|
|
572
|
+
const timeDimensions = loadDataProperties === null || loadDataProperties === void 0 ? void 0 : loadDataProperties.find((prop) => prop.key.name === "timeDimensions");
|
|
553
573
|
// There is no missuse of dimensions and timeDimensions
|
|
554
574
|
if (!dimensions || !timeDimensions)
|
|
555
575
|
return;
|