@timardex/cluemart-shared 1.3.0 → 1.3.11

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.
Files changed (38) hide show
  1. package/dist/{auth-DlXdCHFm.d.mts → auth-DpfaLmTU.d.mts} +1 -1
  2. package/dist/{auth-B1G5QrD2.d.ts → auth-xXqB6t_8.d.ts} +1 -1
  3. package/dist/{chunk-3ZDDQGW4.mjs → chunk-Y3MIKYGQ.mjs} +20 -2
  4. package/dist/chunk-Y3MIKYGQ.mjs.map +1 -0
  5. package/dist/formFields/index.d.mts +1 -1
  6. package/dist/formFields/index.d.ts +1 -1
  7. package/dist/{global-DabCYr5t.d.ts → global-DSwmP6sp.d.ts} +1 -3
  8. package/dist/{global-B3lGLGxH.d.mts → global-O7RsWypG.d.mts} +1 -3
  9. package/dist/graphql/index.cjs +143 -0
  10. package/dist/graphql/index.cjs.map +1 -1
  11. package/dist/graphql/index.d.mts +36 -3
  12. package/dist/graphql/index.d.ts +36 -3
  13. package/dist/graphql/index.mjs +138 -0
  14. package/dist/graphql/index.mjs.map +1 -1
  15. package/dist/hooks/index.cjs +140 -5
  16. package/dist/hooks/index.cjs.map +1 -1
  17. package/dist/hooks/index.d.mts +6 -4
  18. package/dist/hooks/index.d.ts +6 -4
  19. package/dist/hooks/index.mjs +124 -6
  20. package/dist/hooks/index.mjs.map +1 -1
  21. package/dist/index.cjs +287 -5
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.mts +100 -4
  24. package/dist/index.d.ts +100 -4
  25. package/dist/index.mjs +279 -5
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/{ad-j0VWBCVE.d.ts → post-Df5kAhEE.d.ts} +65 -2
  28. package/dist/{ad-Cld9z55n.d.mts → post-tVcpbEDX.d.mts} +65 -2
  29. package/dist/types/index.cjs +20 -0
  30. package/dist/types/index.cjs.map +1 -1
  31. package/dist/types/index.d.mts +3 -3
  32. package/dist/types/index.d.ts +3 -3
  33. package/dist/types/index.mjs +5 -1
  34. package/dist/types/index.mjs.map +1 -1
  35. package/dist/utils/index.d.mts +1 -1
  36. package/dist/utils/index.d.ts +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-3ZDDQGW4.mjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -46,6 +46,8 @@ __export(index_exports, {
46
46
  EnumOSPlatform: () => EnumOSPlatform,
47
47
  EnumPartnerType: () => EnumPartnerType,
48
48
  EnumPaymentMethod: () => EnumPaymentMethod,
49
+ EnumPostContentType: () => EnumPostContentType,
50
+ EnumPostType: () => EnumPostType,
49
51
  EnumRegions: () => EnumRegions,
50
52
  EnumRelationResource: () => EnumRelationResource,
51
53
  EnumResourceType: () => EnumResourceType,
@@ -134,6 +136,7 @@ __export(index_exports, {
134
136
  useCreateEvent: () => useCreateEvent,
135
137
  useCreateEventInfo: () => useCreateEventInfo,
136
138
  useCreatePartner: () => useCreatePartner,
139
+ useCreatePost: () => useCreatePost,
137
140
  useCreatePoster: () => useCreatePoster,
138
141
  useCreatePushToken: () => useCreatePushToken,
139
142
  useCreateRelation: () => useCreateRelation,
@@ -148,6 +151,7 @@ __export(index_exports, {
148
151
  useDeleteEvent: () => useDeleteEvent,
149
152
  useDeleteNotification: () => useDeleteNotification,
150
153
  useDeletePartner: () => useDeletePartner,
154
+ useDeletePost: () => useDeletePost,
151
155
  useDeleteRelation: () => useDeleteRelation,
152
156
  useDeleteTester: () => useDeleteTester,
153
157
  useDeleteUser: () => useDeleteUser,
@@ -170,6 +174,8 @@ __export(index_exports, {
170
174
  useGetPartner: () => useGetPartner,
171
175
  useGetPartners: () => useGetPartners,
172
176
  useGetPartnersByRegion: () => useGetPartnersByRegion,
177
+ useGetPost: () => useGetPost,
178
+ useGetPosts: () => useGetPosts,
173
179
  useGetRelation: () => useGetRelation,
174
180
  useGetRelationByEventAndVendor: () => useGetRelationByEventAndVendor,
175
181
  useGetResourceActivities: () => useGetResourceActivities,
@@ -197,6 +203,7 @@ __export(index_exports, {
197
203
  useMarkAllNotificationsRead: () => useMarkAllNotificationsRead,
198
204
  useMarkNotificationRead: () => useMarkNotificationRead,
199
205
  usePartnerForm: () => usePartnerForm,
206
+ usePostform: () => usePostform,
200
207
  useRefreshToken: () => useRefreshToken,
201
208
  useRegister: () => useRegister,
202
209
  useRegisterForm: () => useRegisterForm,
@@ -219,6 +226,7 @@ __export(index_exports, {
219
226
  useUpdateEvent: () => useUpdateEvent,
220
227
  useUpdateEventInfo: () => useUpdateEventInfo,
221
228
  useUpdatePartner: () => useUpdatePartner,
229
+ useUpdatePost: () => useUpdatePost,
222
230
  useUpdateRelation: () => useUpdateRelation,
223
231
  useUpdateSubscriptionPlan: () => useUpdateSubscriptionPlan,
224
232
  useUpdateTester: () => useUpdateTester,
@@ -5290,6 +5298,139 @@ var useSearchPartners = (search, region) => {
5290
5298
  return { error, loading, partnersSearch, refetch };
5291
5299
  };
5292
5300
 
5301
+ // src/graphql/hooks/post/hooksMutation.ts
5302
+ var import_client61 = require("@apollo/client");
5303
+
5304
+ // src/graphql/mutations/post.ts
5305
+ var import_client60 = require("@apollo/client");
5306
+
5307
+ // src/graphql/queries/post.ts
5308
+ var import_client59 = require("@apollo/client");
5309
+ var POST_CONTENT_DATA_FIELDS_FRAGMENT = import_client59.gql`
5310
+ fragment PostContentDataFields on PostContentData {
5311
+ cover {
5312
+ ...ResourceImageFields
5313
+ }
5314
+ textarea {
5315
+ title
5316
+ data
5317
+ }
5318
+ images {
5319
+ ...ResourceImageFields
5320
+ }
5321
+ video {
5322
+ source
5323
+ title
5324
+ }
5325
+ list {
5326
+ title
5327
+ items
5328
+ }
5329
+ }
5330
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
5331
+ `;
5332
+ var POST_CONTENT_FIELDS_FRAGMENT = import_client59.gql`
5333
+ fragment PostContentFields on PostContentType {
5334
+ _id
5335
+ contentData {
5336
+ ...PostContentDataFields
5337
+ }
5338
+ contentOrder
5339
+ contentType
5340
+ }
5341
+ ${POST_CONTENT_DATA_FIELDS_FRAGMENT}
5342
+ `;
5343
+ var POST_FIELDS_FRAGMENT = import_client59.gql`
5344
+ fragment PostFields on PostType {
5345
+ _id
5346
+ content {
5347
+ ...PostContentFields
5348
+ }
5349
+ postType
5350
+ tags
5351
+ title
5352
+ createdAt
5353
+ updatedAt
5354
+ }
5355
+ ${POST_CONTENT_FIELDS_FRAGMENT}
5356
+ `;
5357
+ var GET_POSTS = import_client59.gql`
5358
+ query getPosts {
5359
+ posts {
5360
+ ...PostFields
5361
+ }
5362
+ }
5363
+ ${POST_FIELDS_FRAGMENT}
5364
+ `;
5365
+ var GET_POST = import_client59.gql`
5366
+ query getPost($postId: ID!) {
5367
+ post(postId: $postId) {
5368
+ ...PostFields
5369
+ }
5370
+ }
5371
+ ${POST_FIELDS_FRAGMENT}
5372
+ `;
5373
+
5374
+ // src/graphql/mutations/post.ts
5375
+ var CREATE_POST_MUTATION = import_client60.gql`
5376
+ mutation createPost($input: PostInputType!) {
5377
+ createPost(input: $input) {
5378
+ ...PostFields
5379
+ }
5380
+ }
5381
+ ${POST_FIELDS_FRAGMENT}
5382
+ `;
5383
+ var UPDATE_POST_MUTATION = import_client60.gql`
5384
+ mutation updatePost($_id: ID!, $input: PostInputType!) {
5385
+ updatePost(_id: $_id, input: $input) {
5386
+ ...PostFields
5387
+ }
5388
+ }
5389
+ ${POST_FIELDS_FRAGMENT}
5390
+ `;
5391
+ var DELETE_POST_MUTATION = import_client60.gql`
5392
+ mutation deletePost($_id: ID!) {
5393
+ deletePost(_id: $_id)
5394
+ }
5395
+ `;
5396
+
5397
+ // src/graphql/hooks/post/hooksMutation.ts
5398
+ var useCreatePost = () => {
5399
+ const [createPost, { loading, error }] = (0, import_client61.useMutation)(CREATE_POST_MUTATION, {
5400
+ awaitRefetchQueries: true,
5401
+ refetchQueries: [{ query: GET_POSTS }]
5402
+ });
5403
+ return { createPost, error, loading };
5404
+ };
5405
+ var useUpdatePost = () => {
5406
+ const [updatePost, { loading, error }] = (0, import_client61.useMutation)(UPDATE_POST_MUTATION, {
5407
+ awaitRefetchQueries: true,
5408
+ refetchQueries: [{ query: GET_POSTS }]
5409
+ });
5410
+ return { error, loading, updatePost };
5411
+ };
5412
+ var useDeletePost = () => {
5413
+ const [deletePost, { loading, error }] = (0, import_client61.useMutation)(DELETE_POST_MUTATION, {
5414
+ awaitRefetchQueries: true,
5415
+ refetchQueries: [{ query: GET_POSTS }]
5416
+ });
5417
+ return { deletePost, error, loading };
5418
+ };
5419
+
5420
+ // src/graphql/hooks/post/hooksQuery.ts
5421
+ var import_client62 = require("@apollo/client");
5422
+ var useGetPosts = () => {
5423
+ const { data, loading, error, refetch } = (0, import_client62.useQuery)(GET_POSTS);
5424
+ return { error, loading, posts: data?.posts || [], refetch };
5425
+ };
5426
+ var useGetPost = (postId) => {
5427
+ const { data, loading, error, refetch } = (0, import_client62.useQuery)(GET_POST, {
5428
+ skip: !postId,
5429
+ variables: { postId }
5430
+ });
5431
+ return { error, loading, post: data?.post || null, refetch };
5432
+ };
5433
+
5293
5434
  // src/hooks/useLocationSearch.ts
5294
5435
  var handleApiError = (error, message) => {
5295
5436
  console.error(message, error);
@@ -5942,6 +6083,87 @@ var partnerSchema = globalResourceSchema.shape({
5942
6083
  partnerType: yup8.mixed().oneOf(Object.values(EnumPartnerType)).required("Please select a Partner type")
5943
6084
  });
5944
6085
 
6086
+ // src/yupSchema/post.ts
6087
+ var yup9 = __toESM(require("yup"));
6088
+
6089
+ // src/types/post.ts
6090
+ var EnumPostType = /* @__PURE__ */ ((EnumPostType2) => {
6091
+ EnumPostType2["DAILY_MEETS"] = "daily_meets";
6092
+ EnumPostType2["DAILY_TIPS"] = "daily_tips";
6093
+ EnumPostType2["DAILY_POLL"] = "daily_poll";
6094
+ return EnumPostType2;
6095
+ })(EnumPostType || {});
6096
+ var EnumPostContentType = /* @__PURE__ */ ((EnumPostContentType2) => {
6097
+ EnumPostContentType2["COVER"] = "cover";
6098
+ EnumPostContentType2["IMAGE"] = "image";
6099
+ EnumPostContentType2["LIST"] = "list";
6100
+ EnumPostContentType2["TEXTAREA"] = "textarea";
6101
+ EnumPostContentType2["VIDEO"] = "video";
6102
+ return EnumPostContentType2;
6103
+ })(EnumPostContentType || {});
6104
+
6105
+ // src/yupSchema/post.ts
6106
+ var coverContentSchema = yup9.object({
6107
+ cover: yup9.object({
6108
+ source: yup9.string().required("Cover source is required"),
6109
+ title: yup9.string().required("Cover title is required")
6110
+ }).required()
6111
+ });
6112
+ var textareaContentSchema = yup9.object({
6113
+ textarea: yup9.object({
6114
+ data: yup9.string().required("Textarea content is required"),
6115
+ title: yup9.string().optional()
6116
+ }).required()
6117
+ });
6118
+ var imagesContentSchema = yup9.object({
6119
+ images: yup9.array().of(
6120
+ yup9.object({
6121
+ source: yup9.string().required("Image source is required"),
6122
+ title: yup9.string().required("Image title is required")
6123
+ })
6124
+ ).nullable()
6125
+ });
6126
+ var videoContentSchema = yup9.object({
6127
+ video: yup9.object({
6128
+ source: yup9.string().required("Video source is required"),
6129
+ title: yup9.string().optional()
6130
+ }).required()
6131
+ });
6132
+ var listContentSchema = yup9.object({
6133
+ list: yup9.object({
6134
+ items: yup9.array().of(yup9.string().required()).min(1, "List must contain at least one item").required(),
6135
+ title: yup9.string().optional()
6136
+ }).required()
6137
+ });
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();
6153
+ }
6154
+ });
6155
+ var postContentSchema = yup9.object().shape({
6156
+ contentData: contentDataSchema.required(),
6157
+ contentOrder: yup9.number().min(0).required(),
6158
+ contentType: yup9.mixed().oneOf(Object.values(EnumPostContentType)).required()
6159
+ });
6160
+ var postSchema = yup9.object().shape({
6161
+ content: yup9.array().of(postContentSchema).required(),
6162
+ postType: yup9.mixed().oneOf(Object.values(EnumPostType)).required(),
6163
+ tags: yup9.array().of(yup9.string()).nullable().optional(),
6164
+ title: yup9.string().required()
6165
+ });
6166
+
5945
6167
  // src/hooks/utils.ts
5946
6168
  var defaultLocation = {
5947
6169
  city: "",
@@ -6739,12 +6961,12 @@ var import_react2 = __toESM(require("react"));
6739
6961
  var import_react_hook_form12 = require("react-hook-form");
6740
6962
 
6741
6963
  // src/yupSchema/contactUs.ts
6742
- var yup9 = __toESM(require("yup"));
6743
- var contactUsSchema = yup9.object().shape({
6964
+ var yup10 = __toESM(require("yup"));
6965
+ var contactUsSchema = yup10.object().shape({
6744
6966
  email: emailRequiredSchema,
6745
- firstName: yup9.string().label("First Name").required("First name is required"),
6746
- lastName: yup9.string().label("Last Name").required("Last name is required"),
6747
- message: yup9.string().label("Message").required("Message is required")
6967
+ firstName: yup10.string().label("First Name").required("First name is required"),
6968
+ lastName: yup10.string().label("Last Name").required("Last name is required"),
6969
+ message: yup10.string().label("Message").required("Message is required")
6748
6970
  });
6749
6971
 
6750
6972
  // src/hooks/useContactUsForm.ts
@@ -6992,6 +7214,58 @@ function usePartnerForm(data) {
6992
7214
  };
6993
7215
  }
6994
7216
 
7217
+ // src/hooks/usePostForm.ts
7218
+ var import_yup15 = require("@hookform/resolvers/yup");
7219
+ var import_react4 = __toESM(require("react"));
7220
+ var import_react_hook_form15 = require("react-hook-form");
7221
+ var defaultValues10 = {
7222
+ content: [],
7223
+ postType: "daily_meets" /* DAILY_MEETS */,
7224
+ tags: [],
7225
+ title: ""
7226
+ };
7227
+ function usePostform(data) {
7228
+ const {
7229
+ control,
7230
+ formState: { errors },
7231
+ getValues,
7232
+ handleSubmit,
7233
+ reset,
7234
+ setValue,
7235
+ watch
7236
+ } = (0, import_react_hook_form15.useForm)({
7237
+ defaultValues: defaultValues10,
7238
+ resolver: (0, import_yup15.yupResolver)(postSchema)
7239
+ });
7240
+ import_react4.default.useEffect(() => {
7241
+ if (data) {
7242
+ reset({
7243
+ content: data.content,
7244
+ postType: data.postType,
7245
+ tags: data.tags,
7246
+ title: data.title
7247
+ });
7248
+ } else {
7249
+ reset(defaultValues10);
7250
+ }
7251
+ }, [data]);
7252
+ const { content, postType, tags, title } = getValues();
7253
+ return {
7254
+ control,
7255
+ fields: {
7256
+ content,
7257
+ postType,
7258
+ tags,
7259
+ title
7260
+ },
7261
+ formState: { errors },
7262
+ handleSubmit,
7263
+ reset,
7264
+ setValue,
7265
+ watch
7266
+ };
7267
+ }
7268
+
6995
7269
  // src/storage/index.ts
6996
7270
  var SAVED_PASSWORD_KEY = "savedPassword";
6997
7271
  var SAVED_EMAIL_KEY = "savedEmail";
@@ -7064,6 +7338,8 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7064
7338
  EnumOSPlatform,
7065
7339
  EnumPartnerType,
7066
7340
  EnumPaymentMethod,
7341
+ EnumPostContentType,
7342
+ EnumPostType,
7067
7343
  EnumRegions,
7068
7344
  EnumRelationResource,
7069
7345
  EnumResourceType,
@@ -7152,6 +7428,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7152
7428
  useCreateEvent,
7153
7429
  useCreateEventInfo,
7154
7430
  useCreatePartner,
7431
+ useCreatePost,
7155
7432
  useCreatePoster,
7156
7433
  useCreatePushToken,
7157
7434
  useCreateRelation,
@@ -7166,6 +7443,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7166
7443
  useDeleteEvent,
7167
7444
  useDeleteNotification,
7168
7445
  useDeletePartner,
7446
+ useDeletePost,
7169
7447
  useDeleteRelation,
7170
7448
  useDeleteTester,
7171
7449
  useDeleteUser,
@@ -7188,6 +7466,8 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7188
7466
  useGetPartner,
7189
7467
  useGetPartners,
7190
7468
  useGetPartnersByRegion,
7469
+ useGetPost,
7470
+ useGetPosts,
7191
7471
  useGetRelation,
7192
7472
  useGetRelationByEventAndVendor,
7193
7473
  useGetResourceActivities,
@@ -7215,6 +7495,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7215
7495
  useMarkAllNotificationsRead,
7216
7496
  useMarkNotificationRead,
7217
7497
  usePartnerForm,
7498
+ usePostform,
7218
7499
  useRefreshToken,
7219
7500
  useRegister,
7220
7501
  useRegisterForm,
@@ -7237,6 +7518,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
7237
7518
  useUpdateEvent,
7238
7519
  useUpdateEventInfo,
7239
7520
  useUpdatePartner,
7521
+ useUpdatePost,
7240
7522
  useUpdateRelation,
7241
7523
  useUpdateSubscriptionPlan,
7242
7524
  useUpdateTester,