@timardex/cluemart-shared 1.3.11 → 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
@@ -176,6 +176,7 @@ __export(index_exports, {
176
176
  useGetPartnersByRegion: () => useGetPartnersByRegion,
177
177
  useGetPost: () => useGetPost,
178
178
  useGetPosts: () => useGetPosts,
179
+ useGetPostsByType: () => useGetPostsByType,
179
180
  useGetRelation: () => useGetRelation,
180
181
  useGetRelationByEventAndVendor: () => useGetRelationByEventAndVendor,
181
182
  useGetResourceActivities: () => useGetResourceActivities,
@@ -5370,6 +5371,14 @@ var GET_POST = import_client59.gql`
5370
5371
  }
5371
5372
  ${POST_FIELDS_FRAGMENT}
5372
5373
  `;
5374
+ var GET_POSTS_BY_TYPE = import_client59.gql`
5375
+ query getPostsByType($postType: PostTypeEnum!) {
5376
+ postsByType(postType: $postType) {
5377
+ ...PostFields
5378
+ }
5379
+ }
5380
+ ${POST_FIELDS_FRAGMENT}
5381
+ `;
5373
5382
 
5374
5383
  // src/graphql/mutations/post.ts
5375
5384
  var CREATE_POST_MUTATION = import_client60.gql`
@@ -5430,6 +5439,13 @@ var useGetPost = (postId) => {
5430
5439
  });
5431
5440
  return { error, loading, post: data?.post || null, refetch };
5432
5441
  };
5442
+ var useGetPostsByType = (postType) => {
5443
+ const { data, loading, error, refetch } = (0, import_client62.useQuery)(GET_POSTS_BY_TYPE, {
5444
+ skip: !postType,
5445
+ variables: { postType }
5446
+ });
5447
+ return { error, loading, postsByType: data?.postsByType || [], refetch };
5448
+ };
5433
5449
 
5434
5450
  // src/hooks/useLocationSearch.ts
5435
5451
  var handleApiError = (error, message) => {
@@ -6135,25 +6151,33 @@ var listContentSchema = yup9.object({
6135
6151
  title: yup9.string().optional()
6136
6152
  }).required()
6137
6153
  });
6138
- var contentDataSchema = yup9.lazy((_, options) => {
6139
- const contentType = options.parent?.contentType;
6140
- switch (contentType) {
6141
- case "cover" /* COVER */:
6142
- return coverContentSchema;
6143
- case "textarea" /* TEXTAREA */:
6144
- return textareaContentSchema;
6145
- case "image" /* IMAGE */:
6146
- return imagesContentSchema;
6147
- case "video" /* VIDEO */:
6148
- return videoContentSchema;
6149
- case "list" /* LIST */:
6150
- return listContentSchema;
6151
- default:
6152
- 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);
6153
6177
  }
6154
- });
6178
+ );
6155
6179
  var postContentSchema = yup9.object().shape({
6156
- contentData: contentDataSchema.required(),
6180
+ contentData: contentDataSchema,
6157
6181
  contentOrder: yup9.number().min(0).required(),
6158
6182
  contentType: yup9.mixed().oneOf(Object.values(EnumPostContentType)).required()
6159
6183
  });
@@ -7468,6 +7492,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7468
7492
  useGetPartnersByRegion,
7469
7493
  useGetPost,
7470
7494
  useGetPosts,
7495
+ useGetPostsByType,
7471
7496
  useGetRelation,
7472
7497
  useGetRelationByEventAndVendor,
7473
7498
  useGetResourceActivities,