@timardex/cluemart-shared 1.2.50 → 1.2.52

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 (47) hide show
  1. package/dist/{ad-Dcmq74_b.d.ts → ad-Bo9PwPRD.d.mts} +19 -4
  2. package/dist/{ad-BO5cMy3b.d.mts → ad-CBsFDjHz.d.ts} +19 -4
  3. package/dist/{chunk-VYFOKMRP.mjs → chunk-IRQ365TO.mjs} +2 -2
  4. package/dist/{chunk-XXZPSRMS.mjs → chunk-N625BZKR.mjs} +3 -2
  5. package/dist/chunk-N625BZKR.mjs.map +1 -0
  6. package/dist/{chunk-S6RE75SK.mjs → chunk-V3BTJQHJ.mjs} +9 -2
  7. package/dist/chunk-V3BTJQHJ.mjs.map +1 -0
  8. package/dist/enums/index.cjs +9 -1
  9. package/dist/enums/index.cjs.map +1 -1
  10. package/dist/enums/index.d.mts +9 -4
  11. package/dist/enums/index.d.ts +9 -4
  12. package/dist/enums/index.mjs +3 -1
  13. package/dist/formFields/index.cjs +94 -82
  14. package/dist/formFields/index.cjs.map +1 -1
  15. package/dist/formFields/index.d.mts +3 -2
  16. package/dist/formFields/index.d.ts +3 -2
  17. package/dist/formFields/index.mjs +24 -10
  18. package/dist/formFields/index.mjs.map +1 -1
  19. package/dist/graphql/index.cjs +379 -175
  20. package/dist/graphql/index.cjs.map +1 -1
  21. package/dist/graphql/index.d.mts +43 -2
  22. package/dist/graphql/index.d.ts +43 -2
  23. package/dist/graphql/index.mjs +278 -81
  24. package/dist/graphql/index.mjs.map +1 -1
  25. package/dist/hooks/index.cjs +128 -21
  26. package/dist/hooks/index.cjs.map +1 -1
  27. package/dist/hooks/index.d.mts +11 -2
  28. package/dist/hooks/index.d.ts +11 -2
  29. package/dist/hooks/index.mjs +121 -22
  30. package/dist/hooks/index.mjs.map +1 -1
  31. package/dist/index.cjs +682 -355
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.mts +77 -6
  34. package/dist/index.d.ts +77 -6
  35. package/dist/index.mjs +539 -222
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/types/index.cjs +2 -1
  38. package/dist/types/index.cjs.map +1 -1
  39. package/dist/types/index.d.mts +1 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/types/index.mjs +1 -1
  42. package/dist/utils/index.cjs.map +1 -1
  43. package/dist/utils/index.mjs +2 -2
  44. package/package.json +1 -1
  45. package/dist/chunk-S6RE75SK.mjs.map +0 -1
  46. package/dist/chunk-XXZPSRMS.mjs.map +0 -1
  47. /package/dist/{chunk-VYFOKMRP.mjs.map → chunk-IRQ365TO.mjs.map} +0 -0
@@ -3,24 +3,25 @@ import {
3
3
  EnumAdStatus,
4
4
  EnumAdStyle,
5
5
  EnumAdType
6
- } from "../chunk-XXZPSRMS.mjs";
6
+ } from "../chunk-N625BZKR.mjs";
7
7
  import {
8
8
  dateFormat,
9
9
  normalizeUrl,
10
10
  timeFormat
11
- } from "../chunk-VYFOKMRP.mjs";
11
+ } from "../chunk-IRQ365TO.mjs";
12
12
  import {
13
13
  EnumEventDateStatus,
14
14
  EnumEventType,
15
15
  EnumFoodFlavor,
16
16
  EnumOSPlatform,
17
+ EnumPartnerType,
17
18
  EnumPaymentMethod,
18
19
  EnumResourceType,
19
20
  EnumSocialMedia,
20
21
  EnumUserLicence,
21
22
  EnumUserRole,
22
23
  EnumVendorType
23
- } from "../chunk-S6RE75SK.mjs";
24
+ } from "../chunk-V3BTJQHJ.mjs";
24
25
 
