@embeddable.com/sdk-react 2.2.12 → 2.2.14
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 +14 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +14 -1
- package/lib/index.js.map +1 -1
- package/lib/validate/schema/componentMetaSchema.d.ts +38 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -467,6 +467,16 @@ const componentMetaSchema = zod.z
|
|
|
467
467
|
})
|
|
468
468
|
.strict()
|
|
469
469
|
.array()
|
|
470
|
+
.superRefine((inputs, refinementContext) => {
|
|
471
|
+
const inputNames = inputs.map((input) => input.name);
|
|
472
|
+
if (new Set(inputNames).size !== inputNames.length) {
|
|
473
|
+
const duplicateInputNames = inputNames.filter((name, index) => inputNames.indexOf(name) !== index);
|
|
474
|
+
return refinementContext.addIssue({
|
|
475
|
+
code: zod.z.ZodIssueCode.custom,
|
|
476
|
+
message: `Input names must be unique. Duplicate names: ${duplicateInputNames.join(", ")}`,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
})
|
|
470
480
|
.optional(),
|
|
471
481
|
events: zod.z
|
|
472
482
|
.object({
|
|
@@ -600,10 +610,13 @@ const validateVariableEvents = (meta) => {
|
|
|
600
610
|
errors.push(`${path}: property "${event.property}" is not defined`);
|
|
601
611
|
return;
|
|
602
612
|
}
|
|
613
|
+
const path = formatErrorPath(["variables", idx]);
|
|
603
614
|
if (definedProperty.type !== variableConfig.type) {
|
|
604
|
-
const path = formatErrorPath(["variables", idx]);
|
|
605
615
|
errors.push(`${path}: the type of the variable "${variableConfig.name}" and the type of the property "${event.property}" do not match`);
|
|
606
616
|
}
|
|
617
|
+
if (Boolean(definedProperty.array) !== Boolean(variableConfig.array)) {
|
|
618
|
+
errors.push(`${path}: the array of the variable "${variableConfig.name}" and the array of the property "${event.property}" do not match`);
|
|
619
|
+
}
|
|
607
620
|
});
|
|
608
621
|
}
|
|
609
622
|
});
|