@timardex/cluemart-shared 1.5.529 → 1.5.531

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.
Files changed (91) hide show
  1. package/dist/{chunk-PYMLMTOQ.mjs → chunk-G2YFRN6A.mjs} +1 -1
  2. package/dist/{chunk-PYMLMTOQ.mjs.map → chunk-G2YFRN6A.mjs.map} +1 -1
  3. package/dist/chunk-TXHYVMOH.mjs +97 -0
  4. package/dist/chunk-TXHYVMOH.mjs.map +1 -0
  5. package/dist/graphql/index.cjs.map +1 -1
  6. package/dist/graphql/index.mjs +1 -1
  7. package/dist/hooks/index.cjs +69 -5
  8. package/dist/hooks/index.cjs.map +1 -1
  9. package/dist/hooks/index.mjs +2 -2
  10. package/dist/images/apple-maps-icon.webp +0 -0
  11. package/dist/images/banner-horizontal.webp +0 -0
  12. package/dist/images/banner-vertical.webp +0 -0
  13. package/dist/images/cluiTui.webp +0 -0
  14. package/dist/images/cluiTui.webp.d.ts +2 -0
  15. package/dist/images/corporate.webp +0 -0
  16. package/dist/images/corporate.webp.d.ts +2 -0
  17. package/dist/images/facebook.webp +0 -0
  18. package/dist/images/facebook.webp.d.ts +2 -0
  19. package/dist/images/google-maps-icon.webp +0 -0
  20. package/dist/images/google-maps-icon.webp.d.ts +2 -0
  21. package/dist/images/googleMaps-logo-dark.webp +0 -0
  22. package/dist/images/googleMaps-logo-dark.webp.d.ts +2 -0
  23. package/dist/images/googleMaps-logo-light.webp +0 -0
  24. package/dist/images/googleMaps-logo-light.webp.d.ts +2 -0
  25. package/dist/images/index.cjs +103 -5
  26. package/dist/images/index.cjs.map +1 -1
  27. package/dist/images/index.d.mts +42 -10
  28. package/dist/images/index.d.ts +42 -10
  29. package/dist/images/index.mjs +35 -1
  30. package/dist/images/instagram.webp +0 -0
  31. package/dist/images/instagram.webp.d.ts +2 -0
  32. package/dist/images/logo-atr.webp +0 -0
  33. package/dist/images/logo-atr.webp.d.ts +2 -0
  34. package/dist/images/logo.webp +0 -0
  35. package/dist/images/logo.webp.d.ts +2 -0
  36. package/dist/images/meet.webp +0 -0
  37. package/dist/images/meet.webp.d.ts +2 -0
  38. package/dist/images/node.cjs +51 -22
  39. package/dist/images/node.d.ts +47 -7
  40. package/dist/images/node.mjs +54 -22
  41. package/dist/images/poll.webp +0 -0
  42. package/dist/images/poll.webp.d.ts +2 -0
  43. package/dist/images/poster1.webp +0 -0
  44. package/dist/images/poster1.webp.d.ts +2 -0
  45. package/dist/images/poster2.webp +0 -0
  46. package/dist/images/poster2.webp.d.ts +2 -0
  47. package/dist/images/poster3.webp +0 -0
  48. package/dist/images/poster3.webp.d.ts +2 -0
  49. package/dist/images/private.webp +0 -0
  50. package/dist/images/private.webp.d.ts +2 -0
  51. package/dist/images/qr-code.webp +0 -0
  52. package/dist/images/qr-code.webp.d.ts +2 -0
  53. package/dist/images/school.webp +0 -0
  54. package/dist/images/school.webp.d.ts +2 -0
  55. package/dist/images/sima.webp +0 -0
  56. package/dist/images/sima.webp.d.ts +2 -0
  57. package/dist/images/store-android.webp +0 -0
  58. package/dist/images/store-android.webp.d.ts +2 -0
  59. package/dist/images/store-ios.webp +0 -0
  60. package/dist/images/store-ios.webp.d.ts +2 -0
  61. package/dist/images/tablas.webp +0 -0
  62. package/dist/images/tablas.webp.d.ts +2 -0
  63. package/dist/images/telefonos.webp +0 -0
  64. package/dist/images/telefonos.webp.d.ts +2 -0
  65. package/dist/images/tiktok.webp +0 -0
  66. package/dist/images/tiktok.webp.d.ts +2 -0
  67. package/dist/images/tip.webp +0 -0
  68. package/dist/images/tip.webp.d.ts +2 -0
  69. package/dist/images/ugralos.webp +0 -0
  70. package/dist/images/ugralos.webp.d.ts +2 -0
  71. package/dist/images/waze-maps-icon.webp +0 -0
  72. package/dist/images/waze-maps-icon.webp.d.ts +2 -0
  73. package/dist/images/website.webp +0 -0
  74. package/dist/images/website.webp.d.ts +2 -0
  75. package/dist/images/youtube.webp +0 -0
  76. package/dist/images/youtube.webp.d.ts +2 -0
  77. package/dist/index.cjs +103 -5
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.d.mts +42 -10
  80. package/dist/index.d.ts +42 -10
  81. package/dist/index.mjs +86 -5
  82. package/dist/index.mjs.map +1 -1
  83. package/package.json +3 -3
  84. package/dist/chunk-IBKLW65U.mjs +0 -16
  85. package/dist/chunk-IBKLW65U.mjs.map +0 -1
  86. package/dist/images/poster1.png +0 -0
  87. package/dist/images/poster2.png +0 -0
  88. package/dist/images/poster3.png +0 -0
  89. /package/dist/images/{poster1.png.d.ts → apple-maps-icon.webp.d.ts} +0 -0
  90. /package/dist/images/{poster2.png.d.ts → banner-horizontal.webp.d.ts} +0 -0
  91. /package/dist/images/{poster3.png.d.ts → banner-vertical.webp.d.ts} +0 -0
