@timardex/cluemart-shared 1.3.12 → 1.3.13

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/dist/index.cjs CHANGED
@@ -6151,23 +6151,31 @@ var listContentSchema = yup9.object({
6151
6151
  title: yup9.string().optional()
6152
6152
  }).required()
6153
6153
  });
6154
- var contentDataSchema = yup9.lazy((_, options) => {
6155
- const contentType = options.parent?.contentType;
6156
- switch (contentType) {
6157
- case "cover" /* COVER */:
6158
- return coverContentSchema;
6159
- case "textarea" /* TEXTAREA */:
6160
- return textareaContentSchema;
6161
- case "image" /* IMAGE */:
6162
- return imagesContentSchema;
6163
- case "video" /* VIDEO */:
6164
- return videoContentSchema;
6165
- case "list" /* LIST */:
6166
- return listContentSchema;
6167
- default:
6168
- return yup9.mixed().required();
6154
+ var contentDataSchema = yup9.mixed().required("Content data is required").test(
6155
+ "contentData-by-type",
6156
+ "Invalid content data for content type",
6157
+ function(value) {
6158
+ const { contentType } = this.parent;
6159
+ const schema = (() => {
6160
+ switch (contentType) {
6161
+ case "cover" /* COVER */:
6162
+ return coverContentSchema;
6163
+ case "textarea" /* TEXTAREA */:
6164
+ return textareaContentSchema;
6165
+ case "image" /* IMAGE */:
6166
+ return imagesContentSchema;
6167
+ case "video" /* VIDEO */:
6168
+ return videoContentSchema;
6169
+ case "list" /* LIST */:
6170
+ return listContentSchema;
6171
+ default:
6172
+ return null;
6173
+ }
6174
+ })();
6175
+ if (!schema) return false;
6176
+ return schema.isValidSync(value);
6169
6177
  }
6170
- });
6178
+ );
6171
6179
  var postContentSchema = yup9.object().shape({
6172
6180
  contentData: contentDataSchema,
6173
6181
  contentOrder: yup9.number().min(0).required(),