@timardex/cluemart-shared 1.7.43 → 1.7.45

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.
@@ -1486,6 +1486,15 @@ declare const useDeleteCoupon: () => {
1486
1486
  error: _apollo_client.ApolloError | undefined;
1487
1487
  loading: boolean;
1488
1488
  };
1489
+ declare const useScanCoupon: () => {
1490
+ error: _apollo_client.ApolloError | undefined;
1491
+ loading: boolean;
1492
+ scanCoupon: (options?: _apollo_client.MutationFunctionOptions<{
1493
+ scanCoupon: MutationResponse<boolean>;
1494
+ }, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<{
1495
+ scanCoupon: MutationResponse<boolean>;
1496
+ }>>;
1497
+ };
1489
1498
 
1490
1499
  declare const useGetCoupons: () => {
1491
1500
  coupons: CouponTypeList | {
@@ -1508,4 +1517,4 @@ declare const useGetCoupon: (_id: string) => {
1508
1517
  }>>;
1509
1518
  };
1510
1519
 
1511
- export { ACTIVATE_VENDOR_CLAIM_MUTATION, GET_EVENT, GET_EVENT_BY_SLUG, GET_EVENT_INFO, GET_PARTNER, GET_PARTNER_BY_SLUG, GET_POST, GET_POST_BY_SLUG, GET_RESOURCE_CONNECTIONS, GET_VENDOR, GET_VENDOR_BY_SLUG, GET_VENDOR_INFO, MY_PENDING_VENDOR_CLAIM, toGraphqlQueryString, useActivateVendorClaim, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAssignAffiliateBonusReward, useAssignAffiliateResourceReward, useCancelSubscription, useContactUs, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCoupon, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateSchool, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAffiliate, useDeleteAllNotifications, useDeleteChat, useDeleteCoupon, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteSchool, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useGetAd, useGetAds, useGetAdsByRegion, useGetAffiliate, useGetAffiliates, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetCoupon, useGetCoupons, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetPrivateChats, useGetRelation, useGetRelationByEventAndVendor, useGetRelationChats, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSchool, useGetSchools, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUnregisteredVendorsByInviterId, useGetUser, useGetUserActivities, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLogin, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, useMyPendingVendorClaim, useRedeemAffiliateReward, useRedeemReward, useRefreshToken, useRegister, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestMarketingMaterial, useRequestPasswordReset, useResetPassword, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUnlinkUnregisteredVendorByInviterId, useUpdateAd, useUpdateAffiliateDetails, useUpdateAppSettings, useUpdateCoupon, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdatePuzzleGame, useUpdateRelation, useUpdateSchool, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useValidateVerificationToken };
1520
+ export { ACTIVATE_VENDOR_CLAIM_MUTATION, GET_EVENT, GET_EVENT_BY_SLUG, GET_EVENT_INFO, GET_PARTNER, GET_PARTNER_BY_SLUG, GET_POST, GET_POST_BY_SLUG, GET_RESOURCE_CONNECTIONS, GET_VENDOR, GET_VENDOR_BY_SLUG, GET_VENDOR_INFO, MY_PENDING_VENDOR_CLAIM, toGraphqlQueryString, useActivateVendorClaim, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAssignAffiliateBonusReward, useAssignAffiliateResourceReward, useCancelSubscription, useContactUs, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCoupon, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateSchool, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAffiliate, useDeleteAllNotifications, useDeleteChat, useDeleteCoupon, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteSchool, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useGetAd, useGetAds, useGetAdsByRegion, useGetAffiliate, useGetAffiliates, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetCoupon, useGetCoupons, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetPrivateChats, useGetRelation, useGetRelationByEventAndVendor, useGetRelationChats, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSchool, useGetSchools, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUnregisteredVendorsByInviterId, useGetUser, useGetUserActivities, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLogin, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, useMyPendingVendorClaim, useRedeemAffiliateReward, useRedeemReward, useRefreshToken, useRegister, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestMarketingMaterial, useRequestPasswordReset, useResetPassword, useScanCoupon, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUnlinkUnregisteredVendorByInviterId, useUpdateAd, useUpdateAffiliateDetails, useUpdateAppSettings, useUpdateCoupon, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdatePuzzleGame, useUpdateRelation, useUpdateSchool, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useValidateVerificationToken };
@@ -1486,6 +1486,15 @@ declare const useDeleteCoupon: () => {
1486
1486
  error: _apollo_client.ApolloError | undefined;
1487
1487
  loading: boolean;
1488
1488
  };
1489
+ declare const useScanCoupon: () => {
1490
+ error: _apollo_client.ApolloError | undefined;
1491
+ loading: boolean;
1492
+ scanCoupon: (options?: _apollo_client.MutationFunctionOptions<{
1493
+ scanCoupon: MutationResponse<boolean>;
1494
+ }, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<{
1495
+ scanCoupon: MutationResponse<boolean>;
1496
+ }>>;
1497
+ };
1489
1498
 
1490
1499
  declare const useGetCoupons: () => {
1491
1500
  coupons: CouponTypeList | {
@@ -1508,4 +1517,4 @@ declare const useGetCoupon: (_id: string) => {
1508
1517
  }>>;
1509
1518
  };
1510
1519
 
1511
- export { ACTIVATE_VENDOR_CLAIM_MUTATION, GET_EVENT, GET_EVENT_BY_SLUG, GET_EVENT_INFO, GET_PARTNER, GET_PARTNER_BY_SLUG, GET_POST, GET_POST_BY_SLUG, GET_RESOURCE_CONNECTIONS, GET_VENDOR, GET_VENDOR_BY_SLUG, GET_VENDOR_INFO, MY_PENDING_VENDOR_CLAIM, toGraphqlQueryString, useActivateVendorClaim, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAssignAffiliateBonusReward, useAssignAffiliateResourceReward, useCancelSubscription, useContactUs, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCoupon, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateSchool, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAffiliate, useDeleteAllNotifications, useDeleteChat, useDeleteCoupon, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteSchool, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useGetAd, useGetAds, useGetAdsByRegion, useGetAffiliate, useGetAffiliates, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetCoupon, useGetCoupons, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetPrivateChats, useGetRelation, useGetRelationByEventAndVendor, useGetRelationChats, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSchool, useGetSchools, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUnregisteredVendorsByInviterId, useGetUser, useGetUserActivities, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLogin, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, useMyPendingVendorClaim, useRedeemAffiliateReward, useRedeemReward, useRefreshToken, useRegister, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestMarketingMaterial, useRequestPasswordReset, useResetPassword, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUnlinkUnregisteredVendorByInviterId, useUpdateAd, useUpdateAffiliateDetails, useUpdateAppSettings, useUpdateCoupon, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdatePuzzleGame, useUpdateRelation, useUpdateSchool, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useValidateVerificationToken };
1520
+ export { ACTIVATE_VENDOR_CLAIM_MUTATION, GET_EVENT, GET_EVENT_BY_SLUG, GET_EVENT_INFO, GET_PARTNER, GET_PARTNER_BY_SLUG, GET_POST, GET_POST_BY_SLUG, GET_RESOURCE_CONNECTIONS, GET_VENDOR, GET_VENDOR_BY_SLUG, GET_VENDOR_INFO, MY_PENDING_VENDOR_CLAIM, toGraphqlQueryString, useActivateVendorClaim, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAssignAffiliateBonusReward, useAssignAffiliateResourceReward, useCancelSubscription, useContactUs, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCoupon, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateSchool, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAffiliate, useDeleteAllNotifications, useDeleteChat, useDeleteCoupon, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteSchool, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useGetAd, useGetAds, useGetAdsByRegion, useGetAffiliate, useGetAffiliates, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetCoupon, useGetCoupons, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetPrivateChats, useGetRelation, useGetRelationByEventAndVendor, useGetRelationChats, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSchool, useGetSchools, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUnregisteredVendorsByInviterId, useGetUser, useGetUserActivities, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLogin, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, useMyPendingVendorClaim, useRedeemAffiliateReward, useRedeemReward, useRefreshToken, useRegister, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestMarketingMaterial, useRequestPasswordReset, useResetPassword, useScanCoupon, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUnlinkUnregisteredVendorByInviterId, useUpdateAd, useUpdateAffiliateDetails, useUpdateAppSettings, useUpdateCoupon, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdatePuzzleGame, useUpdateRelation, useUpdateSchool, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useValidateVerificationToken };
@@ -118,6 +118,7 @@ import {
118
118
  useRemoveUserPresentResource,
119
119
  useReportChatUser,
120
120
  useRequestMarketingMaterial,
121
+ useScanCoupon,
121
122
  useSearchEvents,
122
123
  useSearchPartners,
123
124
  useSearchVendors,
@@ -145,7 +146,7 @@ import {
145
146
  useUpdateUser,
146
147
  useUpdateVendor,
147
148
  useUpdateVendorInfo
148
- } from "../chunk-ZJ5ZNUEB.mjs";
149
+ } from "../chunk-CT2SGB4K.mjs";
149
150
  import {
150
151
  GET_EVENT,
151
152
  GET_EVENT_INFO,
@@ -308,6 +309,7 @@ export {
308
309
  useRequestMarketingMaterial,
309
310
  useRequestPasswordReset,
310
311
  useResetPassword,
312
+ useScanCoupon,
311
313
  useSearchEvents,
312
314
  useSearchPartners,
313
315
  useSearchVendors,
@@ -5748,6 +5748,14 @@ var DELETE_COUPON_MUTATION = import_client79.gql`
5748
5748
  }
5749
5749
  }
5750
5750
  `;
5751
+ var SCAN_COUPON_MUTATION = import_client79.gql`
5752
+ mutation scanCoupon($input: ScanCouponInputType!) {
5753
+ scanCoupon(input: $input) {
5754
+ data
5755
+ message
5756
+ }
5757
+ }
5758
+ `;
5751
5759
 
5752
5760
  // src/graphql/hooks/coupon/hooksQuery.ts
5753
5761
  var import_client81 = require("@apollo/client");
@@ -5983,7 +5991,7 @@ var appSettingsSchema = yup9.object({
5983
5991
  // src/yupSchema/coupon.ts
5984
5992
  var yup10 = __toESM(require("yup"));
5985
5993
  var couponPurchaseOptionSchema = yup10.object().shape({
5986
- buy: yup10.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("How many do they need to buy?").typeError("Buy must be a number").integer("Buy must be a whole number").min(1, "Buy must be at least 1").required("Buy is required"),
5994
+ buy: yup10.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("How many do they need to buy?").typeError("Buy must be a number").integer("Buy must be a whole number").min(1, "Buy must be at least 1").max(15, "Buy must be at most 15").required("Buy is required"),
5987
5995
  get: yup10.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("How many do they get?").typeError("Get must be a number").integer("Get must be a whole number").min(1, "Get must be at least 1").required("Get is required").test("get-less-than-buy", "Get must be less than Buy", function(value) {
5988
5996
  const { buy } = this.parent;
5989
5997
  if (value === void 0 || buy === void 0) return true;
@@ -6012,34 +6020,52 @@ var couponRewardSchema = yup10.object().shape({
6012
6020
  unit: yup10.string().label("Unit").trim().required("Unit is required"),
6013
6021
  vendorId: yup10.string().label("Vendor").trim().required("Vendor is required")
6014
6022
  });
6015
- var couponSchema = yup10.object().shape({
6016
- couponDescription: yup10.string().label("Description").trim().required("Description is required"),
6017
- couponOption: couponOptionSchema,
6018
- couponRewards: yup10.array().of(couponRewardSchema).optional(),
6019
- endDate: yup10.date().label("End Date").typeError("End date is required").required("End date is required").test("is-future-date", "End date must be in the future", (value) => {
6020
- if (!value) return false;
6021
- return new Date(value) > /* @__PURE__ */ new Date();
6022
- }).when("startDate", {
6023
- is: (val) => !!val,
6024
- then: (schema) => schema.test(
6025
- "is-after-start",
6026
- "End date must be after start date",
6027
- function(value) {
6028
- const { startDate } = this.parent;
6029
- if (!value || !startDate) return false;
6030
- return new Date(value) > new Date(startDate);
6023
+ var createCouponSchema = ({
6024
+ enforceFutureStartDate
6025
+ }) => {
6026
+ let startDateSchema = yup10.date().label("Start Date").typeError("Start date is required").required("Start date is required");
6027
+ if (enforceFutureStartDate) {
6028
+ startDateSchema = startDateSchema.test(
6029
+ "is-future-date",
6030
+ "Start date must be in the future",
6031
+ (value) => {
6032
+ if (!value) return false;
6033
+ return new Date(value) > /* @__PURE__ */ new Date();
6031
6034
  }
6032
- )
6033
- }),
6034
- resourceId: yup10.string().label("Resource ID").trim().required("Resource ID is required"),
6035
- resourceType: yup10.mixed().oneOf(
6036
- Object.values(EnumResourceType),
6037
- "Resource type must be a valid EnumResourceType"
6038
- ).required("Resource type is required"),
6039
- startDate: yup10.date().label("Start Date").typeError("Start date is required").required("Start date is required").test("is-future-date", "Start date must be in the future", (value) => {
6040
- if (!value) return false;
6041
- return new Date(value) > /* @__PURE__ */ new Date();
6042
- })
6035
+ );
6036
+ }
6037
+ return yup10.object().shape({
6038
+ couponDescription: yup10.string().label("Description").trim().required("Description is required"),
6039
+ couponOption: couponOptionSchema,
6040
+ couponRewards: yup10.array().of(couponRewardSchema).optional(),
6041
+ endDate: yup10.date().label("End Date").typeError("End date is required").required("End date is required").test("is-future-date", "End date must be in the future", (value) => {
6042
+ if (!value) return false;
6043
+ return new Date(value) > /* @__PURE__ */ new Date();
6044
+ }).when("startDate", {
6045
+ is: (val) => !!val,
6046
+ then: (schema) => schema.test(
6047
+ "is-after-start",
6048
+ "End date must be after start date",
6049
+ function(value) {
6050
+ const { startDate } = this.parent;
6051
+ if (!value || !startDate) return false;
6052
+ return new Date(value) > new Date(startDate);
6053
+ }
6054
+ )
6055
+ }),
6056
+ resourceId: yup10.string().label("Resource ID").trim().required("Resource ID is required"),
6057
+ resourceType: yup10.mixed().oneOf(
6058
+ Object.values(EnumResourceType),
6059
+ "Resource type must be a valid EnumResourceType"
6060
+ ).required("Resource type is required"),
6061
+ startDate: startDateSchema
6062
+ });
6063
+ };
6064
+ var couponSchema = createCouponSchema({
6065
+ enforceFutureStartDate: true
6066
+ });
6067
+ var couponEditSchema = createCouponSchema({
6068
+ enforceFutureStartDate: false
6043
6069
  });
6044
6070
 
6045
6071
  // src/hooks/utils.ts
@@ -7444,7 +7470,7 @@ function useCouponForm(data) {
7444
7470
  watch
7445
7471
  } = (0, import_react_hook_form19.useForm)({
7446
7472
  defaultValues: defaultValues11,
7447
- resolver: (0, import_yup19.yupResolver)(couponSchema)
7473
+ resolver: (0, import_yup19.yupResolver)(data ? couponEditSchema : couponSchema)
7448
7474
  });
7449
7475
  React12.useEffect(() => {
7450
7476
  if (data) {