@@ -1,22 +1,34 @@
1
- import { createRequire } from "node:module";
2
- import { basename, dirname, resolve, sep } from "node:path";
1
+ import {
2
+ basename,
3
+ dirname,
4
+ isAbsolute,
5
+ relative,
6
+ resolve,
7
+ sep,
8
+ } from "node:path";
3
9
  import { fileURLToPath } from "node:url";
4
10
 
5
- const nodeRequire = createRequire(fileURLToPath(import.meta.url));
6
- const PKG = "@timardex/cluemart-shared";
7
- const IMAGES_RESOLVE_ANCHOR = `${PKG}/images/poster1.png`;
11
+ import {
12
+ badgeFiles,
13
+ cluiFiles,
14
+ iconFiles,
15
+ otherImagesFiles,
16
+ logoFiles,
17
+ posterFiles,
18
+ } from "./index.mjs";
8
19
 
9
- /** Keep in sync with `posterFiles` in `src/images/index.ts`. */
10
- const POSTER_FILE_BY_ID = {
11
- poster1: "poster1.png",
12
- poster2: "poster2.png",
13
- poster3: "poster3.png",
14
- };
15
-
16
- const ALLOWED_BASENAMES = new Set(Object.values(POSTER_FILE_BY_ID));
20
+ const ALLOWED_BASENAMES = new Set([
21
+ ...Object.values(posterFiles),
22
+ ...Object.values(cluiFiles),
23
+ ...Object.values(iconFiles),
24
+ ...Object.values(badgeFiles),
25
+ ...Object.values(logoFiles),
26
+ ...Object.values(otherImagesFiles),
27
+ ]);
17
28
 
29
+ /** Directory containing this module and the shipped images (`dist/images/` in the published package). */
18
30
  export function getSharedImagesDir() {
19
- return dirname(nodeRequire.resolve(IMAGES_RESOLVE_ANCHOR));
31
+ return dirname(fileURLToPath(import.meta.url));
20
32
  }
