@timardex/cluemart-shared 2.2.29 → 2.2.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ad-C4L_-r-4.d.ts → ad-CdehhMyb.d.ts} +2 -2
- package/dist/{ad-XtBAH4rD.d.mts → ad-Drhn_Azy.d.mts} +2 -2
- package/dist/{affiliate-CxZHVZb2.d.ts → affiliate-Cd78p2Fz.d.mts} +3 -3
- package/dist/{affiliate-D-L_UtL8.d.mts → affiliate-CdIL0r2o.d.ts} +3 -3
- package/dist/auth/index.cjs +10 -1
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.mts +3 -3
- package/dist/auth/index.d.ts +3 -3
- package/dist/auth/index.mjs +2 -2
- package/dist/{chunk-IKRXLKJ3.mjs → chunk-5AAYX364.mjs} +1 -1
- package/dist/{chunk-IKRXLKJ3.mjs.map → chunk-5AAYX364.mjs.map} +1 -1
- package/dist/{chunk-NRNLARYC.mjs → chunk-BCMBTEGJ.mjs} +13 -4
- package/dist/chunk-BCMBTEGJ.mjs.map +1 -0
- package/dist/{chunk-LLP7OWX5.mjs → chunk-MKHXXZWF.mjs} +2 -2
- package/dist/{chunk-MQHX5BD6.mjs → chunk-NMJ2CR2F.mjs} +2 -2
- package/dist/{chunk-YFFCHTJS.mjs → chunk-T5ZOYS3L.mjs} +5 -23
- package/dist/{chunk-YFFCHTJS.mjs.map → chunk-T5ZOYS3L.mjs.map} +1 -1
- package/dist/{chunk-BR4XNXE7.mjs → chunk-TKSBCN3N.mjs} +11 -2
- package/dist/chunk-TKSBCN3N.mjs.map +1 -0
- package/dist/{chunk-J5N3IEGR.mjs → chunk-VL275KFW.mjs} +3 -3
- package/dist/{chunk-U3KUTQ43.mjs → chunk-XGGFB7HY.mjs} +11 -2
- package/dist/{chunk-U3KUTQ43.mjs.map → chunk-XGGFB7HY.mjs.map} +1 -1
- package/dist/{contactUs-CwHKoGEt.d.mts → contactUs-BJPQ5nKc.d.mts} +1 -1
- package/dist/{contactUs-CR-nghbk.d.ts → contactUs-ITiB1XV4.d.ts} +1 -1
- package/dist/enums/index.cjs +10 -0
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.mts +8 -1
- package/dist/enums/index.d.ts +8 -1
- package/dist/enums/index.mjs +3 -1
- package/dist/formFields/index.cjs +4 -4
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/formFields/index.mjs +5 -5
- package/dist/{global-B4mmQo6R.d.ts → global-DlC7W4p7.d.ts} +9 -0
- package/dist/{global-D1r5ZuQO.d.mts → global-XUBcgjNc.d.mts} +9 -0
- package/dist/graphql/index.cjs +10 -1
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +5 -5
- package/dist/graphql/index.d.ts +5 -5
- package/dist/graphql/index.mjs +3 -3
- package/dist/hooks/index.cjs +320 -285
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +5 -5
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/index.mjs +314 -288
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +34 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +44 -22
- package/dist/index.d.ts +44 -22
- package/dist/index.mjs +32 -23
- package/dist/index.mjs.map +1 -1
- package/dist/map/index.d.mts +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/region/index.cjs.map +1 -1
- package/dist/region/index.d.mts +1 -1
- package/dist/region/index.d.ts +1 -1
- package/dist/region/index.mjs +1 -1
- package/dist/{resourceActivities-Uz9uavhK.d.ts → resourceActivities-C8eIfpKl.d.ts} +1 -1
- package/dist/{resourceActivities-DUReu_jD.d.mts → resourceActivities-Ci12UkJU.d.mts} +1 -1
- package/dist/sharing/index.cjs +4 -25
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.d.mts +3 -22
- package/dist/sharing/index.d.ts +3 -22
- package/dist/sharing/index.mjs +3 -9
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +7 -7
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.mjs +2 -2
- package/dist/{user-BpR-FTW2.d.mts → user-BSFExFvl.d.ts} +18 -4
- package/dist/{user-IR0bHKFb.d.ts → user-D31zAVuz.d.mts} +18 -4
- package/dist/utils/index.cjs +14 -4
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +15 -4
- package/dist/utils/index.d.ts +15 -4
- package/dist/utils/index.mjs +6 -4
- package/package.json +1 -1
- package/dist/chunk-BR4XNXE7.mjs.map +0 -1
- package/dist/chunk-NRNLARYC.mjs.map +0 -1
- /package/dist/{chunk-LLP7OWX5.mjs.map → chunk-MKHXXZWF.mjs.map} +0 -0
- /package/dist/{chunk-MQHX5BD6.mjs.map → chunk-NMJ2CR2F.mjs.map} +0 -0
- /package/dist/{chunk-J5N3IEGR.mjs.map → chunk-VL275KFW.mjs.map} +0 -0
package/dist/hooks/index.cjs
CHANGED
|
@@ -170,9 +170,6 @@ var React = __toESM(require("react"));
|
|
|
170
170
|
var import_react_hook_form = require("react-hook-form");
|
|
171
171
|
|
|
172
172
|
// src/yupSchema/global.ts
|
|
173
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
174
|
-
var import_customParseFormat3 = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
175
|
-
var import_isSameOrAfter2 = __toESM(require("dayjs/plugin/isSameOrAfter.js"));
|
|
176
173
|
var yup = __toESM(require("yup"));
|
|
177
174
|
|
|
178
175
|
// src/enums/index.ts
|
|
@@ -492,14 +489,14 @@ var POST_SHARE_RESOURCE_TYPES = [
|
|
|
492
489
|
var SHARE_RESOURCE_LABEL = {
|
|
493
490
|
[RELATION_SHARE_APPLICATION]: "Application",
|
|
494
491
|
[RELATION_SHARE_INVITATION]: "Invitation",
|
|
492
|
+
affiliate: "Affiliate",
|
|
495
493
|
clue_bites: "Clue Bites",
|
|
496
494
|
market_faces: "Market Faces",
|
|
497
|
-
play_and_win: "Play & Win",
|
|
498
495
|
market: "Market",
|
|
499
496
|
partner: "Partner",
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
497
|
+
play_and_win: "Play & Win",
|
|
498
|
+
school: "School",
|
|
499
|
+
stallholder: "Stallholder"
|
|
503
500
|
};
|
|
504
501
|
|
|
505
502
|
// src/types/global.ts
|
|
@@ -1850,8 +1847,6 @@ var toOptionalNumber = (originalValue) => {
|
|
|
1850
1847
|
}
|
|
1851
1848
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
1852
1849
|
};
|
|
1853
|
-
import_dayjs4.default.extend(import_isSameOrAfter2.default);
|
|
1854
|
-
import_dayjs4.default.extend(import_customParseFormat3.default);
|
|
1855
1850
|
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
1856
1851
|
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
1857
1852
|
);
|
|
@@ -1881,32 +1876,98 @@ var contactDetailsSchema = yup.object({
|
|
|
1881
1876
|
mobilePhone: mobilePhoneSchema,
|
|
1882
1877
|
landlinePhone: landlinePhoneSchema
|
|
1883
1878
|
}).nullable().default(void 0);
|
|
1884
|
-
var
|
|
1879
|
+
var locationSchema = yup.object().shape({
|
|
1880
|
+
city: yup.string().label("City").required("City is required"),
|
|
1881
|
+
country: yup.string().label("Country").required("Country is required"),
|
|
1882
|
+
fullAddress: yup.string().label("Address").required("Address is required"),
|
|
1883
|
+
geo: yup.object().shape({
|
|
1884
|
+
coordinates: yup.array().of(yup.number().required("Coordinates must be numbers")).length(
|
|
1885
|
+
2,
|
|
1886
|
+
"Coordinates must contain exactly two numbers (longitude, latitude)"
|
|
1887
|
+
).required("Coordinates are required"),
|
|
1888
|
+
type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
|
|
1889
|
+
}),
|
|
1890
|
+
latitude: yup.number().label("Latitude").required("Latitude is required"),
|
|
1891
|
+
longitude: yup.number().label("Longitude").required("Longitude is required"),
|
|
1892
|
+
region: yup.string().label("Region").required("Region is required")
|
|
1893
|
+
});
|
|
1894
|
+
var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
|
|
1895
|
+
var socialMediaSchema = yup.object({
|
|
1896
|
+
name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
|
|
1897
|
+
link: yup.string().when("name", {
|
|
1898
|
+
is: (name) => !!name,
|
|
1899
|
+
// If name has a value
|
|
1900
|
+
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
1901
|
+
otherwise: (schema) => schema.notRequired()
|
|
1902
|
+
})
|
|
1903
|
+
});
|
|
1904
|
+
var globalResourceSchema = yup.object().shape({
|
|
1905
|
+
active: yup.boolean().required("Active is required"),
|
|
1906
|
+
cover: yup.object({
|
|
1907
|
+
active: yup.boolean().default(true),
|
|
1908
|
+
source: yup.string().label("Cover").required("Cover Image is required"),
|
|
1909
|
+
title: yup.string().label("Cover Title").required("Cover Title is required")
|
|
1910
|
+
}),
|
|
1911
|
+
contactDetails: contactDetailsSchema,
|
|
1912
|
+
description: yup.string().label("Description").trim().min(50).required("Description is required"),
|
|
1913
|
+
name: yup.string().label("Name").trim().min(3).required("Name is required"),
|
|
1914
|
+
region: yup.string().label("Region").required("Region is required"),
|
|
1915
|
+
socialMedia: yup.array().of(socialMediaSchema).nullable().default(null)
|
|
1916
|
+
});
|
|
1917
|
+
var categorySchema = yup.array().of(
|
|
1918
|
+
yup.object().shape({
|
|
1919
|
+
id: yup.string().required("Category id is required"),
|
|
1920
|
+
name: yup.string().required("Category name is required"),
|
|
1921
|
+
subcategories: yup.array().of(
|
|
1922
|
+
yup.object().shape({
|
|
1923
|
+
id: yup.string().defined(),
|
|
1924
|
+
items: yup.array().of(
|
|
1925
|
+
yup.object().shape({
|
|
1926
|
+
id: yup.string().defined(),
|
|
1927
|
+
name: yup.string().defined()
|
|
1928
|
+
})
|
|
1929
|
+
).nullable(),
|
|
1930
|
+
name: yup.string().defined()
|
|
1931
|
+
})
|
|
1932
|
+
).min(1, "At least one subcategory is required").required("Subcategories are required")
|
|
1933
|
+
})
|
|
1934
|
+
);
|
|
1935
|
+
|
|
1936
|
+
// src/yupSchema/date.ts
|
|
1937
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
1938
|
+
var import_customParseFormat3 = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
1939
|
+
var import_isSameOrAfter2 = __toESM(require("dayjs/plugin/isSameOrAfter.js"));
|
|
1940
|
+
var yup2 = __toESM(require("yup"));
|
|
1941
|
+
import_dayjs4.default.extend(import_isSameOrAfter2.default);
|
|
1942
|
+
import_dayjs4.default.extend(import_customParseFormat3.default);
|
|
1943
|
+
var endDateNotInPastTest = yup2.string().test("not-in-past", "End date cannot be in the past", (value) => {
|
|
1944
|
+
if (!value) return true;
|
|
1885
1945
|
const now = (0, import_dayjs4.default)();
|
|
1886
|
-
return
|
|
1946
|
+
return (0, import_dayjs4.default)(value, dateFormat, true).isSameOrAfter(now, "day");
|
|
1887
1947
|
});
|
|
1888
|
-
var startDateNotInPastTest =
|
|
1948
|
+
var startDateNotInPastTest = yup2.string().test("not-in-past", "Start date cannot be in the past", (value) => {
|
|
1949
|
+
if (!value) return true;
|
|
1889
1950
|
const now = (0, import_dayjs4.default)();
|
|
1890
|
-
return
|
|
1951
|
+
return (0, import_dayjs4.default)(value, dateFormat, true).isSameOrAfter(now, "day");
|
|
1891
1952
|
});
|
|
1892
|
-
var endDateAfterStartDateTest =
|
|
1953
|
+
var endDateAfterStartDateTest = yup2.string().test(
|
|
1893
1954
|
"end-after-start",
|
|
1894
1955
|
"End date cannot be before start date",
|
|
1895
1956
|
function(value) {
|
|
1896
1957
|
const { startDate } = this.parent;
|
|
1897
|
-
if (!startDate || !value) return
|
|
1958
|
+
if (!startDate || !value) return true;
|
|
1898
1959
|
return (0, import_dayjs4.default)(value, dateFormat, true).isSameOrAfter(
|
|
1899
1960
|
(0, import_dayjs4.default)(startDate, dateFormat, true),
|
|
1900
1961
|
"day"
|
|
1901
1962
|
);
|
|
1902
1963
|
}
|
|
1903
1964
|
);
|
|
1904
|
-
var endTimeMustBeAfterStartTimeTest =
|
|
1965
|
+
var endTimeMustBeAfterStartTimeTest = yup2.string().test(
|
|
1905
1966
|
"valid-end-time",
|
|
1906
1967
|
"End time must be after start time",
|
|
1907
1968
|
function(value) {
|
|
1908
1969
|
const { startDate, endDate, startTime } = this.parent;
|
|
1909
|
-
if (!startDate || !endDate || !startTime || !value) return
|
|
1970
|
+
if (!startDate || !endDate || !startTime || !value) return true;
|
|
1910
1971
|
const startDateTime = (0, import_dayjs4.default)(
|
|
1911
1972
|
`${startDate} ${startTime}`,
|
|
1912
1973
|
`${dateFormat} ${timeFormat}`,
|
|
@@ -1920,13 +1981,13 @@ var endTimeMustBeAfterStartTimeTest = yup.string().test(
|
|
|
1920
1981
|
return endDateTime.isAfter(startDateTime);
|
|
1921
1982
|
}
|
|
1922
1983
|
);
|
|
1923
|
-
var startTimeCannotBeInPastTest =
|
|
1984
|
+
var startTimeCannotBeInPastTest = yup2.string().test(
|
|
1924
1985
|
"valid-start-time",
|
|
1925
1986
|
"Start time cannot be in the past",
|
|
1926
1987
|
function(value) {
|
|
1927
1988
|
const now = (0, import_dayjs4.default)();
|
|
1928
1989
|
const { startDate } = this.parent;
|
|
1929
|
-
if (!startDate || !value) return
|
|
1990
|
+
if (!startDate || !value) return true;
|
|
1930
1991
|
const startDateTime = (0, import_dayjs4.default)(
|
|
1931
1992
|
`${startDate} ${value}`,
|
|
1932
1993
|
`${dateFormat} ${timeFormat}`,
|
|
@@ -1935,102 +1996,67 @@ var startTimeCannotBeInPastTest = yup.string().test(
|
|
|
1935
1996
|
return startDateTime.isSameOrAfter(now);
|
|
1936
1997
|
}
|
|
1937
1998
|
);
|
|
1938
|
-
var
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1999
|
+
var resolveWhenDateStatus = (values) => Array.isArray(values) ? values[0] : values;
|
|
2000
|
+
var SKIP_SCHEDULE_STATUSES = /* @__PURE__ */ new Set([
|
|
2001
|
+
"Canceled" /* CANCELED */,
|
|
2002
|
+
"Invalid" /* INVALID */
|
|
2003
|
+
]);
|
|
2004
|
+
var SKIP_START_PAST_STATUSES = /* @__PURE__ */ new Set([
|
|
2005
|
+
"Started" /* STARTED */,
|
|
2006
|
+
"Ended" /* ENDED */
|
|
2007
|
+
]);
|
|
2008
|
+
var SKIP_END_PAST_STATUSES = /* @__PURE__ */ new Set([
|
|
2009
|
+
"Ended" /* ENDED */
|
|
2010
|
+
]);
|
|
2011
|
+
var dateTimeSchema = yup2.object().shape({
|
|
2012
|
+
dateStatus: yup2.mixed().oneOf(Object.values(EnumEventDateStatus)).required("Date status is required"),
|
|
2013
|
+
endDate: yup2.string().label("End Date").when("dateStatus", (values, schema) => {
|
|
2014
|
+
const dateStatus = resolveWhenDateStatus(values);
|
|
2015
|
+
if (SKIP_SCHEDULE_STATUSES.has(dateStatus)) return schema.notRequired();
|
|
2016
|
+
const rules = schema.required("End date is required").concat(endDateAfterStartDateTest);
|
|
2017
|
+
return SKIP_END_PAST_STATUSES.has(dateStatus) ? rules : rules.concat(endDateNotInPastTest);
|
|
1944
2018
|
}),
|
|
1945
|
-
endTime:
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
2019
|
+
endTime: yup2.string().label("End Time").when("dateStatus", (values, schema) => {
|
|
2020
|
+
const dateStatus = resolveWhenDateStatus(values);
|
|
2021
|
+
if (SKIP_SCHEDULE_STATUSES.has(dateStatus)) return schema.notRequired();
|
|
2022
|
+
return schema.required("End time is required").concat(endTimeMustBeAfterStartTimeTest);
|
|
1949
2023
|
}),
|
|
1950
|
-
startDate:
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
2024
|
+
startDate: yup2.string().label("Start Date").when("dateStatus", (values, schema) => {
|
|
2025
|
+
const dateStatus = resolveWhenDateStatus(values);
|
|
2026
|
+
if (SKIP_SCHEDULE_STATUSES.has(dateStatus)) return schema.notRequired();
|
|
2027
|
+
const rules = schema.required("Start date is required");
|
|
2028
|
+
return SKIP_START_PAST_STATUSES.has(dateStatus) ? rules : rules.concat(startDateNotInPastTest);
|
|
1954
2029
|
}),
|
|
1955
|
-
startTime:
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2030
|
+
startTime: yup2.string().label("Start Time").when("dateStatus", (values, schema) => {
|
|
2031
|
+
const dateStatus = resolveWhenDateStatus(values);
|
|
2032
|
+
if (SKIP_SCHEDULE_STATUSES.has(dateStatus)) return schema.notRequired();
|
|
2033
|
+
const rules = schema.required("Start time is required");
|
|
2034
|
+
return SKIP_START_PAST_STATUSES.has(dateStatus) ? rules : rules.concat(startTimeCannotBeInPastTest);
|
|
1959
2035
|
})
|
|
1960
2036
|
});
|
|
1961
|
-
var stallTypesSchema =
|
|
1962
|
-
label:
|
|
1963
|
-
price:
|
|
2037
|
+
var stallTypesSchema = yup2.object({
|
|
2038
|
+
label: yup2.string().trim().label("Stall Type").required("Stall type is required"),
|
|
2039
|
+
price: yup2.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(
|
|
1964
2040
|
"no-leading-zeros",
|
|
1965
2041
|
"",
|
|
1966
2042
|
noLeadingZeros("Stall price", { allowDecimal: true })
|
|
1967
2043
|
),
|
|
1968
|
-
stallCapacity:
|
|
2044
|
+
stallCapacity: yup2.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"))
|
|
1969
2045
|
});
|
|
1970
2046
|
var dateTimeWithPriceSchema = dateTimeSchema.shape({
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
geo: yup.object().shape({
|
|
1978
|
-
coordinates: yup.array().of(yup.number().required("Coordinates must be numbers")).length(
|
|
1979
|
-
2,
|
|
1980
|
-
"Coordinates must contain exactly two numbers (longitude, latitude)"
|
|
1981
|
-
).required("Coordinates are required"),
|
|
1982
|
-
type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
|
|
1983
|
-
}),
|
|
1984
|
-
latitude: yup.number().label("Latitude").required("Latitude is required"),
|
|
1985
|
-
longitude: yup.number().label("Longitude").required("Longitude is required"),
|
|
1986
|
-
region: yup.string().label("Region").required("Region is required")
|
|
1987
|
-
});
|
|
1988
|
-
var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
|
|
1989
|
-
var socialMediaSchema = yup.object({
|
|
1990
|
-
name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
|
|
1991
|
-
link: yup.string().when("name", {
|
|
1992
|
-
is: (name) => !!name,
|
|
1993
|
-
// If name has a value
|
|
1994
|
-
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
1995
|
-
otherwise: (schema) => schema.notRequired()
|
|
2047
|
+
// Keep `required` unconditionally so the static type stays `StallType[]`
|
|
2048
|
+
// (matching `DateTimeWithPriceFormValue`); only the min-count rule is
|
|
2049
|
+
// conditional. Skipped statuses may carry an empty stallTypes array.
|
|
2050
|
+
stallTypes: yup2.array().of(stallTypesSchema).required("Stall types are required").when("dateStatus", (values, schema) => {
|
|
2051
|
+
const dateStatus = resolveWhenDateStatus(values);
|
|
2052
|
+
return SKIP_SCHEDULE_STATUSES.has(dateStatus) ? schema : schema.min(1, "At least one stall type is required");
|
|
1996
2053
|
})
|
|
1997
2054
|
});
|
|
1998
|
-
var globalResourceSchema = yup.object().shape({
|
|
1999
|
-
active: yup.boolean().required("Active is required"),
|
|
2000
|
-
cover: yup.object({
|
|
2001
|
-
active: yup.boolean().default(true),
|
|
2002
|
-
source: yup.string().label("Cover").required("Cover Image is required"),
|
|
2003
|
-
title: yup.string().label("Cover Title").required("Cover Title is required")
|
|
2004
|
-
}),
|
|
2005
|
-
contactDetails: contactDetailsSchema,
|
|
2006
|
-
description: yup.string().label("Description").trim().min(50).required("Description is required"),
|
|
2007
|
-
name: yup.string().label("Name").trim().min(3).required("Name is required"),
|
|
2008
|
-
region: yup.string().label("Region").required("Region is required"),
|
|
2009
|
-
socialMedia: yup.array().of(socialMediaSchema).nullable().default(null)
|
|
2010
|
-
});
|
|
2011
|
-
var categorySchema = yup.array().of(
|
|
2012
|
-
yup.object().shape({
|
|
2013
|
-
id: yup.string().required("Category id is required"),
|
|
2014
|
-
name: yup.string().required("Category name is required"),
|
|
2015
|
-
subcategories: yup.array().of(
|
|
2016
|
-
yup.object().shape({
|
|
2017
|
-
id: yup.string().defined(),
|
|
2018
|
-
items: yup.array().of(
|
|
2019
|
-
yup.object().shape({
|
|
2020
|
-
id: yup.string().defined(),
|
|
2021
|
-
name: yup.string().defined()
|
|
2022
|
-
})
|
|
2023
|
-
).nullable(),
|
|
2024
|
-
name: yup.string().defined()
|
|
2025
|
-
})
|
|
2026
|
-
).min(1, "At least one subcategory is required").required("Subcategories are required")
|
|
2027
|
-
})
|
|
2028
|
-
);
|
|
2029
2055
|
|
|
2030
2056
|
// src/yupSchema/event.ts
|
|
2031
|
-
var
|
|
2057
|
+
var yup3 = __toESM(require("yup"));
|
|
2032
2058
|
var eventSchema = globalResourceSchema.shape({
|
|
2033
|
-
dateTime:
|
|
2059
|
+
dateTime: yup3.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(
|
|
2034
2060
|
"unique-start-date-time",
|
|
2035
2061
|
"Start Date and Start Time must be unique",
|
|
2036
2062
|
function(value) {
|
|
@@ -2047,23 +2073,23 @@ var eventSchema = globalResourceSchema.shape({
|
|
|
2047
2073
|
return true;
|
|
2048
2074
|
}
|
|
2049
2075
|
),
|
|
2050
|
-
eventType:
|
|
2076
|
+
eventType: yup3.mixed().oneOf(Object.values(EnumEventType), "Please select a valid Event type").required("Please select an Event type"),
|
|
2051
2077
|
location: locationSchema,
|
|
2052
|
-
nzbn:
|
|
2053
|
-
rainOrShine:
|
|
2054
|
-
tags:
|
|
2078
|
+
nzbn: yup3.string().required("NZBN is required").matches(nzbnRegex, "NZBN must be 13 digits and start with 94"),
|
|
2079
|
+
rainOrShine: yup3.boolean().label("Rain or Shine").required("Please specify if the event is rain or shine"),
|
|
2080
|
+
tags: yup3.array().of(yup3.string().defined()).min(1, "Tags are required").required("Tags are required")
|
|
2055
2081
|
});
|
|
2056
|
-
var paymentInfoSchema =
|
|
2057
|
-
paymentMethod:
|
|
2082
|
+
var paymentInfoSchema = yup3.object({
|
|
2083
|
+
paymentMethod: yup3.mixed().oneOf(
|
|
2058
2084
|
Object.values(EnumPaymentMethod),
|
|
2059
2085
|
"Please select a valid Payment method"
|
|
2060
2086
|
).required("Please select a Payment method"),
|
|
2061
|
-
accountHolderName:
|
|
2087
|
+
accountHolderName: yup3.string().when("paymentMethod", {
|
|
2062
2088
|
is: "bank_transfer" /* BANK_TRANSFER */,
|
|
2063
2089
|
then: (schema) => schema.required("Account holder name is required for bank transfer").trim(),
|
|
2064
2090
|
otherwise: (schema) => schema.notRequired()
|
|
2065
2091
|
}),
|
|
2066
|
-
accountNumber:
|
|
2092
|
+
accountNumber: yup3.string().when("paymentMethod", {
|
|
2067
2093
|
is: "bank_transfer" /* BANK_TRANSFER */,
|
|
2068
2094
|
then: (schema) => schema.required("Account number is required for bank transfer").matches(
|
|
2069
2095
|
nzBankAccountRegex,
|
|
@@ -2071,18 +2097,18 @@ var paymentInfoSchema = yup2.object({
|
|
|
2071
2097
|
).trim(),
|
|
2072
2098
|
otherwise: (schema) => schema.notRequired()
|
|
2073
2099
|
}),
|
|
2074
|
-
link:
|
|
2100
|
+
link: yup3.string().when("paymentMethod", {
|
|
2075
2101
|
is: (val) => val === "paypal" /* PAYPAL */ || val === "stripe" /* STRIPE */,
|
|
2076
2102
|
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
2077
2103
|
otherwise: (schema) => schema.notRequired()
|
|
2078
2104
|
})
|
|
2079
2105
|
});
|
|
2080
|
-
var eventInfoSchema =
|
|
2081
|
-
applicationDeadlineHours:
|
|
2082
|
-
dateTime:
|
|
2083
|
-
eventId:
|
|
2084
|
-
packInTime:
|
|
2085
|
-
paymentDueHours:
|
|
2106
|
+
var eventInfoSchema = yup3.object().shape({
|
|
2107
|
+
applicationDeadlineHours: yup3.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")),
|
|
2108
|
+
dateTime: yup3.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
2109
|
+
eventId: yup3.string().trim().required("Event ID is required"),
|
|
2110
|
+
packInTime: yup3.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")),
|
|
2111
|
+
paymentDueHours: yup3.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(
|
|
2086
2112
|
"payment-before-deadline",
|
|
2087
2113
|
"Payment due hours must be less than application deadline hours",
|
|
2088
2114
|
function(value) {
|
|
@@ -2090,12 +2116,12 @@ var eventInfoSchema = yup2.object().shape({
|
|
|
2090
2116
|
return value < applicationDeadlineHours;
|
|
2091
2117
|
}
|
|
2092
2118
|
),
|
|
2093
|
-
paymentInfo:
|
|
2094
|
-
refundPolicy:
|
|
2095
|
-
|
|
2096
|
-
category:
|
|
2097
|
-
label:
|
|
2098
|
-
value:
|
|
2119
|
+
paymentInfo: yup3.array().of(paymentInfoSchema).min(1, "At least one payment method is required").required("Payment info is required"),
|
|
2120
|
+
refundPolicy: yup3.array().of(
|
|
2121
|
+
yup3.object({
|
|
2122
|
+
category: yup3.mixed().required("Category is required"),
|
|
2123
|
+
label: yup3.string().required("Label is required"),
|
|
2124
|
+
value: yup3.boolean().required("Value is required")
|
|
2099
2125
|
})
|
|
2100
2126
|
).min(1, "At least one refund policy item is required").test(
|
|
2101
2127
|
"at-least-one-true",
|
|
@@ -2108,12 +2134,12 @@ var eventInfoSchema = yup2.object().shape({
|
|
|
2108
2134
|
});
|
|
2109
2135
|
|
|
2110
2136
|
// src/yupSchema/vendor.ts
|
|
2111
|
-
var
|
|
2112
|
-
var vendorMenuSchema =
|
|
2113
|
-
description:
|
|
2114
|
-
name:
|
|
2115
|
-
price:
|
|
2116
|
-
priceMax:
|
|
2137
|
+
var yup4 = __toESM(require("yup"));
|
|
2138
|
+
var vendorMenuSchema = yup4.object({
|
|
2139
|
+
description: yup4.string().trim().nullable().optional(),
|
|
2140
|
+
name: yup4.string().trim().nullable().min(3, "Product name must be at least 3 characters").required("Product name is required"),
|
|
2141
|
+
price: yup4.number().transform((v, o) => o === "" ? null : v).min(1, "Product price must be greater than 0").required("Product price is required"),
|
|
2142
|
+
priceMax: yup4.number().transform((v, o) => o === "" ? null : v).min(1, "Product max price must be greater than 0").nullable().optional().test(
|
|
2117
2143
|
"is-greater",
|
|
2118
2144
|
"Max price must be greater than Product price",
|
|
2119
2145
|
function(priceMaxValue) {
|
|
@@ -2125,33 +2151,33 @@ var vendorMenuSchema = yup3.object({
|
|
|
2125
2151
|
return maxNum > priceNum;
|
|
2126
2152
|
}
|
|
2127
2153
|
),
|
|
2128
|
-
priceUnit:
|
|
2154
|
+
priceUnit: yup4.string().required("Product unit is required")
|
|
2129
2155
|
});
|
|
2130
2156
|
var vendorSchema = globalResourceSchema.shape({
|
|
2131
2157
|
categories: categorySchema.min(1, "Category list must contain at least one item").required("Categories are required"),
|
|
2132
|
-
foodTruck:
|
|
2133
|
-
products:
|
|
2134
|
-
active:
|
|
2135
|
-
productsList:
|
|
2158
|
+
foodTruck: yup4.boolean().label("Food Truck").required("Please specify if the vendor is a food truck"),
|
|
2159
|
+
products: yup4.object().shape({
|
|
2160
|
+
active: yup4.boolean().nullable().optional(),
|
|
2161
|
+
productsList: yup4.array().of(vendorMenuSchema).nullable().optional()
|
|
2136
2162
|
}).nullable().optional(),
|
|
2137
|
-
vendorType:
|
|
2163
|
+
vendorType: yup4.mixed().oneOf(Object.values(EnumVendorType)).required("Please select a Vendor type")
|
|
2138
2164
|
});
|
|
2139
|
-
var unregisteredVendorSchema =
|
|
2140
|
-
categoryIds:
|
|
2141
|
-
dateTime:
|
|
2165
|
+
var unregisteredVendorSchema = yup4.object().shape({
|
|
2166
|
+
categoryIds: yup4.array().of(yup4.string().defined()).min(1, "Category list must contain at least one item").required("Categories are required"),
|
|
2167
|
+
dateTime: yup4.array().of(dateTimeSchema).min(1, "Select at least one event date").required("DateTime is required"),
|
|
2142
2168
|
email: emailRequiredSchema,
|
|
2143
|
-
inviterId:
|
|
2144
|
-
name:
|
|
2145
|
-
region:
|
|
2169
|
+
inviterId: yup4.string().required("Inviter ID is required"),
|
|
2170
|
+
name: yup4.string().label("Stallholder Name").trim().min(3, "Name must be at least 3 characters").required("Name is required"),
|
|
2171
|
+
region: yup4.string().label("Region").required("Region is required")
|
|
2146
2172
|
});
|
|
2147
|
-
var vendorInfoSchema =
|
|
2148
|
-
product:
|
|
2149
|
-
foodFlavors:
|
|
2150
|
-
|
|
2173
|
+
var vendorInfoSchema = yup4.object().shape({
|
|
2174
|
+
product: yup4.object().shape({
|
|
2175
|
+
foodFlavors: yup4.array().of(
|
|
2176
|
+
yup4.mixed().oneOf(Object.values(EnumFoodFlavor), "Invalid flavor selected").required("Flavor is required")
|
|
2151
2177
|
).min(1, "Food flavors list must contain at least one item").required("Food flavors are required"),
|
|
2152
|
-
packaging:
|
|
2153
|
-
priceRange:
|
|
2154
|
-
max:
|
|
2178
|
+
packaging: yup4.array().of(yup4.string().defined()).min(1, "Packaging list must contain at least one item").required("Packaging is required"),
|
|
2179
|
+
priceRange: yup4.object().shape({
|
|
2180
|
+
max: yup4.string().required("Max price is required").test(
|
|
2155
2181
|
"is-number",
|
|
2156
2182
|
"Max price must be a valid number",
|
|
2157
2183
|
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
@@ -2167,49 +2193,49 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
2167
2193
|
return maxNum >= minNum;
|
|
2168
2194
|
}
|
|
2169
2195
|
),
|
|
2170
|
-
min:
|
|
2196
|
+
min: yup4.string().required("Min price is required").test(
|
|
2171
2197
|
"is-number",
|
|
2172
2198
|
"Min price must be a valid number",
|
|
2173
2199
|
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
2174
2200
|
)
|
|
2175
2201
|
}),
|
|
2176
|
-
producedIn:
|
|
2202
|
+
producedIn: yup4.array().of(yup4.string().defined()).min(1, "Produced in list must contain at least one item").required("Produced in is required")
|
|
2177
2203
|
}),
|
|
2178
|
-
requirements:
|
|
2179
|
-
electricity:
|
|
2180
|
-
details:
|
|
2204
|
+
requirements: yup4.object().shape({
|
|
2205
|
+
electricity: yup4.object().shape({
|
|
2206
|
+
details: yup4.string().trim().test(
|
|
2181
2207
|
"details-required",
|
|
2182
2208
|
"Please add electricity details",
|
|
2183
2209
|
function(value) {
|
|
2184
2210
|
return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
|
|
2185
2211
|
}
|
|
2186
2212
|
).nullable(),
|
|
2187
|
-
isRequired:
|
|
2213
|
+
isRequired: yup4.boolean().required("Electricity requirement is required")
|
|
2188
2214
|
}),
|
|
2189
|
-
gazebo:
|
|
2190
|
-
details:
|
|
2215
|
+
gazebo: yup4.object().shape({
|
|
2216
|
+
details: yup4.string().trim().test(
|
|
2191
2217
|
"details-required",
|
|
2192
2218
|
"Please add gazebo details",
|
|
2193
2219
|
function(value) {
|
|
2194
2220
|
return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
|
|
2195
2221
|
}
|
|
2196
2222
|
).nullable(),
|
|
2197
|
-
isRequired:
|
|
2223
|
+
isRequired: yup4.boolean().required("Gazebo requirement is required")
|
|
2198
2224
|
}),
|
|
2199
|
-
table:
|
|
2200
|
-
details:
|
|
2225
|
+
table: yup4.object().shape({
|
|
2226
|
+
details: yup4.string().trim().test(
|
|
2201
2227
|
"details-required",
|
|
2202
2228
|
"Please add table details",
|
|
2203
2229
|
function(value) {
|
|
2204
2230
|
return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
|
|
2205
2231
|
}
|
|
2206
2232
|
).nullable(),
|
|
2207
|
-
isRequired:
|
|
2233
|
+
isRequired: yup4.boolean().required("Table requirement is required")
|
|
2208
2234
|
})
|
|
2209
2235
|
}).optional(),
|
|
2210
|
-
stallInfo:
|
|
2211
|
-
size:
|
|
2212
|
-
depth:
|
|
2236
|
+
stallInfo: yup4.object().shape({
|
|
2237
|
+
size: yup4.object().shape({
|
|
2238
|
+
depth: yup4.string().required("Depth is required").test(
|
|
2213
2239
|
"is-number",
|
|
2214
2240
|
"Depth must be a valid number",
|
|
2215
2241
|
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
@@ -2218,7 +2244,7 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
2218
2244
|
"Depth must be greater than 0",
|
|
2219
2245
|
(value) => value !== void 0 && value !== "" && Number(value) > 0
|
|
2220
2246
|
),
|
|
2221
|
-
width:
|
|
2247
|
+
width: yup4.string().required("Width is required").test(
|
|
2222
2248
|
"is-number",
|
|
2223
2249
|
"Width must be a valid number",
|
|
2224
2250
|
(value) => value !== void 0 && value !== "" && !Number.isNaN(Number(value))
|
|
@@ -2229,79 +2255,79 @@ var vendorInfoSchema = yup3.object().shape({
|
|
|
2229
2255
|
)
|
|
2230
2256
|
})
|
|
2231
2257
|
}),
|
|
2232
|
-
vendorId:
|
|
2258
|
+
vendorId: yup4.string().trim().required("Vendor ID is required")
|
|
2233
2259
|
});
|
|
2234
2260
|
|
|
2235
2261
|
// src/yupSchema/user.ts
|
|
2236
|
-
var
|
|
2237
|
-
var userSchema =
|
|
2238
|
-
active:
|
|
2262
|
+
var yup5 = __toESM(require("yup"));
|
|
2263
|
+
var userSchema = yup5.object().shape({
|
|
2264
|
+
active: yup5.boolean().required("Active is required"),
|
|
2239
2265
|
email: emailRequiredSchema,
|
|
2240
|
-
firstName:
|
|
2241
|
-
lastName:
|
|
2242
|
-
nickName:
|
|
2243
|
-
isTester:
|
|
2244
|
-
password:
|
|
2245
|
-
preferredRegion:
|
|
2246
|
-
confirmPassword:
|
|
2266
|
+
firstName: yup5.string().label("First Name").trim().required("First name is required"),
|
|
2267
|
+
lastName: yup5.string().label("Last Name").trim().required("Last name is required"),
|
|
2268
|
+
nickName: yup5.string().nullable().label("Nickname").trim().notRequired(),
|
|
2269
|
+
isTester: yup5.boolean().required("Tester status is required"),
|
|
2270
|
+
password: yup5.string().nullable().trim().label("Password").min(8, "Password must be at least 8 characters long").notRequired(),
|
|
2271
|
+
preferredRegion: yup5.string().label("Preferred Region").required("Preferred region is required"),
|
|
2272
|
+
confirmPassword: yup5.string().nullable().trim().label("Confirm Password").when("password", {
|
|
2247
2273
|
is: (val) => !!val,
|
|
2248
2274
|
// only necessary if password typed
|
|
2249
|
-
then: (schema) => schema.required("Confirm Password is required").oneOf([
|
|
2275
|
+
then: (schema) => schema.required("Confirm Password is required").oneOf([yup5.ref("password")], "Passwords must match"),
|
|
2250
2276
|
otherwise: (schema) => schema.notRequired()
|
|
2251
2277
|
})
|
|
2252
2278
|
});
|
|
2253
2279
|
|
|
2254
2280
|
// src/yupSchema/auth.ts
|
|
2255
|
-
var
|
|
2256
|
-
var loginSchema =
|
|
2281
|
+
var yup6 = __toESM(require("yup"));
|
|
2282
|
+
var loginSchema = yup6.object().shape({
|
|
2257
2283
|
email: emailRequiredSchema,
|
|
2258
2284
|
password: passwordSchema
|
|
2259
2285
|
});
|
|
2260
|
-
var registerSchema =
|
|
2286
|
+
var registerSchema = yup6.object().shape({
|
|
2261
2287
|
email: emailRequiredSchema,
|
|
2262
|
-
firstName:
|
|
2263
|
-
interests:
|
|
2264
|
-
|
|
2288
|
+
firstName: yup6.string().label("First Name").required("First Name is required"),
|
|
2289
|
+
interests: yup6.array().of(
|
|
2290
|
+
yup6.mixed().oneOf(
|
|
2265
2291
|
Object.values(EnumResourceType),
|
|
2266
2292
|
"Please select a valid interest"
|
|
2267
2293
|
).defined()
|
|
2268
2294
|
).label("Who will you be on ClueMart?").min(1, "Select at least one interest").required("Interests are required"),
|
|
2269
|
-
lastName:
|
|
2270
|
-
nickName:
|
|
2295
|
+
lastName: yup6.string().label("Last Name").required("Last Name is required"),
|
|
2296
|
+
nickName: yup6.string().nullable().label("Nickname").trim().notRequired(),
|
|
2271
2297
|
password: passwordSchema,
|
|
2272
|
-
preferredRegion:
|
|
2298
|
+
preferredRegion: yup6.string().label("Preferred Region").required("Preferred Region is required")
|
|
2273
2299
|
});
|
|
2274
|
-
var requestPasswordResetSchema =
|
|
2300
|
+
var requestPasswordResetSchema = yup6.object().shape({
|
|
2275
2301
|
email: emailRequiredSchema
|
|
2276
2302
|
});
|
|
2277
|
-
var resetPasswordSchema =
|
|
2303
|
+
var resetPasswordSchema = yup6.object().shape({
|
|
2278
2304
|
email: emailRequiredSchema,
|
|
2279
2305
|
password: passwordSchema,
|
|
2280
2306
|
// eslint-disable-next-line sort-keys
|
|
2281
|
-
confirmPassword:
|
|
2307
|
+
confirmPassword: yup6.string().oneOf([yup6.ref("password")], "Passwords must match").required("Confirm Password is required")
|
|
2282
2308
|
});
|
|
2283
|
-
var validateVerificationTokenSchema =
|
|
2309
|
+
var validateVerificationTokenSchema = yup6.object().shape({
|
|
2284
2310
|
email: emailRequiredSchema,
|
|
2285
|
-
verificationToken:
|
|
2311
|
+
verificationToken: yup6.string().required("Verification code is required").matches(/^\d{6}$/, "Verification code must be exactly 6 digits")
|
|
2286
2312
|
});
|
|
2287
2313
|
|
|
2288
2314
|
// src/yupSchema/ad.ts
|
|
2289
|
-
var
|
|
2290
|
-
var adResourceSchema =
|
|
2291
|
-
adDescription:
|
|
2292
|
-
adImage:
|
|
2293
|
-
adStyle:
|
|
2294
|
-
adTitle:
|
|
2295
|
-
adType:
|
|
2296
|
-
resourceId:
|
|
2297
|
-
resourceName:
|
|
2298
|
-
resourceRegion:
|
|
2299
|
-
resourceType:
|
|
2300
|
-
resourceSlug:
|
|
2315
|
+
var yup7 = __toESM(require("yup"));
|
|
2316
|
+
var adResourceSchema = yup7.object({
|
|
2317
|
+
adDescription: yup7.string().trim().required("Ad description is required").max(150, "Ad description must be at most 150 characters"),
|
|
2318
|
+
adImage: yup7.string().required("Ad image is required"),
|
|
2319
|
+
adStyle: yup7.mixed().oneOf(Object.values(EnumAdStyle), "Please select a valid ad style").required("Ad style is required"),
|
|
2320
|
+
adTitle: yup7.string().trim().required("Ad title is required").max(30, "Ad title must be at most 30 characters"),
|
|
2321
|
+
adType: yup7.mixed().oneOf(Object.values(EnumAdType), "Please select a valid ad type").required("Ad type is required"),
|
|
2322
|
+
resourceId: yup7.string().required("Resource ID is required"),
|
|
2323
|
+
resourceName: yup7.string().required("Resource name is required"),
|
|
2324
|
+
resourceRegion: yup7.string().required("Resource region is required"),
|
|
2325
|
+
resourceType: yup7.mixed().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource type is required"),
|
|
2326
|
+
resourceSlug: yup7.string().required("Resource slug is required")
|
|
2301
2327
|
});
|
|
2302
|
-
var adSchema =
|
|
2303
|
-
active:
|
|
2304
|
-
end:
|
|
2328
|
+
var adSchema = yup7.object().shape({
|
|
2329
|
+
active: yup7.boolean().required("Active status is required"),
|
|
2330
|
+
end: yup7.date().required("End date is required").test("is-future-date", "End date must be in the future", (value) => {
|
|
2305
2331
|
if (!value) return false;
|
|
2306
2332
|
const endDate = new Date(value);
|
|
2307
2333
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2319,30 +2345,30 @@ var adSchema = yup6.object().shape({
|
|
|
2319
2345
|
)
|
|
2320
2346
|
}),
|
|
2321
2347
|
resource: adResourceSchema.required("Resource information is required"),
|
|
2322
|
-
showOn:
|
|
2323
|
-
status:
|
|
2324
|
-
start:
|
|
2348
|
+
showOn: yup7.array().of(yup7.mixed().oneOf(Object.values(EnumAdShowOn)).required()).min(1, "At least one display location is required").required("Display location is required"),
|
|
2349
|
+
status: yup7.mixed().oneOf(Object.values(EnumAdStatus)).required("Ad status is required"),
|
|
2350
|
+
start: yup7.date().when("status", {
|
|
2325
2351
|
is: (status) => status !== "Active" /* ACTIVE */,
|
|
2326
|
-
then: () =>
|
|
2352
|
+
then: () => yup7.date().required("Start date is required").test("is-future-date", "Start date must be in the future", (value) => {
|
|
2327
2353
|
if (!value) return false;
|
|
2328
2354
|
return value > /* @__PURE__ */ new Date();
|
|
2329
2355
|
}),
|
|
2330
2356
|
// Keep `start` optional (not null) when ACTIVE to match TS type `start?: Date`.
|
|
2331
|
-
otherwise: () =>
|
|
2357
|
+
otherwise: () => yup7.date().notRequired()
|
|
2332
2358
|
}),
|
|
2333
|
-
targetRegion:
|
|
2359
|
+
targetRegion: yup7.array().of(yup7.string().required()).min(1, "At least one target region is required").required("Target region is required")
|
|
2334
2360
|
});
|
|
2335
2361
|
|
|
2336
2362
|
// src/yupSchema/partner.ts
|
|
2337
|
-
var
|
|
2363
|
+
var yup8 = __toESM(require("yup"));
|
|
2338
2364
|
var partnerSchema = globalResourceSchema.shape({
|
|
2339
2365
|
location: locationSchema,
|
|
2340
|
-
nzbn:
|
|
2341
|
-
partnerType:
|
|
2366
|
+
nzbn: yup8.string().required("NZBN is required").matches(nzbnRegex, "NZBN must be 13 digits and start with 94"),
|
|
2367
|
+
partnerType: yup8.mixed().oneOf(Object.values(EnumPartnerType), "Please select a valid Partner type").required("Please select a Partner type")
|
|
2342
2368
|
});
|
|
2343
2369
|
|
|
2344
2370
|
// src/yupSchema/post.ts
|
|
2345
|
-
var
|
|
2371
|
+
var yup9 = __toESM(require("yup"));
|
|
2346
2372
|
|
|
2347
2373
|
// src/formFields/vendor/vendorInfo.ts
|
|
2348
2374
|
var packagingTypes = [
|
|
@@ -2852,7 +2878,7 @@ var USER_FIELDS_FRAGMENT = import_client.gql`
|
|
|
2852
2878
|
...LocationFields
|
|
2853
2879
|
}
|
|
2854
2880
|
partner
|
|
2855
|
-
|
|
2881
|
+
totalOverallPoints
|
|
2856
2882
|
platform
|
|
2857
2883
|
preferredRegion
|
|
2858
2884
|
permissions
|
|
@@ -2882,6 +2908,15 @@ var USER_FIELDS_FRAGMENT = import_client.gql`
|
|
|
2882
2908
|
${REDEEMED_REWARD_FIELDS_FRAGMENT}
|
|
2883
2909
|
${STRIPE_FIELDS_FRAGMENT}
|
|
2884
2910
|
`;
|
|
2911
|
+
var USER_OVERALL_POINTS_FIELDS_FRAGMENT = import_client.gql`
|
|
2912
|
+
fragment UserOverallPointsFields on UserType {
|
|
2913
|
+
overallPoints {
|
|
2914
|
+
createdAt
|
|
2915
|
+
pointType
|
|
2916
|
+
points
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
`;
|
|
2885
2920
|
var STALL_TYPE_FIELDS_FRAGMENT = import_client.gql`
|
|
2886
2921
|
fragment StallTypeFields on StallTypeType {
|
|
2887
2922
|
label
|
|
@@ -6488,69 +6523,69 @@ var ADMIN_DASHBOARD_CONTEXTS = [
|
|
|
6488
6523
|
];
|
|
6489
6524
|
|
|
6490
6525
|
// src/yupSchema/post.ts
|
|
6491
|
-
var postContentSchema =
|
|
6492
|
-
contentData:
|
|
6493
|
-
contentOrder:
|
|
6494
|
-
contentType:
|
|
6526
|
+
var postContentSchema = yup9.object().shape({
|
|
6527
|
+
contentData: yup9.mixed().optional().nullable(),
|
|
6528
|
+
contentOrder: yup9.number().nullable(),
|
|
6529
|
+
contentType: yup9.mixed().oneOf(Object.values(EnumPostContentType)).nullable()
|
|
6495
6530
|
});
|
|
6496
|
-
var postSchema =
|
|
6497
|
-
active:
|
|
6498
|
-
caption:
|
|
6499
|
-
content:
|
|
6500
|
-
postType:
|
|
6501
|
-
resource:
|
|
6502
|
-
resourceId:
|
|
6503
|
-
resourceRegion:
|
|
6504
|
-
resourceSlug:
|
|
6505
|
-
resourceType:
|
|
6531
|
+
var postSchema = yup9.object().shape({
|
|
6532
|
+
active: yup9.boolean().required(),
|
|
6533
|
+
caption: yup9.string().required(),
|
|
6534
|
+
content: yup9.array().of(postContentSchema).required(),
|
|
6535
|
+
postType: yup9.mixed().oneOf(Object.values(EnumPostType)).required(),
|
|
6536
|
+
resource: yup9.object({
|
|
6537
|
+
resourceId: yup9.string().required(),
|
|
6538
|
+
resourceRegion: yup9.string().required(),
|
|
6539
|
+
resourceSlug: yup9.string().required(),
|
|
6540
|
+
resourceType: yup9.mixed().oneOf(Object.values(EnumResourceType)).required()
|
|
6506
6541
|
}).nullable().optional(),
|
|
6507
|
-
tags:
|
|
6508
|
-
title:
|
|
6542
|
+
tags: yup9.array().of(yup9.string().required()).nullable().optional(),
|
|
6543
|
+
title: yup9.string().required()
|
|
6509
6544
|
});
|
|
6510
6545
|
|
|
6511
6546
|
// src/yupSchema/appSettings.ts
|
|
6512
|
-
var
|
|
6513
|
-
var appSettingsSchema =
|
|
6514
|
-
adSettings:
|
|
6515
|
-
mobileDisplayEnabled:
|
|
6516
|
-
webDisplayEnabled:
|
|
6547
|
+
var yup10 = __toESM(require("yup"));
|
|
6548
|
+
var appSettingsSchema = yup10.object({
|
|
6549
|
+
adSettings: yup10.object({
|
|
6550
|
+
mobileDisplayEnabled: yup10.boolean().label("Mobile Ad Display").required("Mobile Ad Display is required"),
|
|
6551
|
+
webDisplayEnabled: yup10.boolean().label("Web Ad Display").required("Web Ad Display is required")
|
|
6517
6552
|
}).label("Ad Settings").required("Ad Settings is required"),
|
|
6518
|
-
appVersion:
|
|
6553
|
+
appVersion: yup10.string().trim().label("App Version").matches(
|
|
6519
6554
|
/^\d+\.\d+\.\d+$/,
|
|
6520
6555
|
"App Version must be in the format X.Y.Z (e.g. 1.12.50)"
|
|
6521
6556
|
).required("App Version is required"),
|
|
6522
|
-
isOfflineMode:
|
|
6523
|
-
minimumRedeemableAffiliatePoints:
|
|
6557
|
+
isOfflineMode: yup10.boolean().label("Is Offline Mode").required("Is Offline Mode is required"),
|
|
6558
|
+
minimumRedeemableAffiliatePoints: yup10.number().label("Minimum Redeemable Affiliate Points").min(0, "Minimum Redeemable Affiliate Points must be greater than 0").required("Minimum Redeemable Affiliate Points is required")
|
|
6524
6559
|
});
|
|
6525
6560
|
|
|
6526
6561
|
// src/yupSchema/coupon.ts
|
|
6527
|
-
var
|
|
6528
|
-
var couponPurchaseOptionSchema =
|
|
6529
|
-
buy:
|
|
6530
|
-
get:
|
|
6562
|
+
var yup11 = __toESM(require("yup"));
|
|
6563
|
+
var couponPurchaseOptionSchema = yup11.object().shape({
|
|
6564
|
+
buy: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("How many do they need to buy?").typeError("Buy must be a number").integer("Buy must be a whole number").min(1, "Buy must be at least 1").max(15, "Buy must be at most 15").required("Buy is required"),
|
|
6565
|
+
get: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("How many do they get?").typeError("Get must be a number").integer("Get must be a whole number").min(1, "Get must be at least 1").required("Get is required").test("get-less-than-buy", "Get must be less than Buy", function(value) {
|
|
6531
6566
|
const { buy } = this.parent;
|
|
6532
6567
|
if (value === void 0 || buy === void 0) return true;
|
|
6533
6568
|
return value < buy;
|
|
6534
6569
|
}),
|
|
6535
|
-
maxRewardCount:
|
|
6536
|
-
type:
|
|
6537
|
-
unit:
|
|
6570
|
+
maxRewardCount: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Max coupon count").typeError("Max coupon count must be a number").integer("Max coupon count must be a whole number").min(20, "Max coupon count must be at least 20").max(200, "Max coupon count cannot exceed 200").required("Max coupon count is required"),
|
|
6571
|
+
type: yup11.mixed().oneOf(["PURCHASE" /* PURCHASE */], "Type must be PURCHASE").required("Type is required"),
|
|
6572
|
+
unit: yup11.string().label("Unit").trim().required("Unit is required")
|
|
6538
6573
|
}).nullable().defined("Coupon option is required");
|
|
6539
|
-
var couponMarketVisitOptionSchema =
|
|
6540
|
-
type:
|
|
6574
|
+
var couponMarketVisitOptionSchema = yup11.object().shape({
|
|
6575
|
+
type: yup11.mixed().oneOf(
|
|
6541
6576
|
["MARKET_VISIT" /* MARKET_VISIT */],
|
|
6542
6577
|
"Type must be MARKET_VISIT"
|
|
6543
6578
|
).required("Type is required"),
|
|
6544
|
-
visits:
|
|
6579
|
+
visits: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Visits").typeError("Visits must be a number").integer("Visits must be a whole number").min(1, "Visits must be at least 1").required("Visits is required")
|
|
6545
6580
|
}).nullable().defined("Coupon option is required");
|
|
6546
|
-
var couponMarketPassportOptionSchema =
|
|
6547
|
-
type:
|
|
6581
|
+
var couponMarketPassportOptionSchema = yup11.object().shape({
|
|
6582
|
+
type: yup11.mixed().oneOf(
|
|
6548
6583
|
["MARKET_PASSPORT" /* MARKET_PASSPORT */],
|
|
6549
6584
|
"Type must be MARKET_PASSPORT"
|
|
6550
6585
|
).required("Type is required"),
|
|
6551
|
-
visits:
|
|
6586
|
+
visits: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Visits").typeError("Visits must be a number").integer("Visits must be a whole number").min(1, "Visits must be at least 1").required("Visits is required")
|
|
6552
6587
|
}).nullable().defined("Coupon option is required");
|
|
6553
|
-
var couponOptionSchema =
|
|
6588
|
+
var couponOptionSchema = yup11.lazy((value) => {
|
|
6554
6589
|
const type = value?.type;
|
|
6555
6590
|
if (type === "MARKET_VISIT" /* MARKET_VISIT */) {
|
|
6556
6591
|
return couponMarketVisitOptionSchema;
|
|
@@ -6560,16 +6595,16 @@ var couponOptionSchema = yup10.lazy((value) => {
|
|
|
6560
6595
|
}
|
|
6561
6596
|
return couponPurchaseOptionSchema;
|
|
6562
6597
|
});
|
|
6563
|
-
var couponVendorProductSchema =
|
|
6564
|
-
couponId:
|
|
6565
|
-
productId:
|
|
6566
|
-
vendorCouponId:
|
|
6567
|
-
vendorId:
|
|
6598
|
+
var couponVendorProductSchema = yup11.object().shape({
|
|
6599
|
+
couponId: yup11.string().label("Coupon").trim().required("Coupon is required"),
|
|
6600
|
+
productId: yup11.string().label("Product").trim().required("Product is required"),
|
|
6601
|
+
vendorCouponId: yup11.string().label("Vendor Coupon").trim().nullable().optional(),
|
|
6602
|
+
vendorId: yup11.string().label("Vendor").trim().required("Vendor is required")
|
|
6568
6603
|
});
|
|
6569
6604
|
var createCouponSchema = ({
|
|
6570
6605
|
enforceFutureStartDate
|
|
6571
6606
|
}) => {
|
|
6572
|
-
let startDateSchema =
|
|
6607
|
+
let startDateSchema = yup11.date().label("Start Date").typeError("Start date is required").required("Start date is required");
|
|
6573
6608
|
if (enforceFutureStartDate) {
|
|
6574
6609
|
startDateSchema = startDateSchema.test(
|
|
6575
6610
|
"is-future-date",
|
|
@@ -6580,11 +6615,11 @@ var createCouponSchema = ({
|
|
|
6580
6615
|
}
|
|
6581
6616
|
);
|
|
6582
6617
|
}
|
|
6583
|
-
return
|
|
6584
|
-
couponDescription:
|
|
6618
|
+
return yup11.object().shape({
|
|
6619
|
+
couponDescription: yup11.string().label("Description").trim().required("Description is required"),
|
|
6585
6620
|
couponOption: couponOptionSchema,
|
|
6586
|
-
couponVendorProducts:
|
|
6587
|
-
endDate:
|
|
6621
|
+
couponVendorProducts: yup11.array().of(couponVendorProductSchema).optional(),
|
|
6622
|
+
endDate: yup11.date().label("End Date").typeError("End date is required").required("End date is required").test("is-future-date", "End date must be in the future", (value) => {
|
|
6588
6623
|
if (!value) return false;
|
|
6589
6624
|
return new Date(value) > /* @__PURE__ */ new Date();
|
|
6590
6625
|
}).when("startDate", {
|
|
@@ -6599,8 +6634,8 @@ var createCouponSchema = ({
|
|
|
6599
6634
|
}
|
|
6600
6635
|
)
|
|
6601
6636
|
}),
|
|
6602
|
-
resourceId:
|
|
6603
|
-
resourceType:
|
|
6637
|
+
resourceId: yup11.string().label("Resource ID").trim().required("Resource ID is required"),
|
|
6638
|
+
resourceType: yup11.mixed().oneOf(
|
|
6604
6639
|
Object.values(EnumResourceType),
|
|
6605
6640
|
"Resource type must be a valid EnumResourceType"
|
|
6606
6641
|
).required("Resource type is required"),
|
|
@@ -7451,12 +7486,12 @@ var import_react2 = __toESM(require("react"));
|
|
|
7451
7486
|
var import_react_hook_form12 = require("react-hook-form");
|
|
7452
7487
|
|
|
7453
7488
|
// src/yupSchema/contactUs.ts
|
|
7454
|
-
var
|
|
7455
|
-
var contactUsSchema =
|
|
7489
|
+
var yup12 = __toESM(require("yup"));
|
|
7490
|
+
var contactUsSchema = yup12.object().shape({
|
|
7456
7491
|
email: emailRequiredSchema,
|
|
7457
|
-
firstName:
|
|
7458
|
-
lastName:
|
|
7459
|
-
message:
|
|
7492
|
+
firstName: yup12.string().label("First Name").required("First name is required"),
|
|
7493
|
+
lastName: yup12.string().label("Last Name").required("Last name is required"),
|
|
7494
|
+
message: yup12.string().label("Message").required("Message is required")
|
|
7460
7495
|
});
|
|
7461
7496
|
|
|
7462
7497
|
// src/hooks/useContactUsForm.ts
|
|
@@ -7812,15 +7847,15 @@ var import_react6 = require("react");
|
|
|
7812
7847
|
var import_react_hook_form17 = require("react-hook-form");
|
|
7813
7848
|
|
|
7814
7849
|
// src/yupSchema/school.ts
|
|
7815
|
-
var
|
|
7816
|
-
var schoolSchema =
|
|
7817
|
-
active:
|
|
7850
|
+
var yup13 = __toESM(require("yup"));
|
|
7851
|
+
var schoolSchema = yup13.object().shape({
|
|
7852
|
+
active: yup13.boolean().required("Active is required"),
|
|
7818
7853
|
contactDetails: contactDetailsSchema,
|
|
7819
7854
|
location: locationSchema,
|
|
7820
|
-
name:
|
|
7821
|
-
region:
|
|
7822
|
-
socialMedia:
|
|
7823
|
-
studentCount:
|
|
7855
|
+
name: yup13.string().trim().required("Name is required"),
|
|
7856
|
+
region: yup13.string().trim().required("Region is required"),
|
|
7857
|
+
socialMedia: yup13.array().of(socialMediaSchema).nullable().default(null),
|
|
7858
|
+
studentCount: yup13.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Student Count").nullable().typeError("Student count must be a number").min(
|
|
7824
7859
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
7825
7860
|
`Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
|
|
7826
7861
|
).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
|
|
@@ -7915,29 +7950,29 @@ var import_react7 = require("react");
|
|
|
7915
7950
|
var import_react_hook_form18 = require("react-hook-form");
|
|
7916
7951
|
|
|
7917
7952
|
// src/yupSchema/affiliate.ts
|
|
7918
|
-
var
|
|
7919
|
-
var affiliateContactDetailsSchema =
|
|
7920
|
-
mobilePhone:
|
|
7953
|
+
var yup14 = __toESM(require("yup"));
|
|
7954
|
+
var affiliateContactDetailsSchema = yup14.object({
|
|
7955
|
+
mobilePhone: yup14.string().trim().required("Mobile phone is required").test(
|
|
7921
7956
|
"mobile-phone",
|
|
7922
7957
|
"Mobile must start with 02 and be 9\u201311 digits",
|
|
7923
7958
|
(value) => mobileRegex.test(value)
|
|
7924
7959
|
)
|
|
7925
7960
|
});
|
|
7926
|
-
var bankAccountDetailsSchema =
|
|
7927
|
-
accountHolderName:
|
|
7928
|
-
accountNumber:
|
|
7961
|
+
var bankAccountDetailsSchema = yup14.object({
|
|
7962
|
+
accountHolderName: yup14.string().required("Account holder name is required"),
|
|
7963
|
+
accountNumber: yup14.string().required("Account number is required for bank transfer").matches(
|
|
7929
7964
|
nzBankAccountRegex,
|
|
7930
7965
|
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
7931
7966
|
).trim()
|
|
7932
7967
|
});
|
|
7933
|
-
var affiliateSchema =
|
|
7968
|
+
var affiliateSchema = yup14.object().shape({
|
|
7934
7969
|
bankAccountDetails: bankAccountDetailsSchema.required(
|
|
7935
7970
|
"Bank account details are required"
|
|
7936
7971
|
),
|
|
7937
7972
|
contactDetails: affiliateContactDetailsSchema.required(
|
|
7938
7973
|
"Contact details are required"
|
|
7939
7974
|
),
|
|
7940
|
-
irdNumber:
|
|
7975
|
+
irdNumber: yup14.string().trim().required("IRD number is required").matches(
|
|
7941
7976
|
nzIrdNumberRegex,
|
|
7942
7977
|
"IRD number must be in format: XXX-XXX-XX or XXX-XXX-XXX"
|
|
7943
7978
|
).test(
|
|
@@ -7946,11 +7981,11 @@ var affiliateSchema = yup13.object().shape({
|
|
|
7946
7981
|
(value) => !!value && isValidIrdNumber(value)
|
|
7947
7982
|
),
|
|
7948
7983
|
location: locationSchema.required("Location is required"),
|
|
7949
|
-
participantType:
|
|
7984
|
+
participantType: yup14.mixed().oneOf(
|
|
7950
7985
|
Object.values(EnumAffiliateParticipantType),
|
|
7951
7986
|
"Please select a valid participant type"
|
|
7952
7987
|
).required("Participant type is required"),
|
|
7953
|
-
socialMedia:
|
|
7988
|
+
socialMedia: yup14.array().of(socialMediaSchema).nullable().default(null)
|
|
7954
7989
|
});
|
|
7955
7990
|
|
|
7956
7991
|
// src/hooks/useAffiliateForm.ts
|