@timardex/cluemart-shared 1.5.627 → 1.5.629
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/{chunk-N26FUCHY.mjs → chunk-JGYYSRJT.mjs} +3 -2
- package/dist/chunk-JGYYSRJT.mjs.map +1 -0
- package/dist/hooks/index.cjs +21 -6
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +20 -6
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/images/index.cjs +2 -1
- package/dist/images/index.cjs.map +1 -1
- package/dist/images/index.d.mts +1 -1
- package/dist/images/index.d.ts +1 -1
- package/dist/images/index.mjs +1 -1
- package/dist/images/poster1.webp +0 -0
- package/dist/images/poster2.webp +0 -0
- package/dist/images/poster3.webp +0 -0
- package/dist/images/poster4.webp +0 -0
- package/dist/images/poster4.webp.d.ts +2 -0
- package/dist/index.cjs +21 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +21 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-N26FUCHY.mjs.map +0 -1
|
@@ -9,7 +9,8 @@ var posterIds = [
|
|
|
9
9
|
"mini-market5",
|
|
10
10
|
"poster1",
|
|
11
11
|
"poster2",
|
|
12
|
-
"poster3"
|
|
12
|
+
"poster3",
|
|
13
|
+
"poster4"
|
|
13
14
|
];
|
|
14
15
|
var posterFiles = Object.fromEntries(
|
|
15
16
|
posterIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
|
|
@@ -103,4 +104,4 @@ export {
|
|
|
103
104
|
logos,
|
|
104
105
|
otherImages
|
|
105
106
|
};
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-JGYYSRJT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/images/index.ts"],"sourcesContent":["const PKG = \"@timardex/cluemart-shared\" as const;\nexport const IMAGE_EXTENSION = \".webp\" as const;\n\n/**\n * Basenames under the shared images directory — use with `getSharedImagePath` from `@timardex/cluemart-shared/images/node` (Express / Node).\n * This object is the single source of poster keys; `posters` is derived from it. Add an image with `IMAGE_EXTENSION` under `src/images/posters/` when adding an entry.\n * `images/node` reads this at runtime for `getSharedImagePath` allow-listing.\n */\nexport const posterIds = [\n \"mini-market1\",\n \"mini-market2\",\n \"mini-market3\",\n \"mini-market4\",\n \"mini-market5\",\n \"poster1\",\n \"poster2\",\n \"poster3\",\n \"poster4\",\n] as const;\n\nexport const posterFiles = Object.fromEntries(\n posterIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`]),\n) as {\n readonly [K in (typeof posterIds)[number]]: `${K}${typeof IMAGE_EXTENSION}`;\n};\n\n/**\n * Basenames for assets under `src/images/clui/` in source; they are copied flat into `dist/images/` (same as posters).\n * `images/node` reads this at runtime for `getSharedImagePath` allow-listing.\n */\nexport const cluiIds = [\n \"cluiTui\",\n \"sima\",\n \"tablas\",\n \"telefonos\",\n \"ugralos\",\n] as const;\n\nexport const cluiFiles = Object.fromEntries(\n cluiIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`]),\n) as {\n readonly [K in (typeof cluiIds)[number]]: `${K}${typeof IMAGE_EXTENSION}`;\n};\n\nexport const iconIds = [\n \"apple-maps-icon\",\n \"facebook\",\n \"google-maps-icon\",\n \"instagram\",\n \"meet\",\n \"poll\",\n \"tiktok\",\n \"tip\",\n \"waze-maps-icon\",\n \"website\",\n \"youtube\",\n] as const;\n\nexport const iconFiles = Object.fromEntries(\n iconIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`]),\n) as {\n readonly [K in (typeof iconIds)[number]]: `${K}${typeof IMAGE_EXTENSION}`;\n};\n\nexport const badgeIds = [\"corporate\", \"private\", \"school\"] as const;\n\nexport const badgeFiles = Object.fromEntries(\n badgeIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`]),\n) as {\n readonly [K in (typeof badgeIds)[number]]: `${K}${typeof IMAGE_EXTENSION}`;\n};\n\nexport const logoIds = [\n \"googleMaps-logo-dark\",\n \"googleMaps-logo-light\",\n \"logo\",\n \"logo-atr\",\n] as const;\n\nexport const logoFiles = Object.fromEntries(\n logoIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`]),\n) as {\n readonly [K in (typeof logoIds)[number]]: `${K}${typeof IMAGE_EXTENSION}`;\n};\n\nexport const otherImagesIds = [\n \"banner-horizontal\",\n \"banner-vertical\",\n \"qr-code\",\n \"store-android\",\n \"store-ios\",\n] as const;\n\nexport const otherImagesFiles = Object.fromEntries(\n otherImagesIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`]),\n) as {\n readonly [K in (typeof otherImagesIds)[number]]: `${K}${typeof IMAGE_EXTENSION}`;\n};\n\n/**\n * Module specifiers for each poster (not resolved file URLs). Use a static import or require with these paths\n * so your bundler resolves the file, e.g.\n * `import poster1 from \"@timardex/cluemart-shared/images/poster1.webp\"`\n * or `require(\"@timardex/cluemart-shared/images/poster1.webp\")` (React Native / Metro).\n *\n * Derived from `posterFiles` so keys and filenames stay aligned.\n */\nexport const posters = Object.fromEntries(\n (\n Object.entries(posterFiles) as [\n keyof typeof posterFiles,\n (typeof posterFiles)[keyof typeof posterFiles],\n ][]\n ).map(([key, file]) => [key, `${PKG}/images/${file}`]),\n) as {\n readonly [K in keyof typeof posterFiles]: `${typeof PKG}/images/${(typeof posterFiles)[K]}`;\n};\n\n/**\n * Module specifiers for Clui assets (same flat `@…/images/<file>.webp` pattern as posters), e.g.\n * `import clui from \"@timardex/cluemart-shared/images/cluiTui.webp\"`.\n */\nexport const cluiImages = Object.fromEntries(\n (\n Object.entries(cluiFiles) as [\n keyof typeof cluiFiles,\n (typeof cluiFiles)[keyof typeof cluiFiles],\n ][]\n ).map(([key, file]) => [key, `${PKG}/images/${file}`]),\n) as {\n readonly [K in keyof typeof cluiFiles]: `${typeof PKG}/images/${(typeof cluiFiles)[K]}`;\n};\n\nexport const icons = Object.fromEntries(\n (\n Object.entries(iconFiles) as [\n keyof typeof iconFiles,\n (typeof iconFiles)[keyof typeof iconFiles],\n ][]\n ).map(([key, file]) => [key, `${PKG}/images/${file}`]),\n) as {\n readonly [K in keyof typeof iconFiles]: `${typeof PKG}/images/${(typeof iconFiles)[K]}`;\n};\n\nexport const badges = Object.fromEntries(\n (\n Object.entries(badgeFiles) as [\n keyof typeof badgeFiles,\n (typeof badgeFiles)[keyof typeof badgeFiles],\n ][]\n ).map(([key, file]) => [key, `${PKG}/images/${file}`]),\n) as {\n readonly [K in keyof typeof badgeFiles]: `${typeof PKG}/images/${(typeof badgeFiles)[K]}`;\n};\n\nexport const logos = Object.fromEntries(\n (\n Object.entries(logoFiles) as [\n keyof typeof logoFiles,\n (typeof logoFiles)[keyof typeof logoFiles],\n ][]\n ).map(([key, file]) => [key, `${PKG}/images/${file}`]),\n) as {\n readonly [K in keyof typeof logoFiles]: `${typeof PKG}/images/${(typeof logoFiles)[K]}`;\n};\n\nexport const otherImages = Object.fromEntries(\n (\n Object.entries(otherImagesFiles) as [\n keyof typeof otherImagesFiles,\n (typeof otherImagesFiles)[keyof typeof otherImagesFiles],\n ][]\n ).map(([key, file]) => [key, `${PKG}/images/${file}`]),\n) as {\n readonly [K in keyof typeof otherImagesFiles]: `${typeof PKG}/images/${(typeof otherImagesFiles)[K]}`;\n};\n\nexport type PosterAssetId = keyof typeof posters;\n\n/** A single filename under the shared images directory (values of `posterFiles`). */\nexport type PosterImageBasename = (typeof posterFiles)[PosterAssetId];\n\nexport type CluiImageId = keyof typeof cluiImages;\n\n/** Basename under the shared images directory (values of `cluiFiles`). */\nexport type CluiImageBasename = (typeof cluiFiles)[CluiImageId];\n\nexport type IconId = keyof typeof icons;\nexport type IconBasename = (typeof iconFiles)[IconId];\n\nexport type BadgeId = keyof typeof badges;\nexport type BadgeBasename = (typeof badgeFiles)[BadgeId];\n\nexport type LogoId = keyof typeof logos;\nexport type LogoBasename = (typeof logoFiles)[LogoId];\n\nexport type OtherImagesId = keyof typeof otherImages;\nexport type OtherImagesBasename = (typeof otherImagesFiles)[OtherImagesId];\n"],"mappings":";AAAA,IAAM,MAAM;AACL,IAAM,kBAAkB;AAOxB,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,cAAc,OAAO;AAAA,EAChC,UAAU,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;AACvD;AAQO,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,YAAY,OAAO;AAAA,EAC9B,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;AACrD;AAIO,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,YAAY,OAAO;AAAA,EAC9B,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;AACrD;AAIO,IAAM,WAAW,CAAC,aAAa,WAAW,QAAQ;AAElD,IAAM,aAAa,OAAO;AAAA,EAC/B,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;AACtD;AAIO,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,YAAY,OAAO;AAAA,EAC9B,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;AACrD;AAIO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,mBAAmB,OAAO;AAAA,EACrC,eAAe,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;AAC5D;AAYO,IAAM,UAAU,OAAO;AAAA,EAE1B,OAAO,QAAQ,WAAW,EAI1B,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvD;AAQO,IAAM,aAAa,OAAO;AAAA,EAE7B,OAAO,QAAQ,SAAS,EAIxB,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvD;AAIO,IAAM,QAAQ,OAAO;AAAA,EAExB,OAAO,QAAQ,SAAS,EAIxB,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvD;AAIO,IAAM,SAAS,OAAO;AAAA,EAEzB,OAAO,QAAQ,UAAU,EAIzB,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvD;AAIO,IAAM,QAAQ,OAAO;AAAA,EAExB,OAAO,QAAQ,SAAS,EAIxB,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvD;AAIO,IAAM,cAAc,OAAO;AAAA,EAE9B,OAAO,QAAQ,gBAAgB,EAI/B,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvD;","names":[]}
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -468,6 +468,20 @@ var noLeadingZeros = (fieldName, options = {}) => {
|
|
|
468
468
|
return true;
|
|
469
469
|
};
|
|
470
470
|
};
|
|
471
|
+
var toOptionalNumber = (originalValue) => {
|
|
472
|
+
if (originalValue === "" || originalValue === null || originalValue === void 0) {
|
|
473
|
+
return void 0;
|
|
474
|
+
}
|
|
475
|
+
let parsed;
|
|
476
|
+
if (typeof originalValue === "number") {
|
|
477
|
+
parsed = originalValue;
|
|
478
|
+
} else if (typeof originalValue === "string") {
|
|
479
|
+
parsed = Number(originalValue.replace(",", "."));
|
|
480
|
+
} else {
|
|
481
|
+
parsed = void 0;
|
|
482
|
+
}
|
|
483
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
484
|
+
};
|
|
471
485
|
import_dayjs2.default.extend(import_isSameOrAfter2.default);
|
|
472
486
|
import_dayjs2.default.extend(import_customParseFormat2.default);
|
|
473
487
|
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
@@ -562,12 +576,12 @@ var dateTimeSchema = yup.object().shape({
|
|
|
562
576
|
});
|
|
563
577
|
var stallTypesSchema = yup.object({
|
|
564
578
|
label: yup.string().trim().label("Stall Type").required("Stall type is required"),
|
|
565
|
-
price: yup.number().label("Stall Price").min(0.1, "Stall price must be at least 0.1").required("Stall price is required").test(
|
|
579
|
+
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(
|
|
566
580
|
"no-leading-zeros",
|
|
567
581
|
"",
|
|
568
582
|
noLeadingZeros("Stall price", { allowDecimal: true })
|
|
569
583
|
),
|
|
570
|
-
stallCapacity: yup.number().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"))
|
|
584
|
+
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"))
|
|
571
585
|
});
|
|
572
586
|
var dateTimeWithPriceSchema = dateTimeSchema.shape({
|
|
573
587
|
stallTypes: yup.array().of(stallTypesSchema).min(1, "At least one stall type is required").required("Stall types are required")
|
|
@@ -694,8 +708,8 @@ var eventInfoSchema = yup2.object().shape({
|
|
|
694
708
|
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")),
|
|
695
709
|
dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
696
710
|
eventId: yup2.string().trim().required("Event ID is required"),
|
|
697
|
-
packInTime: yup2.number().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")),
|
|
698
|
-
paymentDueHours: yup2.number().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(
|
|
711
|
+
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")),
|
|
712
|
+
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(
|
|
699
713
|
"payment-before-deadline",
|
|
700
714
|
"Payment due hours must be less than application deadline hours",
|
|
701
715
|
function(value) {
|
|
@@ -4687,7 +4701,8 @@ var posterIds = [
|
|
|
4687
4701
|
"mini-market5",
|
|
4688
4702
|
"poster1",
|
|
4689
4703
|
"poster2",
|
|
4690
|
-
"poster3"
|
|
4704
|
+
"poster3",
|
|
4705
|
+
"poster4"
|
|
4691
4706
|
];
|
|
4692
4707
|
var posterFiles = Object.fromEntries(
|
|
4693
4708
|
posterIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
|
|
@@ -6026,7 +6041,7 @@ var schoolSchema = yup11.object().shape({
|
|
|
6026
6041
|
name: yup11.string().trim().required("Name is required"),
|
|
6027
6042
|
region: yup11.string().trim().required("Region is required"),
|
|
6028
6043
|
socialMedia: yup11.array().of(socialMediaSchema).nullable().default(null),
|
|
6029
|
-
studentCount: yup11.number().
|
|
6044
|
+
studentCount: yup11.number().transform((_, originalValue) => toOptionalNumber(originalValue)).label("Student Count").nullable().typeError("Student count must be a number").min(
|
|
6030
6045
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
6031
6046
|
`Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
|
|
6032
6047
|
).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
|