@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.esm.js
CHANGED
|
@@ -444,6 +444,16 @@ const componentMetaSchema = z
|
|
|
444
444
|
})
|
|
445
445
|
.strict()
|
|
446
446
|
.array()
|
|
447
|
+
.superRefine((inputs, refinementContext) => {
|
|
448
|
+
const inputNames = inputs.map((input) => input.name);
|
|
449
|
+
if (new Set(inputNames).size !== inputNames.length) {
|
|
450
|
+
const duplicateInputNames = inputNames.filter((name, index) => inputNames.indexOf(name) !== index);
|
|
451
|
+
return refinementContext.addIssue({
|
|
452
|
+
code: z.ZodIssueCode.custom,
|
|
453
|
+
message: `Input names must be unique. Duplicate names: ${duplicateInputNames.join(", ")}`,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
})
|
|
447
457
|
.optional(),
|
|
448
458
|
events: z
|
|
449
459
|
.object({
|
|
@@ -577,10 +587,13 @@ const validateVariableEvents = (meta) => {
|
|
|
577
587
|
errors.push(`${path}: property "${event.property}" is not defined`);
|
|
578
588
|
return;
|
|
579
589
|
}
|
|
590
|
+
const path = formatErrorPath(["variables", idx]);
|
|
580
591
|
if (definedProperty.type !== variableConfig.type) {
|
|
581
|
-
const path = formatErrorPath(["variables", idx]);
|
|
582
592
|
errors.push(`${path}: the type of the variable "${variableConfig.name}" and the type of the property "${event.property}" do not match`);
|
|
583
593
|
}
|
|
594
|
+
if (Boolean(definedProperty.array) !== Boolean(variableConfig.array)) {
|
|
595
|
+
errors.push(`${path}: the array of the variable "${variableConfig.name}" and the array of the property "${event.property}" do not match`);
|
|
596
|
+
}
|
|
584
597
|
});
|
|
585
598
|
}
|
|
586
599
|
});
|