@timardex/cluemart-shared 1.7.21 → 1.7.23

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 (59) hide show
  1. package/dist/{ad-03NrHP3C.d.ts → ad-BZcVngc3.d.ts} +2 -2
  2. package/dist/{ad-CplXHfPk.d.mts → ad-DChdPAkx.d.mts} +2 -2
  3. package/dist/{affiliate-BLSH2QdJ.d.ts → affiliate-BM1h7pwc.d.ts} +2 -2
  4. package/dist/{affiliate-hXxPpl_S.d.mts → affiliate-C1EG9HbN.d.mts} +2 -2
  5. package/dist/auth/index.cjs +3 -0
  6. package/dist/auth/index.cjs.map +1 -1
  7. package/dist/auth/index.d.mts +3 -3
  8. package/dist/auth/index.d.ts +3 -3
  9. package/dist/auth/index.mjs +1 -1
  10. package/dist/{chunk-Y3YFLYN4.mjs → chunk-3VDFBRRK.mjs} +4 -1
  11. package/dist/chunk-3VDFBRRK.mjs.map +1 -0
  12. package/dist/{chunk-LBEJECG3.mjs → chunk-BEN24YAH.mjs} +26 -2
  13. package/dist/chunk-BEN24YAH.mjs.map +1 -0
  14. package/dist/{chunk-2QB6MIL2.mjs → chunk-LZQG3BQM.mjs} +2 -2
  15. package/dist/{contactUs-C13TqaIf.d.mts → contactUs-KVN1Iw60.d.mts} +1 -1
  16. package/dist/{contactUs-Cr4itlk6.d.ts → contactUs-l3ciX1_d.d.ts} +1 -1
  17. package/dist/coupon-BSiDzp4T.d.mts +39 -0
  18. package/dist/coupon-IFOTRBJR.d.ts +39 -0
  19. package/dist/formFields/index.d.mts +1 -1
  20. package/dist/formFields/index.d.ts +1 -1
  21. package/dist/formFields/index.mjs +1 -1
  22. package/dist/{global-8HQMiqbS.d.mts → global-BrnExI9t.d.mts} +5 -2
  23. package/dist/{global-DGrr26NH.d.ts → global-D8aPAI5b.d.ts} +5 -2
  24. package/dist/graphql/index.cjs +3 -0
  25. package/dist/graphql/index.cjs.map +1 -1
  26. package/dist/graphql/index.d.mts +5 -5
  27. package/dist/graphql/index.d.ts +5 -5
  28. package/dist/graphql/index.mjs +2 -2
  29. package/dist/hooks/index.cjs +128 -25
  30. package/dist/hooks/index.cjs.map +1 -1
  31. package/dist/hooks/index.d.mts +15 -6
  32. package/dist/hooks/index.d.ts +15 -6
  33. package/dist/hooks/index.mjs +127 -28
  34. package/dist/hooks/index.mjs.map +1 -1
  35. package/dist/index.cjs +28 -0
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.mts +43 -3
  38. package/dist/index.d.ts +43 -3
  39. package/dist/index.mjs +27 -0
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/map/index.d.mts +1 -1
  42. package/dist/map/index.d.ts +1 -1
  43. package/dist/{resourceActivities-BkC-3bF2.d.ts → resourceActivities-DIXjrgOD.d.ts} +1 -1
  44. package/dist/{resourceActivities-CowKiCCb.d.mts → resourceActivities-DuftR4Ts.d.mts} +1 -1
  45. package/dist/sharing/index.d.mts +1 -1
  46. package/dist/sharing/index.d.ts +1 -1
  47. package/dist/types/index.d.mts +7 -7
  48. package/dist/types/index.d.ts +7 -7
  49. package/dist/{user-CpWRig6p.d.ts → user-BY5AtgYc.d.ts} +1 -1
  50. package/dist/{user-DiJffpnd.d.mts → user-CjYZ7tJ4.d.mts} +1 -1
  51. package/dist/utils/index.cjs +25 -0
  52. package/dist/utils/index.cjs.map +1 -1
  53. package/dist/utils/index.d.mts +7 -4
  54. package/dist/utils/index.d.ts +7 -4
  55. package/dist/utils/index.mjs +3 -1
  56. package/package.json +1 -1
  57. package/dist/chunk-LBEJECG3.mjs.map +0 -1
  58. package/dist/chunk-Y3YFLYN4.mjs.map +0 -1
  59. /package/dist/{chunk-2QB6MIL2.mjs.map → chunk-LZQG3BQM.mjs.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
2
  import { DocumentNode } from 'graphql';
3
- import { A as AdminUpdateResourceType, C as ChatType, R as ReportChatUser, N as NotificationType, a as NotificationCount, b as ResourceActivityType } from '../resourceActivities-CowKiCCb.mjs';
4
- import { M as MutationResponse, E as EventType, c as EventListItemType, d as EventInfoType, U as UseGetResourcesByRegionOptions, P as PosterUsageType, e as RelationType, f as ResourceConnectionsType, V as VendorClaimTokenValidation, g as UnregisteredVendorType, h as VendorType, i as VendorInfoType, j as MyPendingVendorClaim, k as UserLicenceType, l as PostType, m as EnumPostType, G as GameDocType, n as GameLeaderboard } from '../global-8HQMiqbS.mjs';
5
- import { A as AuthMutationResponse, R as RefreshTokenMutationResponse, P as PartnerType, a as AdType, E as EnumAdStatus, b as AppSettingsType, S as SchoolType, c as SchoolReturnType } from '../ad-CplXHfPk.mjs';
3
+ import { A as AdminUpdateResourceType, C as ChatType, R as ReportChatUser, N as NotificationType, a as NotificationCount, b as ResourceActivityType } from '../resourceActivities-DuftR4Ts.mjs';
4
+ import { M as MutationResponse, E as EventType, c as EventListItemType, d as EventInfoType, U as UseGetResourcesByRegionOptions, P as PosterUsageType, e as RelationType, f as ResourceConnectionsType, V as VendorClaimTokenValidation, g as UnregisteredVendorType, h as VendorType, i as VendorInfoType, j as MyPendingVendorClaim, k as UserLicenceType, l as PostType, m as EnumPostType, G as GameDocType, n as GameLeaderboard } from '../global-BrnExI9t.mjs';
5
+ import { A as AuthMutationResponse, R as RefreshTokenMutationResponse, P as PartnerType, a as AdType, E as EnumAdStatus, b as AppSettingsType, S as SchoolType, c as SchoolReturnType } from '../ad-DChdPAkx.mjs';
6
6
  import { EnumEventDateStatus, EnumResourceType } from '../enums/index.mjs';
7
- import { S as SafeUserType, R as RedeemRewardMutationResponse, b as ResourceByUser, c as SubscriptionPlansResponse, d as SubscriptionStatusData } from '../user-DiJffpnd.mjs';
8
- import { A as AffiliateType } from '../affiliate-hXxPpl_S.mjs';
7
+ import { S as SafeUserType, R as RedeemRewardMutationResponse, b as ResourceByUser, c as SubscriptionPlansResponse, d as SubscriptionStatusData } from '../user-CjYZ7tJ4.mjs';
8
+ import { A as AffiliateType } from '../affiliate-C1EG9HbN.mjs';
9
9
  import 'react-hook-form';
10
10
  import '../images/index.mjs';
11
11
 
@@ -1,11 +1,11 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
2
  import { DocumentNode } from 'graphql';
3
- import { A as AdminUpdateResourceType, C as ChatType, R as ReportChatUser, N as NotificationType, a as NotificationCount, b as ResourceActivityType } from '../resourceActivities-BkC-3bF2.js';
4
- import { M as MutationResponse, E as EventType, c as EventListItemType, d as EventInfoType, U as UseGetResourcesByRegionOptions, P as PosterUsageType, e as RelationType, f as ResourceConnectionsType, V as VendorClaimTokenValidation, g as UnregisteredVendorType, h as VendorType, i as VendorInfoType, j as MyPendingVendorClaim, k as UserLicenceType, l as PostType, m as EnumPostType, G as GameDocType, n as GameLeaderboard } from '../global-DGrr26NH.js';
5
- import { A as AuthMutationResponse, R as RefreshTokenMutationResponse, P as PartnerType, a as AdType, E as EnumAdStatus, b as AppSettingsType, S as SchoolType, c as SchoolReturnType } from '../ad-03NrHP3C.js';
3
+ import { A as AdminUpdateResourceType, C as ChatType, R as ReportChatUser, N as NotificationType, a as NotificationCount, b as ResourceActivityType } from '../resourceActivities-DIXjrgOD.js';
4
+ import { M as MutationResponse, E as EventType, c as EventListItemType, d as EventInfoType, U as UseGetResourcesByRegionOptions, P as PosterUsageType, e as RelationType, f as ResourceConnectionsType, V as VendorClaimTokenValidation, g as UnregisteredVendorType, h as VendorType, i as VendorInfoType, j as MyPendingVendorClaim, k as UserLicenceType, l as PostType, m as EnumPostType, G as GameDocType, n as GameLeaderboard } from '../global-D8aPAI5b.js';
5
+ import { A as AuthMutationResponse, R as RefreshTokenMutationResponse, P as PartnerType, a as AdType, E as EnumAdStatus, b as AppSettingsType, S as SchoolType, c as SchoolReturnType } from '../ad-BZcVngc3.js';
6
6
  import { EnumEventDateStatus, EnumResourceType } from '../enums/index.js';
7
- import { S as SafeUserType, R as RedeemRewardMutationResponse, b as ResourceByUser, c as SubscriptionPlansResponse, d as SubscriptionStatusData } from '../user-CpWRig6p.js';
8
- import { A as AffiliateType } from '../affiliate-BLSH2QdJ.js';
7
+ import { S as SafeUserType, R as RedeemRewardMutationResponse, b as ResourceByUser, c as SubscriptionPlansResponse, d as SubscriptionStatusData } from '../user-BY5AtgYc.js';
8
+ import { A as AffiliateType } from '../affiliate-BM1h7pwc.js';
9
9
  import 'react-hook-form';
10
10
  import '../images/index.js';
11
11
 
@@ -140,7 +140,7 @@ import {
140
140
  useUpdateUser,
141
141
  useUpdateVendor,
142
142
  useUpdateVendorInfo
143
- } from "../chunk-2QB6MIL2.mjs";
143
+ } from "../chunk-LZQG3BQM.mjs";
144
144
  import {
145
145
  GET_EVENT,
146
146
  GET_EVENT_INFO,
@@ -162,7 +162,7 @@ import {
162
162
  useRequestPasswordReset,
163
163
  useResetPassword,
164
164
  useValidateVerificationToken
165
- } from "../chunk-Y3YFLYN4.mjs";
165
+ } from "../chunk-3VDFBRRK.mjs";
166
166
  import "../chunk-X3OLM35T.mjs";
