@timardex/cluemart-shared 1.5.783 → 1.5.785

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 (44) hide show
  1. package/dist/{affiliate-BiT2X-2N.d.mts → affiliate-DUTVjle1.d.mts} +15 -6
  2. package/dist/{affiliate--dA3h3nC.d.ts → affiliate-aeLUPuKt.d.ts} +15 -6
  3. package/dist/{chunk-52Y5C6F4.mjs → chunk-BAK5L4MW.mjs} +1 -1
  4. package/dist/{chunk-52Y5C6F4.mjs.map → chunk-BAK5L4MW.mjs.map} +1 -1
  5. package/dist/{chunk-I2WBC4RV.mjs → chunk-INWSDO7K.mjs} +2 -2
  6. package/dist/{chunk-OTQQWZUD.mjs → chunk-LXQSIMDY.mjs} +3 -5
  7. package/dist/chunk-LXQSIMDY.mjs.map +1 -0
  8. package/dist/{chunk-U7QU7YDK.mjs → chunk-MDN75KZN.mjs} +2 -2
  9. package/dist/{chunk-3UZKSUNV.mjs → chunk-YYRWWHUW.mjs} +21 -3
  10. package/dist/{chunk-3UZKSUNV.mjs.map → chunk-YYRWWHUW.mjs.map} +1 -1
  11. package/dist/formFields/index.cjs.map +1 -1
  12. package/dist/formFields/index.mjs +3 -3
  13. package/dist/graphql/index.cjs +20 -2
  14. package/dist/graphql/index.cjs.map +1 -1
  15. package/dist/graphql/index.d.mts +1 -1
  16. package/dist/graphql/index.d.ts +1 -1
  17. package/dist/graphql/index.mjs +1 -1
  18. package/dist/hooks/index.cjs +96 -7
  19. package/dist/hooks/index.cjs.map +1 -1
  20. package/dist/hooks/index.d.mts +4 -1
  21. package/dist/hooks/index.d.ts +4 -1
  22. package/dist/hooks/index.mjs +80 -10
  23. package/dist/hooks/index.mjs.map +1 -1
  24. package/dist/index.cjs +21 -5
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.mts +14 -5
  27. package/dist/index.d.ts +14 -5
  28. package/dist/index.mjs +21 -5
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/sharing/index.cjs.map +1 -1
  31. package/dist/sharing/index.mjs +3 -3
  32. package/dist/types/index.cjs.map +1 -1
  33. package/dist/types/index.d.mts +1 -1
  34. package/dist/types/index.d.ts +1 -1
  35. package/dist/types/index.mjs +1 -1
  36. package/dist/utils/index.cjs +1 -3
  37. package/dist/utils/index.cjs.map +1 -1
  38. package/dist/utils/index.d.mts +1 -1
  39. package/dist/utils/index.d.ts +1 -1
  40. package/dist/utils/index.mjs +2 -2
  41. package/package.json +1 -1
  42. package/dist/chunk-OTQQWZUD.mjs.map +0 -1
  43. /package/dist/{chunk-I2WBC4RV.mjs.map → chunk-INWSDO7K.mjs.map} +0 -0
  44. /package/dist/{chunk-U7QU7YDK.mjs.map → chunk-MDN75KZN.mjs.map} +0 -0
@@ -4,7 +4,7 @@ import { EnumResourceType, EnumEventDateStatus } from '../enums/index.mjs';
4
4
  import { A as AuthPayloadType, R as RefreshTokenPayloadType, S as SafeUserType, a as RedeemRewardResponse, P as PartnerType, b as ResourceByUser, c as AdType, E as EnumAdStatus, d as SubscriptionPlansResponse, e as SubscriptionStatusData, f as AppSettingsType, g as SchoolReturnType, h as SchoolType } from '../ad-kAjUceeE.mjs';