21
33
 
22
34
  function assertSafeImageBasename(fileName) {
@@ -37,11 +49,33 @@ function assertSafeImageBasename(fileName) {
37
49
  return fileName;
38
50
  }
39
51
 
52
+ function resolveToBasename(ref) {
53
+ if (Object.prototype.hasOwnProperty.call(posterFiles, ref)) {
54
+ return posterFiles[ref];
55
+ }
56
+ if (Object.prototype.hasOwnProperty.call(cluiFiles, ref)) {
57
+ return cluiFiles[ref];
58
+ }
59
+ if (Object.prototype.hasOwnProperty.call(iconFiles, ref)) {
60
+ return iconFiles[ref];
61
+ }
62
+ if (Object.prototype.hasOwnProperty.call(badgeFiles, ref)) {
63
+ return badgeFiles[ref];
64
+ }
65
+ if (Object.prototype.hasOwnProperty.call(logoFiles, ref)) {
66
+ return logoFiles[ref];
67
+ }
68
+ if (Object.prototype.hasOwnProperty.call(otherImagesFiles, ref)) {
69
+ return otherImagesFiles[ref];
70
+ }
71
+ return assertSafeImageBasename(ref);
72
+ }
73
+
40
74
  function resolvedPathUnderRoot(rootDir, baseName) {
41
75
  const rootResolved = resolve(rootDir);
42
76
  const resolved = resolve(rootResolved, baseName);
43
- const prefix = rootResolved.endsWith(sep) ? rootResolved : rootResolved + sep;
44
- if (resolved !== rootResolved && !resolved.startsWith(prefix)) {
77
+ const rel = relative(rootResolved, resolved);
78
+ if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) {
45
79
  throw new TypeError(
46
80
  "resolved path must stay under the shared images directory",
47
81
  );
@@ -50,11 +84,9 @@ function resolvedPathUnderRoot(rootDir, baseName) {
50
84
  }
51
85
 
52
86
  export function getSharedImagePath(ref) {
53
- const segment = Object.hasOwn(POSTER_FILE_BY_ID, ref)
54
- ? POSTER_FILE_BY_ID[ref]
55
- : assertSafeImageBasename(ref);
56
- if (!ALLOWED_BASENAMES.has(segment)) {
57
- throw new TypeError(`unknown poster image: ${ref}`);
87
+ const baseName = resolveToBasename(ref);
88
+ if (!ALLOWED_BASENAMES.has(baseName)) {
89
+ throw new TypeError(`unknown shared image: ${ref}`);
58
90
  }
59
- return resolvedPathUnderRoot(getSharedImagesDir(), segment);
91
+ return resolvedPathUnderRoot(getSharedImagesDir(), baseName);
60
92
  }
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
Binary file
@@ -0,0 +1,2 @@
1
+ declare const src: string | number;
2
+ export default src;
package/dist/index.cjs CHANGED
@@ -62,6 +62,7 @@ __export(index_exports, {
62
62
  EnumUserRole: () => EnumUserRole,
63
63
  EnumVendorType: () => EnumVendorType,
64
64
  EnumVerificationType: () => EnumVerificationType,
65
+ IMAGE_EXTENSION: () => IMAGE_EXTENSION,
65
66
  IOS_URL: () => IOS_URL,
66
67
  ImageTypeEnum: () => ImageTypeEnum,
67
68
  SAVED_EMAIL_KEY: () => SAVED_EMAIL_KEY,
@@ -73,9 +74,15 @@ __export(index_exports, {
73
74
  availableRegionOptions: () => availableRegionOptions,
74
75
  availableRegionTypes: () => availableRegionTypes,
75
76
  availableTagTypes: () => availableTagTypes,
77
+ badgeFiles: () => badgeFiles,
78
+ badgeIds: () => badgeIds,
79
+ badges: () => badges,
76
80
  capitalizeFirstLetter: () => capitalizeFirstLetter,
77
81
  categoryColors: () => categoryColors,
78
82
  cluemartSocialMedia: () => cluemartSocialMedia,
83
+ cluiFiles: () => cluiFiles,
84
+ cluiIds: () => cluiIds,
85
+ cluiImages: () => cluiImages,
79
86
  companyContactFields: () => companyContactFields,
80
87
  computeDailyClueState: () => computeDailyClueState,
81
88
  contactUsFields: () => contactUsFields,
@@ -102,19 +109,29 @@ __export(index_exports, {
102
109
  gameTypeToDisplayName: () => gameTypeToDisplayName,
103
110
  getCurrentAndFutureDates: () => getCurrentAndFutureDates,
104
111
  globalDefaultValues: () => globalDefaultValues,
112
+ iconFiles: () => iconFiles,
113
+ iconIds: () => iconIds,
114
+ icons: () => icons,
105
115
  isFutureDatesBeforeThreshold: () => isFutureDatesBeforeThreshold,
106
116
  isIsoDateString: () => isIsoDateString,
107
117
  licenseNiceNames: () => licenseNiceNames,
108
118
  lightColors: () => lightColors,
109
119
  loginFields: () => loginFields,
120
+ logoFiles: () => logoFiles,
121
+ logoIds: () => logoIds,
122
+ logos: () => logos,
110
123
  mapArrayToOptions: () => mapArrayToOptions,
111
124
  mapBaseResourceTypeToFormData: () => mapBaseResourceTypeToFormData,
112
125
  normalizeUrl: () => normalizeUrl,
113
126
  nzStartOfDay: () => nzStartOfDay,
127
+ otherImages: () => otherImages,
128
+ otherImagesFiles: () => otherImagesFiles,
129
+ otherImagesIds: () => otherImagesIds,
114
130
  packagingOptions: () => packagingOptions,
115
131
  partnerBasicInfoFields: () => partnerBasicInfoFields,
116
132
  paymentMethodOptions: () => paymentMethodOptions,
117
133
  posterFiles: () => posterFiles,
134
+ posterIds: () => posterIds,
118
135
  posters: () => posters,
119
136
  priceUnits: () => priceUnits,
120
137
  producedIngOptions: () => producedIngOptions,
@@ -8483,14 +8500,78 @@ function useSchoolForm(data) {
8483
8500
 
8484
8501
  // src/images/index.ts
8485
8502
  var PKG = "@timardex/cluemart-shared";
8486
- var posterFiles = {
8487
- poster1: "poster1.png",
8488
- poster2: "poster2.png",
8489
- poster3: "poster3.png"
8490
- };
8503
+ var IMAGE_EXTENSION = ".webp";
8504
+ var posterIds = ["poster1", "poster2", "poster3"];
8505
+ var posterFiles = Object.fromEntries(
8506
+ posterIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
8507
+ );
8508
+ var cluiIds = [
8509
+ "cluiTui",
8510
+ "sima",
8511
+ "tablas",
8512
+ "telefonos",
8513
+ "ugralos"
8514
+ ];
8515
+ var cluiFiles = Object.fromEntries(
8516
+ cluiIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
8517
+ );
8518
+ var iconIds = [
8519
+ "apple-maps-icon",
8520
+ "facebook",
8521
+ "google-maps-icon",
8522
+ "instagram",
8523
+ "meet",
8524
+ "poll",
8525
+ "tiktok",
8526
+ "tip",
8527
+ "waze-maps-icon",
8528
+ "website",
8529
+ "youtube"
8530
+ ];
8531
+ var iconFiles = Object.fromEntries(
8532
+ iconIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
8533
+ );
8534
+ var badgeIds = ["corporate", "private", "school"];
8535
+ var badgeFiles = Object.fromEntries(
8536
+ badgeIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
8537
+ );
8538
+ var logoIds = [
8539
+ "googleMaps-logo-dark",
8540
+ "googleMaps-logo-light",
8541
+ "logo",
8542
+ "logo-atr"
8543
+ ];
8544
+ var logoFiles = Object.fromEntries(
8545
+ logoIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
8546
+ );
8547
+ var otherImagesIds = [
8548
+ "banner-horizontal",
8549
+ "banner-vertical",
8550
+ "qr-code",
8551
+ "store-android",
8552
+ "store-ios"
8553
+ ];
8554
+ var otherImagesFiles = Object.fromEntries(
8555
+ otherImagesIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
8556
+ );
8491
8557
  var posters = Object.fromEntries(
8492
8558
  Object.entries(posterFiles).map(([key, file]) => [key, `${PKG}/images/${file}`])
8493
8559
  );
8560
+ var cluiImages = Object.fromEntries(
8561
+ Object.entries(cluiFiles).map(([key, file]) => [key, `${PKG}/images/${file}`])
8562
+ );
8563
+ var icons = Object.fromEntries(
8564
+ Object.entries(iconFiles).map(([key, file]) => [key, `${PKG}/images/${file}`])
8565
+ );
8566
+ var badges = Object.fromEntries(
8567
+ Object.entries(badgeFiles).map(([key, file]) => [key, `${PKG}/images/${file}`])
8568
+ );
8569
+ var logos = Object.fromEntries(
8570
+ Object.entries(logoFiles).map(([key, file]) => [key, `${PKG}/images/${file}`])
8571
+ );
8572
+ var otherImages = Object.fromEntries(
8573
+ Object.entries(otherImagesFiles).map(([key, file]) => [key, `${PKG}/images/${file}`])
8574
+ );
8494
8575
 
8495
8576
  // src/storage/index.ts
8496
8577
  var SAVED_PASSWORD_KEY = "savedPassword";
@@ -8587,6 +8668,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8587
8668
  EnumUserRole,
8588
8669
  EnumVendorType,
8589
8670
  EnumVerificationType,
8671
+ IMAGE_EXTENSION,
8590
8672
  IOS_URL,
8591
8673
  ImageTypeEnum,
8592
8674
  SAVED_EMAIL_KEY,
@@ -8598,9 +8680,15 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8598
8680
  availableRegionOptions,
8599
8681
  availableRegionTypes,
8600
8682
  availableTagTypes,
8683
+ badgeFiles,
8684
+ badgeIds,
8685
+ badges,
8601
8686
  capitalizeFirstLetter,
8602
8687
  categoryColors,
8603
8688
  cluemartSocialMedia,
8689
+ cluiFiles,
8690
+ cluiIds,
8691
+ cluiImages,
8604
8692
  companyContactFields,
8605
8693
  computeDailyClueState,
8606
8694
  contactUsFields,
@@ -8627,19 +8715,29 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8627
8715
  gameTypeToDisplayName,
8628
8716
  getCurrentAndFutureDates,
8629
8717
  globalDefaultValues,
8718
+ iconFiles,
8719
+ iconIds,
8720
+ icons,
8630
8721
  isFutureDatesBeforeThreshold,
8631
8722
  isIsoDateString,
8632
8723
  licenseNiceNames,
8633
8724
  lightColors,
8634
8725
  loginFields,
8726
+ logoFiles,
8727
+ logoIds,
8728
+ logos,
8635
8729
  mapArrayToOptions,
8636
8730
  mapBaseResourceTypeToFormData,
8637
8731
  normalizeUrl,
8638
8732
  nzStartOfDay,
8733
+ otherImages,
8734
+ otherImagesFiles,
8735
+ otherImagesIds,
8639
8736
  packagingOptions,
8640
8737
  partnerBasicInfoFields,
8641
8738
  paymentMethodOptions,
8642
8739
  posterFiles,
8740
+ posterIds,
8643
8741
  posters,
8644
8742
  priceUnits,
8645
8743
  producedIngOptions,