@timardex/cluemart-shared 1.5.705 → 1.5.706
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/graphql/index.d.mts +1 -1
- package/dist/graphql/index.d.ts +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +69 -2025
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -106
- package/dist/index.d.ts +1 -106
- package/dist/index.mjs +69 -1998
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/{auth-Dvp1IEH_.d.mts → post-CswgI5jI.d.mts} +49 -49
- package/dist/{auth-Cp3BRIVM.d.ts → post-NK1XwGmZ.d.ts} +49 -49
package/dist/index.mjs
CHANGED
|
@@ -32,13 +32,13 @@ var EnumPaymentMethod = /* @__PURE__ */ ((EnumPaymentMethod2) => {
|
|
|
32
32
|
EnumPaymentMethod2["STRIPE"] = "stripe";
|
|
33
33
|
return EnumPaymentMethod2;
|
|
34
34
|
})(EnumPaymentMethod || {});
|
|
35
|
-
var EnumFoodFlavor = /* @__PURE__ */ ((
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return
|
|
35
|
+
var EnumFoodFlavor = /* @__PURE__ */ ((EnumFoodFlavor2) => {
|
|
36
|
+
EnumFoodFlavor2["SALTY"] = "Salty";
|
|
37
|
+
EnumFoodFlavor2["SAVOURY"] = "Savoury";
|
|
38
|
+
EnumFoodFlavor2["SPICY"] = "Spicy";
|
|
39
|
+
EnumFoodFlavor2["SWEET"] = "Sweet";
|
|
40
|
+
EnumFoodFlavor2["OTHER"] = "Not_Applicable";
|
|
41
|
+
return EnumFoodFlavor2;
|
|
42
42
|
})(EnumFoodFlavor || {});
|
|
43
43
|
var EnumFoodType = /* @__PURE__ */ ((EnumFoodType2) => {
|
|
44
44
|
EnumFoodType2["ADDITIVE_FREE"] = "Additive_Free";
|
|
@@ -84,23 +84,23 @@ var EnumResourceType = /* @__PURE__ */ ((EnumResourceType2) => {
|
|
|
84
84
|
EnumResourceType2["PARTNER"] = "partner";
|
|
85
85
|
return EnumResourceType2;
|
|
86
86
|
})(EnumResourceType || {});
|
|
87
|
-
var EnumEventType = /* @__PURE__ */ ((
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return
|
|
87
|
+
var EnumEventType = /* @__PURE__ */ ((EnumEventType2) => {
|
|
88
|
+
EnumEventType2["MARKET"] = "Market";
|
|
89
|
+
EnumEventType2["EXPO"] = "Expo";
|
|
90
|
+
EnumEventType2["FAIR"] = "Fair";
|
|
91
|
+
EnumEventType2["FESTIVAL"] = "Festival";
|
|
92
|
+
return EnumEventType2;
|
|
93
93
|
})(EnumEventType || {});
|
|
94
94
|
var EnumVendorType = /* @__PURE__ */ ((EnumVendorType2) => {
|
|
95
95
|
EnumVendorType2["STALLHOLDER"] = "Stallholder";
|
|
96
96
|
EnumVendorType2["SHOP"] = "Shop";
|
|
97
97
|
return EnumVendorType2;
|
|
98
98
|
})(EnumVendorType || {});
|
|
99
|
-
var EnumPartnerType = /* @__PURE__ */ ((
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return
|
|
99
|
+
var EnumPartnerType = /* @__PURE__ */ ((EnumPartnerType2) => {
|
|
100
|
+
EnumPartnerType2["CHARITY_PARTNER"] = "Charity_Partner";
|
|
101
|
+
EnumPartnerType2["MEDIA_PARTNER"] = "Media_Partner";
|
|
102
|
+
EnumPartnerType2["SUPPORTING_PARTNER"] = "Supporting_Partner";
|
|
103
|
+
return EnumPartnerType2;
|
|
104
104
|
})(EnumPartnerType || {});
|
|
105
105
|
var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform2) => {
|
|
106
106
|
EnumOSPlatform2["ANDROID"] = "android";
|
|
@@ -553,8 +553,8 @@ dayjs.extend(utc);
|
|
|
553
553
|
dayjs.extend(timezone);
|
|
554
554
|
dayjs.extend(isSameOrAfter);
|
|
555
555
|
var NZ_TZ = "Pacific/Auckland";
|
|
556
|
-
function toNZTime(
|
|
557
|
-
return
|
|
556
|
+
function toNZTime(date) {
|
|
557
|
+
return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
|
|
558
558
|
}
|
|
559
559
|
function nzStartOfDay(input) {
|
|
560
560
|
if (input == null) {
|
|
@@ -588,10 +588,10 @@ var getCurrentAndFutureDates = (dates) => {
|
|
|
588
588
|
return dateTime.isSameOrAfter(now);
|
|
589
589
|
});
|
|
590
590
|
};
|
|
591
|
-
var isFutureDatesBeforeThreshold = (
|
|
591
|
+
var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
|
|
592
592
|
const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
|
|
593
593
|
const dateTime = dayjs(
|
|
594
|
-
`${
|
|
594
|
+
`${date.startDate} ${date.startTime}`,
|
|
595
595
|
`${dateFormat} ${timeFormat}`
|
|
596
596
|
);
|
|
597
597
|
return dateTime.isSameOrAfter(threshold);
|
|
@@ -634,9 +634,9 @@ function hashStringToNumber(seed) {
|
|
|
634
634
|
}
|
|
635
635
|
return hash >>> 0;
|
|
636
636
|
}
|
|
637
|
-
function seededShuffle(
|
|
637
|
+
function seededShuffle(array, seed) {
|
|
638
638
|
const rng = createSeededRng(hashStringToNumber(seed));
|
|
639
|
-
const result = [...
|
|
639
|
+
const result = [...array];
|
|
640
640
|
for (let i = result.length - 1; i > 0; i--) {
|
|
641
641
|
const j = Math.floor(rng() * (i + 1));
|
|
642
642
|
[result[i], result[j]] = [result[j], result[i]];
|
|
@@ -6513,1949 +6513,6 @@ var useGetSchool = (_id) => {
|
|
|
6513
6513
|
};
|
|
6514
6514
|
};
|
|
6515
6515
|
|
|
6516
|
-
// src/hooks/useLocationSearch.ts
|
|
6517
|
-
var handleApiError = (error, message) => {
|
|
6518
|
-
console.error(message, error);
|
|
6519
|
-
};
|
|
6520
|
-
var useLocationSearch = (googleApi) => {
|
|
6521
|
-
const getPredictions = async (text) => {
|
|
6522
|
-
try {
|
|
6523
|
-
const response = await fetch(
|
|
6524
|
-
"https://places.googleapis.com/v1/places:autocomplete",
|
|
6525
|
-
{
|
|
6526
|
-
body: JSON.stringify({
|
|
6527
|
-
input: `${text} New Zealand`,
|
|
6528
|
-
languageCode: "en",
|
|
6529
|
-
regionCode: "nz"
|
|
6530
|
-
}),
|
|
6531
|
-
headers: {
|
|
6532
|
-
"Content-Type": "application/json",
|
|
6533
|
-
"X-Goog-Api-Key": googleApi,
|
|
6534
|
-
"X-Goog-FieldMask": "suggestions.placePrediction.placeId,suggestions.placePrediction.text.text"
|
|
6535
|
-
},
|
|
6536
|
-
method: "POST"
|
|
6537
|
-
}
|
|
6538
|
-
);
|
|
6539
|
-
if (!response.ok) {
|
|
6540
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
6541
|
-
}
|
|
6542
|
-
const data = await response.json();
|
|
6543
|
-
const suggestions = data.suggestions ?? [];
|
|
6544
|
-
const predictions = suggestions.map((suggestion) => suggestion.placePrediction).filter(Boolean).map((prediction) => ({
|
|
6545
|
-
description: prediction?.text?.text || "",
|
|
6546
|
-
place_id: prediction?.placeId || ""
|
|
6547
|
-
})).filter((prediction) => prediction.place_id && prediction.description);
|
|
6548
|
-
return predictions;
|
|
6549
|
-
} catch (error) {
|
|
6550
|
-
console.error("Error fetching predictions:", error);
|
|
6551
|
-
handleApiError(error, "Failed to fetch address predictions.");
|
|
6552
|
-
}
|
|
6553
|
-
};
|
|
6554
|
-
const getPlaceDetails = async (placeId) => {
|
|
6555
|
-
try {
|
|
6556
|
-
const response = await fetch(
|
|
6557
|
-
`https://places.googleapis.com/v1/places/${placeId}`,
|
|
6558
|
-
{
|
|
6559
|
-
headers: {
|
|
6560
|
-
"X-Goog-Api-Key": googleApi,
|
|
6561
|
-
"X-Goog-FieldMask": "addressComponents,formattedAddress,location"
|
|
6562
|
-
}
|
|
6563
|
-
}
|
|
6564
|
-
);
|
|
6565
|
-
if (!response.ok) {
|
|
6566
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
6567
|
-
}
|
|
6568
|
-
const result = await response.json();
|
|
6569
|
-
const { latitude, longitude } = result.location;
|
|
6570
|
-
const { addressComponents, formattedAddress } = result;
|
|
6571
|
-
const address = addressComponents.reduce((acc, item) => {
|
|
6572
|
-
if (!Array.isArray(item.types)) return acc;
|
|
6573
|
-
if (item.types.includes("street_number")) {
|
|
6574
|
-
return { ...acc, streetNumber: item.longText };
|
|
6575
|
-
}
|
|
6576
|
-
if (item.types.includes("route")) {
|
|
6577
|
-
return { ...acc, streetName: item.longText };
|
|
6578
|
-
}
|
|
6579
|
-
if (item.types.includes("locality")) {
|
|
6580
|
-
return { ...acc, city: item.longText };
|
|
6581
|
-
}
|
|
6582
|
-
if (item.types.includes("administrative_area_level_1")) {
|
|
6583
|
-
return { ...acc, region: item.longText };
|
|
6584
|
-
}
|
|
6585
|
-
if (item.types.includes("country")) {
|
|
6586
|
-
return { ...acc, country: item.longText };
|
|
6587
|
-
}
|
|
6588
|
-
return acc;
|
|
6589
|
-
}, {});
|
|
6590
|
-
const newLocation = {
|
|
6591
|
-
city: address.city ? address.city.toLowerCase() : "",
|
|
6592
|
-
country: address.country,
|
|
6593
|
-
fullAddress: formattedAddress,
|
|
6594
|
-
geo: {
|
|
6595
|
-
coordinates: [longitude, latitude],
|
|
6596
|
-
// [longitude, latitude]
|
|
6597
|
-
type: "Point"
|
|
6598
|
-
// Mongoose GeoJSON type
|
|
6599
|
-
},
|
|
6600
|
-
latitude,
|
|
6601
|
-
longitude,
|
|
6602
|
-
region: address.region ? address.region.replace(/ Region$/, "") : ""
|
|
6603
|
-
// Remove " Region" suffix
|
|
6604
|
-
};
|
|
6605
|
-
return newLocation;
|
|
6606
|
-
} catch (error) {
|
|
6607
|
-
handleApiError(error, "Failed to fetch place details.");
|
|
6608
|
-
}
|
|
6609
|
-
};
|
|
6610
|
-
return {
|
|
6611
|
-
getPlaceDetails,
|
|
6612
|
-
getPredictions
|
|
6613
|
-
};
|
|
6614
|
-
};
|
|
6615
|
-
|
|
6616
|
-
// src/hooks/vendor/useVendorForm.ts
|
|
6617
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
6618
|
-
import * as React from "react";
|
|
6619
|
-
import { useForm } from "react-hook-form";
|
|
6620
|
-
|
|
6621
|
-
// src/yupSchema/global.ts
|
|
6622
|
-
import dayjs2 from "dayjs";
|
|
6623
|
-
import customParseFormat2 from "dayjs/plugin/customParseFormat.js";
|
|
6624
|
-
import isSameOrAfter2 from "dayjs/plugin/isSameOrAfter.js";
|
|
6625
|
-
import * as yup from "yup";
|
|
6626
|
-
var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
|
|
6627
|
-
var nzbnRegex = /^94\d{11}$/;
|
|
6628
|
-
var normalizedUrlTransform = () => yup.string().trim().transform(
|
|
6629
|
-
(value) => typeof value === "string" ? value.toLowerCase() : value
|
|
6630
|
-
).transform(
|
|
6631
|
-
(value) => typeof value === "string" ? normalizeUrl(value) : value
|
|
6632
|
-
);
|
|
6633
|
-
var noLeadingZeros = (fieldName, options = {}) => {
|
|
6634
|
-
return function(value, context) {
|
|
6635
|
-
const original = context.originalValue;
|
|
6636
|
-
if (typeof original !== "string") {
|
|
6637
|
-
return true;
|
|
6638
|
-
}
|
|
6639
|
-
if (original === "") {
|
|
6640
|
-
return true;
|
|
6641
|
-
}
|
|
6642
|
-
const regex = options.allowDecimal ? /^0\d+(\.\d+)?$/ : /^0\d+$/;
|
|
6643
|
-
if (regex.test(original)) {
|
|
6644
|
-
return context.createError({
|
|
6645
|
-
message: `${fieldName} must not have leading zeros`
|
|
6646
|
-
});
|
|
6647
|
-
}
|
|
6648
|
-
return true;
|
|
6649
|
-
};
|
|
6650
|
-
};
|
|
6651
|
-
var toOptionalNumber = (originalValue) => {
|
|
6652
|
-
if (originalValue === "" || originalValue === null || originalValue === void 0) {
|
|
6653
|
-
return void 0;
|
|
6654
|
-
}
|
|
6655
|
-
let parsed;
|
|
6656
|
-
if (typeof originalValue === "number") {
|
|
6657
|
-
parsed = originalValue;
|
|
6658
|
-
} else if (typeof originalValue === "string") {
|
|
6659
|
-
parsed = Number(originalValue.replace(",", "."));
|
|
6660
|
-
} else {
|
|
6661
|
-
parsed = void 0;
|
|
6662
|
-
}
|
|
6663
|
-
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
6664
|
-
};
|
|
6665
|
-
dayjs2.extend(isSameOrAfter2);
|
|
6666
|
-
dayjs2.extend(customParseFormat2);
|
|
6667
|
-
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
6668
|
-
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
6669
|
-
);
|
|
6670
|
-
var emailOptionalSchema = yup.string().nullable().notRequired().transform(
|
|
6671
|
-
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
6672
|
-
).test(
|
|
6673
|
-
"is-valid-email",
|
|
6674
|
-
"Invalid email address",
|
|
6675
|
-
(value) => !value || yup.string().email().isValidSync(value)
|
|
6676
|
-
).label("Email");
|
|
6677
|
-
var mobileRegex = /^02\d{7,9}$/;
|
|
6678
|
-
var landlineRegex = /^0[34679]\d{7}$/;
|
|
6679
|
-
var mobilePhoneSchema = yup.string().label("Mobile Phone").nullable().notRequired().test(
|
|
6680
|
-
"mobile-phone",
|
|
6681
|
-
"Mobile must start with 02 and be 9\u201311 digits",
|
|
6682
|
-
(value) => !value || mobileRegex.test(value)
|
|
6683
|
-
// skip empty values
|
|
6684
|
-
);
|
|
6685
|
-
var landlinePhoneSchema = yup.string().label("Landline Phone").nullable().notRequired().test(
|
|
6686
|
-
"landline-phone",
|
|
6687
|
-
"Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
|
|
6688
|
-
(value) => !value || landlineRegex.test(value)
|
|
6689
|
-
// skip empty values
|
|
6690
|
-
);
|
|
6691
|
-
var contactDetailsSchema = yup.object({
|
|
6692
|
-
email: emailOptionalSchema,
|
|
6693
|
-
mobilePhone: mobilePhoneSchema,
|
|
6694
|
-
landlinePhone: landlinePhoneSchema
|
|
6695
|
-
}).nullable().default(void 0);
|
|
6696
|
-
var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
|
|
6697
|
-
const now = dayjs2();
|
|
6698
|
-
return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
|
|
6699
|
-
});
|
|
6700
|
-
var startDateNotInPastTest = yup.string().test("not-in-past", "Start date cannot be in the past", (value) => {
|
|
6701
|
-
const now = dayjs2();
|
|
6702
|
-
return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
|
|
6703
|
-
});
|
|
6704
|
-
var endDateAfterStartDateTest = yup.string().test(
|
|
6705
|
-
"end-after-start",
|
|
6706
|
-
"End date cannot be before start date",
|
|
6707
|
-
function(value) {
|
|
6708
|
-
const { startDate } = this.parent;
|
|
6709
|
-
if (!startDate || !value) return false;
|
|
6710
|
-
return dayjs2(value, dateFormat, true).isSameOrAfter(
|
|
6711
|
-
dayjs2(startDate, dateFormat, true),
|
|
6712
|
-
"day"
|
|
6713
|
-
);
|
|
6714
|
-
}
|
|
6715
|
-
);
|
|
6716
|
-
var endTimeMustBeAfterStartTimeTest = yup.string().test(
|
|
6717
|
-
"valid-end-time",
|
|
6718
|
-
"End time must be after start time",
|
|
6719
|
-
function(value) {
|
|
6720
|
-
const { startDate, endDate, startTime } = this.parent;
|
|
6721
|
-
if (!startDate || !endDate || !startTime || !value) return false;
|
|
6722
|
-
const startDateTime = dayjs2(
|
|
6723
|
-
`${startDate} ${startTime}`,
|
|
6724
|
-
`${dateFormat} ${timeFormat}`,
|
|
6725
|
-
true
|
|
6726
|
-
);
|
|
6727
|
-
const endDateTime = dayjs2(
|
|
6728
|
-
`${endDate} ${value}`,
|
|
6729
|
-
`${dateFormat} ${timeFormat}`,
|
|
6730
|
-
true
|
|
6731
|
-
);
|
|
6732
|
-
return endDateTime.isAfter(startDateTime);
|
|
6733
|
-
}
|
|
6734
|
-
);
|
|
6735
|
-
var startTimeCannotBeInPastTest = yup.string().test(
|
|
6736
|
-
"valid-start-time",
|
|
6737
|
-
"Start time cannot be in the past",
|
|
6738
|
-
function(value) {
|
|
6739
|
-
const now = dayjs2();
|
|
6740
|
-
const { startDate } = this.parent;
|
|
6741
|
-
if (!startDate || !value) return false;
|
|
6742
|
-
const startDateTime = dayjs2(
|
|
6743
|
-
`${startDate} ${value}`,
|
|
6744
|
-
`${dateFormat} ${timeFormat}`,
|
|
6745
|
-
true
|
|
6746
|
-
);
|
|
6747
|
-
return startDateTime.isSameOrAfter(now);
|
|
6748
|
-
}
|
|
6749
|
-
);
|
|
6750
|
-
var dateTimeSchema = yup.object().shape({
|
|
6751
|
-
dateStatus: yup.mixed().oneOf(Object.values(EnumEventDateStatus)).required("Date status is required"),
|
|
6752
|
-
endDate: yup.string().label("End Date").concat(endDateNotInPastTest).concat(endDateAfterStartDateTest).required("End date is required"),
|
|
6753
|
-
endTime: yup.string().label("End Time").concat(endTimeMustBeAfterStartTimeTest).required("End time is required"),
|
|
6754
|
-
startDate: yup.string().label("Start Date").concat(startDateNotInPastTest).required("Start date is required"),
|
|
6755
|
-
startTime: yup.string().label("Start Time").concat(startTimeCannotBeInPastTest).required("Start time is required")
|
|
6756
|
-
});
|
|
6757
|
-
var stallTypesSchema = yup.object({
|
|
6758
|
-
label: yup.string().trim().label("Stall Type").required("Stall type is required"),
|
|
6759
|
-
price: yup.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Stall Price").min(0.1, "Stall price must be at least 0.1").required("Stall price is required").test(
|
|
6760
|
-
"no-leading-zeros",
|
|
6761
|
-
"",
|
|
6762
|
-
noLeadingZeros("Stall price", { allowDecimal: true })
|
|
6763
|
-
),
|
|
6764
|
-
stallCapacity: yup.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Stall Capacity").typeError("Stall capacity must be a number").min(0, "Stall capacity cannot be negative").integer("Stall capacity must be a whole number").required("Stall capacity is required").test("no-leading-zeros", "", noLeadingZeros("Stall capacity"))
|
|
6765
|
-
});
|
|
6766
|
-
var dateTimeWithPriceSchema = dateTimeSchema.shape({
|
|
6767
|
-
stallTypes: yup.array().of(stallTypesSchema).min(1, "At least one stall type is required").required("Stall types are required")
|
|
6768
|
-
});
|
|
6769
|
-
var locationSchema = yup.object().shape({
|
|
6770
|
-
city: yup.string().label("City").required("City is required"),
|
|
6771
|
-
country: yup.string().label("Country").required("Country is required"),
|
|
6772
|
-
fullAddress: yup.string().label("Address").required("Address is required"),
|
|
6773
|
-
geo: yup.object().shape({
|
|
6774
|
-
coordinates: yup.array().of(yup.number().required("Coordinates must be numbers")).length(
|
|
6775
|
-
2,
|
|
6776
|
-
"Coordinates must contain exactly two numbers (longitude, latitude)"
|
|
6777
|
-
).required("Coordinates are required"),
|
|
6778
|
-
type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
|
|
6779
|
-
}),
|
|
6780
|
-
latitude: yup.number().label("Latitude").required("Latitude is required"),
|
|
6781
|
-
longitude: yup.number().label("Longitude").required("Longitude is required"),
|
|
6782
|
-
region: yup.string().label("Region").required("Region is required")
|
|
6783
|
-
});
|
|
6784
|
-
var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
|
|
6785
|
-
var socialMediaSchema = yup.object({
|
|
6786
|
-
name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
|
|
6787
|
-
link: yup.string().when("name", {
|
|
6788
|
-
is: (name) => !!name,
|
|
6789
|
-
// If name has a value
|
|
6790
|
-
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
6791
|
-
otherwise: (schema) => schema.notRequired()
|
|
6792
|
-
})
|
|
6793
|
-
});
|
|
6794
|
-
var globalResourceSchema = yup.object().shape({
|
|
6795
|
-
active: yup.boolean().required("Active is required"),
|
|
6796
|
-
cover: yup.object({
|
|
6797
|
-
source: yup.string().label("Cover").required("Cover Image is required"),
|
|
6798
|
-
title: yup.string().label("Cover Title").required("Cover Title is required")
|
|
6799
|
-
}),
|
|
6800
|
-
contactDetails: contactDetailsSchema,
|
|
6801
|
-
description: yup.string().label("Description").trim().min(50).required("Description is required"),
|
|
6802
|
-
name: yup.string().label("Name").trim().min(3).required("Name is required"),
|
|
6803
|
-
region: yup.string().label("Region").required("Region is required"),
|
|
6804
|
-
socialMedia: yup.array().of(socialMediaSchema).nullable().default(null),
|
|
6805
|
-
associates: yup.array().of(
|
|
6806
|
-
yup.object().shape({
|
|
6807
|
-
email: emailRequiredSchema,
|
|
6808
|
-
resourceId: yup.string().label("Resource ID").required("Resource ID is required"),
|
|
6809
|
-
resourceType: yup.mixed().oneOf(Object.values(EnumResourceType)).label("Resource Type").required("Resource Type is required"),
|
|
6810
|
-
licence: yup.object({
|
|
6811
|
-
expiryDate: yup.date().required("Expiry Date is required"),
|
|
6812
|
-
issuedDate: yup.date().required("Issued Date is required"),
|
|
6813
|
-
licenceType: yup.mixed().oneOf(Object.values(EnumUserLicence)).label("Licence Type").required("Licence Type is required")
|
|
6814
|
-
})
|
|
6815
|
-
})
|
|
6816
|
-
).nullable().default(null)
|
|
6817
|
-
});
|
|
6818
|
-
var categorySchema = yup.array().of(
|
|
6819
|
-
yup.object().shape({
|
|
6820
|
-
id: yup.string().required("Category id is required"),
|
|
6821
|
-
name: yup.string().required("Category name is required"),
|
|
6822
|
-
subcategories: yup.array().of(
|
|
6823
|
-
yup.object().shape({
|
|
6824
|
-
id: yup.string().defined(),
|
|
6825
|
-
items: yup.array().of(
|
|
6826
|
-
yup.object().shape({
|
|
6827
|
-
id: yup.string().defined(),
|
|
6828
|
-
name: yup.string().defined()
|
|
6829
|
-
})
|
|
6830
|
-
).nullable(),
|
|
6831
|
-
name: yup.string().defined()
|
|
6832
|
-
})
|
|
6833
|
-
).min(1, "At least one subcategory is required").required("Subcategories are required")
|
|
6834
|
-
})
|
|
6835
|
-
);
|
|
6836
|
-
|
|
6837
|
-
// src/yupSchema/event.ts
|
|
6838
|
-
import * as yup2 from "yup";
|
|
6839
|
-
var eventSchema = globalResourceSchema.shape({
|
|
6840
|
-
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(
|
|
6841
|
-
"unique-start-date-time",
|
|
6842
|
-
"Start Date and Start Time must be unique",
|
|
6843
|
-
function(value) {
|
|
6844
|
-
if (!value) return true;
|
|
6845
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6846
|
-
for (const item of value) {
|
|
6847
|
-
if (!item.startDate || !item.startTime) continue;
|
|
6848
|
-
const key = `${item.startDate}_${item.startTime}`;
|
|
6849
|
-
if (seen.has(key)) {
|
|
6850
|
-
return false;
|
|
6851
|
-
}
|
|
6852
|
-
seen.add(key);
|
|
6853
|
-
}
|
|
6854
|
-
return true;
|
|
6855
|
-
}
|
|
6856
|
-
),
|
|
6857
|
-
eventType: yup2.mixed().oneOf(Object.values(EnumEventType), "Please select a valid Event type").required("Please select an Event type"),
|
|
6858
|
-
location: locationSchema,
|
|
6859
|
-
nzbn: yup2.string().required("NZBN is required").matches(nzbnRegex, "NZBN must be 13 digits and start with 94"),
|
|
6860
|
-
rainOrShine: yup2.boolean().label("Rain or Shine").required("Please specify if the event is rain or shine"),
|
|
6861
|
-
tags: yup2.array().of(yup2.string().defined()).min(1, "Tags are required").required("Tags are required")
|
|
6862
|
-
});
|
|
6863
|
-
var paymentInfoSchema = yup2.object({
|
|
6864
|
-
paymentMethod: yup2.mixed().oneOf(
|
|
6865
|
-
Object.values(EnumPaymentMethod),
|
|
6866
|
-
"Please select a valid Payment method"
|
|
6867
|
-
).required("Please select a Payment method"),
|
|
6868
|
-
accountHolderName: yup2.string().when("paymentMethod", {
|
|
6869
|
-
is: "bank_transfer" /* BANK_TRANSFER */,
|
|
6870
|
-
then: (schema) => schema.required("Account holder name is required for bank transfer").trim(),
|
|
6871
|
-
otherwise: (schema) => schema.notRequired()
|
|
6872
|
-
}),
|
|
6873
|
-
accountNumber: yup2.string().when("paymentMethod", {
|
|
6874
|
-
is: "bank_transfer" /* BANK_TRANSFER */,
|
|
6875
|
-
then: (schema) => schema.required("Account number is required for bank transfer").matches(
|
|
6876
|
-
nzBankAccountRegex,
|
|
6877
|
-
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
6878
|
-
).trim(),
|
|
6879
|
-
otherwise: (schema) => schema.notRequired()
|
|
6880
|
-
}),
|
|
6881
|
-
link: yup2.string().when("paymentMethod", {
|
|
6882
|
-
is: (val) => val === "paypal" /* PAYPAL */ || val === "stripe" /* STRIPE */,
|
|
6883
|
-
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
6884
|
-
otherwise: (schema) => schema.notRequired()
|
|
6885
|
-
})
|
|
6886
|
-
});
|
|
6887
|
-
var eventInfoSchema = yup2.object().shape({
|
|
6888
|
-
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")),
|
|
6889
|
-
dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
6890
|
-
eventId: yup2.string().trim().required("Event ID is required"),
|
|
6891
|
-
packInTime: yup2.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Pack In Time").typeError("Pack in time must be a number").min(1, "Pack in time must be at least 1").required("Pack in time is required").test("no-leading-zeros", "", noLeadingZeros("Pack in time")),
|
|
6892
|
-
paymentDueHours: yup2.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Payment Due Hours").typeError("Payment due hours must be a number").min(1, "Payment due hours must be at least 1").required("Payment due hours is required").test("no-leading-zeros", "", noLeadingZeros("Payment due hours")).test(
|
|
6893
|
-
"payment-before-deadline",
|
|
6894
|
-
"Payment due hours must be less than application deadline hours",
|
|
6895
|
-
function(value) {
|
|
6896
|
-
const { applicationDeadlineHours } = this.parent;
|
|
6897
|
-
return value < applicationDeadlineHours;
|
|
6898
|
-
}
|
|
6899
|
-
),
|
|
6900
|
-
paymentInfo: yup2.array().of(paymentInfoSchema).min(1, "At least one payment method is required").required("Payment info is required"),
|
|
6901
|
-
refundPolicy: yup2.array().of(
|
|
6902
|
-
yup2.object({
|
|
6903
|
-
category: yup2.mixed().required("Category is required"),
|
|
6904
|
-
label: yup2.string().required("Label is required"),
|
|
6905
|
-
value: yup2.boolean().required("Value is required")
|
|
6906
|
-
})
|
|
6907
|
-
).min(1, "At least one refund policy item is required").test(
|
|
6908
|
-
"at-least-one-true",
|
|
6909
|
-
"At least one refund policy option must be selected",
|
|
6910
|
-
(value) => {
|
|
6911
|
-
if (!value) return false;
|
|
6912
|
-
return value.some((item) => item.value === true);
|
|
6913
|
-
}
|
|
6914
|
-
).required("Refund policy is required")
|
|
6915
|
-
});
|
|
6916
|
-
|
|
6917
|
-
// src/yupSchema/vendor.ts
|
|
6918
|
-
import * as yup3 from "yup";
|
|
6919
|
-
var vendorMenuSchema = yup3.object({
|
|
6920
|
-
description: yup3.string().nullable().optional(),
|
|
6921
|
-
name: yup3.string().nullable().required("Product name is required"),
|
|
6922
|
-
price: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product price must be greater than 0").required("Product price is required"),
|
|
6923
|
-
priceUnit: yup3.string().required("Product unit is required")
|
|
6924
|
-
});
|
|
6925
|
-
var vendorSchema = globalResourceSchema.shape({
|
|
6926
|
-
categories: categorySchema.min(1, "Category list must contain at least one item").required("Categories are required"),
|
|
6927
|
-
foodTruck: yup3.boolean().label("Food Truck").required("Please specify if the vendor is a food truck"),
|
|
6928
|
-
products: yup3.object().shape({
|
|
6929
|
-
active: yup3.boolean().nullable().optional(),
|
|
6930
|
-
productsList: yup3.array().of(vendorMenuSchema).nullable().optional()
|
|
6931
|
-
}).nullable().optional(),
|
|
6932
|
-
vendorType: yup3.mixed().oneOf(Object.values(EnumVendorType)).required("Please select a Vendor type")
|
|
6933
|
-
});
|
|
6934
|
-
var unregisteredVendorSchema = yup3.object().shape({
|
|
6935
|
-
categoryIds: yup3.array().of(yup3.string().defined()).min(1, "Category list must contain at least one item").required("Categories are required"),
|
|
6936
|
-
dateTime: yup3.array().of(dateTimeSchema).min(1, "DateTime list must contain at least one item").required("DateTime is required"),
|
|
6937
|
-
email: emailOptionalSchema,
|
|
6938
|
-
inviterId: yup3.string().required("Inviter ID is required"),
|
|
6939
|
-
name: yup3.string().label("Stallholder Name").trim().min(3, "Name must be at least 3 characters").required("Name is required"),
|
|
6940
|
-
region: yup3.string().label("Region").required("Region is required")
|
|
6941
|
-
});
|
|
6942
|
-
var vendorInfoSchema = yup3.object().shape({
|
|
6943
|
-
product: yup3.object().shape({
|
|
6944
|
-
foodFlavors: yup3.array().of(
|
|
6945
|
-
yup3.mixed().oneOf(Object.values(EnumFoodFlavor), "Invalid flavor selected").required("Flavor is required")
|
|
6946
|
-
).min(1, "Food flavors list must contain at least one item").required("Food flavors are required"),
|
|
6947
|
-
packaging: yup3.array().of(yup3.string().defined()).min(1, "Packaging list must contain at least one item").required("Packaging is required"),
|
|
6948
|
-
priceRange: yup3.object().shape({
|
|
6949
|
-
max: yup3.string().required("Max price is required").test(
|
|
6950
|
-
"is-number",
|
|
6951
|
-
"Max price must be a valid number",
|
|
6952
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
6953
|
-
).test(
|
|
6954
|
-
"is-greater",
|
|
6955
|
-
"Max price must be greater than or equal to Min price",
|
|
6956
|
-
function(max) {
|
|
6957
|
-
const { min } = this.parent;
|
|
6958
|
-
if (!max || !min) return true;
|
|
6959
|
-
const maxNum = Number(max);
|
|
6960
|
-
const minNum = Number(min);
|
|
6961
|
-
if (isNaN(maxNum) || isNaN(minNum)) return true;
|
|
6962
|
-
return maxNum >= minNum;
|
|
6963
|
-
}
|
|
6964
|
-
),
|
|
6965
|
-
min: yup3.string().required("Min price is required").test(
|
|
6966
|
-
"is-number",
|
|
6967
|
-
"Min price must be a valid number",
|
|
6968
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
6969
|
-
)
|
|
6970
|
-
}),
|
|
6971
|
-
producedIn: yup3.array().of(yup3.string().defined()).min(1, "Produced in list must contain at least one item").required("Produced in is required")
|
|
6972
|
-
}),
|
|
6973
|
-
requirements: yup3.object().shape({
|
|
6974
|
-
electricity: yup3.object().shape({
|
|
6975
|
-
details: yup3.string().trim().test(
|
|
6976
|
-
"details-required",
|
|
6977
|
-
"Please add electricity details",
|
|
6978
|
-
function(value) {
|
|
6979
|
-
return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
|
|
6980
|
-
}
|
|
6981
|
-
).nullable(),
|
|
6982
|
-
isRequired: yup3.boolean().required("Electricity requirement is required")
|
|
6983
|
-
}),
|
|
6984
|
-
gazebo: yup3.object().shape({
|
|
6985
|
-
details: yup3.string().trim().test(
|
|
6986
|
-
"details-required",
|
|
6987
|
-
"Please add gazebo details",
|
|
6988
|
-
function(value) {
|
|
6989
|
-
return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
|
|
6990
|
-
}
|
|
6991
|
-
).nullable(),
|
|
6992
|
-
isRequired: yup3.boolean().required("Gazebo requirement is required")
|
|
6993
|
-
}),
|
|
6994
|
-
table: yup3.object().shape({
|
|
6995
|
-
details: yup3.string().trim().test(
|
|
6996
|
-
"details-required",
|
|
6997
|
-
"Please add table details",
|
|
6998
|
-
function(value) {
|
|
6999
|
-
return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
|
|
7000
|
-
}
|
|
7001
|
-
).nullable(),
|
|
7002
|
-
isRequired: yup3.boolean().required("Table requirement is required")
|
|
7003
|
-
})
|
|
7004
|
-
}).optional(),
|
|
7005
|
-
stallInfo: yup3.object().shape({
|
|
7006
|
-
size: yup3.object().shape({
|
|
7007
|
-
depth: yup3.string().required("Depth is required").test(
|
|
7008
|
-
"is-number",
|
|
7009
|
-
"Depth must be a valid number",
|
|
7010
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
7011
|
-
).test(
|
|
7012
|
-
"is-positive",
|
|
7013
|
-
"Depth must be greater than 0",
|
|
7014
|
-
(value) => value !== void 0 && value !== "" && Number(value) > 0
|
|
7015
|
-
),
|
|
7016
|
-
width: yup3.string().required("Width is required").test(
|
|
7017
|
-
"is-number",
|
|
7018
|
-
"Width must be a valid number",
|
|
7019
|
-
(value) => value !== void 0 && value !== "" && !isNaN(Number(value))
|
|
7020
|
-
).test(
|
|
7021
|
-
"is-positive",
|
|
7022
|
-
"Width must be greater than 0",
|
|
7023
|
-
(value) => value !== void 0 && value !== "" && Number(value) > 0
|
|
7024
|
-
)
|
|
7025
|
-
})
|
|
7026
|
-
}),
|
|
7027
|
-
vendorId: yup3.string().trim().required("Vendor ID is required")
|
|
7028
|
-
});
|
|
7029
|
-
|
|
7030
|
-
// src/yupSchema/user.ts
|
|
7031
|
-
import * as yup4 from "yup";
|
|
7032
|
-
var userSchema = yup4.object().shape({
|
|
7033
|
-
active: yup4.boolean().required("Active is required"),
|
|
7034
|
-
email: emailRequiredSchema,
|
|
7035
|
-
firstName: yup4.string().label("First Name").trim().required("First name is required"),
|
|
7036
|
-
lastName: yup4.string().label("Last Name").trim().required("Last name is required"),
|
|
7037
|
-
isTester: yup4.boolean().required("Tester status is required"),
|
|
7038
|
-
password: yup4.string().nullable().trim().label("Password").min(8, "Password must be at least 8 characters long").notRequired(),
|
|
7039
|
-
preferredRegion: yup4.string().label("Preferred Region").required("Preferred region is required"),
|
|
7040
|
-
confirmPassword: yup4.string().nullable().trim().label("Confirm Password").when("password", {
|
|
7041
|
-
is: (val) => !!val,
|
|
7042
|
-
// only necessary if password typed
|
|
7043
|
-
then: (schema) => schema.required("Confirm Password is required").oneOf([yup4.ref("password")], "Passwords must match"),
|
|
7044
|
-
otherwise: (schema) => schema.notRequired()
|
|
7045
|
-
}),
|
|
7046
|
-
role: yup4.mixed().oneOf(Object.values(EnumUserRole)).required("Role is required")
|
|
7047
|
-
});
|
|
7048
|
-
|
|
7049
|
-
// src/yupSchema/auth.ts
|
|
7050
|
-
import * as yup5 from "yup";
|
|
7051
|
-
var loginSchema = yup5.object().shape({
|
|
7052
|
-
email: emailRequiredSchema,
|
|
7053
|
-
password: passwordSchema
|
|
7054
|
-
});
|
|
7055
|
-
var registerSchema = yup5.object().shape({
|
|
7056
|
-
email: emailRequiredSchema,
|
|
7057
|
-
firstName: yup5.string().label("First Name").required("First Name is required"),
|
|
7058
|
-
lastName: yup5.string().label("Last Name").required("Last Name is required"),
|
|
7059
|
-
password: passwordSchema,
|
|
7060
|
-
preferredRegion: yup5.string().label("Preferred Region").required("Preferred Region is required")
|
|
7061
|
-
});
|
|
7062
|
-
var requestPasswordResetSchema = yup5.object().shape({
|
|
7063
|
-
email: emailRequiredSchema
|
|
7064
|
-
});
|
|
7065
|
-
var resetPasswordSchema = yup5.object().shape({
|
|
7066
|
-
email: emailRequiredSchema,
|
|
7067
|
-
password: passwordSchema,
|
|
7068
|
-
// eslint-disable-next-line sort-keys
|
|
7069
|
-
confirmPassword: yup5.string().oneOf([yup5.ref("password")], "Passwords must match").required("Confirm Password is required")
|
|
7070
|
-
});
|
|
7071
|
-
var validateVerificationTokenSchema = yup5.object().shape({
|
|
7072
|
-
email: emailRequiredSchema,
|
|
7073
|
-
verificationToken: yup5.string().required("Verification code is required").matches(/^\d{6}$/, "Verification code must be exactly 6 digits")
|
|
7074
|
-
});
|
|
7075
|
-
|
|
7076
|
-
// src/yupSchema/ad.ts
|
|
7077
|
-
import * as yup6 from "yup";
|
|
7078
|
-
|
|
7079
|
-
// src/types/ad.ts
|
|
7080
|
-
var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn2) => {
|
|
7081
|
-
EnumAdShowOn2["EVENTS_PAGE"] = "Events_page";
|
|
7082
|
-
EnumAdShowOn2["FRONT_PAGE"] = "Front_page";
|
|
7083
|
-
EnumAdShowOn2["PARTNERS_PAGE"] = "Partners_page";
|
|
7084
|
-
EnumAdShowOn2["VENDORS_PAGE"] = "Vendors_page";
|
|
7085
|
-
return EnumAdShowOn2;
|
|
7086
|
-
})(EnumAdShowOn || {});
|
|
7087
|
-
var EnumAdStatus = /* @__PURE__ */ ((EnumAdStatus2) => {
|
|
7088
|
-
EnumAdStatus2["ACTIVE"] = "Active";
|
|
7089
|
-
EnumAdStatus2["PAUSED"] = "Paused";
|
|
7090
|
-
EnumAdStatus2["EXPIRED"] = "Expired";
|
|
7091
|
-
return EnumAdStatus2;
|
|
7092
|
-
})(EnumAdStatus || {});
|
|
7093
|
-
var EnumAdType = /* @__PURE__ */ ((EnumAdType2) => {
|
|
7094
|
-
EnumAdType2["SPONSORED"] = "Sponsored";
|
|
7095
|
-
EnumAdType2["FREE"] = "Free";
|
|
7096
|
-
return EnumAdType2;
|
|
7097
|
-
})(EnumAdType || {});
|
|
7098
|
-
var EnumAdStyle = /* @__PURE__ */ ((EnumAdStyle2) => {
|
|
7099
|
-
EnumAdStyle2["BLOOM"] = "Bloom";
|
|
7100
|
-
EnumAdStyle2["RISE"] = "Rise";
|
|
7101
|
-
return EnumAdStyle2;
|
|
7102
|
-
})(EnumAdStyle || {});
|
|
7103
|
-
|
|
7104
|
-
// src/yupSchema/ad.ts
|
|
7105
|
-
var adResourceSchema = yup6.object({
|
|
7106
|
-
adDescription: yup6.string().trim().required("Ad description is required").max(150, "Ad description must be at most 150 characters"),
|
|
7107
|
-
adImage: yup6.string().required("Ad image is required"),
|
|
7108
|
-
adStyle: yup6.mixed().oneOf(Object.values(EnumAdStyle), "Please select a valid ad style").required("Ad style is required"),
|
|
7109
|
-
adTitle: yup6.string().trim().required("Ad title is required").max(30, "Ad title must be at most 30 characters"),
|
|
7110
|
-
adType: yup6.mixed().oneOf(Object.values(EnumAdType), "Please select a valid ad type").required("Ad type is required"),
|
|
7111
|
-
resourceId: yup6.string().required("Resource ID is required"),
|
|
7112
|
-
resourceName: yup6.string().required("Resource name is required"),
|
|
7113
|
-
resourceRegion: yup6.string().required("Resource region is required"),
|
|
7114
|
-
resourceType: yup6.mixed().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource type is required")
|
|
7115
|
-
});
|
|
7116
|
-
var adSchema = yup6.object().shape({
|
|
7117
|
-
active: yup6.boolean().required("Active status is required"),
|
|
7118
|
-
end: yup6.date().required("End date is required").test("is-future-date", "End date must be in the future", (value) => {
|
|
7119
|
-
if (!value) return false;
|
|
7120
|
-
const endDate = new Date(value);
|
|
7121
|
-
const now = /* @__PURE__ */ new Date();
|
|
7122
|
-
return endDate > now;
|
|
7123
|
-
}).when("start", {
|
|
7124
|
-
is: (val) => val && val.length > 0,
|
|
7125
|
-
then: (schema) => schema.test(
|
|
7126
|
-
"is-after-start",
|
|
7127
|
-
"End date must be after start date",
|
|
7128
|
-
function(value) {
|
|
7129
|
-
const { start } = this.parent;
|
|
7130
|
-
if (!value || !start) return false;
|
|
7131
|
-
return new Date(value) > new Date(start);
|
|
7132
|
-
}
|
|
7133
|
-
)
|
|
7134
|
-
}),
|
|
7135
|
-
resource: adResourceSchema.required("Resource information is required"),
|
|
7136
|
-
showOn: yup6.array().of(yup6.mixed().oneOf(Object.values(EnumAdShowOn)).required()).min(1, "At least one display location is required").required("Display location is required"),
|
|
7137
|
-
status: yup6.mixed().oneOf(Object.values(EnumAdStatus)).required("Ad status is required"),
|
|
7138
|
-
start: yup6.date().when("status", {
|
|
7139
|
-
is: (status) => status !== "Active" /* ACTIVE */,
|
|
7140
|
-
then: () => yup6.date().required("Start date is required").test("is-future-date", "Start date must be in the future", (value) => {
|
|
7141
|
-
if (!value) return false;
|
|
7142
|
-
return value > /* @__PURE__ */ new Date();
|
|
7143
|
-
}),
|
|
7144
|
-
// Keep `start` optional (not null) when ACTIVE to match TS type `start?: Date`.
|
|
7145
|
-
otherwise: () => yup6.date().notRequired()
|
|
7146
|
-
}),
|
|
7147
|
-
targetRegion: yup6.array().of(yup6.string().required()).min(1, "At least one target region is required").required("Target region is required")
|
|
7148
|
-
});
|
|
7149
|
-
|
|
7150
|
-
// src/yupSchema/partner.ts
|
|
7151
|
-
import * as yup7 from "yup";
|
|
7152
|
-
var partnerSchema = globalResourceSchema.shape({
|
|
7153
|
-
location: locationSchema,
|
|
7154
|
-
nzbn: yup7.string().required("NZBN is required").matches(nzbnRegex, "NZBN must be 13 digits and start with 94"),
|
|
7155
|
-
partnerType: yup7.mixed().oneOf(Object.values(EnumPartnerType), "Please select a valid Partner type").required("Please select a Partner type")
|
|
7156
|
-
});
|
|
7157
|
-
|
|
7158
|
-
// src/yupSchema/post.ts
|
|
7159
|
-
import * as yup8 from "yup";
|
|
7160
|
-
|
|
7161
|
-
// src/types/post.ts
|
|
7162
|
-
var EnumPostType = /* @__PURE__ */ ((EnumPostType2) => {
|
|
7163
|
-
EnumPostType2["DAILY_MEETS"] = "daily_meets";
|
|
7164
|
-
EnumPostType2["DAILY_TIPS"] = "daily_tips";
|
|
7165
|
-
EnumPostType2["DAILY_GAMES"] = "daily_games";
|
|
7166
|
-
return EnumPostType2;
|
|
7167
|
-
})(EnumPostType || {});
|
|
7168
|
-
var EnumPostContentType = /* @__PURE__ */ ((EnumPostContentType2) => {
|
|
7169
|
-
EnumPostContentType2["GAME"] = "game";
|
|
7170
|
-
EnumPostContentType2["IMAGE"] = "image";
|
|
7171
|
-
EnumPostContentType2["LIST"] = "list";
|
|
7172
|
-
EnumPostContentType2["TEXTAREA"] = "textarea";
|
|
7173
|
-
EnumPostContentType2["VIDEO"] = "video";
|
|
7174
|
-
return EnumPostContentType2;
|
|
7175
|
-
})(EnumPostContentType || {});
|
|
7176
|
-
|
|
7177
|
-
// src/yupSchema/post.ts
|
|
7178
|
-
var postContentSchema = yup8.object().shape({
|
|
7179
|
-
contentData: yup8.mixed().optional().nullable(),
|
|
7180
|
-
contentOrder: yup8.number().nullable(),
|
|
7181
|
-
contentType: yup8.mixed().oneOf(Object.values(EnumPostContentType)).nullable()
|
|
7182
|
-
});
|
|
7183
|
-
var postSchema = yup8.object().shape({
|
|
7184
|
-
active: yup8.boolean().required(),
|
|
7185
|
-
caption: yup8.string().required(),
|
|
7186
|
-
content: yup8.array().of(postContentSchema).required(),
|
|
7187
|
-
postType: yup8.mixed().oneOf(Object.values(EnumPostType)).required(),
|
|
7188
|
-
resource: yup8.object({
|
|
7189
|
-
resourceId: yup8.string().required(),
|
|
7190
|
-
resourceRegion: yup8.string().required(),
|
|
7191
|
-
resourceType: yup8.mixed().oneOf(Object.values(EnumResourceType)).required()
|
|
7192
|
-
}).nullable().optional(),
|
|
7193
|
-
tags: yup8.array().of(yup8.string().required()).nullable().optional(),
|
|
7194
|
-
title: yup8.string().required()
|
|
7195
|
-
});
|
|
7196
|
-
|
|
7197
|
-
// src/yupSchema/appSettings.ts
|
|
7198
|
-
import * as yup9 from "yup";
|
|
7199
|
-
var appSettingsSchema = yup9.object({
|
|
7200
|
-
appVersion: yup9.string().trim().label("App Version").matches(
|
|
7201
|
-
/^\d+\.\d+\.\d+$/,
|
|
7202
|
-
"App Version must be in the format X.Y.Z (e.g. 1.12.50)"
|
|
7203
|
-
).required("App Version is required"),
|
|
7204
|
-
isOfflineMode: yup9.boolean().label("Is Offline Mode").required("Is Offline Mode is required")
|
|
7205
|
-
});
|
|
7206
|
-
|
|
7207
|
-
// src/hooks/utils.ts
|
|
7208
|
-
var defaultLocation = {
|
|
7209
|
-
city: "",
|
|
7210
|
-
country: "",
|
|
7211
|
-
fullAddress: "",
|
|
7212
|
-
geo: {
|
|
7213
|
-
coordinates: [0, 0],
|
|
7214
|
-
// [longitude, latitude]
|
|
7215
|
-
type: "Point"
|
|
7216
|
-
},
|
|
7217
|
-
latitude: 0,
|
|
7218
|
-
longitude: 0,
|
|
7219
|
-
region: ""
|
|
7220
|
-
};
|
|
7221
|
-
var globalDefaultValues = {
|
|
7222
|
-
active: false,
|
|
7223
|
-
associates: null,
|
|
7224
|
-
contactDetails: {
|
|
7225
|
-
email: null,
|
|
7226
|
-
landlinePhone: null,
|
|
7227
|
-
mobilePhone: null
|
|
7228
|
-
},
|
|
7229
|
-
cover: {
|
|
7230
|
-
active: true,
|
|
7231
|
-
source: "",
|
|
7232
|
-
title: ""
|
|
7233
|
-
},
|
|
7234
|
-
coverUpload: {
|
|
7235
|
-
active: true,
|
|
7236
|
-
source: "",
|
|
7237
|
-
title: ""
|
|
7238
|
-
},
|
|
7239
|
-
description: "",
|
|
7240
|
-
images: null,
|
|
7241
|
-
imagesUpload: null,
|
|
7242
|
-
logo: null,
|
|
7243
|
-
logoUpload: null,
|
|
7244
|
-
name: "",
|
|
7245
|
-
promoCodes: [],
|
|
7246
|
-
region: "",
|
|
7247
|
-
socialMedia: []
|
|
7248
|
-
};
|
|
7249
|
-
var defaultPartnerFormValues = {
|
|
7250
|
-
...globalDefaultValues,
|
|
7251
|
-
location: defaultLocation,
|
|
7252
|
-
nzbn: "",
|
|
7253
|
-
partnerType: ""
|
|
7254
|
-
};
|
|
7255
|
-
var defaultEventFormValues = {
|
|
7256
|
-
...globalDefaultValues,
|
|
7257
|
-
claimed: true,
|
|
7258
|
-
dateTime: [],
|
|
7259
|
-
eventType: "",
|
|
7260
|
-
googlePlaceId: null,
|
|
7261
|
-
location: defaultLocation,
|
|
7262
|
-
nzbn: "",
|
|
7263
|
-
provider: null,
|
|
7264
|
-
rainOrShine: false,
|
|
7265
|
-
tags: []
|
|
7266
|
-
};
|
|
7267
|
-
var defaultEventInfoFormValues = {
|
|
7268
|
-
applicationDeadlineHours: 24,
|
|
7269
|
-
dateTime: [],
|
|
7270
|
-
eventId: "",
|
|
7271
|
-
packInTime: 2,
|
|
7272
|
-
// e.g., 2 hours before event opens
|
|
7273
|
-
paymentDueHours: 12,
|
|
7274
|
-
paymentInfo: [],
|
|
7275
|
-
refundPolicy: [],
|
|
7276
|
-
requirements: []
|
|
7277
|
-
};
|
|
7278
|
-
var defaultVendorFormValues = {
|
|
7279
|
-
...globalDefaultValues,
|
|
7280
|
-
availability: {
|
|
7281
|
-
corporate: false,
|
|
7282
|
-
private: false,
|
|
7283
|
-
school: false
|
|
7284
|
-
},
|
|
7285
|
-
categories: [],
|
|
7286
|
-
claimed: true,
|
|
7287
|
-
foodTruck: false,
|
|
7288
|
-
products: null,
|
|
7289
|
-
unregisteredVendorId: null,
|
|
7290
|
-
vendorType: "Stallholder" /* STALLHOLDER */
|
|
7291
|
-
};
|
|
7292
|
-
var defaultUnregisteredVendorFormValues = {
|
|
7293
|
-
categoryIds: [],
|
|
7294
|
-
dateTime: [],
|
|
7295
|
-
email: null,
|
|
7296
|
-
inviterId: "",
|
|
7297
|
-
name: "",
|
|
7298
|
-
region: ""
|
|
7299
|
-
};
|
|
7300
|
-
var defaultVendorInfoFormValues = {
|
|
7301
|
-
compliance: { foodBeverageLicense: false, liabilityInsurance: false },
|
|
7302
|
-
documents: null,
|
|
7303
|
-
documentsUpload: null,
|
|
7304
|
-
product: {
|
|
7305
|
-
foodFlavors: [],
|
|
7306
|
-
packaging: [],
|
|
7307
|
-
priceRange: { max: "", min: "" },
|
|
7308
|
-
producedIn: []
|
|
7309
|
-
},
|
|
7310
|
-
requirements: {
|
|
7311
|
-
electricity: { details: null, isRequired: false },
|
|
7312
|
-
gazebo: { details: null, isRequired: false },
|
|
7313
|
-
table: { details: null, isRequired: false }
|
|
7314
|
-
},
|
|
7315
|
-
stallInfo: {
|
|
7316
|
-
size: { depth: "", width: "" }
|
|
7317
|
-
},
|
|
7318
|
-
vendorId: ""
|
|
7319
|
-
};
|
|
7320
|
-
function mapBaseResourceTypeToFormData(data) {
|
|
7321
|
-
return {
|
|
7322
|
-
_id: data._id,
|
|
7323
|
-
active: data.active,
|
|
7324
|
-
associates: data.associates,
|
|
7325
|
-
contactDetails: data.contactDetails,
|
|
7326
|
-
cover: data.cover,
|
|
7327
|
-
coverUpload: data.coverUpload,
|
|
7328
|
-
description: data.description,
|
|
7329
|
-
images: data.images,
|
|
7330
|
-
imagesUpload: data.imagesUpload,
|
|
7331
|
-
logo: data.logo,
|
|
7332
|
-
logoUpload: data.logoUpload,
|
|
7333
|
-
name: data.name,
|
|
7334
|
-
owner: data.owner,
|
|
7335
|
-
promoCodes: data.promoCodes,
|
|
7336
|
-
region: data.region,
|
|
7337
|
-
socialMedia: data.socialMedia,
|
|
7338
|
-
termsAgreement: data.termsAgreement
|
|
7339
|
-
};
|
|
7340
|
-
}
|
|
7341
|
-
|
|
7342
|
-
// src/hooks/vendor/useVendorForm.ts
|
|
7343
|
-
function useVendorForm(data) {
|
|
7344
|
-
const {
|
|
7345
|
-
control,
|
|
7346
|
-
formState,
|
|
7347
|
-
getValues,
|
|
7348
|
-
handleSubmit,
|
|
7349
|
-
reset,
|
|
7350
|
-
setValue,
|
|
7351
|
-
watch
|
|
7352
|
-
} = useForm({
|
|
7353
|
-
defaultValues: defaultVendorFormValues,
|
|
7354
|
-
resolver: yupResolver(vendorSchema)
|
|
7355
|
-
});
|
|
7356
|
-
React.useEffect(() => {
|
|
7357
|
-
if (data) {
|
|
7358
|
-
reset({
|
|
7359
|
-
...mapBaseResourceTypeToFormData(data),
|
|
7360
|
-
availability: data.availability,
|
|
7361
|
-
calendar: data.calendar,
|
|
7362
|
-
categories: data.categories,
|
|
7363
|
-
claimed: data.claimed ?? false,
|
|
7364
|
-
foodTruck: data.foodTruck,
|
|
7365
|
-
products: data.products,
|
|
7366
|
-
unregisteredVendorId: data.unregisteredVendorId,
|
|
7367
|
-
vendorType: data.vendorType
|
|
7368
|
-
});
|
|
7369
|
-
} else {
|
|
7370
|
-
reset(defaultVendorFormValues);
|
|
7371
|
-
}
|
|
7372
|
-
}, [data]);
|
|
7373
|
-
const {
|
|
7374
|
-
_id,
|
|
7375
|
-
active,
|
|
7376
|
-
associates,
|
|
7377
|
-
availability,
|
|
7378
|
-
calendar,
|
|
7379
|
-
categories,
|
|
7380
|
-
claimed,
|
|
7381
|
-
contactDetails,
|
|
7382
|
-
cover,
|
|
7383
|
-
coverUpload,
|
|
7384
|
-
description,
|
|
7385
|
-
foodTruck,
|
|
7386
|
-
images,
|
|
7387
|
-
imagesUpload,
|
|
7388
|
-
logo,
|
|
7389
|
-
logoUpload,
|
|
7390
|
-
name,
|
|
7391
|
-
owner,
|
|
7392
|
-
products,
|
|
7393
|
-
promoCodes,
|
|
7394
|
-
region,
|
|
7395
|
-
socialMedia: socialMedia2,
|
|
7396
|
-
termsAgreement,
|
|
7397
|
-
unregisteredVendorId,
|
|
7398
|
-
vendorType
|
|
7399
|
-
} = getValues();
|
|
7400
|
-
return {
|
|
7401
|
-
control,
|
|
7402
|
-
fields: {
|
|
7403
|
-
_id,
|
|
7404
|
-
active,
|
|
7405
|
-
associates,
|
|
7406
|
-
availability,
|
|
7407
|
-
calendar,
|
|
7408
|
-
categories,
|
|
7409
|
-
claimed,
|
|
7410
|
-
contactDetails,
|
|
7411
|
-
cover,
|
|
7412
|
-
coverUpload,
|
|
7413
|
-
description,
|
|
7414
|
-
foodTruck,
|
|
7415
|
-
images,
|
|
7416
|
-
imagesUpload,
|
|
7417
|
-
logo,
|
|
7418
|
-
logoUpload,
|
|
7419
|
-
name,
|
|
7420
|
-
owner,
|
|
7421
|
-
products,
|
|
7422
|
-
promoCodes,
|
|
7423
|
-
region,
|
|
7424
|
-
socialMedia: socialMedia2,
|
|
7425
|
-
termsAgreement,
|
|
7426
|
-
unregisteredVendorId,
|
|
7427
|
-
vendorType
|
|
7428
|
-
},
|
|
7429
|
-
formState,
|
|
7430
|
-
getValues,
|
|
7431
|
-
handleSubmit,
|
|
7432
|
-
reset,
|
|
7433
|
-
setValue,
|
|
7434
|
-
watch
|
|
7435
|
-
};
|
|
7436
|
-
}
|
|
7437
|
-
|
|
7438
|
-
// src/hooks/vendor/useVendorInfoForm.ts
|
|
7439
|
-
import { yupResolver as yupResolver2 } from "@hookform/resolvers/yup";
|
|
7440
|
-
import * as React2 from "react";
|
|
7441
|
-
import { useForm as useForm2 } from "react-hook-form";
|
|
7442
|
-
function useVendorInfoForm(data) {
|
|
7443
|
-
const {
|
|
7444
|
-
control,
|
|
7445
|
-
formState,
|
|
7446
|
-
getValues,
|
|
7447
|
-
handleSubmit,
|
|
7448
|
-
reset,
|
|
7449
|
-
setValue,
|
|
7450
|
-
watch
|
|
7451
|
-
} = useForm2({
|
|
7452
|
-
defaultValues: defaultVendorInfoFormValues,
|
|
7453
|
-
resolver: yupResolver2(vendorInfoSchema)
|
|
7454
|
-
});
|
|
7455
|
-
React2.useEffect(() => {
|
|
7456
|
-
if (data) {
|
|
7457
|
-
reset({
|
|
7458
|
-
_id: data._id,
|
|
7459
|
-
compliance: data.compliance,
|
|
7460
|
-
documents: data.documents,
|
|
7461
|
-
documentsUpload: data.documentsUpload,
|
|
7462
|
-
product: data.product,
|
|
7463
|
-
requirements: data.requirements,
|
|
7464
|
-
stallInfo: data.stallInfo,
|
|
7465
|
-
vendorId: data.vendorId
|
|
7466
|
-
});
|
|
7467
|
-
} else {
|
|
7468
|
-
reset(defaultVendorInfoFormValues);
|
|
7469
|
-
}
|
|
7470
|
-
}, [data]);
|
|
7471
|
-
const {
|
|
7472
|
-
_id,
|
|
7473
|
-
compliance,
|
|
7474
|
-
documents,
|
|
7475
|
-
documentsUpload,
|
|
7476
|
-
product,
|
|
7477
|
-
requirements,
|
|
7478
|
-
stallInfo,
|
|
7479
|
-
vendorId
|
|
7480
|
-
} = getValues();
|
|
7481
|
-
return {
|
|
7482
|
-
control,
|
|
7483
|
-
fields: {
|
|
7484
|
-
_id,
|
|
7485
|
-
compliance,
|
|
7486
|
-
documents,
|
|
7487
|
-
documentsUpload,
|
|
7488
|
-
product,
|
|
7489
|
-
requirements,
|
|
7490
|
-
stallInfo,
|
|
7491
|
-
vendorId
|
|
7492
|
-
},
|
|
7493
|
-
formState,
|
|
7494
|
-
getValues,
|
|
7495
|
-
handleSubmit,
|
|
7496
|
-
reset,
|
|
7497
|
-
setValue,
|
|
7498
|
-
watch
|
|
7499
|
-
};
|
|
7500
|
-
}
|
|
7501
|
-
|
|
7502
|
-
// src/hooks/vendor/useUnregisteredVendorForm.ts
|
|
7503
|
-
import { yupResolver as yupResolver3 } from "@hookform/resolvers/yup";
|
|
7504
|
-
import * as React3 from "react";
|
|
7505
|
-
import { useForm as useForm3 } from "react-hook-form";
|
|
7506
|
-
function useUnregisteredVendorForm(data) {
|
|
7507
|
-
const {
|
|
7508
|
-
control,
|
|
7509
|
-
formState,
|
|
7510
|
-
getValues,
|
|
7511
|
-
handleSubmit,
|
|
7512
|
-
reset,
|
|
7513
|
-
setValue,
|
|
7514
|
-
watch
|
|
7515
|
-
} = useForm3({
|
|
7516
|
-
defaultValues: defaultUnregisteredVendorFormValues,
|
|
7517
|
-
resolver: yupResolver3(unregisteredVendorSchema)
|
|
7518
|
-
});
|
|
7519
|
-
React3.useEffect(() => {
|
|
7520
|
-
if (data) {
|
|
7521
|
-
reset({
|
|
7522
|
-
categoryIds: data.categoryIds,
|
|
7523
|
-
dateTime: data.dateTime,
|
|
7524
|
-
email: data.email,
|
|
7525
|
-
inviterId: data.inviterId,
|
|
7526
|
-
name: data.name,
|
|
7527
|
-
region: data.region
|
|
7528
|
-
});
|
|
7529
|
-
} else {
|
|
7530
|
-
reset(defaultUnregisteredVendorFormValues);
|
|
7531
|
-
}
|
|
7532
|
-
}, [data]);
|
|
7533
|
-
const { categoryIds, dateTime, email, inviterId, name, region } = getValues();
|
|
7534
|
-
return {
|
|
7535
|
-
control,
|
|
7536
|
-
fields: {
|
|
7537
|
-
categoryIds,
|
|
7538
|
-
dateTime,
|
|
7539
|
-
email,
|
|
7540
|
-
inviterId,
|
|
7541
|
-
name,
|
|
7542
|
-
region
|
|
7543
|
-
},
|
|
7544
|
-
formState,
|
|
7545
|
-
getValues,
|
|
7546
|
-
handleSubmit,
|
|
7547
|
-
reset,
|
|
7548
|
-
setValue,
|
|
7549
|
-
watch
|
|
7550
|
-
};
|
|
7551
|
-
}
|
|
7552
|
-
|
|
7553
|
-
// src/hooks/event/useEventForm.ts
|
|
7554
|
-
import { yupResolver as yupResolver4 } from "@hookform/resolvers/yup";
|
|
7555
|
-
import * as React4 from "react";
|
|
7556
|
-
import { useForm as useForm4 } from "react-hook-form";
|
|
7557
|
-
function useEventForm(data) {
|
|
7558
|
-
const {
|
|
7559
|
-
control,
|
|
7560
|
-
formState,
|
|
7561
|
-
getValues,
|
|
7562
|
-
handleSubmit,
|
|
7563
|
-
reset,
|
|
7564
|
-
setValue,
|
|
7565
|
-
watch
|
|
7566
|
-
} = useForm4({
|
|
7567
|
-
defaultValues: defaultEventFormValues,
|
|
7568
|
-
resolver: yupResolver4(eventSchema)
|
|
7569
|
-
});
|
|
7570
|
-
React4.useEffect(() => {
|
|
7571
|
-
if (data) {
|
|
7572
|
-
reset({
|
|
7573
|
-
...mapBaseResourceTypeToFormData(data),
|
|
7574
|
-
claimed: data.claimed ?? false,
|
|
7575
|
-
dateTime: data.dateTime,
|
|
7576
|
-
eventType: data.eventType,
|
|
7577
|
-
googlePlaceId: data.googlePlaceId,
|
|
7578
|
-
location: data.location,
|
|
7579
|
-
nzbn: data.nzbn,
|
|
7580
|
-
provider: data.provider,
|
|
7581
|
-
rainOrShine: data.rainOrShine,
|
|
7582
|
-
tags: data.tags
|
|
7583
|
-
});
|
|
7584
|
-
} else {
|
|
7585
|
-
reset(defaultEventFormValues);
|
|
7586
|
-
}
|
|
7587
|
-
}, [data]);
|
|
7588
|
-
const {
|
|
7589
|
-
_id,
|
|
7590
|
-
active,
|
|
7591
|
-
associates,
|
|
7592
|
-
claimed,
|
|
7593
|
-
contactDetails,
|
|
7594
|
-
cover,
|
|
7595
|
-
coverUpload,
|
|
7596
|
-
dateTime,
|
|
7597
|
-
description,
|
|
7598
|
-
eventType,
|
|
7599
|
-
googlePlaceId,
|
|
7600
|
-
images,
|
|
7601
|
-
imagesUpload,
|
|
7602
|
-
location,
|
|
7603
|
-
logo,
|
|
7604
|
-
logoUpload,
|
|
7605
|
-
name,
|
|
7606
|
-
nzbn,
|
|
7607
|
-
owner,
|
|
7608
|
-
promoCodes,
|
|
7609
|
-
provider,
|
|
7610
|
-
rainOrShine,
|
|
7611
|
-
region,
|
|
7612
|
-
socialMedia: socialMedia2,
|
|
7613
|
-
tags,
|
|
7614
|
-
termsAgreement
|
|
7615
|
-
} = getValues();
|
|
7616
|
-
return {
|
|
7617
|
-
control,
|
|
7618
|
-
fields: {
|
|
7619
|
-
_id,
|
|
7620
|
-
active,
|
|
7621
|
-
associates,
|
|
7622
|
-
claimed,
|
|
7623
|
-
contactDetails,
|
|
7624
|
-
cover,
|
|
7625
|
-
coverUpload,
|
|
7626
|
-
dateTime,
|
|
7627
|
-
description,
|
|
7628
|
-
eventType,
|
|
7629
|
-
googlePlaceId,
|
|
7630
|
-
images,
|
|
7631
|
-
imagesUpload,
|
|
7632
|
-
location,
|
|
7633
|
-
logo,
|
|
7634
|
-
logoUpload,
|
|
7635
|
-
name,
|
|
7636
|
-
nzbn,
|
|
7637
|
-
owner,
|
|
7638
|
-
promoCodes,
|
|
7639
|
-
provider,
|
|
7640
|
-
rainOrShine,
|
|
7641
|
-
region,
|
|
7642
|
-
socialMedia: socialMedia2,
|
|
7643
|
-
tags,
|
|
7644
|
-
termsAgreement
|
|
7645
|
-
},
|
|
7646
|
-
formState,
|
|
7647
|
-
getValues,
|
|
7648
|
-
handleSubmit,
|
|
7649
|
-
reset,
|
|
7650
|
-
setValue,
|
|
7651
|
-
watch
|
|
7652
|
-
};
|
|
7653
|
-
}
|
|
7654
|
-
|
|
7655
|
-
// src/hooks/event/useEventInfoForm.ts
|
|
7656
|
-
import { yupResolver as yupResolver5 } from "@hookform/resolvers/yup";
|
|
7657
|
-
import * as React5 from "react";
|
|
7658
|
-
import { useForm as useForm5 } from "react-hook-form";
|
|
7659
|
-
function useEventInfoForm(data) {
|
|
7660
|
-
const {
|
|
7661
|
-
control,
|
|
7662
|
-
formState,
|
|
7663
|
-
getValues,
|
|
7664
|
-
handleSubmit,
|
|
7665
|
-
reset,
|
|
7666
|
-
setValue,
|
|
7667
|
-
watch
|
|
7668
|
-
} = useForm5({
|
|
7669
|
-
defaultValues: defaultEventInfoFormValues,
|
|
7670
|
-
resolver: yupResolver5(eventInfoSchema)
|
|
7671
|
-
});
|
|
7672
|
-
React5.useEffect(() => {
|
|
7673
|
-
if (data) {
|
|
7674
|
-
reset({
|
|
7675
|
-
_id: data._id,
|
|
7676
|
-
applicationDeadlineHours: data.applicationDeadlineHours,
|
|
7677
|
-
dateTime: data.dateTime,
|
|
7678
|
-
eventId: data.eventId,
|
|
7679
|
-
packInTime: data.packInTime,
|
|
7680
|
-
paymentDueHours: data.paymentDueHours,
|
|
7681
|
-
paymentInfo: data.paymentInfo,
|
|
7682
|
-
refundPolicy: data.refundPolicy,
|
|
7683
|
-
requirements: data.requirements
|
|
7684
|
-
});
|
|
7685
|
-
} else {
|
|
7686
|
-
reset(defaultEventInfoFormValues);
|
|
7687
|
-
}
|
|
7688
|
-
}, [data]);
|
|
7689
|
-
const {
|
|
7690
|
-
_id,
|
|
7691
|
-
applicationDeadlineHours,
|
|
7692
|
-
dateTime,
|
|
7693
|
-
eventId,
|
|
7694
|
-
packInTime,
|
|
7695
|
-
paymentDueHours,
|
|
7696
|
-
paymentInfo,
|
|
7697
|
-
refundPolicy,
|
|
7698
|
-
requirements
|
|
7699
|
-
} = getValues();
|
|
7700
|
-
return {
|
|
7701
|
-
control,
|
|
7702
|
-
fields: {
|
|
7703
|
-
_id,
|
|
7704
|
-
applicationDeadlineHours,
|
|
7705
|
-
dateTime,
|
|
7706
|
-
eventId,
|
|
7707
|
-
packInTime,
|
|
7708
|
-
paymentDueHours,
|
|
7709
|
-
paymentInfo,
|
|
7710
|
-
refundPolicy,
|
|
7711
|
-
requirements
|
|
7712
|
-
},
|
|
7713
|
-
formState,
|
|
7714
|
-
getValues,
|
|
7715
|
-
handleSubmit,
|
|
7716
|
-
reset,
|
|
7717
|
-
setValue,
|
|
7718
|
-
watch
|
|
7719
|
-
};
|
|
7720
|
-
}
|
|
7721
|
-
|
|
7722
|
-
// src/hooks/useUserForm.ts
|
|
7723
|
-
import { yupResolver as yupResolver6 } from "@hookform/resolvers/yup";
|
|
7724
|
-
import * as React6 from "react";
|
|
7725
|
-
import { useForm as useForm6 } from "react-hook-form";
|
|
7726
|
-
var defaultValues = {
|
|
7727
|
-
active: false,
|
|
7728
|
-
avatar: null,
|
|
7729
|
-
avatarUpload: null,
|
|
7730
|
-
confirmPassword: "",
|
|
7731
|
-
email: "",
|
|
7732
|
-
firstName: "",
|
|
7733
|
-
isTester: false,
|
|
7734
|
-
lastName: "",
|
|
7735
|
-
password: null,
|
|
7736
|
-
preferredRegion: "",
|
|
7737
|
-
role: "customer" /* CUSTOMER */
|
|
7738
|
-
};
|
|
7739
|
-
function useUserForm(data) {
|
|
7740
|
-
const {
|
|
7741
|
-
control,
|
|
7742
|
-
formState,
|
|
7743
|
-
getValues,
|
|
7744
|
-
handleSubmit,
|
|
7745
|
-
reset,
|
|
7746
|
-
setValue,
|
|
7747
|
-
watch
|
|
7748
|
-
} = useForm6({
|
|
7749
|
-
defaultValues,
|
|
7750
|
-
resolver: yupResolver6(userSchema)
|
|
7751
|
-
});
|
|
7752
|
-
React6.useEffect(() => {
|
|
7753
|
-
if (data) {
|
|
7754
|
-
reset({
|
|
7755
|
-
_id: data._id,
|
|
7756
|
-
active: data.active,
|
|
7757
|
-
avatar: data.avatar,
|
|
7758
|
-
avatarUpload: data.avatarUpload,
|
|
7759
|
-
email: data.email,
|
|
7760
|
-
firstName: data.firstName,
|
|
7761
|
-
isTester: data.isTester,
|
|
7762
|
-
lastName: data.lastName,
|
|
7763
|
-
password: data.password,
|
|
7764
|
-
preferredRegion: data.preferredRegion,
|
|
7765
|
-
role: data.role,
|
|
7766
|
-
termsAgreement: data.termsAgreement
|
|
7767
|
-
});
|
|
7768
|
-
} else {
|
|
7769
|
-
reset(defaultValues);
|
|
7770
|
-
}
|
|
7771
|
-
}, [data]);
|
|
7772
|
-
const {
|
|
7773
|
-
_id,
|
|
7774
|
-
active,
|
|
7775
|
-
avatar,
|
|
7776
|
-
avatarUpload,
|
|
7777
|
-
email,
|
|
7778
|
-
firstName,
|
|
7779
|
-
isTester,
|
|
7780
|
-
lastName,
|
|
7781
|
-
password,
|
|
7782
|
-
preferredRegion,
|
|
7783
|
-
role,
|
|
7784
|
-
termsAgreement
|
|
7785
|
-
} = getValues();
|
|
7786
|
-
return {
|
|
7787
|
-
control,
|
|
7788
|
-
fields: {
|
|
7789
|
-
_id,
|
|
7790
|
-
active,
|
|
7791
|
-
avatar,
|
|
7792
|
-
avatarUpload,
|
|
7793
|
-
email,
|
|
7794
|
-
firstName,
|
|
7795
|
-
isTester,
|
|
7796
|
-
lastName,
|
|
7797
|
-
password,
|
|
7798
|
-
preferredRegion,
|
|
7799
|
-
role,
|
|
7800
|
-
termsAgreement
|
|
7801
|
-
},
|
|
7802
|
-
formState,
|
|
7803
|
-
getValues,
|
|
7804
|
-
handleSubmit,
|
|
7805
|
-
reset,
|
|
7806
|
-
setValue,
|
|
7807
|
-
watch
|
|
7808
|
-
};
|
|
7809
|
-
}
|
|
7810
|
-
|
|
7811
|
-
// src/hooks/auth/useLoginForm.ts
|
|
7812
|
-
import { yupResolver as yupResolver7 } from "@hookform/resolvers/yup";
|
|
7813
|
-
import { useForm as useForm7 } from "react-hook-form";
|
|
7814
|
-
var defaultValues2 = {
|
|
7815
|
-
email: "",
|
|
7816
|
-
password: ""
|
|
7817
|
-
};
|
|
7818
|
-
function useLoginForm() {
|
|
7819
|
-
const {
|
|
7820
|
-
control,
|
|
7821
|
-
formState,
|
|
7822
|
-
getValues,
|
|
7823
|
-
handleSubmit,
|
|
7824
|
-
reset,
|
|
7825
|
-
setValue,
|
|
7826
|
-
watch
|
|
7827
|
-
} = useForm7({
|
|
7828
|
-
defaultValues: defaultValues2,
|
|
7829
|
-
resolver: yupResolver7(loginSchema)
|
|
7830
|
-
});
|
|
7831
|
-
const { email, password } = getValues();
|
|
7832
|
-
return {
|
|
7833
|
-
control,
|
|
7834
|
-
fields: {
|
|
7835
|
-
email,
|
|
7836
|
-
password
|
|
7837
|
-
},
|
|
7838
|
-
formState,
|
|
7839
|
-
getValues,
|
|
7840
|
-
handleSubmit,
|
|
7841
|
-
reset,
|
|
7842
|
-
setValue,
|
|
7843
|
-
watch
|
|
7844
|
-
};
|
|
7845
|
-
}
|
|
7846
|
-
|
|
7847
|
-
// src/hooks/auth/useRegisterForm.ts
|
|
7848
|
-
import { yupResolver as yupResolver8 } from "@hookform/resolvers/yup";
|
|
7849
|
-
import { useForm as useForm8 } from "react-hook-form";
|
|
7850
|
-
var defaultValues3 = {
|
|
7851
|
-
email: "",
|
|
7852
|
-
firstName: "",
|
|
7853
|
-
lastName: "",
|
|
7854
|
-
password: "",
|
|
7855
|
-
preferredRegion: "",
|
|
7856
|
-
promoCode: null,
|
|
7857
|
-
termsAgreement: null
|
|
7858
|
-
};
|
|
7859
|
-
function useRegisterForm() {
|
|
7860
|
-
const {
|
|
7861
|
-
control,
|
|
7862
|
-
formState,
|
|
7863
|
-
getValues,
|
|
7864
|
-
handleSubmit,
|
|
7865
|
-
reset,
|
|
7866
|
-
setValue,
|
|
7867
|
-
watch
|
|
7868
|
-
} = useForm8({
|
|
7869
|
-
defaultValues: defaultValues3,
|
|
7870
|
-
resolver: yupResolver8(registerSchema)
|
|
7871
|
-
});
|
|
7872
|
-
const {
|
|
7873
|
-
email,
|
|
7874
|
-
firstName,
|
|
7875
|
-
lastName,
|
|
7876
|
-
password,
|
|
7877
|
-
preferredRegion,
|
|
7878
|
-
promoCode,
|
|
7879
|
-
termsAgreement
|
|
7880
|
-
} = getValues();
|
|
7881
|
-
return {
|
|
7882
|
-
control,
|
|
7883
|
-
fields: {
|
|
7884
|
-
email,
|
|
7885
|
-
firstName,
|
|
7886
|
-
lastName,
|
|
7887
|
-
password,
|
|
7888
|
-
preferredRegion,
|
|
7889
|
-
promoCode,
|
|
7890
|
-
termsAgreement
|
|
7891
|
-
},
|
|
7892
|
-
formState,
|
|
7893
|
-
getValues,
|
|
7894
|
-
handleSubmit,
|
|
7895
|
-
reset,
|
|
7896
|
-
setValue,
|
|
7897
|
-
watch
|
|
7898
|
-
};
|
|
7899
|
-
}
|
|
7900
|
-
|
|
7901
|
-
// src/hooks/auth/useRequestPasswordResetForm.ts
|
|
7902
|
-
import { yupResolver as yupResolver9 } from "@hookform/resolvers/yup";
|
|
7903
|
-
import { useForm as useForm9 } from "react-hook-form";
|
|
7904
|
-
var defaultValues4 = {
|
|
7905
|
-
email: ""
|
|
7906
|
-
};
|
|
7907
|
-
function useRequestPasswordResetForm() {
|
|
7908
|
-
const {
|
|
7909
|
-
control,
|
|
7910
|
-
formState,
|
|
7911
|
-
getValues,
|
|
7912
|
-
handleSubmit,
|
|
7913
|
-
reset,
|
|
7914
|
-
setValue,
|
|
7915
|
-
watch
|
|
7916
|
-
} = useForm9({
|
|
7917
|
-
defaultValues: defaultValues4,
|
|
7918
|
-
resolver: yupResolver9(requestPasswordResetSchema)
|
|
7919
|
-
});
|
|
7920
|
-
const { email } = getValues();
|
|
7921
|
-
return {
|
|
7922
|
-
control,
|
|
7923
|
-
fields: {
|
|
7924
|
-
email
|
|
7925
|
-
},
|
|
7926
|
-
formState,
|
|
7927
|
-
getValues,
|
|
7928
|
-
handleSubmit,
|
|
7929
|
-
reset,
|
|
7930
|
-
setValue,
|
|
7931
|
-
watch
|
|
7932
|
-
};
|
|
7933
|
-
}
|
|
7934
|
-
|
|
7935
|
-
// src/hooks/auth/useValidateVerificationTokenForm.ts
|
|
7936
|
-
import { yupResolver as yupResolver10 } from "@hookform/resolvers/yup";
|
|
7937
|
-
import { useForm as useForm10 } from "react-hook-form";
|
|
7938
|
-
var defaultValues5 = {
|
|
7939
|
-
email: "",
|
|
7940
|
-
verificationToken: ""
|
|
7941
|
-
};
|
|
7942
|
-
function useValidateVerificationTokenForm() {
|
|
7943
|
-
const {
|
|
7944
|
-
control,
|
|
7945
|
-
formState,
|
|
7946
|
-
getValues,
|
|
7947
|
-
handleSubmit,
|
|
7948
|
-
reset,
|
|
7949
|
-
setValue,
|
|
7950
|
-
watch
|
|
7951
|
-
} = useForm10({
|
|
7952
|
-
defaultValues: defaultValues5,
|
|
7953
|
-
resolver: yupResolver10(validateVerificationTokenSchema)
|
|
7954
|
-
});
|
|
7955
|
-
const { email, verificationToken } = getValues();
|
|
7956
|
-
return {
|
|
7957
|
-
control,
|
|
7958
|
-
fields: {
|
|
7959
|
-
email,
|
|
7960
|
-
verificationToken
|
|
7961
|
-
},
|
|
7962
|
-
formState,
|
|
7963
|
-
getValues,
|
|
7964
|
-
handleSubmit,
|
|
7965
|
-
reset,
|
|
7966
|
-
setValue,
|
|
7967
|
-
watch
|
|
7968
|
-
};
|
|
7969
|
-
}
|
|
7970
|
-
|
|
7971
|
-
// src/hooks/auth/useResetPasswordForm.ts
|
|
7972
|
-
import { yupResolver as yupResolver11 } from "@hookform/resolvers/yup";
|
|
7973
|
-
import { useForm as useForm11 } from "react-hook-form";
|
|
7974
|
-
var defaultValues6 = {
|
|
7975
|
-
confirmPassword: "",
|
|
7976
|
-
email: "",
|
|
7977
|
-
password: ""
|
|
7978
|
-
};
|
|
7979
|
-
function useResetPasswordForm() {
|
|
7980
|
-
const {
|
|
7981
|
-
control,
|
|
7982
|
-
formState,
|
|
7983
|
-
getValues,
|
|
7984
|
-
handleSubmit,
|
|
7985
|
-
reset,
|
|
7986
|
-
setValue,
|
|
7987
|
-
watch
|
|
7988
|
-
} = useForm11({
|
|
7989
|
-
defaultValues: defaultValues6,
|
|
7990
|
-
resolver: yupResolver11(resetPasswordSchema)
|
|
7991
|
-
});
|
|
7992
|
-
const { confirmPassword, email, password } = getValues();
|
|
7993
|
-
return {
|
|
7994
|
-
control,
|
|
7995
|
-
fields: {
|
|
7996
|
-
confirmPassword,
|
|
7997
|
-
email,
|
|
7998
|
-
password
|
|
7999
|
-
},
|
|
8000
|
-
formState,
|
|
8001
|
-
getValues,
|
|
8002
|
-
handleSubmit,
|
|
8003
|
-
reset,
|
|
8004
|
-
setValue,
|
|
8005
|
-
watch
|
|
8006
|
-
};
|
|
8007
|
-
}
|
|
8008
|
-
|
|
8009
|
-
// src/hooks/useContactUsForm.ts
|
|
8010
|
-
import { yupResolver as yupResolver12 } from "@hookform/resolvers/yup";
|
|
8011
|
-
import React7 from "react";
|
|
8012
|
-
import { useForm as useForm12 } from "react-hook-form";
|
|
8013
|
-
|
|
8014
|
-
// src/yupSchema/contactUs.ts
|
|
8015
|
-
import * as yup10 from "yup";
|
|
8016
|
-
var contactUsSchema = yup10.object().shape({
|
|
8017
|
-
email: emailRequiredSchema,
|
|
8018
|
-
firstName: yup10.string().label("First Name").required("First name is required"),
|
|
8019
|
-
lastName: yup10.string().label("Last Name").required("Last name is required"),
|
|
8020
|
-
message: yup10.string().label("Message").required("Message is required")
|
|
8021
|
-
});
|
|
8022
|
-
|
|
8023
|
-
// src/hooks/useContactUsForm.ts
|
|
8024
|
-
var defaultValues7 = {
|
|
8025
|
-
email: "",
|
|
8026
|
-
firstName: "",
|
|
8027
|
-
lastName: "",
|
|
8028
|
-
message: ""
|
|
8029
|
-
};
|
|
8030
|
-
function useContactUsForm(data) {
|
|
8031
|
-
const {
|
|
8032
|
-
control,
|
|
8033
|
-
formState,
|
|
8034
|
-
getValues,
|
|
8035
|
-
handleSubmit,
|
|
8036
|
-
reset,
|
|
8037
|
-
setValue,
|
|
8038
|
-
watch
|
|
8039
|
-
} = useForm12({
|
|
8040
|
-
defaultValues: defaultValues7,
|
|
8041
|
-
resolver: yupResolver12(contactUsSchema)
|
|
8042
|
-
});
|
|
8043
|
-
React7.useEffect(() => {
|
|
8044
|
-
if (data) {
|
|
8045
|
-
reset({
|
|
8046
|
-
email: data.email,
|
|
8047
|
-
firstName: data.firstName,
|
|
8048
|
-
lastName: data.lastName,
|
|
8049
|
-
message: data.message
|
|
8050
|
-
});
|
|
8051
|
-
} else {
|
|
8052
|
-
reset(defaultValues7);
|
|
8053
|
-
}
|
|
8054
|
-
}, [data]);
|
|
8055
|
-
const { email, firstName, lastName, message } = getValues();
|
|
8056
|
-
return {
|
|
8057
|
-
control,
|
|
8058
|
-
fields: {
|
|
8059
|
-
email,
|
|
8060
|
-
firstName,
|
|
8061
|
-
lastName,
|
|
8062
|
-
message
|
|
8063
|
-
},
|
|
8064
|
-
formState,
|
|
8065
|
-
getValues,
|
|
8066
|
-
handleSubmit,
|
|
8067
|
-
reset,
|
|
8068
|
-
setValue,
|
|
8069
|
-
watch
|
|
8070
|
-
};
|
|
8071
|
-
}
|
|
8072
|
-
|
|
8073
|
-
// src/hooks/useAdForm.ts
|
|
8074
|
-
import { yupResolver as yupResolver13 } from "@hookform/resolvers/yup";
|
|
8075
|
-
import React8 from "react";
|
|
8076
|
-
import { useForm as useForm13 } from "react-hook-form";
|
|
8077
|
-
var defaultValues8 = {
|
|
8078
|
-
active: true,
|
|
8079
|
-
// Use a future default so yup "future date" rules pass on first submit.
|
|
8080
|
-
end: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3),
|
|
8081
|
-
resource: {
|
|
8082
|
-
adDescription: "",
|
|
8083
|
-
adImage: "",
|
|
8084
|
-
adStyle: "Bloom" /* BLOOM */,
|
|
8085
|
-
adTitle: "",
|
|
8086
|
-
adType: "Sponsored" /* SPONSORED */,
|
|
8087
|
-
resourceId: "",
|
|
8088
|
-
resourceName: "",
|
|
8089
|
-
resourceRegion: "",
|
|
8090
|
-
resourceType: "event" /* EVENT */
|
|
8091
|
-
},
|
|
8092
|
-
showOn: ["Front_page" /* FRONT_PAGE */],
|
|
8093
|
-
// `start` is only required (and must be future) when status !== ACTIVE.
|
|
8094
|
-
start: void 0,
|
|
8095
|
-
status: "Active" /* ACTIVE */,
|
|
8096
|
-
targetRegion: []
|
|
8097
|
-
};
|
|
8098
|
-
function useAdForm(data) {
|
|
8099
|
-
const {
|
|
8100
|
-
control,
|
|
8101
|
-
formState,
|
|
8102
|
-
getValues,
|
|
8103
|
-
handleSubmit,
|
|
8104
|
-
reset,
|
|
8105
|
-
setValue,
|
|
8106
|
-
watch
|
|
8107
|
-
} = useForm13({
|
|
8108
|
-
defaultValues: defaultValues8,
|
|
8109
|
-
resolver: yupResolver13(adSchema)
|
|
8110
|
-
});
|
|
8111
|
-
React8.useEffect(() => {
|
|
8112
|
-
if (data) {
|
|
8113
|
-
reset({
|
|
8114
|
-
active: data.active,
|
|
8115
|
-
end: data.end,
|
|
8116
|
-
resource: data.resource,
|
|
8117
|
-
showOn: data.showOn,
|
|
8118
|
-
start: data.start,
|
|
8119
|
-
status: data.status,
|
|
8120
|
-
targetRegion: data.targetRegion
|
|
8121
|
-
});
|
|
8122
|
-
} else {
|
|
8123
|
-
reset(defaultValues8);
|
|
8124
|
-
}
|
|
8125
|
-
}, [data]);
|
|
8126
|
-
const { active, end, resource, showOn, start, status, targetRegion } = getValues();
|
|
8127
|
-
return {
|
|
8128
|
-
control,
|
|
8129
|
-
fields: {
|
|
8130
|
-
active,
|
|
8131
|
-
end,
|
|
8132
|
-
resource,
|
|
8133
|
-
showOn,
|
|
8134
|
-
start,
|
|
8135
|
-
status,
|
|
8136
|
-
targetRegion
|
|
8137
|
-
},
|
|
8138
|
-
formState,
|
|
8139
|
-
getValues,
|
|
8140
|
-
handleSubmit,
|
|
8141
|
-
reset,
|
|
8142
|
-
setValue,
|
|
8143
|
-
watch
|
|
8144
|
-
};
|
|
8145
|
-
}
|
|
8146
|
-
|
|
8147
|
-
// src/hooks/partner/usePartnerForm.ts
|
|
8148
|
-
import { yupResolver as yupResolver14 } from "@hookform/resolvers/yup";
|
|
8149
|
-
import * as React9 from "react";
|
|
8150
|
-
import { useForm as useForm14 } from "react-hook-form";
|
|
8151
|
-
function usePartnerForm(data) {
|
|
8152
|
-
const {
|
|
8153
|
-
control,
|
|
8154
|
-
formState,
|
|
8155
|
-
getValues,
|
|
8156
|
-
handleSubmit,
|
|
8157
|
-
reset,
|
|
8158
|
-
setValue,
|
|
8159
|
-
watch
|
|
8160
|
-
} = useForm14({
|
|
8161
|
-
defaultValues: defaultPartnerFormValues,
|
|
8162
|
-
resolver: yupResolver14(partnerSchema)
|
|
8163
|
-
});
|
|
8164
|
-
React9.useEffect(() => {
|
|
8165
|
-
if (data) {
|
|
8166
|
-
reset({
|
|
8167
|
-
...mapBaseResourceTypeToFormData(data),
|
|
8168
|
-
location: data.location,
|
|
8169
|
-
nzbn: data.nzbn,
|
|
8170
|
-
partnerType: data.partnerType
|
|
8171
|
-
});
|
|
8172
|
-
} else {
|
|
8173
|
-
reset(defaultPartnerFormValues);
|
|
8174
|
-
}
|
|
8175
|
-
}, [data]);
|
|
8176
|
-
const {
|
|
8177
|
-
_id,
|
|
8178
|
-
active,
|
|
8179
|
-
associates,
|
|
8180
|
-
contactDetails,
|
|
8181
|
-
cover,
|
|
8182
|
-
coverUpload,
|
|
8183
|
-
description,
|
|
8184
|
-
images,
|
|
8185
|
-
imagesUpload,
|
|
8186
|
-
location,
|
|
8187
|
-
logo,
|
|
8188
|
-
logoUpload,
|
|
8189
|
-
name,
|
|
8190
|
-
nzbn,
|
|
8191
|
-
owner,
|
|
8192
|
-
partnerType,
|
|
8193
|
-
promoCodes,
|
|
8194
|
-
region,
|
|
8195
|
-
socialMedia: socialMedia2,
|
|
8196
|
-
termsAgreement
|
|
8197
|
-
} = getValues();
|
|
8198
|
-
return {
|
|
8199
|
-
control,
|
|
8200
|
-
fields: {
|
|
8201
|
-
_id,
|
|
8202
|
-
active,
|
|
8203
|
-
associates,
|
|
8204
|
-
contactDetails,
|
|
8205
|
-
cover,
|
|
8206
|
-
coverUpload,
|
|
8207
|
-
description,
|
|
8208
|
-
images,
|
|
8209
|
-
imagesUpload,
|
|
8210
|
-
location,
|
|
8211
|
-
logo,
|
|
8212
|
-
logoUpload,
|
|
8213
|
-
name,
|
|
8214
|
-
nzbn,
|
|
8215
|
-
owner,
|
|
8216
|
-
partnerType,
|
|
8217
|
-
promoCodes,
|
|
8218
|
-
region,
|
|
8219
|
-
socialMedia: socialMedia2,
|
|
8220
|
-
termsAgreement
|
|
8221
|
-
},
|
|
8222
|
-
formState,
|
|
8223
|
-
getValues,
|
|
8224
|
-
handleSubmit,
|
|
8225
|
-
reset,
|
|
8226
|
-
setValue,
|
|
8227
|
-
watch
|
|
8228
|
-
};
|
|
8229
|
-
}
|
|
8230
|
-
|
|
8231
|
-
// src/hooks/usePostForm.ts
|
|
8232
|
-
import { yupResolver as yupResolver15 } from "@hookform/resolvers/yup";
|
|
8233
|
-
import React10 from "react";
|
|
8234
|
-
import { useForm as useForm15 } from "react-hook-form";
|
|
8235
|
-
var defaultValues9 = {
|
|
8236
|
-
active: true,
|
|
8237
|
-
caption: "",
|
|
8238
|
-
content: [],
|
|
8239
|
-
cover: null,
|
|
8240
|
-
coverUpload: null,
|
|
8241
|
-
postType: "",
|
|
8242
|
-
resource: null,
|
|
8243
|
-
tags: [],
|
|
8244
|
-
title: ""
|
|
8245
|
-
};
|
|
8246
|
-
function usePostForm(data) {
|
|
8247
|
-
const {
|
|
8248
|
-
control,
|
|
8249
|
-
formState,
|
|
8250
|
-
getValues,
|
|
8251
|
-
handleSubmit,
|
|
8252
|
-
reset,
|
|
8253
|
-
setValue,
|
|
8254
|
-
watch
|
|
8255
|
-
} = useForm15({
|
|
8256
|
-
defaultValues: defaultValues9,
|
|
8257
|
-
resolver: yupResolver15(postSchema)
|
|
8258
|
-
});
|
|
8259
|
-
React10.useEffect(() => {
|
|
8260
|
-
if (data) {
|
|
8261
|
-
reset({
|
|
8262
|
-
active: data.active,
|
|
8263
|
-
caption: data.caption,
|
|
8264
|
-
content: data.content,
|
|
8265
|
-
cover: data.cover,
|
|
8266
|
-
coverUpload: data.coverUpload,
|
|
8267
|
-
postType: data.postType,
|
|
8268
|
-
resource: data.resource,
|
|
8269
|
-
tags: data.tags,
|
|
8270
|
-
title: data.title
|
|
8271
|
-
});
|
|
8272
|
-
} else {
|
|
8273
|
-
reset(defaultValues9);
|
|
8274
|
-
}
|
|
8275
|
-
}, [data]);
|
|
8276
|
-
const {
|
|
8277
|
-
active,
|
|
8278
|
-
caption,
|
|
8279
|
-
content,
|
|
8280
|
-
cover,
|
|
8281
|
-
coverUpload,
|
|
8282
|
-
postType,
|
|
8283
|
-
resource,
|
|
8284
|
-
tags,
|
|
8285
|
-
title
|
|
8286
|
-
} = getValues();
|
|
8287
|
-
return {
|
|
8288
|
-
control,
|
|
8289
|
-
fields: {
|
|
8290
|
-
active,
|
|
8291
|
-
caption,
|
|
8292
|
-
content,
|
|
8293
|
-
cover,
|
|
8294
|
-
coverUpload,
|
|
8295
|
-
postType,
|
|
8296
|
-
resource,
|
|
8297
|
-
tags,
|
|
8298
|
-
title
|
|
8299
|
-
},
|
|
8300
|
-
formState,
|
|
8301
|
-
getValues,
|
|
8302
|
-
handleSubmit,
|
|
8303
|
-
reset,
|
|
8304
|
-
setValue,
|
|
8305
|
-
watch
|
|
8306
|
-
};
|
|
8307
|
-
}
|
|
8308
|
-
|
|
8309
|
-
// src/hooks/useAppSettingsForm.ts
|
|
8310
|
-
import { yupResolver as yupResolver16 } from "@hookform/resolvers/yup";
|
|
8311
|
-
import React11 from "react";
|
|
8312
|
-
import { useForm as useForm16 } from "react-hook-form";
|
|
8313
|
-
var defaultValues10 = {
|
|
8314
|
-
appVersion: "",
|
|
8315
|
-
isOfflineMode: false
|
|
8316
|
-
};
|
|
8317
|
-
function useAppSettingsForm(data) {
|
|
8318
|
-
const {
|
|
8319
|
-
control,
|
|
8320
|
-
formState,
|
|
8321
|
-
getValues,
|
|
8322
|
-
handleSubmit,
|
|
8323
|
-
reset,
|
|
8324
|
-
setValue,
|
|
8325
|
-
watch
|
|
8326
|
-
} = useForm16({
|
|
8327
|
-
defaultValues: defaultValues10,
|
|
8328
|
-
resolver: yupResolver16(appSettingsSchema)
|
|
8329
|
-
});
|
|
8330
|
-
React11.useEffect(() => {
|
|
8331
|
-
if (data) {
|
|
8332
|
-
reset({
|
|
8333
|
-
appVersion: data.appVersion,
|
|
8334
|
-
isOfflineMode: data.isOfflineMode
|
|
8335
|
-
});
|
|
8336
|
-
} else {
|
|
8337
|
-
reset(defaultValues10);
|
|
8338
|
-
}
|
|
8339
|
-
}, [data]);
|
|
8340
|
-
const { appVersion, isOfflineMode } = getValues();
|
|
8341
|
-
return {
|
|
8342
|
-
control,
|
|
8343
|
-
fields: {
|
|
8344
|
-
appVersion,
|
|
8345
|
-
isOfflineMode
|
|
8346
|
-
},
|
|
8347
|
-
formState,
|
|
8348
|
-
getValues,
|
|
8349
|
-
handleSubmit,
|
|
8350
|
-
reset,
|
|
8351
|
-
setValue,
|
|
8352
|
-
watch
|
|
8353
|
-
};
|
|
8354
|
-
}
|
|
8355
|
-
|
|
8356
|
-
// src/hooks/useSchoolForm.ts
|
|
8357
|
-
import { yupResolver as yupResolver17 } from "@hookform/resolvers/yup";
|
|
8358
|
-
import { useEffect as useEffect8 } from "react";
|
|
8359
|
-
import { useForm as useForm17 } from "react-hook-form";
|
|
8360
|
-
|
|
8361
|
-
// src/yupSchema/school.ts
|
|
8362
|
-
import * as yup11 from "yup";
|
|
8363
|
-
var schoolSchema = yup11.object().shape({
|
|
8364
|
-
active: yup11.boolean().required("Active is required"),
|
|
8365
|
-
contactDetails: contactDetailsSchema,
|
|
8366
|
-
location: locationSchema,
|
|
8367
|
-
name: yup11.string().trim().required("Name is required"),
|
|
8368
|
-
region: yup11.string().trim().required("Region is required"),
|
|
8369
|
-
socialMedia: yup11.array().of(socialMediaSchema).nullable().default(null),
|
|
8370
|
-
studentCount: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Student Count").nullable().typeError("Student count must be a number").min(
|
|
8371
|
-
SCHOOL_MIN_STUDENT_COUNT,
|
|
8372
|
-
`Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
|
|
8373
|
-
).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
|
|
8374
|
-
});
|
|
8375
|
-
|
|
8376
|
-
// src/hooks/useSchoolForm.ts
|
|
8377
|
-
var defaultSchoolFormValues = {
|
|
8378
|
-
// New schools are active by default
|
|
8379
|
-
active: true,
|
|
8380
|
-
contactDetails: null,
|
|
8381
|
-
location: defaultLocation,
|
|
8382
|
-
logo: null,
|
|
8383
|
-
logoUpload: null,
|
|
8384
|
-
name: "",
|
|
8385
|
-
region: "",
|
|
8386
|
-
socialMedia: [],
|
|
8387
|
-
studentCount: 0,
|
|
8388
|
-
termsAgreement: null
|
|
8389
|
-
};
|
|
8390
|
-
function useSchoolForm(data) {
|
|
8391
|
-
const {
|
|
8392
|
-
control,
|
|
8393
|
-
formState,
|
|
8394
|
-
getValues,
|
|
8395
|
-
handleSubmit,
|
|
8396
|
-
reset,
|
|
8397
|
-
setValue,
|
|
8398
|
-
watch
|
|
8399
|
-
} = useForm17({
|
|
8400
|
-
defaultValues: defaultSchoolFormValues,
|
|
8401
|
-
resolver: yupResolver17(schoolSchema)
|
|
8402
|
-
});
|
|
8403
|
-
useEffect8(() => {
|
|
8404
|
-
if (data) {
|
|
8405
|
-
reset({
|
|
8406
|
-
_id: data._id,
|
|
8407
|
-
active: data.active,
|
|
8408
|
-
contactDetails: data.contactDetails,
|
|
8409
|
-
location: data.location,
|
|
8410
|
-
logo: data.logo,
|
|
8411
|
-
logoUpload: data.logoUpload,
|
|
8412
|
-
name: data.name,
|
|
8413
|
-
region: data.region,
|
|
8414
|
-
socialMedia: data.socialMedia,
|
|
8415
|
-
studentCount: data.studentCount,
|
|
8416
|
-
termsAgreement: data.termsAgreement
|
|
8417
|
-
});
|
|
8418
|
-
} else {
|
|
8419
|
-
reset(defaultSchoolFormValues);
|
|
8420
|
-
}
|
|
8421
|
-
}, [data]);
|
|
8422
|
-
const {
|
|
8423
|
-
_id,
|
|
8424
|
-
socialMedia: socialMedia2,
|
|
8425
|
-
active,
|
|
8426
|
-
contactDetails,
|
|
8427
|
-
location,
|
|
8428
|
-
logo,
|
|
8429
|
-
logoUpload,
|
|
8430
|
-
name,
|
|
8431
|
-
region,
|
|
8432
|
-
studentCount,
|
|
8433
|
-
termsAgreement
|
|
8434
|
-
} = getValues();
|
|
8435
|
-
return {
|
|
8436
|
-
control,
|
|
8437
|
-
fields: {
|
|
8438
|
-
_id,
|
|
8439
|
-
active,
|
|
8440
|
-
contactDetails,
|
|
8441
|
-
location,
|
|
8442
|
-
logo,
|
|
8443
|
-
logoUpload,
|
|
8444
|
-
name,
|
|
8445
|
-
region,
|
|
8446
|
-
socialMedia: socialMedia2,
|
|
8447
|
-
studentCount,
|
|
8448
|
-
termsAgreement
|
|
8449
|
-
},
|
|
8450
|
-
formState,
|
|
8451
|
-
getValues,
|
|
8452
|
-
handleSubmit,
|
|
8453
|
-
reset,
|
|
8454
|
-
setValue,
|
|
8455
|
-
watch
|
|
8456
|
-
};
|
|
8457
|
-
}
|
|
8458
|
-
|
|
8459
6516
|
// src/images/index.ts
|
|
8460
6517
|
var PKG = "@timardex/cluemart-shared";
|
|
8461
6518
|
var IMAGE_EXTENSION = ".webp";
|
|
@@ -8643,9 +6700,9 @@ function formatShareStallLine(stall) {
|
|
|
8643
6700
|
return ` - ${stall.label} \u2014 $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`;
|
|
8644
6701
|
}
|
|
8645
6702
|
function formatShareInvitationMarketDatesSection(dateTime) {
|
|
8646
|
-
const dateBlocks = dateTime.map((
|
|
8647
|
-
const formattedDate = formatShareMarketDate(
|
|
8648
|
-
const stallLines =
|
|
6703
|
+
const dateBlocks = dateTime.map((date) => {
|
|
6704
|
+
const formattedDate = formatShareMarketDate(date.startDate);
|
|
6705
|
+
const stallLines = date.stallTypes.map(formatShareStallLine);
|
|
8649
6706
|
return [`- ${formattedDate}`, ...stallLines].join("\n");
|
|
8650
6707
|
});
|
|
8651
6708
|
return `${SHARE_MARKET_DATES_SECTION_HEADING}
|
|
@@ -8702,7 +6759,7 @@ function formatShareInvitationApplicationDeadlineLine(applicationDeadlineHours)
|
|
|
8702
6759
|
return `${SHARE_APPLICATION_DEADLINE_PREFIX} vendors must apply at least ${applicationDeadlineHours} hours before each market date.`;
|
|
8703
6760
|
}
|
|
8704
6761
|
function buildInvitationShareDescription(event, eventInfo2) {
|
|
8705
|
-
const stallTypes2 = eventInfo2?.dateTime?.flatMap((
|
|
6762
|
+
const stallTypes2 = eventInfo2?.dateTime?.flatMap((date) => date.stallTypes) ?? [];
|
|
8706
6763
|
if (!eventInfo2 || stallTypes2.length === 0) {
|
|
8707
6764
|
return event.description?.trim() || "";
|
|
8708
6765
|
}
|
|
@@ -8888,6 +6945,31 @@ var EnumVerificationType = /* @__PURE__ */ ((EnumVerificationType2) => {
|
|
|
8888
6945
|
// src/types/global.ts
|
|
8889
6946
|
var PROMO_CODE_PREFIX = "CM-";
|
|
8890
6947
|
|
|
6948
|
+
// src/types/ad.ts
|
|
6949
|
+
var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn2) => {
|
|
6950
|
+
EnumAdShowOn2["EVENTS_PAGE"] = "Events_page";
|
|
6951
|
+
EnumAdShowOn2["FRONT_PAGE"] = "Front_page";
|
|
6952
|
+
EnumAdShowOn2["PARTNERS_PAGE"] = "Partners_page";
|
|
6953
|
+
EnumAdShowOn2["VENDORS_PAGE"] = "Vendors_page";
|
|
6954
|
+
return EnumAdShowOn2;
|
|
6955
|
+
})(EnumAdShowOn || {});
|
|
6956
|
+
var EnumAdStatus = /* @__PURE__ */ ((EnumAdStatus2) => {
|
|
6957
|
+
EnumAdStatus2["ACTIVE"] = "Active";
|
|
6958
|
+
EnumAdStatus2["PAUSED"] = "Paused";
|
|
6959
|
+
EnumAdStatus2["EXPIRED"] = "Expired";
|
|
6960
|
+
return EnumAdStatus2;
|
|
6961
|
+
})(EnumAdStatus || {});
|
|
6962
|
+
var EnumAdType = /* @__PURE__ */ ((EnumAdType2) => {
|
|
6963
|
+
EnumAdType2["SPONSORED"] = "Sponsored";
|
|
6964
|
+
EnumAdType2["FREE"] = "Free";
|
|
6965
|
+
return EnumAdType2;
|
|
6966
|
+
})(EnumAdType || {});
|
|
6967
|
+
var EnumAdStyle = /* @__PURE__ */ ((EnumAdStyle2) => {
|
|
6968
|
+
EnumAdStyle2["BLOOM"] = "Bloom";
|
|
6969
|
+
EnumAdStyle2["RISE"] = "Rise";
|
|
6970
|
+
return EnumAdStyle2;
|
|
6971
|
+
})(EnumAdStyle || {});
|
|
6972
|
+
|
|
8891
6973
|
// src/types/resourceActivities.ts
|
|
8892
6974
|
var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
8893
6975
|
EnumActivity2["FAVORITE"] = "FAVORITE";
|
|
@@ -8898,6 +6980,22 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
|
8898
6980
|
return EnumActivity2;
|
|
8899
6981
|
})(EnumActivity || {});
|
|
8900
6982
|
|
|
6983
|
+
// src/types/post.ts
|
|
6984
|
+
var EnumPostType = /* @__PURE__ */ ((EnumPostType2) => {
|
|
6985
|
+
EnumPostType2["DAILY_MEETS"] = "daily_meets";
|
|
6986
|
+
EnumPostType2["DAILY_TIPS"] = "daily_tips";
|
|
6987
|
+
EnumPostType2["DAILY_GAMES"] = "daily_games";
|
|
6988
|
+
return EnumPostType2;
|
|
6989
|
+
})(EnumPostType || {});
|
|
6990
|
+
var EnumPostContentType = /* @__PURE__ */ ((EnumPostContentType2) => {
|
|
6991
|
+
EnumPostContentType2["GAME"] = "game";
|
|
6992
|
+
EnumPostContentType2["IMAGE"] = "image";
|
|
6993
|
+
EnumPostContentType2["LIST"] = "list";
|
|
6994
|
+
EnumPostContentType2["TEXTAREA"] = "textarea";
|
|
6995
|
+
EnumPostContentType2["VIDEO"] = "video";
|
|
6996
|
+
return EnumPostContentType2;
|
|
6997
|
+
})(EnumPostContentType || {});
|
|
6998
|
+
|
|
8901
6999
|
// src/types/game/index.ts
|
|
8902
7000
|
var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
|
|
8903
7001
|
EnumGameStatus2["GAME_COMPLETED"] = "GAME_COMPLETED";
|
|
@@ -9044,13 +7142,6 @@ export {
|
|
|
9044
7142
|
contactUsFields,
|
|
9045
7143
|
darkColors,
|
|
9046
7144
|
dateFormat,
|
|
9047
|
-
defaultEventFormValues,
|
|
9048
|
-
defaultEventInfoFormValues,
|
|
9049
|
-
defaultLocation,
|
|
9050
|
-
defaultPartnerFormValues,
|
|
9051
|
-
defaultUnregisteredVendorFormValues,
|
|
9052
|
-
defaultVendorFormValues,
|
|
9053
|
-
defaultVendorInfoFormValues,
|
|
9054
7145
|
emailField,
|
|
9055
7146
|
eventBasicInfoFields,
|
|
9056
7147
|
eventEndDateFields,
|
|
@@ -9078,7 +7169,6 @@ export {
|
|
|
9078
7169
|
gameScreenIdentifierList,
|
|
9079
7170
|
gameTypeToDisplayName,
|
|
9080
7171
|
getCurrentAndFutureDates,
|
|
9081
|
-
globalDefaultValues,
|
|
9082
7172
|
iconFiles,
|
|
9083
7173
|
iconIds,
|
|
9084
7174
|
icons,
|
|
@@ -9095,7 +7185,6 @@ export {
|
|
|
9095
7185
|
logoIds,
|
|
9096
7186
|
logos,
|
|
9097
7187
|
mapArrayToOptions,
|
|
9098
|
-
mapBaseResourceTypeToFormData,
|
|
9099
7188
|
normalizeShareOgDescription,
|
|
9100
7189
|
normalizeShareRouteId,
|
|
9101
7190
|
normalizeShareText,
|
|
@@ -9131,7 +7220,6 @@ export {
|
|
|
9131
7220
|
timeFormat,
|
|
9132
7221
|
toNZTime,
|
|
9133
7222
|
truncateText,
|
|
9134
|
-
useAdForm,
|
|
9135
7223
|
useAddParticipantToChat,
|
|
9136
7224
|
useAddUserFavouriteResource,
|
|
9137
7225
|
useAddUserGoingResource,
|
|
@@ -9140,10 +7228,8 @@ export {
|
|
|
9140
7228
|
useAdminPermanentlyDeleteResource,
|
|
9141
7229
|
useAdminResendUserVerificationEmail,
|
|
9142
7230
|
useAdminUpdateResourceType,
|
|
9143
|
-
useAppSettingsForm,
|
|
9144
7231
|
useCancelSubscription,
|
|
9145
7232
|
useContactUs,
|
|
9146
|
-
useContactUsForm,
|
|
9147
7233
|
useCrawlGoogleMarkets,
|
|
9148
7234
|
useCreateAd,
|
|
9149
7235
|
useCreateBulkNotifications,
|
|
@@ -9175,8 +7261,6 @@ export {
|
|
|
9175
7261
|
useDeleteUnregisteredVendor,
|
|
9176
7262
|
useDeleteUser,
|
|
9177
7263
|
useDeleteVendor,
|
|
9178
|
-
useEventForm,
|
|
9179
|
-
useEventInfoForm,
|
|
9180
7264
|
useGetAd,
|
|
9181
7265
|
useGetAds,
|
|
9182
7266
|
useGetAdsByRegion,
|
|
@@ -9230,18 +7314,13 @@ export {
|
|
|
9230
7314
|
useGetVendors,
|
|
9231
7315
|
useGetVendorsByRegion,
|
|
9232
7316
|
useLeaveGame,
|
|
9233
|
-
useLocationSearch,
|
|
9234
7317
|
useLogin,
|
|
9235
|
-
useLoginForm,
|
|
9236
7318
|
useLogout,
|
|
9237
7319
|
useMarkAllNotificationsRead,
|
|
9238
7320
|
useMarkChatMessagesSeen,
|
|
9239
7321
|
useMarkNotificationRead,
|
|
9240
|
-
usePartnerForm,
|
|
9241
|
-
usePostForm,
|
|
9242
7322
|
useRefreshToken,
|
|
9243
7323
|
useRegister,
|
|
9244
|
-
useRegisterForm,
|
|
9245
7324
|
useRemoveParticipantFromChat,
|
|
9246
7325
|
useRemoveUserFavouriteResource,
|
|
9247
7326
|
useRemoveUserGoingResource,
|
|
@@ -9250,10 +7329,7 @@ export {
|
|
|
9250
7329
|
useReportChatUser,
|
|
9251
7330
|
useRequestMarketingMaterial,
|
|
9252
7331
|
useRequestPasswordReset,
|
|
9253
|
-
useRequestPasswordResetForm,
|
|
9254
7332
|
useResetPassword,
|
|
9255
|
-
useResetPasswordForm,
|
|
9256
|
-
useSchoolForm,
|
|
9257
7333
|
useSearchEvents,
|
|
9258
7334
|
useSearchPartners,
|
|
9259
7335
|
useSearchVendors,
|
|
@@ -9263,7 +7339,6 @@ export {
|
|
|
9263
7339
|
useStartGame,
|
|
9264
7340
|
useToggleChatMessageLike,
|
|
9265
7341
|
useUnlinkUnregisteredVendorByInviterId,
|
|
9266
|
-
useUnregisteredVendorForm,
|
|
9267
7342
|
useUpdateAd,
|
|
9268
7343
|
useUpdateAppSettings,
|
|
9269
7344
|
useUpdateDailyClueGame,
|
|
@@ -9280,11 +7355,7 @@ export {
|
|
|
9280
7355
|
useUpdateUser,
|
|
9281
7356
|
useUpdateVendor,
|
|
9282
7357
|
useUpdateVendorInfo,
|
|
9283
|
-
useUserForm,
|
|
9284
7358
|
useValidateVerificationToken,
|
|
9285
|
-
useValidateVerificationTokenForm,
|
|
9286
|
-
useVendorForm,
|
|
9287
|
-
useVendorInfoForm,
|
|
9288
7359
|
validateVerificationTokenFields,
|
|
9289
7360
|
vendorAvailability,
|
|
9290
7361
|
vendorBasicInfoFields,
|