@timardex/cluemart-shared 1.2.49 → 1.2.51
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.
- package/dist/{ad-DPP5n_ZS.d.mts → ad-C98yzFdy.d.mts} +19 -6
- package/dist/{ad-BBJMdfCl.d.ts → ad-CPL59gj7.d.ts} +19 -6
- package/dist/{auth-CQPRj4DB.d.mts → auth-D636FFnJ.d.mts} +1 -1
- package/dist/{auth-OLWCR6Zr.d.ts → auth-D6Rg-cEc.d.ts} +1 -1
- package/dist/{chunk-HFYQRL77.mjs → chunk-IRQ365TO.mjs} +2 -2
- package/dist/{chunk-XXZPSRMS.mjs → chunk-N625BZKR.mjs} +3 -2
- package/dist/chunk-N625BZKR.mjs.map +1 -0
- package/dist/{chunk-WNRV4DSZ.mjs → chunk-V3BTJQHJ.mjs} +11 -4
- package/dist/chunk-V3BTJQHJ.mjs.map +1 -0
- package/dist/enums/index.cjs +11 -3
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.mts +11 -6
- package/dist/enums/index.d.ts +11 -6
- package/dist/enums/index.mjs +3 -1
- package/dist/formFields/index.cjs +94 -82
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +4 -3
- package/dist/formFields/index.d.ts +4 -3
- package/dist/formFields/index.mjs +24 -10
- package/dist/formFields/index.mjs.map +1 -1
- package/dist/{global-qg1lwtYo.d.mts → global-Czf4z7aN.d.mts} +3 -3
- package/dist/{global-Be5v6emI.d.ts → global-dQyePynY.d.ts} +3 -3
- package/dist/graphql/index.cjs +393 -189
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +44 -3
- package/dist/graphql/index.d.ts +44 -3
- package/dist/graphql/index.mjs +292 -95
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +135 -28
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +13 -4
- package/dist/hooks/index.d.ts +13 -4
- package/dist/hooks/index.mjs +128 -29
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +688 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +81 -12
- package/dist/index.d.ts +81 -12
- package/dist/index.mjs +562 -245
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +2 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-WNRV4DSZ.mjs.map +0 -1
- package/dist/chunk-XXZPSRMS.mjs.map +0 -1
- /package/dist/{chunk-HFYQRL77.mjs.map → chunk-IRQ365TO.mjs.map} +0 -0
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LocationType, f as VendorFormData, g as CreateVendorFormData, h as VendorInfoFormData, i as CreateVendorInfoFormData, j as EventFormData, k as CreateEventFormData, l as EventInfoFormData, m as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-
|
|
2
|
-
import { a as UserFormData, C as CreateUserFormData, b as
|
|
3
|
-
import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-
|
|
1
|
+
import { L as LocationType, f as VendorFormData, g as CreateVendorFormData, h as VendorInfoFormData, i as CreateVendorInfoFormData, j as EventFormData, k as CreateEventFormData, l as EventInfoFormData, m as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-dQyePynY.js';
|
|
2
|
+
import { a as UserFormData, C as CreateUserFormData, b as PartnerFormData, c as TestersFormData, d as CreateTestersFormData, e as AdFormData, f as CreateAdFormData, g as CreatePartnerFormData } from '../ad-CPL59gj7.js';
|
|
3
|
+
import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-D6Rg-cEc.js';
|
|
4
4
|
import 'react-hook-form';
|
|
5
5
|
import '../enums/index.js';
|
|
6
6
|
|
|
@@ -74,6 +74,7 @@ declare function useValidateVerificationTokenForm(): CreateValidateVerificationT
|
|
|
74
74
|
declare function useResetPasswordForm(): CreateResetPasswordFormData;
|
|
75
75
|
|
|
76
76
|
declare const globalDefaultValues: BaseResourceTypeFormData;
|
|
77
|
+
declare const defaultPartnerFormValues: PartnerFormData;
|
|
77
78
|
declare const defaultEventFormValues: EventFormData;
|
|
78
79
|
declare const defaultEventInfoFormValues: EventInfoFormData;
|
|
79
80
|
declare const defaultVendorFormValues: VendorFormData;
|
|
@@ -86,4 +87,12 @@ declare function useContactUsForm(data?: ContactUsFormData): CreateContactUsForm
|
|
|
86
87
|
|
|
87
88
|
declare function useAdForm(data?: AdFormData): CreateAdFormData;
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Custom hook to manage the partner form state and validation.
|
|
92
|
+
*
|
|
93
|
+
* @param {PartnerFormData} data - The initial form data.
|
|
94
|
+
* @returns {CreatePartnerFormData} - The form methods and state.
|
|
95
|
+
*/
|
|
96
|
+
declare function usePartnerForm(data?: PartnerFormData): CreatePartnerFormData;
|
|
97
|
+
|
|
98
|
+
export { type PlacePrediction, defaultEventFormValues, defaultEventInfoFormValues, defaultPartnerFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, globalDefaultValues, mapBaseResourceTypeToFormData, useAdForm, useContactUsForm, useEventForm, useEventInfoForm, useLocationSearch, useLoginForm, usePartnerForm, useRegisterForm, useRequestPasswordResetForm, useResetPasswordForm, useTestersForm, useUserForm, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -3,24 +3,25 @@ import {
|
|
|
3
3
|
EnumAdStatus,
|
|
4
4
|
EnumAdStyle,
|
|
5
5
|
EnumAdType
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-N625BZKR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
dateFormat,
|
|
9
9
|
normalizeUrl,
|
|
10
10
|
timeFormat
|
|
11
|
-
} from "../chunk-
|
|
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-
|
|
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(
|
|
@@ -269,7 +272,7 @@ var globalResourceSchema = yup.object().shape({
|
|
|
269
272
|
name: yup.string().label("Name").trim().min(3).max(40).required("Name is required"),
|
|
270
273
|
region: yup.string().label("Region").required("Region is required"),
|
|
271
274
|
socialMedia: yup.array().of(socialMediaSchema).nullable().optional(),
|
|
272
|
-
|
|
275
|
+
associates: yup.array().of(
|
|
273
276
|
yup.object().shape({
|
|
274
277
|
email: emailRequiredSchema,
|
|
275
278
|
resourceId: yup.string().required(),
|
|
@@ -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,9 +536,30 @@ 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,
|
|
562
|
+
associates: null,
|
|
541
563
|
contactDetails: {
|
|
542
564
|
email: null,
|
|
543
565
|
landlinePhone: null,
|
|
@@ -557,27 +579,21 @@ var globalDefaultValues = {
|
|
|
557
579
|
logo: null,
|
|
558
580
|
logoUpload: null,
|
|
559
581
|
name: "",
|
|
560
|
-
partners: null,
|
|
561
582
|
promoCodes: [],
|
|
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,
|
|
@@ -630,6 +646,7 @@ function mapBaseResourceTypeToFormData(data) {
|
|
|
630
646
|
return {
|
|
631
647
|
_id: data._id,
|
|
632
648
|
active: data.active,
|
|
649
|
+
associates: data.associates,
|
|
633
650
|
contactDetails: data.contactDetails,
|
|
634
651
|
cover: data.cover,
|
|
635
652
|
coverUpload: data.coverUpload,
|
|
@@ -640,7 +657,6 @@ function mapBaseResourceTypeToFormData(data) {
|
|
|
640
657
|
logoUpload: data.logoUpload,
|
|
641
658
|
name: data.name,
|
|
642
659
|
owner: data.owner,
|
|
643
|
-
partners: data.partners,
|
|
644
660
|
promoCodes: data.promoCodes,
|
|
645
661
|
region: data.region,
|
|
646
662
|
socialMedia: data.socialMedia,
|
|
@@ -680,6 +696,7 @@ function useVendorForm(data) {
|
|
|
680
696
|
const {
|
|
681
697
|
_id,
|
|
682
698
|
active,
|
|
699
|
+
associates,
|
|
683
700
|
availability,
|
|
684
701
|
categories,
|
|
685
702
|
cover,
|
|
@@ -693,7 +710,6 @@ function useVendorForm(data) {
|
|
|
693
710
|
multiLocation,
|
|
694
711
|
name,
|
|
695
712
|
owner,
|
|
696
|
-
partners,
|
|
697
713
|
products,
|
|
698
714
|
promoCodes,
|
|
699
715
|
region,
|
|
@@ -706,6 +722,7 @@ function useVendorForm(data) {
|
|
|
706
722
|
fields: {
|
|
707
723
|
_id,
|
|
708
724
|
active,
|
|
725
|
+
associates,
|
|
709
726
|
availability,
|
|
710
727
|
categories,
|
|
711
728
|
cover,
|
|
@@ -719,7 +736,6 @@ function useVendorForm(data) {
|
|
|
719
736
|
multiLocation,
|
|
720
737
|
name,
|
|
721
738
|
owner,
|
|
722
|
-
partners,
|
|
723
739
|
products,
|
|
724
740
|
promoCodes,
|
|
725
741
|
region,
|
|
@@ -834,6 +850,7 @@ function useEventForm(data) {
|
|
|
834
850
|
const {
|
|
835
851
|
_id,
|
|
836
852
|
active,
|
|
853
|
+
associates,
|
|
837
854
|
cover,
|
|
838
855
|
coverUpload,
|
|
839
856
|
dateTime,
|
|
@@ -847,7 +864,6 @@ function useEventForm(data) {
|
|
|
847
864
|
name,
|
|
848
865
|
nzbn,
|
|
849
866
|
owner,
|
|
850
|
-
partners,
|
|
851
867
|
promoCodes,
|
|
852
868
|
provider,
|
|
853
869
|
rainOrShine,
|
|
@@ -861,6 +877,7 @@ function useEventForm(data) {
|
|
|
861
877
|
fields: {
|
|
862
878
|
_id,
|
|
863
879
|
active,
|
|
880
|
+
associates,
|
|
864
881
|
cover,
|
|
865
882
|
coverUpload,
|
|
866
883
|
dateTime,
|
|
@@ -874,7 +891,6 @@ function useEventForm(data) {
|
|
|
874
891
|
name,
|
|
875
892
|
nzbn,
|
|
876
893
|
owner,
|
|
877
|
-
partners,
|
|
878
894
|
promoCodes,
|
|
879
895
|
provider,
|
|
880
896
|
rainOrShine,
|
|
@@ -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
|
|
1306
|
-
var contactUsSchema =
|
|
1321
|
+
import * as yup9 from "yup";
|
|
1322
|
+
var contactUsSchema = yup9.object().shape({
|
|
1307
1323
|
email: emailRequiredSchema,
|
|
1308
|
-
firstName:
|
|
1309
|
-
lastName:
|
|
1310
|
-
message:
|
|
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,
|