@timardex/cluemart-shared 1.2.6 → 1.2.8
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/{auth-AfM4Q2Zl.d.ts → auth-Cp4zKr5d.d.ts} +6 -8
- package/dist/{auth-NEJeIZp5.d.mts → auth-DNveddIQ.d.mts} +6 -8
- package/dist/{contactUs-BTRh2D7-.d.mts → contactUs-D4YMyStC.d.mts} +1 -1
- package/dist/{contactUs-OR-5Mkkg.d.ts → contactUs-gQtGXo7i.d.ts} +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/{global-Clh5l5eo.d.ts → global-B42Tds9R.d.ts} +10 -11
- package/dist/{global-CNiNcYkF.d.mts → global-B87BDXpD.d.mts} +10 -11
- package/dist/graphql/index.cjs +22 -10
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +2 -2
- package/dist/graphql/index.d.ts +2 -2
- package/dist/graphql/index.mjs +22 -10
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +42 -65
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.mjs +42 -65
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +64 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.mjs +64 -75
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/hooks/index.mjs
CHANGED
|
@@ -124,6 +124,33 @@ var noLeadingZeros = (fieldName, options = {}) => {
|
|
|
124
124
|
};
|
|
125
125
|
dayjs.extend(isSameOrAfter);
|
|
126
126
|
dayjs.extend(customParseFormat);
|
|
127
|
+
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
128
|
+
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
129
|
+
);
|
|
130
|
+
var emailOptionalSchema = yup.string().nullable().notRequired().transform(
|
|
131
|
+
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
132
|
+
).test(
|
|
133
|
+
"is-valid-email",
|
|
134
|
+
"Invalid email address",
|
|
135
|
+
(value) => !value || yup.string().email().isValidSync(value)
|
|
136
|
+
).label("Email");
|
|
137
|
+
var mobileRegex = /^02\d{7,9}$/;
|
|
138
|
+
var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
|
|
139
|
+
var contactDetailsSchema = yup.object({
|
|
140
|
+
email: emailOptionalSchema,
|
|
141
|
+
mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
|
|
142
|
+
"mobile-phone",
|
|
143
|
+
"Mobile must start with 02 and be 9\u201311 digits",
|
|
144
|
+
(value) => !value || mobileRegex.test(value)
|
|
145
|
+
// skip empty values
|
|
146
|
+
),
|
|
147
|
+
landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
|
|
148
|
+
"landline-phone",
|
|
149
|
+
"Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
|
|
150
|
+
(value) => !value || landlineRegex.test(value)
|
|
151
|
+
// skip empty values
|
|
152
|
+
)
|
|
153
|
+
}).nullable().optional().label("Contact Details");
|
|
127
154
|
var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
|
|
128
155
|
const now = dayjs();
|
|
129
156
|
return value ? dayjs(value, dateFormat, true).isSameOrAfter(now, "day") : false;
|
|
@@ -219,16 +246,6 @@ var locationSchema = yup.object().shape({
|
|
|
219
246
|
region: yup.string().label("Region").required("Region is required"),
|
|
220
247
|
type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
|
|
221
248
|
});
|
|
222
|
-
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
223
|
-
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
224
|
-
);
|
|
225
|
-
var emailOptionalSchema = yup.string().nullable().notRequired().transform(
|
|
226
|
-
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
227
|
-
).test(
|
|
228
|
-
"is-valid-email",
|
|
229
|
-
"Invalid email address",
|
|
230
|
-
(value) => !value || yup.string().email().isValidSync(value)
|
|
231
|
-
).label("Email");
|
|
232
249
|
var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
|
|
233
250
|
var socialMediaSchema = yup.object({
|
|
234
251
|
name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
|
|
@@ -245,6 +262,7 @@ var globalResourceSchema = yup.object().shape({
|
|
|
245
262
|
source: yup.string().label("Cover").required("Cover is required"),
|
|
246
263
|
title: yup.string().label("Cover Title").required("Cover is required")
|
|
247
264
|
}),
|
|
265
|
+
contactDetails: contactDetailsSchema,
|
|
248
266
|
description: yup.string().label("Description").trim().min(3).required("Description is required"),
|
|
249
267
|
name: yup.string().label("Name").trim().min(3).max(40).required("Name is required"),
|
|
250
268
|
region: yup.string().label("Region").required("Region is required"),
|
|
@@ -276,23 +294,6 @@ var categorySchema = yup.array().of(
|
|
|
276
294
|
).min(1, "At least one subcategory is required").required("Subcategories are required")
|
|
277
295
|
})
|
|
278
296
|
);
|
|
279
|
-
var mobileRegex = /^02\d{7,9}$/;
|
|
280
|
-
var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
|
|
281
|
-
var contactDetailsSchema = yup.object({
|
|
282
|
-
email: emailOptionalSchema,
|
|
283
|
-
mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
|
|
284
|
-
"mobile-phone",
|
|
285
|
-
"Mobile must start with 02 and be 9\u201311 digits",
|
|
286
|
-
(value) => !value || mobileRegex.test(value)
|
|
287
|
-
// skip empty values
|
|
288
|
-
),
|
|
289
|
-
landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
|
|
290
|
-
"landline-phone",
|
|
291
|
-
"Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
|
|
292
|
-
(value) => !value || landlineRegex.test(value)
|
|
293
|
-
// skip empty values
|
|
294
|
-
)
|
|
295
|
-
}).nullable().optional().label("Contact Details");
|
|
296
297
|
|
|
297
298
|
// src/yupSchema/event.ts
|
|
298
299
|
import * as yup2 from "yup";
|
|
@@ -343,7 +344,6 @@ var paymentInfoSchema = yup2.object({
|
|
|
343
344
|
})
|
|
344
345
|
});
|
|
345
346
|
var eventInfoSchema = yup2.object().shape({
|
|
346
|
-
contactDetails: contactDetailsSchema,
|
|
347
347
|
applicationDeadlineHours: yup2.number().label("Application Deadline Hours").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Application deadline hours must be a number").min(1, "Application deadline hours must be at least 1").required("Application deadline hours is required").test("no-leading-zeros", "", noLeadingZeros("Application deadline hours")),
|
|
348
348
|
dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
349
349
|
eventId: yup2.string().trim().required("Event ID is required"),
|
|
@@ -374,7 +374,6 @@ var vendorSchema = globalResourceSchema.shape({
|
|
|
374
374
|
vendorType: yup3.mixed().oneOf(Object.values(EnumVendorType)).required("Please select a Vendor type")
|
|
375
375
|
});
|
|
376
376
|
var vendorInfoSchema = yup3.object().shape({
|
|
377
|
-
contactDetails: contactDetailsSchema,
|
|
378
377
|
product: yup3.object().shape({
|
|
379
378
|
foodFlavors: yup3.array().of(
|
|
380
379
|
yup3.mixed().oneOf(Object.values(EnumFoodFlavor), "Invalid flavor selected").required("Flavor is required")
|
|
@@ -531,6 +530,11 @@ var adSchema = yup7.object().shape({
|
|
|
531
530
|
// src/hooks/utils.ts
|
|
532
531
|
var globalDefaultValues = {
|
|
533
532
|
active: false,
|
|
533
|
+
contactDetails: {
|
|
534
|
+
email: null,
|
|
535
|
+
landlinePhone: null,
|
|
536
|
+
mobilePhone: null
|
|
537
|
+
},
|
|
534
538
|
cover: {
|
|
535
539
|
source: "",
|
|
536
540
|
title: ""
|
|
@@ -552,14 +556,7 @@ var globalDefaultValues = {
|
|
|
552
556
|
};
|
|
553
557
|
var defaultEventFormValues = {
|
|
554
558
|
...globalDefaultValues,
|
|
555
|
-
dateTime: [
|
|
556
|
-
{
|
|
557
|
-
endDate: "",
|
|
558
|
-
endTime: "",
|
|
559
|
-
startDate: "",
|
|
560
|
-
startTime: ""
|
|
561
|
-
}
|
|
562
|
-
],
|
|
559
|
+
dateTime: [],
|
|
563
560
|
eventType: "market" /* MARKET */,
|
|
564
561
|
location: {
|
|
565
562
|
city: "",
|
|
@@ -580,20 +577,7 @@ var defaultEventFormValues = {
|
|
|
580
577
|
};
|
|
581
578
|
var defaultEventInfoFormValues = {
|
|
582
579
|
applicationDeadlineHours: 24,
|
|
583
|
-
|
|
584
|
-
email: null,
|
|
585
|
-
landlinePhone: null,
|
|
586
|
-
mobilePhone: null
|
|
587
|
-
},
|
|
588
|
-
dateTime: [
|
|
589
|
-
{
|
|
590
|
-
endDate: "",
|
|
591
|
-
endTime: "",
|
|
592
|
-
stallTypes: [],
|
|
593
|
-
startDate: "",
|
|
594
|
-
startTime: ""
|
|
595
|
-
}
|
|
596
|
-
],
|
|
580
|
+
dateTime: [],
|
|
597
581
|
eventId: "",
|
|
598
582
|
packInTime: 2,
|
|
599
583
|
// e.g., 2 hours before event opens
|
|
@@ -616,11 +600,6 @@ var defaultVendorFormValues = {
|
|
|
616
600
|
};
|
|
617
601
|
var defaultVendorInfoFormValues = {
|
|
618
602
|
compliance: { foodBeverageLicense: false, liabilityInsurance: false },
|
|
619
|
-
contactDetails: {
|
|
620
|
-
email: null,
|
|
621
|
-
landlinePhone: null,
|
|
622
|
-
mobilePhone: null
|
|
623
|
-
},
|
|
624
603
|
documents: null,
|
|
625
604
|
documentsUpload: null,
|
|
626
605
|
product: {
|
|
@@ -643,6 +622,7 @@ function mapBaseResourceTypeToFormData(data) {
|
|
|
643
622
|
return {
|
|
644
623
|
_id: data._id,
|
|
645
624
|
active: data.active,
|
|
625
|
+
contactDetails: data.contactDetails,
|
|
646
626
|
cover: data.cover,
|
|
647
627
|
coverUpload: data.coverUpload,
|
|
648
628
|
description: data.description,
|
|
@@ -766,7 +746,6 @@ function useVendorInfoForm(data) {
|
|
|
766
746
|
reset({
|
|
767
747
|
_id: data._id,
|
|
768
748
|
compliance: data.compliance,
|
|
769
|
-
contactDetails: data.contactDetails,
|
|
770
749
|
documents: data.documents,
|
|
771
750
|
documentsUpload: data.documentsUpload,
|
|
772
751
|
product: data.product,
|
|
@@ -781,7 +760,6 @@ function useVendorInfoForm(data) {
|
|
|
781
760
|
const {
|
|
782
761
|
_id,
|
|
783
762
|
compliance,
|
|
784
|
-
contactDetails,
|
|
785
763
|
documents,
|
|
786
764
|
documentsUpload,
|
|
787
765
|
product,
|
|
@@ -794,7 +772,6 @@ function useVendorInfoForm(data) {
|
|
|
794
772
|
fields: {
|
|
795
773
|
_id,
|
|
796
774
|
compliance,
|
|
797
|
-
contactDetails,
|
|
798
775
|
documents,
|
|
799
776
|
documentsUpload,
|
|
800
777
|
product,
|
|
@@ -923,7 +900,6 @@ function useEventInfoForm(data) {
|
|
|
923
900
|
reset({
|
|
924
901
|
_id: data._id,
|
|
925
902
|
applicationDeadlineHours: data.applicationDeadlineHours,
|
|
926
|
-
contactDetails: data.contactDetails,
|
|
927
903
|
dateTime: data.dateTime,
|
|
928
904
|
eventId: data.eventId,
|
|
929
905
|
packInTime: data.packInTime,
|
|
@@ -938,7 +914,6 @@ function useEventInfoForm(data) {
|
|
|
938
914
|
const {
|
|
939
915
|
_id,
|
|
940
916
|
applicationDeadlineHours,
|
|
941
|
-
contactDetails,
|
|
942
917
|
dateTime,
|
|
943
918
|
eventId,
|
|
944
919
|
packInTime,
|
|
@@ -951,7 +926,6 @@ function useEventInfoForm(data) {
|
|
|
951
926
|
fields: {
|
|
952
927
|
_id,
|
|
953
928
|
applicationDeadlineHours,
|
|
954
|
-
contactDetails,
|
|
955
929
|
dateTime,
|
|
956
930
|
eventId,
|
|
957
931
|
packInTime,
|
|
@@ -1009,7 +983,8 @@ function useUserForm(data) {
|
|
|
1009
983
|
lastName: data.lastName,
|
|
1010
984
|
password: data.password,
|
|
1011
985
|
preferredRegion: data.preferredRegion,
|
|
1012
|
-
role: data.role
|
|
986
|
+
role: data.role,
|
|
987
|
+
termsAgreement: data.termsAgreement
|
|
1013
988
|
});
|
|
1014
989
|
} else {
|
|
1015
990
|
reset(defaultValues);
|
|
@@ -1026,7 +1001,8 @@ function useUserForm(data) {
|
|
|
1026
1001
|
lastName,
|
|
1027
1002
|
password,
|
|
1028
1003
|
preferredRegion,
|
|
1029
|
-
role
|
|
1004
|
+
role,
|
|
1005
|
+
termsAgreement
|
|
1030
1006
|
} = getValues();
|
|
1031
1007
|
return {
|
|
1032
1008
|
control,
|
|
@@ -1041,7 +1017,8 @@ function useUserForm(data) {
|
|
|
1041
1017
|
lastName,
|
|
1042
1018
|
password,
|
|
1043
1019
|
preferredRegion,
|
|
1044
|
-
role
|
|
1020
|
+
role,
|
|
1021
|
+
termsAgreement
|
|
1045
1022
|
},
|
|
1046
1023
|
formState: { errors },
|
|
1047
1024
|
handleSubmit,
|