5
5
  import { C as ChatType, R as ReportChatUser, N as NotificationCount, a as NotificationType, b as ResourceActivityType } from '../resourceActivities-zczOntNk.mjs';
6
6
  import { E as EventType, c as EventListItemType, d as EventInfoType, U as UseGetResourcesByRegionOptions, e as RelationType, f as ResourceConnectionsType, g as UnregisteredVendorType, V as VendorType, h as VendorInfoType, i as UserLicenceType, P as PostType, j as EnumPostType, G as GameDocType, k as GameLeaderboard } from '../global-BUUfmCo7.mjs';
7
- import { A as AffiliateType } from '../affiliate-BiT2X-2N.mjs';
7
+ import { A as AffiliateType } from '../affiliate-DUTVjle1.mjs';
8
8
  import '../images/index.mjs';
9
9
  import 'react-hook-form';
10
10
 
@@ -4,7 +4,7 @@ import { EnumResourceType, EnumEventDateStatus } from '../enums/index.js';
4
4
  import { A as AuthPayloadType, R as RefreshTokenPayloadType, S as SafeUserType, a as RedeemRewardResponse, P as PartnerType, b as ResourceByUser, c as AdType, E as EnumAdStatus, d as SubscriptionPlansResponse, e as SubscriptionStatusData, f as AppSettingsType, g as SchoolReturnType, h as SchoolType } from '../ad-BmDOVKmE.js';
5
5
  import { C as ChatType, R as ReportChatUser, N as NotificationCount, a as NotificationType, b as ResourceActivityType } from '../resourceActivities-BL_12IAo.js';
6
6
  import { E as EventType, c as EventListItemType, d as EventInfoType, U as UseGetResourcesByRegionOptions, e as RelationType, f as ResourceConnectionsType, g as UnregisteredVendorType, V as VendorType, h as VendorInfoType, i as UserLicenceType, P as PostType, j as EnumPostType, G as GameDocType, k as GameLeaderboard } from '../global-fKbMmluy.js';
7
- import { A as AffiliateType } from '../affiliate--dA3h3nC.js';
7
+ import { A as AffiliateType } from '../affiliate-aeLUPuKt.js';
8
8
  import '../images/index.js';
9
9
  import 'react-hook-form';
10
10
 
@@ -150,7 +150,7 @@ import {
150
150
  useUpdateVendor,
151
151
  useUpdateVendorInfo,
152
152
  useValidateVerificationToken
153
- } from "../chunk-3UZKSUNV.mjs";
153
+ } from "../chunk-YYRWWHUW.mjs";
154
154
  import "../chunk-LETM2YHF.mjs";
