@timardex/cluemart-shared 1.2.7 → 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-BS0Z8xN3.d.ts → auth-Cp4zKr5d.d.ts} +1 -1
- package/dist/{auth-Dcif6SZD.d.mts → auth-DNveddIQ.d.mts} +1 -1
- 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 +36 -62
- 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 +36 -62
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +58 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -9
- package/dist/index.d.ts +8 -9
- package/dist/index.mjs +58 -72
- 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.cjs
CHANGED
|
@@ -284,6 +284,33 @@ var noLeadingZeros = (fieldName, options = {}) => {
|
|
|
284
284
|
};
|
|
285
285
|
import_dayjs2.default.extend(import_isSameOrAfter2.default);
|
|
286
286
|
import_dayjs2.default.extend(import_customParseFormat2.default);
|
|
287
|
+
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
288
|
+
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
289
|
+
);
|
|
290
|
+
var emailOptionalSchema = yup.string().nullable().notRequired().transform(
|
|
291
|
+
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
292
|
+
).test(
|
|
293
|
+
"is-valid-email",
|
|
294
|
+
"Invalid email address",
|
|
295
|
+
(value) => !value || yup.string().email().isValidSync(value)
|
|
296
|
+
).label("Email");
|
|
297
|
+
var mobileRegex = /^02\d{7,9}$/;
|
|
298
|
+
var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
|
|
299
|
+
var contactDetailsSchema = yup.object({
|
|
300
|
+
email: emailOptionalSchema,
|
|
301
|
+
mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
|
|
302
|
+
"mobile-phone",
|
|
303
|
+
"Mobile must start with 02 and be 9\u201311 digits",
|
|
304
|
+
(value) => !value || mobileRegex.test(value)
|
|
305
|
+
// skip empty values
|
|
306
|
+
),
|
|
307
|
+
landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
|
|
308
|
+
"landline-phone",
|
|
309
|
+
"Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
|
|
310
|
+
(value) => !value || landlineRegex.test(value)
|
|
311
|
+
// skip empty values
|
|
312
|
+
)
|
|
313
|
+
}).nullable().optional().label("Contact Details");
|
|
287
314
|
var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
|
|
288
315
|
const now = (0, import_dayjs2.default)();
|
|
289
316
|
return value ? (0, import_dayjs2.default)(value, dateFormat, true).isSameOrAfter(now, "day") : false;
|
|
@@ -379,16 +406,6 @@ var locationSchema = yup.object().shape({
|
|
|
379
406
|
region: yup.string().label("Region").required("Region is required"),
|
|
380
407
|
type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
|
|
381
408
|
});
|
|
382
|
-
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
383
|
-
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
384
|
-
);
|
|
385
|
-
var emailOptionalSchema = yup.string().nullable().notRequired().transform(
|
|
386
|
-
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
387
|
-
).test(
|
|
388
|
-
"is-valid-email",
|
|
389
|
-
"Invalid email address",
|
|
390
|
-
(value) => !value || yup.string().email().isValidSync(value)
|
|
391
|
-
).label("Email");
|
|
392
409
|
var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
|
|
393
410
|
var socialMediaSchema = yup.object({
|
|
394
411
|
name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
|
|
@@ -405,6 +422,7 @@ var globalResourceSchema = yup.object().shape({
|
|
|
405
422
|
source: yup.string().label("Cover").required("Cover is required"),
|
|
406
423
|
title: yup.string().label("Cover Title").required("Cover is required")
|
|
407
424
|
}),
|
|
425
|
+
contactDetails: contactDetailsSchema,
|
|
408
426
|
description: yup.string().label("Description").trim().min(3).required("Description is required"),
|
|
409
427
|
name: yup.string().label("Name").trim().min(3).max(40).required("Name is required"),
|
|
410
428
|
region: yup.string().label("Region").required("Region is required"),
|
|
@@ -436,23 +454,6 @@ var categorySchema = yup.array().of(
|
|
|
436
454
|
).min(1, "At least one subcategory is required").required("Subcategories are required")
|
|
437
455
|
})
|
|
438
456
|
);
|
|
439
|
-
var mobileRegex = /^02\d{7,9}$/;
|
|
440
|
-
var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
|
|
441
|
-
var contactDetailsSchema = yup.object({
|
|
442
|
-
email: emailOptionalSchema,
|
|
443
|
-
mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
|
|
444
|
-
"mobile-phone",
|
|
445
|
-
"Mobile must start with 02 and be 9\u201311 digits",
|
|
446
|
-
(value) => !value || mobileRegex.test(value)
|
|
447
|
-
// skip empty values
|
|
448
|
-
),
|
|
449
|
-
landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
|
|
450
|
-
"landline-phone",
|
|
451
|
-
"Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
|
|
452
|
-
(value) => !value || landlineRegex.test(value)
|
|
453
|
-
// skip empty values
|
|
454
|
-
)
|
|
455
|
-
}).nullable().optional().label("Contact Details");
|
|
456
457
|
|
|
457
458
|
// src/yupSchema/event.ts
|
|
458
459
|
var yup2 = __toESM(require("yup"));
|
|
@@ -503,7 +504,6 @@ var paymentInfoSchema = yup2.object({
|
|
|
503
504
|
})
|
|
504
505
|
});
|
|
505
506
|
var eventInfoSchema = yup2.object().shape({
|
|
506
|
-
contactDetails: contactDetailsSchema,
|
|
507
507
|
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")),
|
|
508
508
|
dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
509
509
|
eventId: yup2.string().trim().required("Event ID is required"),
|
|
@@ -534,7 +534,6 @@ var vendorSchema = globalResourceSchema.shape({
|
|
|
534
534
|
vendorType: yup3.mixed().oneOf(Object.values(EnumVendorType)).required("Please select a Vendor type")
|
|
535
535
|
});
|
|
536
536
|
var vendorInfoSchema = yup3.object().shape({
|
|
537
|
-
contactDetails: contactDetailsSchema,
|
|
538
537
|
product: yup3.object().shape({
|
|
539
538
|
foodFlavors: yup3.array().of(
|
|
540
539
|
yup3.mixed().oneOf(Object.values(EnumFoodFlavor), "Invalid flavor selected").required("Flavor is required")
|
|
@@ -717,6 +716,11 @@ var adSchema = yup7.object().shape({
|
|
|
717
716
|
// src/hooks/utils.ts
|
|
718
717
|
var globalDefaultValues = {
|
|
719
718
|
active: false,
|
|
719
|
+
contactDetails: {
|
|
720
|
+
email: null,
|
|
721
|
+
landlinePhone: null,
|
|
722
|
+
mobilePhone: null
|
|
723
|
+
},
|
|
720
724
|
cover: {
|
|
721
725
|
source: "",
|
|
722
726
|
title: ""
|
|
@@ -738,14 +742,7 @@ var globalDefaultValues = {
|
|
|
738
742
|
};
|
|
739
743
|
var defaultEventFormValues = {
|
|
740
744
|
...globalDefaultValues,
|
|
741
|
-
dateTime: [
|
|
742
|
-
{
|
|
743
|
-
endDate: "",
|
|
744
|
-
endTime: "",
|
|
745
|
-
startDate: "",
|
|
746
|
-
startTime: ""
|
|
747
|
-
}
|
|
748
|
-
],
|
|
745
|
+
dateTime: [],
|
|
749
746
|
eventType: "market" /* MARKET */,
|
|
750
747
|
location: {
|
|
751
748
|
city: "",
|
|
@@ -766,20 +763,7 @@ var defaultEventFormValues = {
|
|
|
766
763
|
};
|
|
767
764
|
var defaultEventInfoFormValues = {
|
|
768
765
|
applicationDeadlineHours: 24,
|
|
769
|
-
|
|
770
|
-
email: null,
|
|
771
|
-
landlinePhone: null,
|
|
772
|
-
mobilePhone: null
|
|
773
|
-
},
|
|
774
|
-
dateTime: [
|
|
775
|
-
{
|
|
776
|
-
endDate: "",
|
|
777
|
-
endTime: "",
|
|
778
|
-
stallTypes: [],
|
|
779
|
-
startDate: "",
|
|
780
|
-
startTime: ""
|
|
781
|
-
}
|
|
782
|
-
],
|
|
766
|
+
dateTime: [],
|
|
783
767
|
eventId: "",
|
|
784
768
|
packInTime: 2,
|
|
785
769
|
// e.g., 2 hours before event opens
|
|
@@ -802,11 +786,6 @@ var defaultVendorFormValues = {
|
|
|
802
786
|
};
|
|
803
787
|
var defaultVendorInfoFormValues = {
|
|
804
788
|
compliance: { foodBeverageLicense: false, liabilityInsurance: false },
|
|
805
|
-
contactDetails: {
|
|
806
|
-
email: null,
|
|
807
|
-
landlinePhone: null,
|
|
808
|
-
mobilePhone: null
|
|
809
|
-
},
|
|
810
789
|
documents: null,
|
|
811
790
|
documentsUpload: null,
|
|
812
791
|
product: {
|
|
@@ -829,6 +808,7 @@ function mapBaseResourceTypeToFormData(data) {
|
|
|
829
808
|
return {
|
|
830
809
|
_id: data._id,
|
|
831
810
|
active: data.active,
|
|
811
|
+
contactDetails: data.contactDetails,
|
|
832
812
|
cover: data.cover,
|
|
833
813
|
coverUpload: data.coverUpload,
|
|
834
814
|
description: data.description,
|
|
@@ -952,7 +932,6 @@ function useVendorInfoForm(data) {
|
|
|
952
932
|
reset({
|
|
953
933
|
_id: data._id,
|
|
954
934
|
compliance: data.compliance,
|
|
955
|
-
contactDetails: data.contactDetails,
|
|
956
935
|
documents: data.documents,
|
|
957
936
|
documentsUpload: data.documentsUpload,
|
|
958
937
|
product: data.product,
|
|
@@ -967,7 +946,6 @@ function useVendorInfoForm(data) {
|
|
|
967
946
|
const {
|
|
968
947
|
_id,
|
|
969
948
|
compliance,
|
|
970
|
-
contactDetails,
|
|
971
949
|
documents,
|
|
972
950
|
documentsUpload,
|
|
973
951
|
product,
|
|
@@ -980,7 +958,6 @@ function useVendorInfoForm(data) {
|
|
|
980
958
|
fields: {
|
|
981
959
|
_id,
|
|
982
960
|
compliance,
|
|
983
|
-
contactDetails,
|
|
984
961
|
documents,
|
|
985
962
|
documentsUpload,
|
|
986
963
|
product,
|
|
@@ -1109,7 +1086,6 @@ function useEventInfoForm(data) {
|
|
|
1109
1086
|
reset({
|
|
1110
1087
|
_id: data._id,
|
|
1111
1088
|
applicationDeadlineHours: data.applicationDeadlineHours,
|
|
1112
|
-
contactDetails: data.contactDetails,
|
|
1113
1089
|
dateTime: data.dateTime,
|
|
1114
1090
|
eventId: data.eventId,
|
|
1115
1091
|
packInTime: data.packInTime,
|
|
@@ -1124,7 +1100,6 @@ function useEventInfoForm(data) {
|
|
|
1124
1100
|
const {
|
|
1125
1101
|
_id,
|
|
1126
1102
|
applicationDeadlineHours,
|
|
1127
|
-
contactDetails,
|
|
1128
1103
|
dateTime,
|
|
1129
1104
|
eventId,
|
|
1130
1105
|
packInTime,
|
|
@@ -1137,7 +1112,6 @@ function useEventInfoForm(data) {
|
|
|
1137
1112
|
fields: {
|
|
1138
1113
|
_id,
|
|
1139
1114
|
applicationDeadlineHours,
|
|
1140
|
-
contactDetails,
|
|
1141
1115
|
dateTime,
|
|
1142
1116
|
eventId,
|
|
1143
1117
|
packInTime,
|