@timardex/cluemart-shared 1.7.24 → 1.7.25

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.
@@ -1,5 +1,5 @@
1
1
  import { EnumResourceType } from './enums/index.js';
2
- import { am as PromoCodeType, L as LocationType, ay as SocialMediaType, a9 as OwnerType, J as CreateFormData } from './global-D8aPAI5b.js';
2
+ import { am as PromoCodeType, L as LocationType, ay as SocialMediaType, a9 as OwnerType, J as CreateFormData, ax as ResourceImageType, aG as VendorProductList } from './global-D8aPAI5b.js';
3
3
  import { U as UserFormData } from './user-BY5AtgYc.js';
4
4
 
5
5
  declare enum EnumAffiliateParticipantType {
@@ -70,4 +70,48 @@ interface AffiliateType {
70
70
  type AffiliateFormData = Omit<AffiliateDetailsType, "email" | "firstName" | "lastName">;
71
71
  type CreateAffiliateFormData = CreateFormData<AffiliateFormData>;
72
72
 
73
- export { type AffiliateType as A, type CreateAffiliateFormData as C, EnumAffiliateParticipantType as E, type RedeemHistoryType as R, type AffiliateFormData as a, type AffiliateBankAccountDetailsType as b, type AffiliateContactDetails as c, type AffiliateDetailsType as d, type AffiliateResourceType as e, type AffiliateRewardType as f, type AffiliateUserDefaultFields as g, EnumAffiliateRewardType as h };
73
+ type CouponTypeOption = {
74
+ buy: number;
75
+ get: number;
76
+ unit: string;
77
+ };
78
+ type ProductCouponFormData = {
79
+ couponDescription: string;
80
+ couponOption: CouponTypeOption;
81
+ endDate: Date;
82
+ participantProductId: string;
83
+ startDate: Date;
84
+ };
85
+ type CreateProductCouponFormData = CreateFormData<ProductCouponFormData>;
86
+ type CouponParticipantUserType = {
87
+ couponCount: number;
88
+ couponRedeemedAt: Date | null;
89
+ createdAt: Date;
90
+ updatedAt: Date | null;
91
+ userId: string;
92
+ };
93
+ type CouponCodeType = {
94
+ code: string;
95
+ qrCode: ResourceImageType;
96
+ };
97
+ type ProductCouponType = Omit<ProductCouponFormData, "participantProductId"> & {
98
+ _id: string;
99
+ active: boolean;
100
+ couponCode: CouponCodeType;
101
+ createdAt: Date;
102
+ participantProduct: VendorProductList;
103
+ participantUsers: CouponParticipantUserType[] | null;
104
+ updatedAt: Date | null;
105
+ };
106
+ type CouponTypeOptionWithType = Omit<ProductCouponType, "_id" | "participantUsers">;
107
+ type CreateCouponTypeOptionParams = Pick<ProductCouponType, "couponCode" | "couponDescription" | "couponOption" | "createdAt" | "endDate" | "participantProduct" | "startDate">;
108
+ interface CouponType {
109
+ _id: string;
110
+ active: boolean;
111
+ createdAt: Date;
112
+ deletedAt: Date | null;
113
+ productCoupons: ProductCouponType[];
114
+ updatedAt: Date | null;
115
+ }
116
+
117
+ export { type AffiliateType as A, type CouponType as C, EnumAffiliateParticipantType as E, type ProductCouponFormData as P, type RedeemHistoryType as R, type AffiliateFormData as a, type CreateAffiliateFormData as b, type CreateProductCouponFormData as c, type AffiliateBankAccountDetailsType as d, type AffiliateContactDetails as e, type AffiliateDetailsType as f, type AffiliateResourceType as g, type AffiliateRewardType as h, type AffiliateUserDefaultFields as i, type CouponCodeType as j, type CouponParticipantUserType as k, type CouponTypeOption as l, type CouponTypeOptionWithType as m, type CreateCouponTypeOptionParams as n, EnumAffiliateRewardType as o, type ProductCouponType as p };
@@ -1,5 +1,5 @@
1
1
  import { EnumResourceType } from './enums/index.mjs';
2
- import { am as PromoCodeType, L as LocationType, ay as SocialMediaType, a9 as OwnerType, J as CreateFormData } from './global-BrnExI9t.mjs';
2
+ import { am as PromoCodeType, L as LocationType, ay as SocialMediaType, a9 as OwnerType, J as CreateFormData, ax as ResourceImageType, aG as VendorProductList } from './global-BrnExI9t.mjs';
3
3
  import { U as UserFormData } from './user-CjYZ7tJ4.mjs';
4
4
 
5
5
  declare enum EnumAffiliateParticipantType {
@@ -70,4 +70,48 @@ interface AffiliateType {
70
70
  type AffiliateFormData = Omit<AffiliateDetailsType, "email" | "firstName" | "lastName">;
71
71
  type CreateAffiliateFormData = CreateFormData<AffiliateFormData>;
72
72
 
73
- export { type AffiliateType as A, type CreateAffiliateFormData as C, EnumAffiliateParticipantType as E, type RedeemHistoryType as R, type AffiliateFormData as a, type AffiliateBankAccountDetailsType as b, type AffiliateContactDetails as c, type AffiliateDetailsType as d, type AffiliateResourceType as e, type AffiliateRewardType as f, type AffiliateUserDefaultFields as g, EnumAffiliateRewardType as h };
73
+ type CouponTypeOption = {
74
+ buy: number;
75
+ get: number;
76
+ unit: string;
77
+ };
78
+ type ProductCouponFormData = {
79
+ couponDescription: string;
80
+ couponOption: CouponTypeOption;
81
+ endDate: Date;
82
+ participantProductId: string;
83
+ startDate: Date;
84
+ };
85
+ type CreateProductCouponFormData = CreateFormData<ProductCouponFormData>;
86
+ type CouponParticipantUserType = {
87
+ couponCount: number;
88
+ couponRedeemedAt: Date | null;
89
+ createdAt: Date;
90
+ updatedAt: Date | null;
91
+ userId: string;
92
+ };
93
+ type CouponCodeType = {
94
+ code: string;
95
+ qrCode: ResourceImageType;
96
+ };
97
+ type ProductCouponType = Omit<ProductCouponFormData, "participantProductId"> & {
98
+ _id: string;
99
+ active: boolean;
100
+ couponCode: CouponCodeType;
101
+ createdAt: Date;
102
+ participantProduct: VendorProductList;
103
+ participantUsers: CouponParticipantUserType[] | null;
104
+ updatedAt: Date | null;
105
+ };
106
+ type CouponTypeOptionWithType = Omit<ProductCouponType, "_id" | "participantUsers">;
107
+ type CreateCouponTypeOptionParams = Pick<ProductCouponType, "couponCode" | "couponDescription" | "couponOption" | "createdAt" | "endDate" | "participantProduct" | "startDate">;
108
+ interface CouponType {
109
+ _id: string;
110
+ active: boolean;
111
+ createdAt: Date;
112
+ deletedAt: Date | null;
113
+ productCoupons: ProductCouponType[];
114
+ updatedAt: Date | null;
115
+ }
116
+
117
+ export { type AffiliateType as A, type CouponType as C, EnumAffiliateParticipantType as E, type ProductCouponFormData as P, type RedeemHistoryType as R, type AffiliateFormData as a, type CreateAffiliateFormData as b, type CreateProductCouponFormData as c, type AffiliateBankAccountDetailsType as d, type AffiliateContactDetails as e, type AffiliateDetailsType as f, type AffiliateResourceType as g, type AffiliateRewardType as h, type AffiliateUserDefaultFields as i, type CouponCodeType as j, type CouponParticipantUserType as k, type CouponTypeOption as l, type CouponTypeOptionWithType as m, type CreateCouponTypeOptionParams as n, EnumAffiliateRewardType as o, type ProductCouponType as p };
@@ -51,6 +51,7 @@ __export(graphql_exports, {
51
51
  useCreateAd: () => useCreateAd,
52
52
  useCreateBulkNotifications: () => useCreateBulkNotifications,
53
53
  useCreateCheckoutSession: () => useCreateCheckoutSession,
54
+ useCreateCoupon: () => useCreateCoupon,
54
55
  useCreateCustomerPortal: () => useCreateCustomerPortal,
55
56
  useCreateEvent: () => useCreateEvent,
56
57
  useCreateEventInfo: () => useCreateEventInfo,
@@ -70,6 +71,7 @@ __export(graphql_exports, {
70
71
  useDeleteAffiliate: () => useDeleteAffiliate,
71
72
  useDeleteAllNotifications: () => useDeleteAllNotifications,
72
73
  useDeleteChat: () => useDeleteChat,
74
+ useDeleteCoupon: () => useDeleteCoupon,
73
75
  useDeleteEvent: () => useDeleteEvent,
74
76
  useDeleteNotification: () => useDeleteNotification,
75
77
  useDeletePartner: () => useDeletePartner,
@@ -88,6 +90,8 @@ __export(graphql_exports, {
88
90
  useGetChat: () => useGetChat,
89
91
  useGetChatSubscription: () => useGetChatSubscription,
90
92
  useGetChatsByRegion: () => useGetChatsByRegion,
93
+ useGetCoupon: () => useGetCoupon,
94
+ useGetCoupons: () => useGetCoupons,
91
95
  useGetEvent: () => useGetEvent,
92
96
  useGetEventByPlaceId: () => useGetEventByPlaceId,
93
97
  useGetEventInfo: () => useGetEventInfo,
@@ -166,6 +170,7 @@ __export(graphql_exports, {
166
170
  useUpdateAd: () => useUpdateAd,
167
171
  useUpdateAffiliateDetails: () => useUpdateAffiliateDetails,
168
172
  useUpdateAppSettings: () => useUpdateAppSettings,
173
+ useUpdateCoupon: () => useUpdateCoupon,
169
174
  useUpdateDailyClueGame: () => useUpdateDailyClueGame,
170
175
  useUpdateEvent: () => useUpdateEvent,
171
176
  useUpdateEventInfo: () => useUpdateEventInfo,
@@ -2985,7 +2990,7 @@ var useGetVendor = (_id) => {
2985
2990
  variables: { _id }
2986
2991
  }
2987
2992
  );
2988
- const vendor = data?.vendor;
2993
+ const vendor = data?.vendor || null;
2989
2994
  return { error, loading, refetch, vendor };
2990
2995
  };
2991
2996
  var useGetVendorsByRegion = (region, options) => {
@@ -4846,6 +4851,153 @@ var useAssignAffiliateBonusReward = () => {
4846
4851
  });
4847
4852
  return { assignAffiliateBonusReward, error, loading };
4848
4853
  };
4854
+
4855
+ // src/graphql/hooks/coupon/hooksMutation.ts
4856
+ var import_client80 = require("@apollo/client");
4857
+
4858
+ // src/graphql/mutations/coupon.ts
4859
+ var import_client79 = require("@apollo/client");
4860
+
4861
+ // src/graphql/queries/coupon.ts
4862
+ var import_client78 = require("@apollo/client");
4863
+ var COUPON_CODE_FIELDS_FRAGMENT = import_client78.gql`
4864
+ fragment CouponCodeFields on CouponCodeType {
4865
+ code
4866
+ qrCode {
4867
+ ...ResourceImageFields
4868
+ }
4869
+ }
4870
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
4871
+ `;
4872
+ var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = import_client78.gql`
4873
+ fragment CouponParticipantUserFields on CouponParticipantUserType {
4874
+ couponCount
4875
+ couponRedeemedAt
4876
+ createdAt
4877
+ updatedAt
4878
+ userId
4879
+ }
4880
+ `;
4881
+ var PRODUCT_COUPON_FIELDS_FRAGMENT = import_client78.gql`
4882
+ fragment ProductCouponFields on ProductCouponType {
4883
+ _id
4884
+ active
4885
+ couponCode {
4886
+ ...CouponCodeFields
4887
+ }
4888
+ couponDescription
4889
+ couponOption
4890
+ createdAt
4891
+ endDate
4892
+ participantProduct {
4893
+ ...VendorProductListFields
4894
+ }
4895
+ participantUsers {
4896
+ ...CouponParticipantUserFields
4897
+ }
4898
+ startDate
4899
+ updatedAt
4900
+ }
4901
+ ${COUPON_CODE_FIELDS_FRAGMENT}
4902
+ ${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
4903
+ ${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
4904
+ `;
4905
+ var COUPON = import_client78.gql`
4906
+ fragment CouponFields on CouponType {
4907
+ _id
4908
+ active
4909
+ productCoupons {
4910
+ ...ProductCouponFields
4911
+ }
4912
+ createdAt
4913
+ deletedAt
4914
+ updatedAt
4915
+ }
4916
+ ${PRODUCT_COUPON_FIELDS_FRAGMENT}
4917
+ ${COUPON_CODE_FIELDS_FRAGMENT}
4918
+ ${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
4919
+ `;
4920
+ var GET_COUPONS = import_client78.gql`
4921
+ query getCoupons {
4922
+ coupons {
4923
+ ...CouponFields
4924
+ }
4925
+ }
4926
+ ${COUPON}
4927
+ `;
4928
+ var GET_COUPON = import_client78.gql`
4929
+ query getCoupon($_id: ID!) {
4930
+ coupon(_id: $_id) {
4931
+ ...CouponFields
4932
+ }
4933
+ }
4934
+ ${COUPON}
4935
+ `;
4936
+
4937
+ // src/graphql/mutations/coupon.ts
4938
+ var CREATE_COUPON_MUTATION = import_client79.gql`
4939
+ mutation createCoupon($input: CouponInputType!) {
4940
+ createCoupon(input: $input) {
4941
+ data {
4942
+ ...CouponFields
4943
+ }
4944
+ message
4945
+ }
4946
+ }
4947
+ ${COUPON}
4948
+ `;
4949
+ var UPDATE_COUPON_MUTATION = import_client79.gql`
4950
+ mutation updateCoupon($_id: ID!, $input: CouponInputType!) {
4951
+ updateCoupon(_id: $_id, input: $input) {
4952
+ data {
4953
+ ...CouponFields
4954
+ }
4955
+ message
4956
+ }
4957
+ }
4958
+ ${COUPON}
4959
+ `;
4960
+ var DELETE_COUPON_MUTATION = import_client79.gql`
4961
+ mutation deleteCoupon($_id: ID!) {
4962
+ deleteCoupon(_id: $_id) {
4963
+ data
4964
+ message
4965
+ }
4966
+ }
4967
+ `;
4968
+
4969
+ // src/graphql/hooks/coupon/hooksMutation.ts
4970
+ var useCreateCoupon = () => {
4971
+ const [createCoupon, { loading, error }] = (0, import_client80.useMutation)(CREATE_COUPON_MUTATION);
4972
+ return { createCoupon, error, loading };
4973
+ };
4974
+ var useUpdateCoupon = () => {
4975
+ const [updateCoupon, { loading, error }] = (0, import_client80.useMutation)(UPDATE_COUPON_MUTATION);
4976
+ return { error, loading, updateCoupon };
4977
+ };
4978
+ var useDeleteCoupon = () => {
4979
+ const [deleteCoupon, { loading, error }] = (0, import_client80.useMutation)(DELETE_COUPON_MUTATION);
4980
+ return { deleteCoupon, error, loading };
4981
+ };
4982
+
4983
+ // src/graphql/hooks/coupon/hooksQuery.ts
4984
+ var import_client81 = require("@apollo/client");
4985
+ var useGetCoupons = () => {
4986
+ const { loading, error, data, refetch } = (0, import_client81.useQuery)(GET_COUPONS, {
4987
+ fetchPolicy: "network-only"
4988
+ });
4989
+ const coupons = data?.coupons || [];
4990
+ return { coupons, error, loading, refetch };
4991
+ };
4992
+ var useGetCoupon = (_id) => {
4993
+ const { loading, error, data, refetch } = (0, import_client81.useQuery)(GET_COUPON, {
4994
+ fetchPolicy: "network-only",
4995
+ skip: !_id || _id === "",
4996
+ variables: { _id }
4997
+ });
4998
+ const coupon = data?.coupon || null;
4999
+ return { coupon, error, loading, refetch };
5000
+ };
4849
5001
  // Annotate the CommonJS export names for ESM import in node:
4850
5002
  0 && (module.exports = {
4851
5003
  ACTIVATE_VENDOR_CLAIM_MUTATION,
@@ -4879,6 +5031,7 @@ var useAssignAffiliateBonusReward = () => {
4879
5031
  useCreateAd,
4880
5032
  useCreateBulkNotifications,
4881
5033
  useCreateCheckoutSession,
5034
+ useCreateCoupon,
4882
5035
  useCreateCustomerPortal,
4883
5036
  useCreateEvent,
4884
5037
  useCreateEventInfo,
@@ -4898,6 +5051,7 @@ var useAssignAffiliateBonusReward = () => {
4898
5051
  useDeleteAffiliate,
4899
5052
  useDeleteAllNotifications,
4900
5053
  useDeleteChat,
5054
+ useDeleteCoupon,
4901
5055
  useDeleteEvent,
4902
5056
  useDeleteNotification,
4903
5057
  useDeletePartner,
@@ -4916,6 +5070,8 @@ var useAssignAffiliateBonusReward = () => {
4916
5070
  useGetChat,
4917
5071
  useGetChatSubscription,
4918
5072
  useGetChatsByRegion,
5073
+ useGetCoupon,
5074
+ useGetCoupons,
4919
5075
  useGetEvent,
4920
5076
  useGetEventByPlaceId,
4921
5077
  useGetEventInfo,
@@ -4994,6 +5150,7 @@ var useAssignAffiliateBonusReward = () => {
4994
5150
  useUpdateAd,
4995
5151
  useUpdateAffiliateDetails,
4996
5152
  useUpdateAppSettings,
5153
+ useUpdateCoupon,
4997
5154
  useUpdateDailyClueGame,
4998
5155
  useUpdateEvent,
4999
5156
  useUpdateEventInfo,