167
167
  export {
168
168
  ACTIVATE_VENDOR_CLAIM_MUTATION,
@@ -45,6 +45,7 @@ __export(hooks_exports, {
45
45
  useAffiliateForm: () => useAffiliateForm,
46
46
  useAppSettingsForm: () => useAppSettingsForm,
47
47
  useContactUsForm: () => useContactUsForm,
48
+ useCouponForm: () => useCouponForm,
48
49
  useEventForm: () => useEventForm,
49
50
  useEventInfoForm: () => useEventInfoForm,
50
51
  useLocationSearch: () => useLocationSearch,
@@ -1969,8 +1970,8 @@ var vendorSchema = globalResourceSchema.shape({
1969
1970
  });
1970
1971
  var unregisteredVendorSchema = yup3.object().shape({
1971
1972
  categoryIds: yup3.array().of(yup3.string().defined()).min(1, "Category list must contain at least one item").required("Categories are required"),
1972
- dateTime: yup3.array().of(dateTimeSchema).min(1, "DateTime list must contain at least one item").required("DateTime is required"),
1973
- email: emailOptionalSchema,
1973
+ dateTime: yup3.array().of(dateTimeSchema).min(1, "Select at least one event date").required("DateTime is required"),
1974
+ email: emailRequiredSchema,
1974
1975
  inviterId: yup3.string().required("Inviter ID is required"),
1975
1976
  name: yup3.string().label("Stallholder Name").trim().min(3, "Name must be at least 3 characters").required("Name is required"),
1976
1977
  region: yup3.string().label("Region").required("Region is required")
@@ -2986,11 +2987,14 @@ var VENDOR_DATETIME_FIELDS_FRAGMENT = import_client3.gql`
2986
2987
  `;
2987
2988
  var VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT = import_client3.gql`
2988
2989
  fragment VendorProductListFields on VendorProductListType {
2990
+ _id
2991
+ createdAt
2989
2992
  description
2990
2993
  name
2991
2994
  price
2992
2995
  priceUnit
2993
2996
  productGroups
2997
+ updatedAt
2994
2998
  }
2995
2999
  `;
2996
3000
  var VENDOR = import_client3.gql`
@@ -5759,6 +5763,38 @@ var appSettingsSchema = yup9.object({
5759
5763
  minimumRedeemableAffiliatePoints: yup9.number().label("Minimum Redeemable Affiliate Points").min(0, "Minimum Redeemable Affiliate Points must be greater than 0").required("Minimum Redeemable Affiliate Points is required")
5760
5764
  });
5761
5765
 
5766
+ // src/yupSchema/coupon.ts
5767
+ var yup10 = __toESM(require("yup"));
5768
+ var couponOptionSchema = yup10.object().shape({
5769
+ buy: yup10.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("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"),
5770
+ get: yup10.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("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"),
5771
+ unit: yup10.string().label("Unit").trim().required("Unit is required")
5772
+ });
5773
+ var couponSchema = yup10.object().shape({
5774
+ couponDescription: yup10.string().label("Description").trim().required("Description is required"),
5775
+ couponOption: couponOptionSchema,
5776
+ 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) => {
5777
+ if (!value) return false;
5778
+ return new Date(value) > /* @__PURE__ */ new Date();
5779
+ }).when("startDate", {
5780
+ is: (val) => !!val,
5781
+ then: (schema) => schema.test(
5782
+ "is-after-start",
5783
+ "End date must be after start date",
5784
+ function(value) {
5785
+ const { startDate } = this.parent;
5786
+ if (!value || !startDate) return false;
5787
+ return new Date(value) > new Date(startDate);
5788
+ }
5789
+ )
5790
+ }),
5791
+ participantProductId: yup10.string().label("Participant Product").trim().required("Participant product is required"),
5792
+ 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) => {
5793
+ if (!value) return false;
5794
+ return new Date(value) > /* @__PURE__ */ new Date();
5795
+ })
5796
+ });
5797
+
5762
5798
  // src/hooks/utils.ts
5763
5799
  var defaultLocation = {
5764
5800
  city: "",
@@ -5846,7 +5882,7 @@ var defaultVendorFormValues = {
5846
5882
  var defaultUnregisteredVendorFormValues = {
5847
5883
  categoryIds: [],
5848
5884
  dateTime: [],
5849
- email: null,
5885
+ email: "",
5850
5886
  inviterId: "",
5851
5887
  name: "",
5852
5888
  region: ""
@@ -6586,12 +6622,12 @@ var import_react = __toESM(require("react"));
6586
6622
  var import_react_hook_form12 = require("react-hook-form");
6587
6623
 
6588
6624
  // src/yupSchema/contactUs.ts
6589
- var yup10 = __toESM(require("yup"));
6590
- var contactUsSchema = yup10.object().shape({
6625
+ var yup11 = __toESM(require("yup"));
6626
+ var contactUsSchema = yup11.object().shape({
6591
6627
  email: emailRequiredSchema,
6592
- firstName: yup10.string().label("First Name").required("First name is required"),
6593
- lastName: yup10.string().label("Last Name").required("Last name is required"),
6594
- message: yup10.string().label("Message").required("Message is required")
6628
+ firstName: yup11.string().label("First Name").required("First name is required"),
6629
+ lastName: yup11.string().label("Last Name").required("Last name is required"),
6630
+ message: yup11.string().label("Message").required("Message is required")
6595
6631
  });
6596
6632
 
6597
6633
  // src/hooks/useContactUsForm.ts
@@ -6933,15 +6969,15 @@ var import_react5 = require("react");
6933
6969
  var import_react_hook_form17 = require("react-hook-form");
6934
6970
 
6935
6971
  // src/yupSchema/school.ts
6936
- var yup11 = __toESM(require("yup"));
6937
- var schoolSchema = yup11.object().shape({
6938
- active: yup11.boolean().required("Active is required"),
6972
+ var yup12 = __toESM(require("yup"));
6973
+ var schoolSchema = yup12.object().shape({
6974
+ active: yup12.boolean().required("Active is required"),
6939
6975
  contactDetails: contactDetailsSchema,
6940
6976
  location: locationSchema,
6941
- name: yup11.string().trim().required("Name is required"),
6942
- region: yup11.string().trim().required("Region is required"),
6943
- socialMedia: yup11.array().of(socialMediaSchema).nullable().default(null),
6944
- studentCount: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Student Count").nullable().typeError("Student count must be a number").min(
6977
+ name: yup12.string().trim().required("Name is required"),
6978
+ region: yup12.string().trim().required("Region is required"),
6979
+ socialMedia: yup12.array().of(socialMediaSchema).nullable().default(null),
6980
+ studentCount: yup12.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Student Count").nullable().typeError("Student count must be a number").min(
6945
6981
  SCHOOL_MIN_STUDENT_COUNT,
6946
6982
  `Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
6947
6983
  ).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
@@ -7036,29 +7072,29 @@ var import_react6 = require("react");
7036
7072
  var import_react_hook_form18 = require("react-hook-form");
7037
7073
 
7038
7074
  // src/yupSchema/affiliate.ts
7039
- var yup12 = __toESM(require("yup"));
7040
- var affiliateContactDetailsSchema = yup12.object({
7041
- mobilePhone: yup12.string().trim().required("Mobile phone is required").test(
7075
+ var yup13 = __toESM(require("yup"));
7076
+ var affiliateContactDetailsSchema = yup13.object({
7077
+ mobilePhone: yup13.string().trim().required("Mobile phone is required").test(
7042
7078
  "mobile-phone",
7043
7079
  "Mobile must start with 02 and be 9\u201311 digits",
7044
7080
  (value) => mobileRegex.test(value)
7045
7081
  )
7046
7082
  });
7047
- var bankAccountDetailsSchema = yup12.object({
7048
- accountHolderName: yup12.string().required("Account holder name is required"),
7049
- accountNumber: yup12.string().required("Account number is required for bank transfer").matches(
7083
+ var bankAccountDetailsSchema = yup13.object({
7084
+ accountHolderName: yup13.string().required("Account holder name is required"),
7085
+ accountNumber: yup13.string().required("Account number is required for bank transfer").matches(
7050
7086
  nzBankAccountRegex,
7051
7087
  "Account number must be in format: XX-XXXX-XXXXXXX-XX"
7052
7088
  ).trim()
7053
7089
  });
7054
- var affiliateSchema = yup12.object().shape({
7090
+ var affiliateSchema = yup13.object().shape({
7055
7091
  bankAccountDetails: bankAccountDetailsSchema.required(
7056
7092
  "Bank account details are required"
7057
7093
  ),
7058
7094
  contactDetails: affiliateContactDetailsSchema.required(
7059
7095
  "Contact details are required"
7060
7096
  ),
7061
- irdNumber: yup12.string().trim().required("IRD number is required").matches(
7097
+ irdNumber: yup13.string().trim().required("IRD number is required").matches(
7062
7098
  nzIrdNumberRegex,
7063
7099
  "IRD number must be in format: XXX-XXX-XX or XXX-XXX-XXX"
7064
7100
  ).test(
@@ -7067,11 +7103,11 @@ var affiliateSchema = yup12.object().shape({
7067
7103
  (value) => !!value && isValidIrdNumber(value)
7068
7104
  ),
7069
7105
  location: locationSchema.required("Location is required"),
7070
- participantType: yup12.mixed().oneOf(
7106
+ participantType: yup13.mixed().oneOf(
7071
7107
  Object.values(EnumAffiliateParticipantType),
7072
7108
  "Please select a valid participant type"
7073
7109
  ).required("Participant type is required"),
7074
- socialMedia: yup12.array().of(socialMediaSchema).nullable().default(null)
7110
+ socialMedia: yup13.array().of(socialMediaSchema).nullable().default(null)
7075
7111
  });
7076
7112
 
7077
7113
  // src/hooks/useAffiliateForm.ts
@@ -7131,6 +7167,72 @@ function useAffiliateForm(data) {
7131
7167
  watch
7132
7168
  };
7133
7169
  }
7170
+
7171
+ // src/hooks/useCouponForm.tsx
7172
+ var import_yup19 = require("@hookform/resolvers/yup");
7173
+ var React12 = __toESM(require("react"));
7174
+ var import_react_hook_form19 = require("react-hook-form");
7175
+ var defaultValues11 = {
7176
+ couponDescription: "",
7177
+ couponOption: {
7178
+ buy: 0,
7179
+ get: 0,
7180
+ unit: ""
7181
+ },
7182
+ endDate: /* @__PURE__ */ new Date(),
7183
+ participantProductId: "",
7184
+ startDate: /* @__PURE__ */ new Date()
7185
+ };
7186
+ function useCouponForm(data) {
7187
+ const {
7188
+ control,
7189
+ formState,
7190
+ getValues,
7191
+ handleSubmit,
7192
+ reset,
7193
+ setValue,
7194
+ watch
7195
+ } = (0, import_react_hook_form19.useForm)({
7196
+ defaultValues: defaultValues11,
7197
+ resolver: (0, import_yup19.yupResolver)(couponSchema)
7198
+ });
7199
+ React12.useEffect(() => {
7200
+ if (data) {
7201
+ reset({
7202
+ couponDescription: data.couponDescription,
7203
+ couponOption: data.couponOption,
7204
+ endDate: data.endDate,
7205
+ participantProductId: data.participantProductId,
7206
+ startDate: data.startDate
7207
+ });
7208
+ } else {
7209
+ reset(defaultValues11);
7210
+ }
7211
+ }, [data]);
7212
+ const {
7213
+ couponDescription,
7214
+ couponOption,
7215
+ endDate,
7216
+ participantProductId,
7217
+ startDate
7218
+ } = getValues();
7219
+ return {
7220
+ control,
7221
+ fields: {
7222
+ couponDescription,
7223
+ couponOption,
7224
+ endDate,
7225
+ participantProductId,
7226
+ startDate
7227
+ },
7228
+ formState,
7229
+ getValues,
7230
+ handleSubmit,
7231
+ reset,
7232
+ setValue,
7233
+ watch
7234
+ };
7235
+ }
7134
7236
  // Annotate the CommonJS export names for ESM import in node:
7135
7237
  0 && (module.exports = {
7136
7238
  defaultAffiliateFormValues,
@@ -7148,6 +7250,7 @@ function useAffiliateForm(data) {
7148
7250
  useAffiliateForm,
7149
7251
  useAppSettingsForm,
7150
7252
  useContactUsForm,
7253
+ useCouponForm,
7151
7254
  useEventForm,
7152
7255
  useEventInfoForm,
7153
7256
  useLocationSearch,