25
26
  // src/hooks/useLocationSearch.ts
26
27
  var handleApiError = (error, message) => {
@@ -106,6 +107,8 @@ import dayjs from "dayjs";
106
107
  import customParseFormat from "dayjs/plugin/customParseFormat.js";
107
108
  import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
108
109
  import * as yup from "yup";
110
+ var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
111
+ var nzbnRegex = /^94\d{11}$/;
109
112
  var normalizedUrlTransform = () => yup.string().trim().transform(
110
113
  (value) => typeof value === "string" ? value.toLowerCase() : value
111
114
  ).transform(
@@ -299,8 +302,6 @@ var categorySchema = yup.array().of(
299
302
 
300
303
  // src/yupSchema/event.ts
301
304
  import * as yup2 from "yup";
302
- var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
303
- var nzbnRegex = /^94\d{11}$/;
304
305
  var eventSchema = globalResourceSchema.shape({
305
306
  dateTime: yup2.array().of(dateTimeSchema).min(1, "At least one Event date required").max(50, "You can only add up to 50 Event dates").required("DateTime is required").test(
306
307
  "unique-start-date-time",
@@ -535,7 +536,27 @@ var adSchema = yup7.object().shape({
535
536
  targetRegion: yup7.string().nullable().notRequired()
536
537
  });
537
538
 
539
+ // src/yupSchema/partner.ts
540
+ import * as yup8 from "yup";
541
+ var partnerSchema = globalResourceSchema.shape({
542
+ location: locationSchema,
543
+ nzbn: yup8.string().required("NZBN is required").matches(nzbnRegex, "NZBN must be 13 digits and start with 94"),
544
+ partnerType: yup8.mixed().oneOf(Object.values(EnumPartnerType)).required("Please select a Partner type")
545
+ });
546
+
538
547
  // src/hooks/utils.ts
548
+ var defaultLocation = {
549
+ city: "",
550
+ coordinates: [0, 0],
551
+ // [longitude, latitude]
552
+ country: "",
553
+ fullAddress: "",
554
+ latitude: 0,
555
+ longitude: 0,
556
+ region: "",
557
+ type: "Point"
558
+ // Default type for GeoJSON
559
+ };
539
560
  var globalDefaultValues = {
540
561
  active: false,
541
562
  associates: null,
@@ -562,22 +583,17 @@ var globalDefaultValues = {
562
583
  region: "",
563
584
  socialMedia: []
564
585
  };
586
+ var defaultPartnerFormValues = {
587
+ ...globalDefaultValues,
588
+ location: defaultLocation,
589
+ nzbn: "",
590
+ partnerType: "Charity_Partner" /* CHARITY_PARTNER */
591
+ };
565
592
  var defaultEventFormValues = {
566
593
  ...globalDefaultValues,
567
594
  dateTime: [],
568
595
  eventType: "Market" /* MARKET */,
569
- location: {
570
- city: "",
571
- coordinates: [0, 0],
572
- // [longitude, latitude]
573
- country: "",
574
- fullAddress: "",
575
- latitude: 0,
576
- longitude: 0,
577
- region: "",
578
- type: "Point"
579
- // Default type for GeoJSON
580
- },
596
+ location: defaultLocation,
581
597
  nzbn: "",
582
598
  provider: null,
583
599
  rainOrShine: false,
@@ -1302,12 +1318,12 @@ import React7 from "react";
1302
1318
  import { useForm as useForm12 } from "react-hook-form";
1303
1319
 
1304
1320
  // src/yupSchema/contactUs.ts
1305
- import * as yup8 from "yup";
1306
- var contactUsSchema = yup8.object().shape({
1321
+ import * as yup9 from "yup";
1322
+ var contactUsSchema = yup9.object().shape({
1307
1323
  email: emailRequiredSchema,
1308
- firstName: yup8.string().label("First Name").required("First name is required"),
1309
- lastName: yup8.string().label("Last Name").required("Last name is required"),
1310
- message: yup8.string().label("Message").required("Message is required")
1324
+ firstName: yup9.string().label("First Name").required("First name is required"),
1325
+ lastName: yup9.string().label("Last Name").required("Last name is required"),
1326
+ message: yup9.string().label("Message").required("Message is required")
1311
1327
  });
1312
1328
 
1313
1329
  // src/hooks/useContactUsForm.ts
@@ -1471,9 +1487,91 @@ function useAdForm(data) {
1471
1487
  watch
1472
1488
  };
1473
1489
  }
1490
+
1491
+ // src/hooks/partner/usePartnerForm.ts
1492
+ import { yupResolver as yupResolver14 } from "@hookform/resolvers/yup";
1493
+ import * as React9 from "react";
1494
+ import { useForm as useForm14 } from "react-hook-form";
1495
+ function usePartnerForm(data) {
1496
+ const {
1497
+ control,
1498
+ formState: { errors },
1499
+ getValues,
1500
+ handleSubmit,
1501
+ reset,
1502
+ setValue,
1503
+ watch
1504
+ } = useForm14({
1505
+ defaultValues: defaultPartnerFormValues,
1506
+ resolver: yupResolver14(partnerSchema)
1507
+ });
1508
+ React9.useEffect(() => {
1509
+ if (data) {
1510
+ reset({
1511
+ ...mapBaseResourceTypeToFormData(data),
1512
+ location: data.location,
1513
+ nzbn: data.nzbn,
1514
+ partnerType: data.partnerType
1515
+ });
1516
+ } else {
1517
+ reset(defaultPartnerFormValues);
1518
+ }
1519
+ }, [data]);
1520
+ const {
1521
+ _id,
1522
+ active,
1523
+ associates,
1524
+ cover,
1525
+ coverUpload,
1526
+ description,
1527
+ images,
1528
+ imagesUpload,
1529
+ location,
1530
+ logo,
1531
+ logoUpload,
1532
+ name,
1533
+ nzbn,
1534
+ owner,
1535
+ partnerType,
1536
+ promoCodes,
1537
+ region,
1538
+ socialMedia,
1539
+ termsAgreement
1540
+ } = getValues();
1541
+ return {
1542
+ control,
1543
+ fields: {
1544
+ _id,
1545
+ active,
1546
+ associates,
1547
+ cover,
1548
+ coverUpload,
1549
+ description,
1550
+ images,
1551
+ imagesUpload,
1552
+ location,
1553
+ logo,
1554
+ logoUpload,
1555
+ name,
1556
+ nzbn,
1557
+ owner,
1558
+ partnerType,
1559
+ promoCodes,
1560
+ region,
1561
+ socialMedia,
1562
+ termsAgreement
1563
+ },
1564
+ formState: { errors },
1565
+ handleSubmit,
1566
+ reset,
1567
+ setValue,
1568
+ watch
1569
+ };
1570
+ }
1474
1571
  export {
1475
1572
  defaultEventFormValues,
1476
1573
  defaultEventInfoFormValues,
1574
+ defaultPartnerFormValues,
1477
1575
  defaultVendorFormValues,
1478
1576
  defaultVendorInfoFormValues,
1479
1577
  globalDefaultValues,
@@ -1484,6 +1582,7 @@ export {
1484
1582
  useEventInfoForm,
1485
1583
  useLocationSearch,
1486
1584
  useLoginForm,
1585
+ usePartnerForm,
1487
1586
  useRegisterForm,
1488
1587
  useRequestPasswordResetForm,
1489
1588
  useResetPasswordForm,