@react-pakistan/util-functions 2.0.2 → 3.0.1

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 (369) hide show
  1. package/constants/api-methods.d.mts +13 -0
  2. package/constants/api-methods.mjs +1 -0
  3. package/constants/cache-time.d.mts +7 -0
  4. package/constants/cache-time.mjs +1 -0
  5. package/constants/countries-timezones.d.mts +8 -0
  6. package/constants/countries-timezones.mjs +1 -0
  7. package/constants/currencies.d.mts +14 -0
  8. package/constants/currencies.mjs +1 -0
  9. package/constants/dial-codes.d.mts +9 -0
  10. package/constants/dial-codes.mjs +1 -0
  11. package/constants/layout-direction.d.mts +6 -0
  12. package/constants/layout-direction.mjs +1 -0
  13. package/constants/react-pakistan-meta.d.mts +32 -0
  14. package/constants/react-pakistan-meta.mjs +1 -0
  15. package/constants/react-pakistan.d.mts +15 -0
  16. package/constants/react-pakistan.mjs +12 -0
  17. package/constants/select-value-delimiter.d.mts +12 -0
  18. package/constants/select-value-delimiter.mjs +1 -0
  19. package/constants/social-media-colors.d.mts +40 -0
  20. package/constants/social-media-colors.mjs +1 -0
  21. package/constants/social-media-sizes.d.mts +323 -0
  22. package/constants/social-media-sizes.mjs +1 -0
  23. package/constants/user-roles.d.mts +7 -0
  24. package/constants/user-roles.mjs +1 -0
  25. package/factory/generic-component-factory.d.mts +78 -0
  26. package/factory/generic-component-factory.mjs +1 -0
  27. package/factory/generic-module-factory.d.mts +80 -0
  28. package/factory/generic-module-factory.mjs +1 -0
  29. package/general/basic-get.d.mts +8 -0
  30. package/general/basic-get.mjs +1 -0
  31. package/general/basic-post.d.mts +8 -0
  32. package/general/basic-post.mjs +1 -0
  33. package/general/calculate-pages.d.mts +9 -0
  34. package/general/calculate-pages.mjs +1 -0
  35. package/general/camel-to-sentence-case.d.mts +12 -0
  36. package/general/camel-to-sentence-case.mjs +1 -0
  37. package/general/check-even-odd-length.d.mts +13 -0
  38. package/general/check-even-odd-length.mjs +1 -0
  39. package/general/clear-cache.d.mts +10 -0
  40. package/general/clear-cache.mjs +1 -0
  41. package/general/cnic-formatter.d.mts +20 -0
  42. package/general/cnic-formatter.mjs +1 -0
  43. package/general/convert-url-to-base64.d.mts +57 -0
  44. package/general/convert-url-to-base64.mjs +1 -0
  45. package/general/countries.d.mts +268 -0
  46. package/general/countries.mjs +1 -0
  47. package/general/create-date.d.mts +12 -0
  48. package/general/create-date.js +1 -1
  49. package/general/create-date.mjs +1 -0
  50. package/general/crypto.d.mts +11 -0
  51. package/general/crypto.mjs +1 -0
  52. package/general/currencies.d.mts +2 -0
  53. package/general/currencies.mjs +0 -0
  54. package/general/delete-image-from-private-supabase.d.mts +16 -0
  55. package/general/delete-image-from-private-supabase.mjs +1 -0
  56. package/general/delete-image-from-public-supabase.d.mts +16 -0
  57. package/general/delete-image-from-public-supabase.mjs +1 -0
  58. package/general/download-from-url.d.mts +8 -0
  59. package/general/download-from-url.mjs +1 -0
  60. package/general/dynamic-page-limit.d.mts +12 -0
  61. package/general/dynamic-page-limit.mjs +1 -0
  62. package/general/enum-to-text.d.mts +8 -0
  63. package/general/enum-to-text.mjs +1 -0
  64. package/general/fetch-data.d.mts +25 -0
  65. package/general/fetch-data.mjs +1 -0
  66. package/general/fetch-supabase-image.d.mts +16 -0
  67. package/general/fetch-supabase-image.mjs +1 -0
  68. package/general/fetch-supabase-private-assets.d.mts +15 -0
  69. package/general/fetch-supabase-private-assets.mjs +1 -0
  70. package/general/format-date.d.mts +18 -0
  71. package/general/format-date.mjs +1 -0
  72. package/general/format-number.d.mts +16 -0
  73. package/general/format-number.mjs +1 -0
  74. package/general/format-phone-display.d.mts +9 -0
  75. package/general/format-phone-display.js +1 -1
  76. package/general/format-phone-display.mjs +1 -0
  77. package/general/format-phone.d.mts +13 -0
  78. package/general/format-phone.d.ts +1 -3
  79. package/general/format-phone.js +1 -1
  80. package/general/format-phone.mjs +1 -0
  81. package/general/format-pricing.d.mts +8 -0
  82. package/general/format-pricing.mjs +1 -0
  83. package/general/format-secs.d.mts +8 -0
  84. package/general/format-secs.mjs +1 -0
  85. package/general/format-time.d.mts +11 -0
  86. package/general/format-time.mjs +1 -0
  87. package/general/format-value.d.mts +8 -0
  88. package/general/format-value.mjs +1 -0
  89. package/general/full-month-range.d.mts +13 -0
  90. package/general/full-month-range.mjs +1 -0
  91. package/general/full-year-range.d.mts +12 -0
  92. package/general/full-year-range.mjs +1 -0
  93. package/general/generate-article-schema.d.mts +50 -0
  94. package/general/generate-article-schema.mjs +1 -0
  95. package/general/generate-blog-schema.d.mts +37 -0
  96. package/general/generate-blog-schema.mjs +1 -0
  97. package/general/generate-book-schema.d.mts +58 -0
  98. package/general/generate-book-schema.mjs +1 -0
  99. package/general/generate-breadcrumb-schema.d.mts +40 -0
  100. package/general/generate-breadcrumb-schema.mjs +1 -0
  101. package/general/generate-carousel-schema.d.mts +52 -0
  102. package/general/generate-carousel-schema.mjs +1 -0
  103. package/general/generate-course-schema.d.mts +53 -0
  104. package/general/generate-course-schema.mjs +1 -0
  105. package/general/generate-dataset-schema.d.mts +65 -0
  106. package/general/generate-dataset-schema.mjs +1 -0
  107. package/general/generate-discussion-forum-schema.d.mts +39 -0
  108. package/general/generate-discussion-forum-schema.mjs +1 -0
  109. package/general/generate-education-schema.d.mts +68 -0
  110. package/general/generate-education-schema.mjs +1 -0
  111. package/general/generate-employer-aggregate-rating-schema.d.mts +29 -0
  112. package/general/generate-employer-aggregate-rating-schema.mjs +1 -0
  113. package/general/generate-event-schema.d.mts +63 -0
  114. package/general/generate-event-schema.mjs +1 -0
  115. package/general/generate-faq-schema.d.mts +32 -0
  116. package/general/generate-faq-schema.mjs +1 -0
  117. package/general/generate-grid.d.mts +17 -0
  118. package/general/generate-grid.mjs +1 -0
  119. package/general/generate-image-metadata-schema.d.mts +36 -0
  120. package/general/generate-image-metadata-schema.mjs +1 -0
  121. package/general/generate-job-posting-schema.d.mts +49 -0
  122. package/general/generate-job-posting-schema.mjs +1 -0
  123. package/general/generate-local-business-schema.d.mts +42 -0
  124. package/general/generate-local-business-schema.mjs +1 -0
  125. package/general/generate-math-solver-schema.d.mts +45 -0
  126. package/general/generate-math-solver-schema.mjs +1 -0
  127. package/general/generate-movie-carousel-schema.d.mts +51 -0
  128. package/general/generate-movie-carousel-schema.mjs +1 -0
  129. package/general/generate-organization-schema.d.mts +49 -0
  130. package/general/generate-organization-schema.mjs +1 -0
  131. package/general/generate-profile-page-schema.d.mts +37 -0
  132. package/general/generate-profile-page-schema.mjs +1 -0
  133. package/general/generate-qa-page-schema.d.mts +34 -0
  134. package/general/generate-qa-page-schema.mjs +1 -0
  135. package/general/generate-recipe-schema.d.mts +49 -0
  136. package/general/generate-recipe-schema.mjs +1 -0
  137. package/general/generate-ref.d.mts +11 -0
  138. package/general/generate-ref.js +1 -1
  139. package/general/generate-ref.mjs +1 -0
  140. package/general/generate-review-snippet-schema.d.mts +52 -0
  141. package/general/generate-review-snippet-schema.mjs +1 -0
  142. package/general/generate-shopping-loyalty-program-schema.d.mts +38 -0
  143. package/general/generate-shopping-loyalty-program-schema.mjs +1 -0
  144. package/general/generate-shopping-merchant-listing-schema.d.mts +53 -0
  145. package/general/generate-shopping-merchant-listing-schema.mjs +1 -0
  146. package/general/generate-shopping-merchant-return-policy-schema.d.mts +32 -0
  147. package/general/generate-shopping-merchant-return-policy-schema.mjs +1 -0
  148. package/general/generate-shopping-merchant-shipping-policy-schema.d.mts +36 -0
  149. package/general/generate-shopping-merchant-shipping-policy-schema.mjs +1 -0
  150. package/general/generate-shopping-overview-schema.d.mts +52 -0
  151. package/general/generate-shopping-overview-schema.mjs +1 -0
  152. package/general/generate-shopping-product-snippet-schema.d.mts +57 -0
  153. package/general/generate-shopping-product-snippet-schema.mjs +1 -0
  154. package/general/generate-shopping-variants-schema.d.mts +46 -0
  155. package/general/generate-shopping-variants-schema.mjs +1 -0
  156. package/general/generate-software-app-schema.d.mts +62 -0
  157. package/general/generate-software-app-schema.mjs +1 -0
  158. package/general/generate-speakable-schema.d.mts +64 -0
  159. package/general/generate-speakable-schema.mjs +1 -0
  160. package/general/generate-subscription-schema.d.mts +60 -0
  161. package/general/generate-subscription-schema.mjs +1 -0
  162. package/general/generate-vacation-rental-schema.d.mts +67 -0
  163. package/general/generate-vacation-rental-schema.mjs +1 -0
  164. package/general/generate-video-schema.d.mts +75 -0
  165. package/general/generate-video-schema.mjs +1 -0
  166. package/general/generic-cache.d.mts +193 -0
  167. package/general/generic-cache.mjs +1 -0
  168. package/general/get-available-page-limit.d.mts +11 -0
  169. package/general/get-available-page-limit.mjs +1 -0
  170. package/general/get-calendar-current-month.d.mts +15 -0
  171. package/general/get-calendar-current-month.js +1 -1
  172. package/general/get-calendar-current-month.mjs +1 -0
  173. package/general/get-calendar-dates.d.mts +15 -0
  174. package/general/get-calendar-dates.js +1 -1
  175. package/general/get-calendar-dates.mjs +1 -0
  176. package/general/get-calendar-next-month.d.mts +17 -0
  177. package/general/get-calendar-next-month.js +1 -1
  178. package/general/get-calendar-next-month.mjs +1 -0
  179. package/general/get-calendar-previous-month.d.mts +17 -0
  180. package/general/get-calendar-previous-month.js +1 -1
  181. package/general/get-calendar-previous-month.mjs +1 -0
  182. package/general/get-current-year.d.mts +7 -0
  183. package/general/get-current-year.mjs +1 -0
  184. package/general/get-day-name.d.mts +10 -0
  185. package/general/get-day-name.mjs +1 -0
  186. package/general/get-dial-code.d.mts +8 -0
  187. package/general/get-dial-code.mjs +1 -0
  188. package/general/get-full-name.d.mts +13 -0
  189. package/general/get-full-name.mjs +1 -0
  190. package/general/get-href.d.mts +11 -0
  191. package/general/get-href.mjs +1 -0
  192. package/general/get-month-name.d.mts +10 -0
  193. package/general/get-month-name.mjs +1 -0
  194. package/general/get-month-number.d.mts +15 -0
  195. package/general/get-month-number.mjs +1 -0
  196. package/general/get-number-of-days-in-month.d.mts +13 -0
  197. package/general/get-number-of-days-in-month.js +1 -1
  198. package/general/get-number-of-days-in-month.mjs +1 -0
  199. package/general/get-pathname.d.mts +11 -0
  200. package/general/get-pathname.mjs +1 -0
  201. package/general/get-week-day.d.mts +8 -0
  202. package/general/get-week-day.js +1 -1
  203. package/general/get-week-day.mjs +1 -0
  204. package/general/image-url-to-base64.d.mts +9 -0
  205. package/general/image-url-to-base64.mjs +1 -0
  206. package/general/is-created-or-updated.d.mts +13 -0
  207. package/general/is-created-or-updated.mjs +1 -0
  208. package/general/is-next-button-disabled.d.mts +9 -0
  209. package/general/is-next-button-disabled.mjs +1 -0
  210. package/general/is-odd.d.mts +11 -0
  211. package/general/is-odd.mjs +1 -0
  212. package/general/is-previous-button-disabled.d.mts +8 -0
  213. package/general/is-previous-button-disabled.mjs +1 -0
  214. package/general/linear-gradients.d.mts +14 -0
  215. package/general/linear-gradients.mjs +1 -0
  216. package/general/multi-part-search.d.mts +22 -0
  217. package/general/multi-part-search.mjs +1 -0
  218. package/general/normalize-phone.d.mts +15 -0
  219. package/general/normalize-phone.js +1 -1
  220. package/general/normalize-phone.mjs +1 -0
  221. package/general/parse-frontmatter.d.mts +36 -0
  222. package/general/parse-frontmatter.mjs +2 -0
  223. package/general/remove-data-image-prefix.d.mts +8 -0
  224. package/general/remove-data-image-prefix.mjs +1 -0
  225. package/general/repeat-times.d.mts +15 -0
  226. package/general/repeat-times.mjs +1 -0
  227. package/general/resolve-anchor-link.d.mts +13 -0
  228. package/general/resolve-anchor-link.mjs +1 -0
  229. package/general/resolve-current-date.d.mts +12 -0
  230. package/general/resolve-current-date.mjs +1 -0
  231. package/general/resolve-grid.d.mts +14 -0
  232. package/general/resolve-grid.mjs +1 -0
  233. package/general/resolve-initials.d.mts +12 -0
  234. package/general/resolve-initials.mjs +1 -0
  235. package/general/set-timezone.d.mts +9 -0
  236. package/general/set-timezone.d.ts +1 -3
  237. package/general/set-timezone.js +1 -1
  238. package/general/set-timezone.mjs +1 -0
  239. package/general/slugify.d.mts +12 -0
  240. package/general/slugify.mjs +1 -0
  241. package/general/text-to-enum.d.mts +8 -0
  242. package/general/text-to-enum.mjs +1 -0
  243. package/general/text-to-sentence-case.d.mts +12 -0
  244. package/general/text-to-sentence-case.mjs +1 -0
  245. package/general/time-out.d.mts +12 -0
  246. package/general/time-out.mjs +1 -0
  247. package/general/time-zones.d.mts +11 -0
  248. package/general/time-zones.mjs +1 -0
  249. package/general/truncate-text.d.mts +14 -0
  250. package/general/truncate-text.mjs +1 -0
  251. package/general/type.d.mts +8 -0
  252. package/general/type.mjs +0 -0
  253. package/general/upload-blob-to-private-supabase.d.mts +24 -0
  254. package/general/upload-blob-to-private-supabase.mjs +1 -0
  255. package/general/upload-blob-to-public-supabase.d.mts +24 -0
  256. package/general/upload-blob-to-public-supabase.mjs +1 -0
  257. package/general/upload-image-to-private-supabase.d.mts +26 -0
  258. package/general/upload-image-to-private-supabase.mjs +1 -0
  259. package/general/upload-image-to-public-supabase.d.mts +26 -0
  260. package/general/upload-image-to-public-supabase.mjs +1 -0
  261. package/general/url-to-sentence-case.d.mts +12 -0
  262. package/general/url-to-sentence-case.mjs +1 -0
  263. package/general/validate-comment.d.mts +14 -0
  264. package/general/validate-comment.mjs +1 -0
  265. package/general/validate-email.d.mts +15 -0
  266. package/general/validate-email.mjs +1 -0
  267. package/general/validate-form.d.mts +18 -0
  268. package/general/validate-form.mjs +1 -0
  269. package/general/validate-name.d.mts +14 -0
  270. package/general/validate-name.mjs +1 -0
  271. package/hooks/use-change.d.mts +11 -0
  272. package/hooks/use-change.mjs +1 -0
  273. package/hooks/use-debounce.d.mts +10 -0
  274. package/hooks/use-debounce.mjs +1 -0
  275. package/hooks/use-fetch.d.mts +42 -0
  276. package/hooks/use-fetch.mjs +1 -0
  277. package/hooks/use-force-render.d.mts +14 -0
  278. package/hooks/use-force-render.mjs +1 -0
  279. package/hooks/use-ip-geo-location.d.mts +12 -0
  280. package/hooks/use-ip-geo-location.mjs +1 -0
  281. package/hooks/use-is-mobile.d.mts +8 -0
  282. package/hooks/use-is-mobile.mjs +1 -0
  283. package/hooks/use-module-entity-v2.d.mts +105 -0
  284. package/hooks/use-module-entity-v2.mjs +1 -0
  285. package/hooks/use-module-entity.d.mts +98 -0
  286. package/hooks/use-module-entity.mjs +1 -0
  287. package/hooks/use-phone-formatter.d.mts +17 -0
  288. package/hooks/use-phone-formatter.d.ts +1 -3
  289. package/hooks/use-phone-formatter.js +1 -1
  290. package/hooks/use-phone-formatter.mjs +1 -0
  291. package/hooks/use-position.d.mts +29 -0
  292. package/hooks/use-position.mjs +1 -0
  293. package/hooks/use-rtl.d.mts +46 -0
  294. package/hooks/use-rtl.mjs +1 -0
  295. package/hooks/use-sticky.d.mts +13 -0
  296. package/hooks/use-sticky.mjs +1 -0
  297. package/hooks/use-toggle-state.d.mts +14 -0
  298. package/hooks/use-toggle-state.mjs +1 -0
  299. package/hooks/use-window-event-listener.d.mts +9 -0
  300. package/hooks/use-window-event-listener.mjs +1 -0
  301. package/hooks/with-seo.d.mts +19 -0
  302. package/hooks/with-seo.mjs +1 -0
  303. package/local-storage/get-storage-value.d.mts +5 -0
  304. package/local-storage/get-storage-value.mjs +1 -0
  305. package/local-storage/remove-storage-value.d.mts +3 -0
  306. package/local-storage/remove-storage-value.mjs +1 -0
  307. package/local-storage/set-storage-value.d.mts +3 -0
  308. package/local-storage/set-storage-value.mjs +1 -0
  309. package/local-storage/type.d.mts +3 -0
  310. package/local-storage/type.mjs +0 -0
  311. package/npm.d.d.mts +2 -0
  312. package/npm.d.mjs +0 -0
  313. package/package.json +1 -10
  314. package/edu-pilot-pro/types/academics.d.ts +0 -2
  315. package/edu-pilot-pro/types/academics.js +0 -1
  316. package/edu-pilot-pro/types/admission.d.ts +0 -878
  317. package/edu-pilot-pro/types/admission.js +0 -1
  318. package/edu-pilot-pro/types/communication.d.ts +0 -2
  319. package/edu-pilot-pro/types/communication.js +0 -1
  320. package/edu-pilot-pro/types/enums.d.ts +0 -413
  321. package/edu-pilot-pro/types/enums.js +0 -1
  322. package/edu-pilot-pro/types/finance.d.ts +0 -2
  323. package/edu-pilot-pro/types/finance.js +0 -1
  324. package/edu-pilot-pro/types/index.d.ts +0 -2
  325. package/edu-pilot-pro/types/index.js +0 -1
  326. package/edu-pilot-pro/types/user-management.d.ts +0 -2
  327. package/edu-pilot-pro/types/user-management.js +0 -1
  328. package/stellar-solution/types/common.d.ts +0 -26
  329. package/stellar-solution/types/common.js +0 -1
  330. package/stellar-solution/types/erp.d.ts +0 -305
  331. package/stellar-solution/types/erp.js +0 -1
  332. package/stellar-solution/types/index.d.ts +0 -3
  333. package/stellar-solution/types/index.js +0 -1
  334. package/stellar-solution/types/pos.d.ts +0 -179
  335. package/stellar-solution/types/pos.js +0 -1
  336. package/storybook/generate-sitemap.d.ts +0 -16
  337. package/storybook/generate-sitemap.js +0 -17
  338. package/storybook/preview.d.ts +0 -148
  339. package/storybook/preview.js +0 -1
  340. package/storybook/react-design-story-script.d.ts +0 -12
  341. package/storybook/react-design-story-script.js +0 -5
  342. package/storybook/react-emoji-collection.d.ts +0 -13
  343. package/storybook/react-emoji-collection.js +0 -11
  344. package/storybook/react-emoji-story-script.d.ts +0 -12
  345. package/storybook/react-emoji-story-script.js +0 -5
  346. package/storybook/react-emoji-story-template.d.ts +0 -14
  347. package/storybook/react-emoji-story-template.js +0 -46
  348. package/storybook/react-icon-collection.d.ts +0 -13
  349. package/storybook/react-icon-collection.js +0 -11
  350. package/storybook/react-icon-story-script.d.ts +0 -12
  351. package/storybook/react-icon-story-script.js +0 -5
  352. package/storybook/react-icon-story-template.d.ts +0 -13
  353. package/storybook/react-icon-story-template.js +0 -46
  354. package/storybook/react-logo-collection.d.ts +0 -13
  355. package/storybook/react-logo-collection.js +0 -11
  356. package/storybook/react-logo-story-script.d.ts +0 -12
  357. package/storybook/react-logo-story-script.js +0 -5
  358. package/storybook/react-logo-story-template.d.ts +0 -13
  359. package/storybook/react-logo-story-template.js +0 -46
  360. package/storybook/react-pakistan-theme.d.ts +0 -25
  361. package/storybook/react-pakistan-theme.js +0 -1
  362. package/storybook/responsive-args.d.ts +0 -22
  363. package/storybook/responsive-args.js +0 -1
  364. package/storybook/responsive-component.d.ts +0 -33
  365. package/storybook/responsive-component.js +0 -37
  366. package/storybook/responsive-screens.d.ts +0 -108
  367. package/storybook/responsive-screens.js +0 -1
  368. package/storybook/theme.d.ts +0 -96
  369. package/storybook/theme.js +0 -1
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Generate schema.org `VacationRental` JSON-LD including optional reviews
3
+ * and `AggregateRating`.
4
+ *
5
+ * The function accepts address or geo information, images, host references,
6
+ * and occupancy data. Reviews and aggregate ratings are formatted into
7
+ * `Review` and `AggregateRating` objects when provided.
8
+ *
9
+ * See `VacationRentalOptions` below for supported inputs.
10
+ * @returns A JSON-LD compatible `VacationRental` object
11
+ */
12
+ interface ImageRef {
13
+ url: string;
14
+ width?: number;
15
+ height?: number;
16
+ }
17
+ interface PersonRef {
18
+ name: string;
19
+ url?: string;
20
+ }
21
+ interface AddressRef {
22
+ streetAddress?: string;
23
+ addressLocality?: string;
24
+ addressRegion?: string;
25
+ postalCode?: string;
26
+ addressCountry?: string;
27
+ }
28
+ interface GeoRef {
29
+ latitude?: number | string;
30
+ longitude?: number | string;
31
+ }
32
+ interface RatingItem {
33
+ ratingValue: number | string;
34
+ bestRating?: number | string;
35
+ worstRating?: number | string;
36
+ }
37
+ interface ReviewItem {
38
+ author?: string | PersonRef;
39
+ datePublished?: string;
40
+ reviewBody?: string;
41
+ reviewRating?: RatingItem;
42
+ }
43
+ interface AggregateRatingOptions {
44
+ ratingValue: number | string;
45
+ reviewCount?: number;
46
+ ratingCount?: number;
47
+ bestRating?: number | string;
48
+ worstRating?: number | string;
49
+ }
50
+ interface VacationRentalOptions {
51
+ name: string;
52
+ description?: string;
53
+ image?: string | ImageRef | (string | ImageRef)[];
54
+ url?: string;
55
+ address?: string | AddressRef;
56
+ geo?: GeoRef;
57
+ numberOfRooms?: number;
58
+ numberOfBeds?: number;
59
+ priceRange?: string;
60
+ host?: string | PersonRef;
61
+ reviews?: ReviewItem[];
62
+ aggregateRating?: AggregateRatingOptions;
63
+ keywords?: string | string[];
64
+ }
65
+ declare const generateVacationRentalSchema: ({ name, description, image, url, address, geo, numberOfRooms, numberOfBeds, priceRange, host, reviews, aggregateRating, keywords, }: VacationRentalOptions) => any;
66
+
67
+ export { generateVacationRentalSchema as default, generateVacationRentalSchema };
@@ -0,0 +1 @@
1
+ const A=t=>{if(t)return Array.isArray(t)?t.map(e=>typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}):typeof t=="string"?t:{"@type":"ImageObject",url:t.url,...t.width&&{width:t.width},...t.height&&{height:t.height}}},c=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},I=t=>{if(t)return typeof t=="string"?t:{"@type":"PostalAddress",...t.streetAddress&&{streetAddress:t.streetAddress},...t.addressLocality&&{addressLocality:t.addressLocality},...t.addressRegion&&{addressRegion:t.addressRegion},...t.postalCode&&{postalCode:t.postalCode},...t.addressCountry&&{addressCountry:t.addressCountry}}},P=t=>{const e={"@type":"Review"};return t.author&&(e.author=c(t.author)),t.datePublished&&(e.datePublished=t.datePublished),t.reviewBody&&(e.reviewBody=t.reviewBody),t.reviewRating&&(e.reviewRating={"@type":"Rating",ratingValue:t.reviewRating.ratingValue,...t.reviewRating.bestRating!=null&&{bestRating:t.reviewRating.bestRating},...t.reviewRating.worstRating!=null&&{worstRating:t.reviewRating.worstRating}}),e},V=({name:t,description:e,image:y,url:g,address:w,geo:s,numberOfRooms:d,numberOfBeds:l,priceRange:f,host:b,reviews:a,aggregateRating:r,keywords:o})=>{const n={"@context":"https://schema.org","@type":"VacationRental",name:t};e&&(n.description=e);const R=A(y);R&&(n.image=R),g&&(n.url=g);const m=I(w);m&&(n.address=m),s&&(n.geo={"@type":"GeoCoordinates",...s.latitude!=null&&{latitude:s.latitude},...s.longitude!=null&&{longitude:s.longitude}}),d!=null&&(n.numberOfRooms=d),l!=null&&(n.numberOfBeds=l),f&&(n.priceRange=f);const h=c(b);if(h&&(n.host=h),o&&(n.keywords=Array.isArray(o)?o.join(", "):o),a&&a.length>0){const p=a.map(P);if(n.review=p,!r){const u=a.map(i=>i.reviewRating?Number(i.reviewRating.ratingValue):NaN).filter(i=>!Number.isNaN(i));if(u.length>0){const i=u.reduce((v,C)=>v+C,0);n.aggregateRating={"@type":"AggregateRating",ratingValue:i/u.length,reviewCount:a.length,ratingCount:u.length}}}}return r&&(n.aggregateRating={"@type":"AggregateRating",ratingValue:r.ratingValue,...r.reviewCount!=null&&{reviewCount:r.reviewCount},...r.ratingCount!=null&&{ratingCount:r.ratingCount},...r.bestRating!=null&&{bestRating:r.bestRating},...r.worstRating!=null&&{worstRating:r.worstRating}}),n};var O=V;export{O as default,V as generateVacationRentalSchema};
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Generate schema.org structured data for `VideoObject`, `Clip`, or
3
+ * `BroadcastEvent`.
4
+ *
5
+ * The `VideoOptions` input controls which type is produced and supports
6
+ * optional fields like `aggregateRating`, `reviews`, thumbnails and
7
+ * associated `Clip` or `BroadcastEvent` metadata. The result is a plain
8
+ * object ready to be stringified as JSON-LD for inclusion in a page.
9
+ *
10
+ * See `VideoOptions` below for accepted fields and shapes.
11
+ * @returns A JSON-LD compatible Video/Clip/BroadcastEvent object
12
+ */
13
+ interface ImageRef {
14
+ url: string;
15
+ width?: number;
16
+ height?: number;
17
+ }
18
+ interface PersonRef {
19
+ name: string;
20
+ url?: string;
21
+ }
22
+ interface OrgRef {
23
+ name: string;
24
+ url?: string;
25
+ }
26
+ interface RatingItem {
27
+ ratingValue: number | string;
28
+ bestRating?: number | string;
29
+ worstRating?: number | string;
30
+ }
31
+ interface ReviewItem {
32
+ author?: string | PersonRef;
33
+ datePublished?: string;
34
+ reviewBody?: string;
35
+ reviewRating?: RatingItem;
36
+ }
37
+ interface ClipOptions {
38
+ name?: string;
39
+ startOffset?: number;
40
+ endOffset?: number;
41
+ url?: string;
42
+ }
43
+ interface BroadcastEventOptions {
44
+ name?: string;
45
+ startDate?: string;
46
+ endDate?: string;
47
+ isLiveBroadcast?: boolean;
48
+ url?: string;
49
+ }
50
+ interface AggregateRatingOptions {
51
+ ratingValue: number | string;
52
+ reviewCount?: number;
53
+ ratingCount?: number;
54
+ bestRating?: number | string;
55
+ worstRating?: number | string;
56
+ }
57
+ interface VideoOptions {
58
+ type?: 'VideoObject' | 'Clip' | 'BroadcastEvent';
59
+ name: string;
60
+ description?: string;
61
+ thumbnail?: string | ImageRef | (string | ImageRef)[];
62
+ uploadDate?: string;
63
+ duration?: string;
64
+ contentUrl?: string;
65
+ embedUrl?: string;
66
+ clip?: ClipOptions;
67
+ broadcastEvent?: BroadcastEventOptions;
68
+ publisher?: string | OrgRef;
69
+ author?: string | PersonRef;
70
+ reviews?: ReviewItem[];
71
+ aggregateRating?: AggregateRatingOptions;
72
+ }
73
+ declare const generateVideoSchema: ({ type, name, description, thumbnail, uploadDate, duration, contentUrl, embedUrl, clip, broadcastEvent, publisher, author, reviews, aggregateRating, }: VideoOptions) => any;
74
+
75
+ export { generateVideoSchema as default, generateVideoSchema };
@@ -0,0 +1 @@
1
+ const I=t=>{if(t)return Array.isArray(t)?t.map(e=>typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}):typeof t=="string"?t:{"@type":"ImageObject",url:t.url,...t.width&&{width:t.width},...t.height&&{height:t.height}}},c=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},V=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Organization",name:t};const e={"@type":"Organization",name:t.name};return t.url&&(e.url=t.url),e},B=t=>{const e={"@type":"Review"};return t.author&&(e.author=c(t.author)),t.datePublished&&(e.datePublished=t.datePublished),t.reviewBody&&(e.reviewBody=t.reviewBody),t.reviewRating&&(e.reviewRating={"@type":"Rating",ratingValue:t.reviewRating.ratingValue,...t.reviewRating.bestRating!=null&&{bestRating:t.reviewRating.bestRating},...t.reviewRating.worstRating!=null&&{worstRating:t.reviewRating.worstRating}}),e},P=({type:t="VideoObject",name:e,description:o,thumbnail:p,uploadDate:l,duration:m,contentUrl:d,embedUrl:h,clip:s,broadcastEvent:r,publisher:b,author:O,reviews:g,aggregateRating:a})=>{const n={"@context":"https://schema.org","@type":t,name:e};o&&(n.description=o);const R=I(p);R&&(n.thumbnail=R),l&&(n.uploadDate=l),m&&(n.duration=m),d&&(n.contentUrl=d),h&&(n.embedUrl=h);const w=V(b);w&&(n.publisher=w);const y=c(O);if(y&&(n.author=y),s){const i={"@type":"Clip"};s.name&&(i.name=s.name),s.startOffset!=null&&(i.startOffset=s.startOffset),s.endOffset!=null&&(i.endOffset=s.endOffset),s.url&&(i.url=s.url),n.clip=i}if(r){const i={"@type":"BroadcastEvent"};r.name&&(i.name=r.name),r.startDate&&(i.startDate=r.startDate),r.endDate&&(i.endDate=r.endDate),r.isLiveBroadcast!=null&&(i.isLiveBroadcast=r.isLiveBroadcast),r.url&&(i.url=r.url),n.broadcaster=i}if(g&&g.length>0){const i=g.map(B);if(n.review=i,!a){const f=g.map(u=>u.reviewRating?Number(u.reviewRating.ratingValue):NaN).filter(u=>!Number.isNaN(u));if(f.length>0){const u=f.reduce((v,C)=>v+C,0);n.aggregateRating={"@type":"AggregateRating",ratingValue:u/f.length,reviewCount:g.length,ratingCount:f.length}}}}return a&&(n.aggregateRating={"@type":"AggregateRating",ratingValue:a.ratingValue,...a.reviewCount!=null&&{reviewCount:a.reviewCount},...a.ratingCount!=null&&{ratingCount:a.ratingCount},...a.bestRating!=null&&{bestRating:a.bestRating},...a.worstRating!=null&&{worstRating:a.worstRating}}),n};var D=P;export{D as default,P as generateVideoSchema};
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Generic Cache Utilities
3
+ *
4
+ * A lightweight localStorage-backed cache used by module-level cache wrappers.
5
+ * Key behaviors:
6
+ * - Default expiration: 1 day (configurable per cache)
7
+ * - Search and filter requests bypass the cache and always fetch fresh data
8
+ * - Lists are stored as a normalized map (id -> item) for fast lookups
9
+ * - Provides both synchronous reads (`getCachedDataSync`) and async reads
10
+ * with API fallback (`getCachedData`)
11
+ * - Single-item helpers available (`getCachedSingleItem`, `getCachedSingleItemSync`)
12
+ *
13
+ * The main async helper `getCachedData` now accepts a single options object
14
+ * (`GetCachedDataOptions`) which includes `config`, optional `searchQuery`,
15
+ * `filters`, `pageLimit` and extra `params` for the list API. Module cache
16
+ * wrappers should call `getCachedData({ config, searchQuery, filters, pageLimit, params, headers })`.
17
+ * Both `getCachedData` and `getCachedSingleItem` accept an optional `headers`
18
+ * object which will be forwarded to the underlying `fetchData` calls.
19
+ *
20
+ * Organization:
21
+ * - Types
22
+ * - List Cache Functions
23
+ * - Single Item Cache Functions
24
+ * - Cache Utilities
25
+ */
26
+ interface CacheConfig {
27
+ cacheKey: string;
28
+ apiUrl: string;
29
+ expirationMs?: number;
30
+ responseKey?: string;
31
+ params?: Record<string, unknown>;
32
+ }
33
+ interface GetCachedDataOptions {
34
+ config: CacheConfig;
35
+ params?: Record<string, unknown>;
36
+ headers?: Record<string, string>;
37
+ }
38
+ interface CachedData<T> {
39
+ items: Record<string, T>;
40
+ cachedAt: string;
41
+ count: number;
42
+ currentPage?: number;
43
+ }
44
+ interface CachedSingleData<T> {
45
+ item: T;
46
+ cachedAt: string;
47
+ }
48
+ interface ListResponse<T> {
49
+ count: number;
50
+ items: T[];
51
+ currentPage?: number;
52
+ }
53
+ /**
54
+ * Get synchronous cached data for a module
55
+ * Returns empty result if cache is missing or stale
56
+ *
57
+ * @param cacheKey - localStorage key for the cache
58
+ * @param expirationMs - Cache expiration time in milliseconds (default: 1 day)
59
+ * @returns {count: number, items: T[]} - Cached data or empty array
60
+ *
61
+ * @example
62
+ * const users = getCachedDataSync<UserBE>(LS_KEYS.USERS);
63
+ * if (users.items.length > 0) {
64
+ * console.log(users.items[0].name);
65
+ * }
66
+ */
67
+ declare const getCachedDataSync: <T>(cacheKey: string, expirationMs?: number) => ListResponse<T>;
68
+ /**
69
+ * Get cached data with API fallback for a module
70
+ *
71
+ * Accepts a single `GetCachedDataOptions` object. The function will return
72
+ * cached results when fresh, or fetch from the API when the cache is stale
73
+ * or when `searchQuery`/`filters` are present (those always bypass cache).
74
+ *
75
+ * @param opts - `GetCachedDataOptions` containing `config`, optional
76
+ * `searchQuery`, `filters`, `pageLimit`, and extra `params`
77
+ * @returns Promise<{count: number, items: T[]}> - Cached or fresh data
78
+ *
79
+ * @example
80
+ * const config = { cacheKey: LS_KEYS.USERS, apiUrl: USER_API_ROUTES.LIST, responseKey: 'users' };
81
+ * // Basic usage (reads cache if fresh)
82
+ * const users = await getCachedData<UserBE>({ config });
83
+ *
84
+ * // With search (bypasses cache)
85
+ * const filtered = await getCachedData<UserBE>({ config, searchQuery: 'John' });
86
+ *
87
+ * // With filters and custom page limit
88
+ * const active = await getCachedData<UserBE>({ config, filters: { enabled: true }, pageLimit: 200 });
89
+ */
90
+ declare const getCachedData: <T>(opts: GetCachedDataOptions) => Promise<ListResponse<T>>;
91
+ /**
92
+ * Get single cached item by ID from a list cache
93
+ *
94
+ * @param cacheKey - localStorage key for the cache
95
+ * @param itemId - ID of the item to retrieve
96
+ * @returns T | null - Cached item or null
97
+ *
98
+ * @example
99
+ * const user = getCachedItemById<UserBE>(LS_KEYS.USERS, 'user-123');
100
+ * if (user) {
101
+ * console.log(user.name);
102
+ * }
103
+ */
104
+ declare const getCachedItemById: <T extends {
105
+ id: string;
106
+ }>(cacheKey: string, itemId: string) => T | null;
107
+ /**
108
+ * Get synchronous cached single item
109
+ * Returns null if cache is missing or stale
110
+ *
111
+ * @param cacheKey - localStorage key for the cache
112
+ * @param expirationMs - Cache expiration time in milliseconds (default: 1 day)
113
+ * @returns T | null - Cached item or null
114
+ *
115
+ * @example
116
+ * const workspace = getCachedSingleItemSync<WorkspaceBE>(LS_KEYS.WORKSPACE);
117
+ * if (workspace) {
118
+ * console.log(workspace.name);
119
+ * }
120
+ */
121
+ declare const getCachedSingleItemSync: <T>(cacheKey: string, expirationMs?: number) => T | null;
122
+ /**
123
+ * Get cached single item with API fallback
124
+ * Useful for workspace, profile, settings, etc.
125
+ *
126
+ * @param config - Cache configuration (cacheKey, apiUrl, expirationMs, responseKey)
127
+ * @param params - Optional query parameters for API request
128
+ * @returns Promise<T | null> - Cached or fresh item
129
+ *
130
+ * @example
131
+ * const config = { cacheKey: LS_KEYS.WORKSPACE, apiUrl: '/api/workspace', responseKey: 'workspace' };
132
+ * const workspace = await getCachedSingleItem<WorkspaceBE>(config, { subdomain: 'school1' });
133
+ */
134
+ declare const getCachedSingleItem: <T>(config: CacheConfig, params?: Record<string, string>, headers?: Record<string, string>) => Promise<T | null>;
135
+ /**
136
+ * Get cached data but fall back to the API when sync cache is empty.
137
+ *
138
+ * This helper first performs a quick synchronous cache check via
139
+ * `getCachedDataSync`. If that returns an empty result it will call
140
+ * the async `getCachedData` to fetch fresh data from the API and return
141
+ * the result. Use this when callers want a fast-path cache read but also
142
+ * need the ability to recall the API transparently when cache is missing.
143
+ */
144
+ declare const getCachedDataWithFallback: <T>(config: CacheConfig, params?: Record<string, unknown>, headers?: Record<string, string>) => Promise<ListResponse<T>>;
145
+ /**
146
+ * Async variant to get a single item by ID with API fallback.
147
+ *
148
+ * Unlike `getCachedItemById` (sync), this function will call the API
149
+ * (via `getCachedDataWithFallback`) when the item is not available in
150
+ * the local cache. Requires a full `CacheConfig` so the API URL is
151
+ * available for fetching.
152
+ */
153
+ declare const getCachedItemByIdAsync: <T extends {
154
+ id: string;
155
+ }>(config: CacheConfig, itemId: string, params?: Record<string, unknown>, headers?: Record<string, string>) => Promise<T | null>;
156
+ /**
157
+ * Invalidate (remove) cache for a module
158
+ * Useful after create/update/delete operations
159
+ *
160
+ * @param cacheKey - localStorage key for the cache
161
+ *
162
+ * @example
163
+ * invalidateCache(LS_KEYS.USERS);
164
+ * const freshUsers = await getCachedData(config);
165
+ */
166
+ declare const invalidateCache: (cacheKey: string) => void;
167
+ /**
168
+ * Preload cache for a module
169
+ * Useful to call on app initialization or login
170
+ *
171
+ * @param config - Cache configuration
172
+ * @returns Promise<ListResponse<T>> - Preloaded data
173
+ *
174
+ * @example
175
+ * const config = { cacheKey: LS_KEYS.USERS, apiUrl: USER_API_ROUTES.LIST, responseKey: 'users' };
176
+ * await preloadCache(config);
177
+ */
178
+ declare const preloadCache: <T>(config: CacheConfig) => Promise<ListResponse<T>>;
179
+ /**
180
+ * Check if cache is stale (older than expiration time)
181
+ *
182
+ * @param cacheKey - localStorage key for the cache
183
+ * @param expirationMs - Cache expiration time in milliseconds (default: 1 day)
184
+ * @returns boolean - True if cache is stale or doesn't exist
185
+ *
186
+ * @example
187
+ * if (isCacheStale(LS_KEYS.USERS)) {
188
+ * await getCachedData(config); // This will fetch fresh data
189
+ * }
190
+ */
191
+ declare const isCacheStale: (cacheKey: string, expirationMs?: number) => boolean;
192
+
193
+ export { type CacheConfig, type CachedData, type CachedSingleData, type GetCachedDataOptions, type ListResponse, getCachedData, getCachedDataSync, getCachedDataWithFallback, getCachedItemById, getCachedItemByIdAsync, getCachedSingleItem, getCachedSingleItemSync, invalidateCache, isCacheStale, preloadCache };
@@ -0,0 +1 @@
1
+ import{API_METHODS as x}from"../constants/api-methods";import{ONE_DAY_IN_MS as A}from"../constants/cache-time";import{fetchData as O}from"./fetch-data";import{getStorageValue as w}from"../local-storage/get-storage-value";import{setStorageValue as q}from"../local-storage/set-storage-value";function k(t){if(!t||typeof t!="object")return!1;const n=t;return Array.isArray(n.items)&&typeof n.cachedAt=="string"&&typeof n.count=="number"}function M(t){if(!t||typeof t!="object")return!1;const n=t;return n.items!==void 0&&typeof n.items=="object"&&!Array.isArray(n.items)&&typeof n.cachedAt=="string"}const z=(t,n=A)=>{try{const e=w(t);if(e==null)return{count:0,items:[]};const s=new Date().getTime();if(k(e)){const r=new Date(e.cachedAt).getTime();return s-r<n?{count:e.count??e.items.length,items:e.items,currentPage:e.currentPage??void 0}:{count:0,items:[]}}if(M(e)){const r=new Date(e.cachedAt).getTime();if(s-r<n){const a=Object.values(e.items||{});return{count:e.count??a.length,items:a,currentPage:e.currentPage??void 0}}return{count:0,items:[]}}return{count:0,items:[]}}catch(e){return console.error(`Error getting cached data for ${t}:`,e),{count:0,items:[]}}},J=async t=>{const{config:n,params:e,headers:s}=t,{cacheKey:r,apiUrl:u,responseKey:a}=n,T=n.expirationMs??A,D=e?.pageLimit?.toString()??"100",$=e?.currentPage?.toString()??"1",p=e?.filters,l=e?.searchQuery;try{if(l&&l.trim()||e?.filters){const o={...e||{}};o.filters!==void 0&&delete o.filters;const f=Object.keys(o).reduce((i,h)=>(i[h]=String(o[h]),i),{}),y={pageLimit:D,currentPage:$,...l&&{searchQuery:l},...p?Object.keys(p).reduce((i,h)=>(i[h]=String(p[h]),i),{}):{},...f},P=new URLSearchParams(y),d=await O({url:`${u}?${P.toString()}`,method:x.GET,headers:s}),g=a?d?.data?.[a]:d?.data?.items||d?.data,m=Array.isArray(g)?g:[],R=d?.data?.currentPage,L=R==null?void 0:Number(R),N=e?.currentPage?Number(e.currentPage):void 0;return{count:d?.data?.count||m.length,items:m,currentPage:L??N}}const c=w(r),U=new Date().getTime();if(k(c)){const o=new Date(c.cachedAt).getTime();if(U-o<T)return{count:c.count,items:c.items,currentPage:c.currentPage??void 0}}if(M(c)){const o=new Date(c.cachedAt).getTime();if(U-o<T){const y=Object.values(c.items||{}),P=c.count,d=c.currentPage,g=e?.currentPage?Number(e.currentPage):void 0;if(g!==void 0&&g!==d){const m={...e||{}};m.filters!==void 0&&delete m.filters;const R=Object.keys(m).reduce((C,S)=>(C[S]=String(m[S]),C),{}),L={pageLimit:D,currentPage:String(g),...R},N=new URLSearchParams(L),i=await O({url:`${u}?${N.toString()}`,method:x.GET,headers:s}),h=(a?i?.data?.[a]:i?.data?.items)||i?.data,te=Array.isArray(h)?h:[],W=i?.data?.count,_=i?.data?.currentPage,ne=_==null?void 0:Number(_),re=te.reduce((C,S,se)=>{const Y=S,ae=Y?.id??Y?.uid??se,ce=String(ae);return C[ce]=S,C},{}),K=Object.assign({},c.items||{},re),Q=Object.values(K),V=W??Q.length,H=ne??g;if(Array.isArray(h)&&typeof W=="number"){const C={items:K,cachedAt:new Date().toISOString(),count:V,currentPage:H};q(r,C)}return{count:V,items:Q,currentPage:H}}return{count:P??y.length,items:y,currentPage:c.currentPage??void 0}}}const I={...e||{}};I.filters!==void 0&&delete I.filters;const X=Object.keys(I).reduce((o,f)=>(o[f]=String(I[f]),o),{}),Z={pageLimit:D,currentPage:$,...X},ee=new URLSearchParams(Z),b=await O({url:`${u}?${ee.toString()}`,method:x.GET,headers:s}),j=(a?b?.data?.[a]:b?.data?.items)||b?.data,G=Array.isArray(j)?j:[],E=b?.data?.count,v=b?.data?.currentPage,B=v==null?void 0:Number(v),F=e?.currentPage?Number(e.currentPage):void 0;if(Array.isArray(j)&&typeof E=="number"){const f={items:G.reduce((y,P,d)=>{const g=P,m=g?.id??g?.uid??d,R=String(m);return y[R]=P,y},{}),cachedAt:new Date().toISOString(),count:E,currentPage:B??F};q(r,f)}return{count:E,items:G,currentPage:B??F}}catch(c){return console.error(`Error fetching data for ${r}:`,c),{count:0,items:[]}}},fe=(t,n)=>{if(!n)return null;try{const e=w(t);if(k(e))return e.items.find(r=>r.id===n)||null;if(M(e))return e.items&&e.items[n]||null;const{items:s}=z(t);return s.find(r=>r.id===n)||null}catch(e){return console.error(`Error getting cached item by ID for ${t}:`,e),null}},Te=(t,n=A)=>{try{const e=w(t);if(!e)return null;const s=new Date().getTime(),r=new Date(e.cachedAt).getTime();return s-r<n?e.item:null}catch(e){return console.error(`Error getting cached single item for ${t}:`,e),null}},pe=async(t,n,e)=>{const{cacheKey:s,apiUrl:r}=t,u=t.expirationMs??A;try{const a=w(s),T=new Date().getTime();if(a){const l=new Date(a.cachedAt).getTime();if(T-l<u)return a.item}const D=n?`?${new URLSearchParams(n).toString()}`:"",p=(await O({url:`${r}${D}`,method:x.GET,headers:e}))?.data||null;if(p){const l={item:p,cachedAt:new Date().toISOString()};q(s,l)}return p}catch(a){return console.error(`Error fetching single item for ${s}:`,a),null}},oe=async(t,n,e)=>{const s=t.expirationMs??A;try{const r=z(t.cacheKey,s);return r&&r.count>0&&Array.isArray(r.items)&&r.items.length>0?r:await J({config:t,params:n,headers:e})}catch(r){return console.error(`Error in getCachedDataWithFallback for ${t.cacheKey}:`,r),{count:0,items:[]}}},ye=async(t,n,e,s)=>{if(!n)return null;try{const r=w(t.cacheKey);if(k(r)){const a=r.items.find(T=>T.id===n);if(a)return a}return M(r)&&r.items&&r.items[n]?r.items[n]:(await oe(t,e,s)).items.find(a=>a.id===n)||null}catch(r){return console.error(`Error in getCachedItemByIdAsync for ${t.cacheKey}:`,r),null}},Ce=t=>{try{localStorage.removeItem(t)}catch(n){console.error(`Error invalidating cache for ${t}:`,n)}},we=async t=>J({config:t}),Pe=(t,n=A)=>{try{const e=w(t);if(e==null)return!0;if(k(e)||M(e)){const s=new Date(e.cachedAt).getTime();return new Date().getTime()-s>=n}return!0}catch(e){return console.error(`Error checking cache staleness for ${t}:`,e),!0}};export{J as getCachedData,z as getCachedDataSync,oe as getCachedDataWithFallback,fe as getCachedItemById,ye as getCachedItemByIdAsync,pe as getCachedSingleItem,Te as getCachedSingleItemSync,Ce as invalidateCache,Pe as isCacheStale,we as preloadCache};
@@ -0,0 +1,11 @@
1
+ interface Return {
2
+ option: string;
3
+ }
4
+ /**
5
+ * Returns available page-limit dropdown options based on total record count.
6
+ * @param totalRecords - Total number of records.
7
+ * @returns Array of page-limit option objects.
8
+ */
9
+ declare const getAvailablePageLimits: (totalRecords: number) => Array<Return>;
10
+
11
+ export { getAvailablePageLimits };
@@ -0,0 +1 @@
1
+ import{dynamicPageLimit as o}from"./dynamic-page-limit";const s=n=>{const i=[10,15,25,100];if(n<i[0])return o([i[0]]);const a=i.filter(r=>r<n),t=i.find(r=>r>=n),e=[...a];return t&&!e.includes(t)&&e.push(t),o(e)};export{s as getAvailablePageLimits};
@@ -0,0 +1,15 @@
1
+ import { CalendarDay } from './type.mjs';
2
+
3
+ interface Params {
4
+ month: number;
5
+ year: number;
6
+ }
7
+ /**
8
+ * Generates an array of CalendarDay objects for the current month.
9
+ * @param params.month - Month number (1-based).
10
+ * @param params.year - Full year number.
11
+ * @returns Array of CalendarDay objects for the month.
12
+ */
13
+ declare const getCalendarCurrentMonth: ({ month, year, }: Params) => Array<CalendarDay>;
14
+
15
+ export { getCalendarCurrentMonth };
@@ -1 +1 @@
1
- var f=Object.create;var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var p=(r,a)=>{for(var t in a)o(r,t,{get:a[t],enumerable:!0})},m=(r,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of D(a))!M.call(r,e)&&e!==t&&o(r,e,{get:()=>a[e],enumerable:!(n=u(a,e))||n.enumerable});return r};var C=(r,a,t)=>(t=r!=null?f(d(r)):{},m(a||!r||!r.__esModule?o(t,"default",{value:r,enumerable:!0}):t,r)),h=r=>m(o({},"__esModule",{value:!0}),r);var Y={};p(Y,{getCalendarCurrentMonth:()=>i});module.exports=h(Y);var y=C(require("dayjs")),s=require("./get-number-of-days-in-month");const i=({month:r,year:a})=>{const t=new Date().getDate();return[...Array((0,s.getNumberOfDaysInMonth)({year:a,month:r}))].map((n,e)=>({date:(0,y.default)(`${a}-${r}-${e+1}`).format("YYYY-MM-DD"),dayOfMonth:e+1,isCurrentMonth:!0,isToday:t===e+1}))};0&&(module.exports={getCalendarCurrentMonth});
1
+ var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var d=(a,r)=>{for(var t in r)m(a,t,{get:r[t],enumerable:!0})},f=(a,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of u(r))!D.call(a,e)&&e!==t&&m(a,e,{get:()=>r[e],enumerable:!(n=y(r,e))||n.enumerable});return a};var M=a=>f(m({},"__esModule",{value:!0}),a);var c={};d(c,{getCalendarCurrentMonth:()=>C});module.exports=M(c);var s=require("./get-number-of-days-in-month");const C=({month:a,year:r})=>{const t=require("dayjs"),n=new Date().getDate();return[...Array((0,s.getNumberOfDaysInMonth)({year:r,month:a}))].map((e,o)=>({date:t(`${r}-${a}-${o+1}`).format("YYYY-MM-DD"),dayOfMonth:o+1,isCurrentMonth:!0,isToday:n===o+1}))};0&&(module.exports={getCalendarCurrentMonth});
@@ -0,0 +1 @@
1
+ import{getNumberOfDaysInMonth as o}from"./get-number-of-days-in-month";const D=({month:a,year:t})=>{const e=require("dayjs"),n=new Date().getDate();return[...Array(o({year:t,month:a}))].map((m,r)=>({date:e(`${t}-${a}-${r+1}`).format("YYYY-MM-DD"),dayOfMonth:r+1,isCurrentMonth:!0,isToday:n===r+1}))};export{D as getCalendarCurrentMonth};
@@ -0,0 +1,15 @@
1
+ import { CalendarDay } from './type.mjs';
2
+
3
+ interface Params {
4
+ month: number;
5
+ year: number;
6
+ }
7
+ /**
8
+ * Generates a full calendar month grid including overflow days from adjacent months.
9
+ * @param params.month - Month index (0-based).
10
+ * @param params.year - Full year number.
11
+ * @returns Array of CalendarDay objects for the entire grid.
12
+ */
13
+ declare const getCalendarDates: ({ month, year, }: Params) => Array<CalendarDay>;
14
+
15
+ export { getCalendarDates };
@@ -1 +1 @@
1
- var u=Object.create;var e=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var D=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},m=(t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of C(r))!l.call(t,n)&&n!==o&&e(t,n,{get:()=>r[n],enumerable:!(a=f(r,n))||a.enumerable});return t};var s=(t,r,o)=>(o=t!=null?u(M(t)):{},m(r||!t||!t.__esModule?e(o,"default",{value:t,enumerable:!0}):o,t)),g=t=>m(e({},"__esModule",{value:!0}),t);var P={};D(P,{getCalendarDates:()=>x});module.exports=g(P);var d=s(require("dayjs")),h=s(require("dayjs/plugin/weekday")),i=require("./get-calendar-previous-month"),p=require("./get-calendar-next-month"),y=require("./get-calendar-current-month");d.default.extend(h.default);const x=({month:t,year:r})=>{const o=t+1,a=(0,y.getCalendarCurrentMonth)({month:o,year:r}),n=(0,i.getCalendarPreviousMonth)({currentMonthDays:a,month:o,year:r}),c=(0,p.getCalendarNextMonth)({currentMonthDays:a,month:o,year:r});return[...n,...a,...c]};0&&(module.exports={getCalendarDates});
1
+ var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var C=(n,t)=>{for(var e in t)s(n,e,{get:t[e],enumerable:!0})},M=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of y(t))!p.call(n,r)&&r!==e&&s(n,r,{get:()=>t[r],enumerable:!(o=i(t,r))||o.enumerable});return n};var l=n=>M(s({},"__esModule",{value:!0}),n);var f={};C(f,{getCalendarDates:()=>D});module.exports=l(f);var m=require("./get-calendar-previous-month"),d=require("./get-calendar-next-month"),h=require("./get-calendar-current-month");const D=({month:n,year:t})=>{const e=require("dayjs"),o=require("dayjs/plugin/weekday");e.extend(o);const r=n+1,a=(0,h.getCalendarCurrentMonth)({month:r,year:t}),c=(0,m.getCalendarPreviousMonth)({currentMonthDays:a,month:r,year:t}),u=(0,d.getCalendarNextMonth)({currentMonthDays:a,month:r,year:t});return[...c,...a,...u]};0&&(module.exports={getCalendarDates});
@@ -0,0 +1 @@
1
+ import{getCalendarPreviousMonth as d}from"./get-calendar-previous-month";import{getCalendarNextMonth as h}from"./get-calendar-next-month";import{getCalendarCurrentMonth as c}from"./get-calendar-current-month";const l=({month:e,year:t})=>{const o=require("dayjs"),a=require("dayjs/plugin/weekday");o.extend(a);const n=e+1,r=c({month:n,year:t}),s=d({currentMonthDays:r,month:n,year:t}),m=h({currentMonthDays:r,month:n,year:t});return[...s,...r,...m]};export{l as getCalendarDates};
@@ -0,0 +1,17 @@
1
+ import { CalendarDay } from './type.mjs';
2
+
3
+ interface Params {
4
+ currentMonthDays: Array<CalendarDay>;
5
+ month: number;
6
+ year: number;
7
+ }
8
+ /**
9
+ * Generates the overflow CalendarDay entries from the next month to fill the grid.
10
+ * @param params.currentMonthDays - Days of the current month.
11
+ * @param params.month - Month number (1-based).
12
+ * @param params.year - Full year number.
13
+ * @returns Array of CalendarDay objects for the overflow days.
14
+ */
15
+ declare const getCalendarNextMonth: ({ year, month, currentMonthDays, }: Params) => Array<CalendarDay>;
16
+
17
+ export { getCalendarNextMonth };
@@ -1 +1 @@
1
- var f=Object.create;var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var i=(a,r)=>{for(var t in r)o(a,t,{get:r[t],enumerable:!0})},s=(a,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of M(r))!$.call(a,e)&&e!==t&&o(a,e,{get:()=>r[e],enumerable:!(n=l(r,e))||n.enumerable});return a};var c=(a,r,t)=>(t=a!=null?f(D(a)):{},s(r||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),u=a=>s(o({},"__esModule",{value:!0}),a);var C={};i(C,{getCalendarNextMonth:()=>p});module.exports=u(C);var m=c(require("dayjs")),d=require("./get-week-day");const p=({year:a,month:r,currentMonthDays:t})=>{const n=(0,d.getWeekday)(`${a}-${r}-${t.length}`),e=(0,m.default)(`${a}-${r}-01`).add(1,"month"),h=n&&7-n;return[...Array(h)].map((b,y)=>({date:(0,m.default)(`${e.year()}-${e.month()+1}-${y+1}`).format("YYYY-MM-DD"),dayOfMonth:y+1,isCurrentMonth:!1,isToday:!1}))};0&&(module.exports={getCalendarNextMonth});
1
+ var o=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var M=(r,a)=>{for(var t in a)o(r,t,{get:a[t],enumerable:!0})},D=(r,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of f(a))!l.call(r,e)&&e!==t&&o(r,e,{get:()=>a[e],enumerable:!(n=h(a,e))||n.enumerable});return r};var $=r=>D(o({},"__esModule",{value:!0}),r);var i={};M(i,{getCalendarNextMonth:()=>c});module.exports=$(i);var m=require("./get-week-day");const c=({year:r,month:a,currentMonthDays:t})=>{const n=require("dayjs"),e=(0,m.getWeekday)(`${r}-${a}-${t.length}`),s=n(`${r}-${a}-01`).add(1,"month"),d=e&&7-e;return[...Array(d)].map((u,y)=>({date:n(`${s.year()}-${s.month()+1}-${y+1}`).format("YYYY-MM-DD"),dayOfMonth:y+1,isCurrentMonth:!1,isToday:!1}))};0&&(module.exports={getCalendarNextMonth});
@@ -0,0 +1 @@
1
+ import{getWeekday as m}from"./get-week-day";const M=({year:r,month:e,currentMonthDays:s})=>{const t=require("dayjs"),a=m(`${r}-${e}-${s.length}`),n=t(`${r}-${e}-01`).add(1,"month"),y=a&&7-a;return[...Array(y)].map((d,o)=>({date:t(`${n.year()}-${n.month()+1}-${o+1}`).format("YYYY-MM-DD"),dayOfMonth:o+1,isCurrentMonth:!1,isToday:!1}))};export{M as getCalendarNextMonth};
@@ -0,0 +1,17 @@
1
+ import { CalendarDay } from './type.mjs';
2
+
3
+ interface Params {
4
+ currentMonthDays: Array<CalendarDay>;
5
+ month: number;
6
+ year: number;
7
+ }
8
+ /**
9
+ * Generates the overflow CalendarDay entries from the previous month to fill the grid.
10
+ * @param params.currentMonthDays - Days of the current month.
11
+ * @param params.month - Month number (1-based).
12
+ * @param params.year - Full year number.
13
+ * @returns Array of CalendarDay objects for the overflow days.
14
+ */
15
+ declare const getCalendarPreviousMonth: ({ currentMonthDays, month, year, }: Params) => Array<CalendarDay>;
16
+
17
+ export { getCalendarPreviousMonth };
@@ -1 +1 @@
1
- var i=Object.create;var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var l=(a,r)=>{for(var t in r)n(a,t,{get:r[t],enumerable:!0})},f=(a,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of M(r))!D.call(a,e)&&e!==t&&n(a,e,{get:()=>r[e],enumerable:!(o=u(r,e))||o.enumerable});return a};var p=(a,r,t)=>(t=a!=null?i(c(a)):{},f(r||!a||!a.__esModule?n(t,"default",{value:a,enumerable:!0}):t,a)),b=a=>f(n({},"__esModule",{value:!0}),a);var C={};l(C,{getCalendarPreviousMonth:()=>v});module.exports=b(C);var s=p(require("dayjs")),h=require("./get-week-day");const v=({currentMonthDays:a,month:r,year:t})=>{const o=(0,h.getWeekday)(a[0].date),e=(0,s.default)(`${t}-${r}-01`).subtract(1,"month"),y=o?o-1:6,m=(0,s.default)(a[0].date).subtract(y,"day").date();return[...Array(y)].map(($,d)=>({date:(0,s.default)(`${e.year()}-${e.month()+1}-${m+d}`).format("YYYY-MM-DD"),dayOfMonth:m+d,isCurrentMonth:!1,isToday:!1}))};0&&(module.exports={getCalendarPreviousMonth});
1
+ var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var M=(r,a)=>{for(var e in a)n(r,e,{get:a[e],enumerable:!0})},c=(r,a,e,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let t of u(a))!f.call(r,t)&&t!==e&&n(r,t,{get:()=>a[t],enumerable:!(o=i(a,t))||o.enumerable});return r};var D=r=>c(n({},"__esModule",{value:!0}),r);var b={};M(b,{getCalendarPreviousMonth:()=>l});module.exports=D(b);var h=require("./get-week-day");const l=({currentMonthDays:r,month:a,year:e})=>{const o=require("dayjs"),t=(0,h.getWeekday)(r[0].date),s=o(`${e}-${a}-01`).subtract(1,"month"),y=t?t-1:6,d=o(r[0].date).subtract(y,"day").date();return[...Array(y)].map((p,m)=>({date:o(`${s.year()}-${s.month()+1}-${d+m}`).format("YYYY-MM-DD"),dayOfMonth:d+m,isCurrentMonth:!1,isToday:!1}))};0&&(module.exports={getCalendarPreviousMonth});
@@ -0,0 +1 @@
1
+ import{getWeekday as m}from"./get-week-day";const M=({currentMonthDays:r,month:y,year:d})=>{const a=require("dayjs"),t=m(r[0].date),e=a(`${d}-${y}-01`).subtract(1,"month"),o=t?t-1:6,n=a(r[0].date).subtract(o,"day").date();return[...Array(o)].map((h,s)=>({date:a(`${e.year()}-${e.month()+1}-${n+s}`).format("YYYY-MM-DD"),dayOfMonth:n+s,isCurrentMonth:!1,isToday:!1}))};export{M as getCalendarPreviousMonth};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the current 4-digit year.
3
+ * @returns The current year as a number.
4
+ */
5
+ declare const getCurrentYear: () => number;
6
+
7
+ export { getCurrentYear };
@@ -0,0 +1 @@
1
+ const e=()=>new Date().getFullYear();export{e as getCurrentYear};
@@ -0,0 +1,10 @@
1
+ interface IDayMap {
2
+ /**
3
+ *
4
+ */
5
+ [key: number]: string;
6
+ }
7
+ declare const dayMap: IDayMap;
8
+ declare const getDayName: (num: number) => string;
9
+
10
+ export { type IDayMap, dayMap, getDayName };
@@ -0,0 +1 @@
1
+ const e={0:"Sunday",1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday"},y=a=>e[a];export{e as dayMap,y as getDayName};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns the dial code for a given ISO country code.
3
+ * @param countryCode - The ISO country code.
4
+ * @returns The dial code string, or undefined if not found.
5
+ */
6
+ declare const getDialCode: (countryCode: string) => string | undefined;
7
+
8
+ export { getDialCode };
@@ -0,0 +1 @@
1
+ import{dialCodeMap as t}from"../constants/dial-codes";const i=e=>t.get(e);export{i as getDialCode};
@@ -0,0 +1,13 @@
1
+ interface Params {
2
+ firstName: string;
3
+ lastName: string;
4
+ }
5
+ /**
6
+ * Combines first and last name into a full name string.
7
+ * @param params.firstName - The first name.
8
+ * @param params.lastName - The last name.
9
+ * @returns The combined full name.
10
+ */
11
+ declare const getFullName: ({ firstName, lastName }: Params) => string;
12
+
13
+ export { getFullName };
@@ -0,0 +1 @@
1
+ const r=({firstName:a,lastName:t})=>`${a} ${t}`;export{r as getFullName};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A util function to get current window href
3
+ *
4
+ * @returns string - https://taimoor.io/
5
+ * @author Taimoor Khan
6
+ * @remarks Taimoor Resume 4
7
+ */
8
+ /** End file docs */
9
+ declare const getHref: () => string;
10
+
11
+ export { getHref };
@@ -0,0 +1 @@
1
+ const o=()=>window&&window.location.href;export{o as getHref};
@@ -0,0 +1,10 @@
1
+ interface IMonthMap {
2
+ /**
3
+ *
4
+ */
5
+ [key: number]: string;
6
+ }
7
+ declare const monthMap: IMonthMap;
8
+ declare const getMonthName: (num: number) => string;
9
+
10
+ export { type IMonthMap, getMonthName, monthMap };
@@ -0,0 +1 @@
1
+ const r={0:"January",1:"February",2:"March",3:"April",4:"May",5:"June",6:"July",7:"August",8:"September",9:"October",10:"November",11:"December"},t=e=>r[e];export{t as getMonthName,r as monthMap};
@@ -0,0 +1,15 @@
1
+ interface IMonthNameMap {
2
+ /**
3
+ *
4
+ */
5
+ [key: string]: number;
6
+ }
7
+ declare const monthNameMap: IMonthNameMap;
8
+ /**
9
+ * Get the UTC month number (0-11) from a month name
10
+ * @param monthName - The name of the month (case-insensitive)
11
+ * @returns The UTC month number (0-11), or -1 if the month name is invalid
12
+ */
13
+ declare const getMonthNumber: (monthName: string) => number;
14
+
15
+ export { type IMonthNameMap, getMonthNumber, monthNameMap };
@@ -0,0 +1 @@
1
+ const r={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},n=t=>{const e=t.toLowerCase().trim();return r[e]!==void 0?r[e]:-1};export{n as getMonthNumber,r as monthNameMap};
@@ -0,0 +1,13 @@
1
+ interface Params {
2
+ year: number;
3
+ month: number;
4
+ }
5
+ /**
6
+ * Returns the number of days in a given month and year.
7
+ * @param params.year - The year.
8
+ * @param params.month - The month number (1-based).
9
+ * @returns Number of days in the month.
10
+ */
11
+ declare const getNumberOfDaysInMonth: ({ year, month }: Params) => number;
12
+
13
+ export { getNumberOfDaysInMonth };