155
155
  export {
156
156
  GET_EVENT,
@@ -40,6 +40,7 @@ __export(hooks_exports, {
40
40
  globalDefaultValues: () => globalDefaultValues,
41
41
  mapBaseResourceTypeToFormData: () => mapBaseResourceTypeToFormData,
42
42
  useAdForm: () => useAdForm,
43
+ useAffiliateForm: () => useAffiliateForm,
43
44
  useAppSettingsForm: () => useAppSettingsForm,
44
45
  useContactUsForm: () => useContactUsForm,
45
46
  useEventForm: () => useEventForm,
@@ -1903,7 +1904,7 @@ var vendorInfoSchema = yup3.object().shape({
1903
1904
  max: yup3.string().required("Max price is required").test(
1904
1905
  "is-number",
1905
1906
  "Max price must be a valid number",
1906
- (value) => value !== void 0 && value !== "" && !isNaN(Number(value))
1907
+ (value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
1907
1908
  ).test(
1908
1909
  "is-greater",
1909
1910
  "Max price must be greater than or equal to Min price",
@@ -1912,14 +1913,14 @@ var vendorInfoSchema = yup3.object().shape({
1912
1913
  if (!max || !min) return true;
1913
1914
  const maxNum = Number(max);
1914
1915
  const minNum = Number(min);
1915
- if (isNaN(maxNum) || isNaN(minNum)) return true;
1916
+ if (Number.isNaN(maxNum) || Number.isNaN(minNum)) return true;
1916
1917
  return maxNum >= minNum;
1917
1918
  }
1918
1919
  ),
1919
1920
  min: yup3.string().required("Min price is required").test(
1920
1921
  "is-number",
1921
1922
  "Min price must be a valid number",
1922
- (value) => value !== void 0 && value !== "" && !isNaN(Number(value))
1923
+ (value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
1923
1924
  )
1924
1925
  }),
1925
1926
  producedIn: yup3.array().of(yup3.string().defined()).min(1, "Produced in list must contain at least one item").required("Produced in is required")
@@ -1961,7 +1962,7 @@ var vendorInfoSchema = yup3.object().shape({
1961
1962
  depth: yup3.string().required("Depth is required").test(
1962
1963
  "is-number",
1963
1964
  "Depth must be a valid number",
1964
- (value) => value !== void 0 && value !== "" && !isNaN(Number(value))
1965
+ (value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
1965
1966
  ).test(
1966
1967
  "is-positive",
1967
1968
  "Depth must be greater than 0",
@@ -1970,7 +1971,7 @@ var vendorInfoSchema = yup3.object().shape({
1970
1971
  width: yup3.string().required("Width is required").test(
1971
1972
  "is-number",
1972
1973
  "Width must be a valid number",
1973
- (value) => value !== void 0 && value !== "" && !isNaN(Number(value))
1974
+ (value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
1974
1975
  ).test(
1975
1976
  "is-positive",
1976
1977
  "Width must be greater than 0",
@@ -4999,12 +5000,10 @@ var import_client74 = require("@apollo/client");
4999
5000
  var AFFILIATE_REWARD_FIELDS_FRAGMENT = import_client74.gql`
5000
5001
  fragment AffiliateRewardFields on AffiliateRewardType {
5001
5002
  createdAt
5002
- deletedAt
5003
5003
  redeemedAt
5004
5004
  rewardDescription
5005
5005
  rewardType
5006
5006
  rewardValue
5007
- updatedAt
5008
5007
  }
5009
5008
  `;
5010
5009
  var AFFILIATE_RESOURCE_FIELDS_FRAGMENT = import_client74.gql`
@@ -5019,11 +5018,30 @@ var AFFILIATE_RESOURCE_FIELDS_FRAGMENT = import_client74.gql`
5019
5018
  }
5020
5019
  ${AFFILIATE_REWARD_FIELDS_FRAGMENT}
5021
5020
  `;
5021
+ var AFFILIATE_DETAILS_FIELDS_FRAGMENT = import_client74.gql`
5022
+ fragment AffiliateDetailsFields on AffiliateDetailsType {
5023
+ contactDetails {
5024
+ mobilePhone
5025
+ }
5026
+ region
5027
+ socialMedia {
5028
+ ...SocialMediaFields
5029
+ }
5030
+ termsAgreement {
5031
+ ...TermsAgreementFields
5032
+ }
5033
+ }
5034
+ ${SOCIAL_MEDIA_FIELDS_FRAGMENT}
5035
+ ${TERMS_AGREEMENT_FIELDS_FRAGMENT}
5036
+ `;
5022
5037
  var AFFILIATE_FIELDS_FRAGMENT = import_client74.gql`
5023
5038
  fragment AffiliateFields on AffiliateType {
5024
5039
  _id
5025
5040
  active
5026
5041
  affiliateCode
5042
+ affiliateDetails {
5043
+ ...AffiliateDetailsFields
5044
+ }
5027
5045
  affiliateResources {
5028
5046
  ...AffiliateResourceFields
5029
5047
  }
@@ -5035,6 +5053,7 @@ var AFFILIATE_FIELDS_FRAGMENT = import_client74.gql`
5035
5053
  }
5036
5054
  updatedAt
5037
5055
  }
5056
+ ${AFFILIATE_DETAILS_FIELDS_FRAGMENT}
5038
5057
  ${AFFILIATE_RESOURCE_FIELDS_FRAGMENT}
5039
5058
  ${OWNER_FIELDS_FRAGMENT}
5040
5059
  `;
@@ -6487,6 +6506,75 @@ function useSchoolForm(data) {
6487
6506
  watch
6488
6507
  };
6489
6508
  }
6509
+
6510
+ // src/hooks/useAffiliateForm.ts
6511
+ var import_yup18 = require("@hookform/resolvers/yup");
6512
+ var import_react6 = require("react");
6513
+ var import_react_hook_form18 = require("react-hook-form");
6514
+
6515
+ // src/yupSchema/affiliate.ts
6516
+ var yup12 = __toESM(require("yup"));
6517
+ var affiliateContactDetailsSchema = yup12.object({
6518
+ mobilePhone: yup12.string().trim().required("Mobile phone is required").test(
6519
+ "mobile-phone",
6520
+ "Mobile must start with 02 and be 9\u201311 digits",
6521
+ (value) => mobileRegex.test(value)
6522
+ )
6523
+ });
6524
+ var affiliateSchema = yup12.object().shape({
6525
+ contactDetails: affiliateContactDetailsSchema.nullable().default(null).test(
6526
+ "contact-details-required",
6527
+ "Mobile phone is required",
6528
+ (value) => Boolean(value?.mobilePhone?.trim())
6529
+ ),
6530
+ region: yup12.string().trim().required("Region is required"),
6531
+ socialMedia: yup12.array().of(socialMediaSchema).nullable().default(null)
6532
+ });
6533
+
6534
+ // src/hooks/useAffiliateForm.ts
6535
+ var defaultAffiliateFormValues = {
6536
+ contactDetails: null,
6537
+ region: "",
6538
+ socialMedia: [],
6539
+ termsAgreement: null
6540
+ };
6541
+ function useAffiliateForm(data) {
6542
+ const {
6543
+ control,
6544
+ formState,
6545
+ getValues,
6546
+ handleSubmit,
6547
+ reset,
6548
+ setValue,
6549
+ watch
6550
+ } = (0, import_react_hook_form18.useForm)({
6551
+ defaultValues: defaultAffiliateFormValues,
6552
+ resolver: (0, import_yup18.yupResolver)(affiliateSchema)
6553
+ });
6554
+ (0, import_react6.useEffect)(() => {
6555
+ if (data) {
6556
+ reset({
6557
+ contactDetails: data.contactDetails,
6558
+ region: data.region,
6559
+ socialMedia: data.socialMedia,
6560
+ termsAgreement: data.termsAgreement
6561
+ });
6562
+ } else {
6563
+ reset(defaultAffiliateFormValues);
6564
+ }
6565
+ }, [data, reset]);
6566
+ const { contactDetails, region, socialMedia: socialMedia2, termsAgreement } = getValues();
6567
+ return {
6568
+ control,
6569
+ fields: { contactDetails, region, socialMedia: socialMedia2, termsAgreement },
6570
+ formState,
6571
+ getValues,
6572
+ handleSubmit,
6573
+ reset,
6574
+ setValue,
6575
+ watch
6576
+ };
6577
+ }
6490
6578
  // Annotate the CommonJS export names for ESM import in node:
6491
6579
  0 && (module.exports = {
6492
6580
  defaultEventFormValues,
@@ -6499,6 +6587,7 @@ function useSchoolForm(data) {
6499
6587
  globalDefaultValues,
6500
6588
  mapBaseResourceTypeToFormData,
6501
6589
  useAdForm,
6590
+ useAffiliateForm,
6502
6591
  useAppSettingsForm,
6503
6592
  useContactUsForm,
6504
6593
  useEventForm,