@react-pakistan/util-functions 1.25.90 → 2.0.0

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 (412) hide show
  1. package/README.md +74 -315
  2. package/constants/api-methods.d.ts +3 -1
  3. package/constants/api-methods.js +1 -15
  4. package/constants/cache-time.d.ts +7 -5
  5. package/constants/cache-time.js +1 -8
  6. package/constants/countries-timezones.d.ts +4 -2
  7. package/constants/countries-timezones.js +1 -1411
  8. package/constants/currencies.d.ts +4 -2
  9. package/constants/currencies.js +1 -1076
  10. package/constants/dial-codes.d.ts +5 -3
  11. package/constants/dial-codes.js +1 -1216
  12. package/constants/layout-direction.d.ts +3 -1
  13. package/constants/layout-direction.js +1 -8
  14. package/constants/react-pakistan-meta.d.ts +4 -2
  15. package/constants/react-pakistan-meta.js +1 -35
  16. package/constants/react-pakistan.d.ts +5 -3
  17. package/constants/react-pakistan.js +12 -104
  18. package/constants/select-value-delimiter.d.ts +3 -1
  19. package/constants/select-value-delimiter.js +1 -13
  20. package/constants/social-media-colors.d.ts +3 -1
  21. package/constants/social-media-colors.js +1 -42
  22. package/constants/social-media-sizes.d.ts +6 -4
  23. package/constants/social-media-sizes.js +1 -327
  24. package/constants/user-roles.d.ts +3 -1
  25. package/constants/user-roles.js +1 -9
  26. package/edu-pilot-pro/types/academics.d.ts +2 -266
  27. package/edu-pilot-pro/types/academics.js +1 -9
  28. package/edu-pilot-pro/types/admission.d.ts +803 -10
  29. package/edu-pilot-pro/types/admission.js +1 -7
  30. package/edu-pilot-pro/types/communication.d.ts +2 -165
  31. package/edu-pilot-pro/types/communication.js +1 -8
  32. package/edu-pilot-pro/types/enums.d.ts +30 -28
  33. package/edu-pilot-pro/types/enums.js +1 -445
  34. package/edu-pilot-pro/types/finance.d.ts +2 -128
  35. package/edu-pilot-pro/types/finance.js +1 -8
  36. package/edu-pilot-pro/types/index.d.ts +2 -12
  37. package/edu-pilot-pro/types/index.js +1 -28
  38. package/edu-pilot-pro/types/user-management.d.ts +2 -236
  39. package/edu-pilot-pro/types/user-management.js +1 -8
  40. package/factory/generic-component-factory.d.ts +12 -9
  41. package/factory/generic-component-factory.js +1 -131
  42. package/factory/generic-module-factory.d.ts +14 -10
  43. package/factory/generic-module-factory.js +1 -190
  44. package/general/basic-get.d.ts +8 -1
  45. package/general/basic-get.js +1 -83
  46. package/general/basic-post.d.ts +8 -1
  47. package/general/basic-post.js +1 -70
  48. package/general/calculate-pages.d.ts +9 -1
  49. package/general/calculate-pages.js +1 -7
  50. package/general/camel-to-sentence-case.d.ts +3 -1
  51. package/general/camel-to-sentence-case.js +1 -20
  52. package/general/check-even-odd-length.d.ts +3 -1
  53. package/general/check-even-odd-length.js +1 -17
  54. package/general/clear-cache.d.ts +7 -2
  55. package/general/clear-cache.js +1 -12
  56. package/general/cnic-formatter.d.ts +16 -3
  57. package/general/cnic-formatter.js +1 -53
  58. package/general/convert-url-to-base64.d.ts +8 -6
  59. package/general/convert-url-to-base64.js +1 -231
  60. package/general/countries.d.ts +5 -3
  61. package/general/countries.js +1 -514
  62. package/general/create-date.d.ts +3 -1
  63. package/general/create-date.js +1 -22
  64. package/general/crypto.d.ts +4 -2
  65. package/general/crypto.js +1 -45
  66. package/general/currencies.d.ts +2 -0
  67. package/general/currencies.js +0 -1077
  68. package/general/delete-image-from-private-supabase.d.ts +10 -2
  69. package/general/delete-image-from-private-supabase.js +1 -66
  70. package/general/delete-image-from-public-supabase.d.ts +10 -2
  71. package/general/delete-image-from-public-supabase.js +1 -66
  72. package/general/download-from-url.d.ts +8 -1
  73. package/general/download-from-url.js +1 -82
  74. package/general/dynamic-page-limit.d.ts +9 -3
  75. package/general/dynamic-page-limit.js +1 -7
  76. package/general/enum-to-text.d.ts +8 -1
  77. package/general/enum-to-text.js +1 -11
  78. package/general/fetch-data.d.ts +16 -4
  79. package/general/fetch-data.js +1 -95
  80. package/general/fetch-supabase-image.d.ts +11 -2
  81. package/general/fetch-supabase-image.js +1 -67
  82. package/general/fetch-supabase-private-assets.d.ts +11 -2
  83. package/general/fetch-supabase-private-assets.js +1 -69
  84. package/general/format-date.d.ts +10 -2
  85. package/general/format-date.js +1 -49
  86. package/general/format-number.d.ts +12 -2
  87. package/general/format-number.js +1 -35
  88. package/general/format-phone-display.d.ts +9 -1
  89. package/general/format-phone-display.js +1 -32
  90. package/general/format-phone.d.ts +10 -2
  91. package/general/format-phone.js +1 -20
  92. package/general/format-pricing.d.ts +8 -1
  93. package/general/format-pricing.js +1 -23
  94. package/general/format-secs.d.ts +8 -1
  95. package/general/format-secs.js +1 -21
  96. package/general/format-time.d.ts +8 -2
  97. package/general/format-time.js +1 -38
  98. package/general/format-value.d.ts +8 -1
  99. package/general/format-value.js +1 -7
  100. package/general/full-month-range.d.ts +3 -2
  101. package/general/full-month-range.js +1 -24
  102. package/general/full-year-range.d.ts +3 -2
  103. package/general/full-year-range.js +1 -20
  104. package/general/generate-article-schema.d.ts +3 -2
  105. package/general/generate-article-schema.js +1 -100
  106. package/general/generate-blog-schema.d.ts +3 -2
  107. package/general/generate-blog-schema.js +1 -32
  108. package/general/generate-book-schema.d.ts +3 -2
  109. package/general/generate-book-schema.js +1 -109
  110. package/general/generate-breadcrumb-schema.d.ts +3 -2
  111. package/general/generate-breadcrumb-schema.js +1 -34
  112. package/general/generate-carousel-schema.d.ts +3 -2
  113. package/general/generate-carousel-schema.js +1 -172
  114. package/general/generate-course-schema.d.ts +3 -2
  115. package/general/generate-course-schema.js +1 -124
  116. package/general/generate-dataset-schema.d.ts +3 -2
  117. package/general/generate-dataset-schema.js +1 -156
  118. package/general/generate-discussion-forum-schema.d.ts +3 -2
  119. package/general/generate-discussion-forum-schema.js +1 -67
  120. package/general/generate-education-schema.d.ts +3 -2
  121. package/general/generate-education-schema.js +1 -137
  122. package/general/generate-employer-aggregate-rating-schema.d.ts +3 -2
  123. package/general/generate-employer-aggregate-rating-schema.js +1 -64
  124. package/general/generate-event-schema.d.ts +3 -2
  125. package/general/generate-event-schema.js +1 -214
  126. package/general/generate-faq-schema.d.ts +3 -2
  127. package/general/generate-faq-schema.js +1 -43
  128. package/general/generate-grid.d.ts +3 -2
  129. package/general/generate-grid.js +1 -55
  130. package/general/generate-image-metadata-schema.d.ts +3 -2
  131. package/general/generate-image-metadata-schema.js +1 -73
  132. package/general/generate-job-posting-schema.d.ts +3 -2
  133. package/general/generate-job-posting-schema.js +1 -120
  134. package/general/generate-local-business-schema.d.ts +3 -2
  135. package/general/generate-local-business-schema.js +1 -75
  136. package/general/generate-math-solver-schema.d.ts +3 -2
  137. package/general/generate-math-solver-schema.js +1 -83
  138. package/general/generate-movie-carousel-schema.d.ts +3 -2
  139. package/general/generate-movie-carousel-schema.js +1 -160
  140. package/general/generate-organization-schema.d.ts +3 -2
  141. package/general/generate-organization-schema.js +1 -39
  142. package/general/generate-profile-page-schema.d.ts +3 -2
  143. package/general/generate-profile-page-schema.js +1 -82
  144. package/general/generate-qa-page-schema.d.ts +3 -2
  145. package/general/generate-qa-page-schema.js +1 -67
  146. package/general/generate-recipe-schema.d.ts +3 -2
  147. package/general/generate-recipe-schema.js +1 -104
  148. package/general/generate-ref.d.ts +8 -2
  149. package/general/generate-ref.js +1 -12
  150. package/general/generate-review-snippet-schema.d.ts +3 -2
  151. package/general/generate-review-snippet-schema.js +1 -137
  152. package/general/generate-shopping-loyalty-program-schema.d.ts +3 -2
  153. package/general/generate-shopping-loyalty-program-schema.js +1 -59
  154. package/general/generate-shopping-merchant-listing-schema.d.ts +3 -2
  155. package/general/generate-shopping-merchant-listing-schema.js +1 -153
  156. package/general/generate-shopping-merchant-return-policy-schema.d.ts +3 -2
  157. package/general/generate-shopping-merchant-return-policy-schema.js +1 -68
  158. package/general/generate-shopping-merchant-shipping-policy-schema.d.ts +3 -2
  159. package/general/generate-shopping-merchant-shipping-policy-schema.js +1 -74
  160. package/general/generate-shopping-overview-schema.d.ts +3 -2
  161. package/general/generate-shopping-overview-schema.js +1 -157
  162. package/general/generate-shopping-product-snippet-schema.d.ts +3 -2
  163. package/general/generate-shopping-product-snippet-schema.js +1 -167
  164. package/general/generate-shopping-variants-schema.d.ts +3 -2
  165. package/general/generate-shopping-variants-schema.js +1 -143
  166. package/general/generate-software-app-schema.d.ts +3 -2
  167. package/general/generate-software-app-schema.js +1 -143
  168. package/general/generate-speakable-schema.d.ts +3 -2
  169. package/general/generate-speakable-schema.js +1 -139
  170. package/general/generate-subscription-schema.d.ts +3 -2
  171. package/general/generate-subscription-schema.js +1 -133
  172. package/general/generate-vacation-rental-schema.d.ts +3 -2
  173. package/general/generate-vacation-rental-schema.js +1 -135
  174. package/general/generate-video-schema.d.ts +3 -2
  175. package/general/generate-video-schema.js +1 -163
  176. package/general/generic-cache.d.ts +17 -15
  177. package/general/generic-cache.js +1 -659
  178. package/general/get-available-page-limit.d.ts +8 -2
  179. package/general/get-available-page-limit.js +1 -31
  180. package/general/get-calendar-current-month.d.ts +11 -3
  181. package/general/get-calendar-current-month.js +1 -31
  182. package/general/get-calendar-dates.d.ts +11 -3
  183. package/general/get-calendar-dates.js +1 -42
  184. package/general/get-calendar-next-month.d.ts +12 -3
  185. package/general/get-calendar-next-month.js +1 -32
  186. package/general/get-calendar-previous-month.d.ts +12 -3
  187. package/general/get-calendar-previous-month.js +1 -36
  188. package/general/get-current-year.d.ts +7 -1
  189. package/general/get-current-year.js +1 -5
  190. package/general/get-day-name.d.ts +5 -3
  191. package/general/get-day-name.js +1 -14
  192. package/general/get-dial-code.d.ts +8 -1
  193. package/general/get-dial-code.js +1 -8
  194. package/general/get-full-name.d.ts +9 -2
  195. package/general/get-full-name.js +1 -8
  196. package/general/get-href.d.ts +3 -1
  197. package/general/get-href.js +1 -13
  198. package/general/get-month-name.d.ts +5 -3
  199. package/general/get-month-name.js +1 -19
  200. package/general/get-month-number.d.ts +5 -3
  201. package/general/get-month-number.js +1 -29
  202. package/general/get-number-of-days-in-month.d.ts +9 -2
  203. package/general/get-number-of-days-in-month.js +1 -12
  204. package/general/get-pathname.d.ts +3 -1
  205. package/general/get-pathname.js +1 -16
  206. package/general/get-week-day.d.ts +8 -1
  207. package/general/get-week-day.js +1 -9
  208. package/general/image-url-to-base64.d.ts +3 -1
  209. package/general/image-url-to-base64.js +1 -80
  210. package/general/is-created-or-updated.d.ts +3 -1
  211. package/general/is-created-or-updated.js +1 -26
  212. package/general/is-next-button-disabled.d.ts +9 -1
  213. package/general/is-next-button-disabled.js +1 -5
  214. package/general/is-odd.d.ts +3 -1
  215. package/general/is-odd.js +1 -13
  216. package/general/is-previous-button-disabled.d.ts +8 -1
  217. package/general/is-previous-button-disabled.js +1 -7
  218. package/general/linear-gradients.d.ts +4 -2
  219. package/general/linear-gradients.js +1 -52
  220. package/general/multi-part-search.d.ts +10 -2
  221. package/general/multi-part-search.js +1 -16
  222. package/general/normalize-phone.d.ts +15 -2
  223. package/general/normalize-phone.js +1 -40
  224. package/general/parse-frontmatter.d.ts +11 -4
  225. package/general/parse-frontmatter.js +2 -35
  226. package/general/remove-data-image-prefix.d.ts +8 -1
  227. package/general/remove-data-image-prefix.js +1 -7
  228. package/general/repeat-times.d.ts +3 -1
  229. package/general/repeat-times.js +1 -21
  230. package/general/resolve-anchor-link.d.ts +3 -1
  231. package/general/resolve-anchor-link.js +1 -26
  232. package/general/resolve-current-date.d.ts +3 -1
  233. package/general/resolve-current-date.js +1 -22
  234. package/general/resolve-grid.d.ts +3 -1
  235. package/general/resolve-grid.js +1 -18
  236. package/general/resolve-initials.d.ts +3 -1
  237. package/general/resolve-initials.js +1 -17
  238. package/general/set-timezone.d.ts +11 -1
  239. package/general/set-timezone.js +1 -12
  240. package/general/slugify.d.ts +3 -1
  241. package/general/slugify.js +1 -24
  242. package/general/text-to-enum.d.ts +8 -1
  243. package/general/text-to-enum.js +1 -10
  244. package/general/text-to-sentence-case.d.ts +3 -1
  245. package/general/text-to-sentence-case.js +1 -16
  246. package/general/time-out.d.ts +3 -1
  247. package/general/time-out.js +1 -16
  248. package/general/time-zones.d.ts +3 -1
  249. package/general/time-zones.js +1 -437
  250. package/general/truncate-text.d.ts +3 -1
  251. package/general/truncate-text.js +1 -18
  252. package/general/type.d.ts +3 -1
  253. package/general/type.js +1 -2
  254. package/general/upload-blob-to-private-supabase.d.ts +14 -2
  255. package/general/upload-blob-to-private-supabase.js +1 -62
  256. package/general/upload-blob-to-public-supabase.d.ts +14 -2
  257. package/general/upload-blob-to-public-supabase.js +1 -62
  258. package/general/upload-image-to-private-supabase.d.ts +15 -3
  259. package/general/upload-image-to-private-supabase.js +1 -66
  260. package/general/upload-image-to-public-supabase.d.ts +15 -3
  261. package/general/upload-image-to-public-supabase.js +1 -66
  262. package/general/url-to-sentence-case.d.ts +3 -1
  263. package/general/url-to-sentence-case.js +1 -19
  264. package/general/validate-comment.d.ts +3 -1
  265. package/general/validate-comment.js +1 -21
  266. package/general/validate-email.d.ts +3 -1
  267. package/general/validate-email.js +1 -24
  268. package/general/validate-form.d.ts +12 -3
  269. package/general/validate-form.js +1 -29
  270. package/general/validate-name.d.ts +3 -1
  271. package/general/validate-name.js +1 -21
  272. package/hooks/use-change.d.ts +11 -2
  273. package/hooks/use-change.js +1 -23
  274. package/hooks/use-debounce.d.ts +10 -1
  275. package/hooks/use-debounce.js +1 -14
  276. package/hooks/use-fetch.d.ts +7 -5
  277. package/hooks/use-fetch.js +1 -239
  278. package/hooks/use-force-render.d.ts +6 -2
  279. package/hooks/use-force-render.js +1 -17
  280. package/hooks/use-ip-geo-location.d.ts +8 -1
  281. package/hooks/use-ip-geo-location.js +1 -79
  282. package/hooks/use-is-mobile.d.ts +8 -1
  283. package/hooks/use-is-mobile.js +1 -22
  284. package/hooks/use-module-entity-v2.d.ts +7 -4
  285. package/hooks/use-module-entity-v2.js +1 -188
  286. package/hooks/use-module-entity.d.ts +7 -4
  287. package/hooks/use-module-entity.js +1 -177
  288. package/hooks/use-phone-formatter.d.ts +10 -2
  289. package/hooks/use-phone-formatter.js +1 -23
  290. package/hooks/use-position.d.ts +6 -3
  291. package/hooks/use-position.js +1 -43
  292. package/hooks/use-rtl.d.ts +4 -2
  293. package/hooks/use-rtl.js +1 -84
  294. package/hooks/use-sticky.d.ts +3 -1
  295. package/hooks/use-sticky.js +1 -39
  296. package/hooks/use-toggle-state.d.ts +3 -2
  297. package/hooks/use-toggle-state.js +1 -26
  298. package/hooks/use-window-event-listener.d.ts +9 -1
  299. package/hooks/use-window-event-listener.js +1 -11
  300. package/hooks/with-seo.d.ts +11 -2
  301. package/hooks/with-seo.js +1 -37
  302. package/local-storage/get-storage-value.d.ts +5 -2
  303. package/local-storage/get-storage-value.js +1 -20
  304. package/local-storage/remove-storage-value.d.ts +3 -1
  305. package/local-storage/remove-storage-value.js +1 -14
  306. package/local-storage/set-storage-value.d.ts +3 -1
  307. package/local-storage/set-storage-value.js +1 -14
  308. package/local-storage/type.d.ts +3 -1
  309. package/local-storage/type.js +1 -2
  310. package/npm.d.d.ts +2 -0
  311. package/npm.d.js +0 -0
  312. package/package.json +20 -18
  313. package/storybook/generate-sitemap.d.ts +3 -1
  314. package/storybook/generate-sitemap.js +17 -26
  315. package/storybook/preview.d.ts +4 -2
  316. package/storybook/preview.js +1 -62
  317. package/storybook/react-design-story-script.d.ts +3 -1
  318. package/storybook/react-design-story-script.js +5 -27
  319. package/storybook/react-emoji-collection.d.ts +3 -1
  320. package/storybook/react-emoji-collection.js +10 -55
  321. package/storybook/react-emoji-story-script.d.ts +3 -1
  322. package/storybook/react-emoji-story-script.js +5 -31
  323. package/storybook/react-emoji-story-template.d.ts +3 -1
  324. package/storybook/react-emoji-story-template.js +45 -15
  325. package/storybook/react-icon-collection.d.ts +3 -1
  326. package/storybook/react-icon-collection.js +10 -42
  327. package/storybook/react-icon-story-script.d.ts +3 -1
  328. package/storybook/react-icon-story-script.js +5 -27
  329. package/storybook/react-icon-story-template.d.ts +3 -1
  330. package/storybook/react-icon-story-template.js +45 -14
  331. package/storybook/react-logo-collection.d.ts +3 -1
  332. package/storybook/react-logo-collection.js +10 -42
  333. package/storybook/react-logo-story-script.d.ts +3 -1
  334. package/storybook/react-logo-story-script.js +5 -27
  335. package/storybook/react-logo-story-template.d.ts +3 -1
  336. package/storybook/react-logo-story-template.js +45 -14
  337. package/storybook/react-pakistan-theme.d.ts +3 -1
  338. package/storybook/react-pakistan-theme.js +1 -31
  339. package/storybook/responsive-args.d.ts +11 -10
  340. package/storybook/responsive-args.js +1 -19
  341. package/storybook/responsive-component.d.ts +4 -2
  342. package/storybook/responsive-component.js +37 -23
  343. package/storybook/responsive-screens.d.ts +3 -1
  344. package/storybook/responsive-screens.js +1 -109
  345. package/storybook/theme.d.ts +17 -15
  346. package/storybook/theme.js +1 -1022
  347. package/api/stellar-solutions/app-user/index.d.ts +0 -51
  348. package/api/stellar-solutions/app-user/index.js +0 -210
  349. package/api/stellar-solutions/bank/index.d.ts +0 -59
  350. package/api/stellar-solutions/bank/index.js +0 -210
  351. package/api/stellar-solutions/branch/index.d.ts +0 -58
  352. package/api/stellar-solutions/branch/index.js +0 -220
  353. package/api/stellar-solutions/company/index.d.ts +0 -57
  354. package/api/stellar-solutions/company/index.js +0 -218
  355. package/api/stellar-solutions/company-report/index.d.ts +0 -15
  356. package/api/stellar-solutions/company-report/index.js +0 -74
  357. package/api/stellar-solutions/constants.d.ts +0 -19
  358. package/api/stellar-solutions/constants.js +0 -22
  359. package/api/stellar-solutions/contact/index.d.ts +0 -56
  360. package/api/stellar-solutions/contact/index.js +0 -217
  361. package/api/stellar-solutions/currency/index.d.ts +0 -55
  362. package/api/stellar-solutions/currency/index.js +0 -212
  363. package/api/stellar-solutions/customer/index.d.ts +0 -68
  364. package/api/stellar-solutions/customer/index.js +0 -249
  365. package/api/stellar-solutions/expense/index.d.ts +0 -58
  366. package/api/stellar-solutions/expense/index.js +0 -229
  367. package/api/stellar-solutions/expense-category/index.d.ts +0 -53
  368. package/api/stellar-solutions/expense-category/index.js +0 -214
  369. package/api/stellar-solutions/lead/index.d.ts +0 -51
  370. package/api/stellar-solutions/lead/index.js +0 -206
  371. package/api/stellar-solutions/menu-order/index.d.ts +0 -53
  372. package/api/stellar-solutions/menu-order/index.js +0 -202
  373. package/api/stellar-solutions/payment/index.d.ts +0 -65
  374. package/api/stellar-solutions/payment/index.js +0 -230
  375. package/api/stellar-solutions/payment-mode/index.d.ts +0 -53
  376. package/api/stellar-solutions/payment-mode/index.js +0 -191
  377. package/api/stellar-solutions/preference/index.d.ts +0 -25
  378. package/api/stellar-solutions/preference/index.js +0 -114
  379. package/api/stellar-solutions/product/index.d.ts +0 -64
  380. package/api/stellar-solutions/product/index.js +0 -235
  381. package/api/stellar-solutions/product-category/index.d.ts +0 -51
  382. package/api/stellar-solutions/product-category/index.js +0 -212
  383. package/api/stellar-solutions/profile/index.d.ts +0 -78
  384. package/api/stellar-solutions/profile/index.js +0 -234
  385. package/api/stellar-solutions/quote-invoice/index.d.ts +0 -97
  386. package/api/stellar-solutions/quote-invoice/index.js +0 -369
  387. package/api/stellar-solutions/quote-invoice-report/index.d.ts +0 -15
  388. package/api/stellar-solutions/quote-invoice-report/index.js +0 -74
  389. package/api/stellar-solutions/tax/index.d.ts +0 -55
  390. package/api/stellar-solutions/tax/index.js +0 -224
  391. package/api/stellar-solutions/types/common.d.ts +0 -24
  392. package/api/stellar-solutions/types/common.js +0 -22
  393. package/api/stellar-solutions/types/erp.d.ts +0 -302
  394. package/api/stellar-solutions/types/erp.js +0 -73
  395. package/api/stellar-solutions/types/index.d.ts +0 -3
  396. package/api/stellar-solutions/types/index.js +0 -19
  397. package/api/stellar-solutions/types/pos.d.ts +0 -176
  398. package/api/stellar-solutions/types/pos.js +0 -61
  399. package/constants/index.d.ts +0 -12
  400. package/constants/index.js +0 -28
  401. package/factory/index.d.ts +0 -2
  402. package/factory/index.js +0 -18
  403. package/general/index.d.ts +0 -95
  404. package/general/index.js +0 -111
  405. package/index.d.ts +0 -28
  406. package/index.js +0 -44
  407. package/local-storage/index.d.ts +0 -4
  408. package/local-storage/index.js +0 -20
  409. package/setupTests.d.ts +0 -1
  410. package/setupTests.js +0 -52
  411. package/storybook/index.d.ts +0 -17
  412. package/storybook/index.js +0 -33
@@ -1,4 +1,4 @@
1
- export declare enum DATE_FORMATS {
1
+ declare enum DATE_FORMATS {
2
2
  LOCALE_DATE = "LOCALE_DATE",
3
3
  DD_MM = "DD_MM",
4
4
  YYYY_MM_DD = "YYYY_MM_DD",
@@ -7,4 +7,12 @@ export declare enum DATE_FORMATS {
7
7
  HH_MM_AM_PM = "HH_MM_AM_PM",
8
8
  HH_MM_SS_AM_PM = "HH_MM_SS_AM_PM"
9
9
  }
10
- export declare const formatDate: (str: string, format: DATE_FORMATS) => string;
10
+ /**
11
+ * Formats a date string into the specified DATE_FORMATS format.
12
+ * @param str - A date string parsable by Date constructor.
13
+ * @param format - The target DATE_FORMATS format.
14
+ * @returns The formatted date string.
15
+ */
16
+ declare const formatDate: (str: string, format: DATE_FORMATS) => string;
17
+
18
+ export { DATE_FORMATS, formatDate };
@@ -1,49 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatDate = exports.DATE_FORMATS = void 0;
4
- var get_day_name_1 = require("./get-day-name");
5
- var get_month_name_1 = require("./get-month-name");
6
- var DATE_FORMATS;
7
- (function (DATE_FORMATS) {
8
- DATE_FORMATS["LOCALE_DATE"] = "LOCALE_DATE";
9
- DATE_FORMATS["DD_MM"] = "DD_MM";
10
- DATE_FORMATS["YYYY_MM_DD"] = "YYYY_MM_DD";
11
- DATE_FORMATS["DAY_DD_MM_YYYY"] = "DAY_DD_MM_YYYY";
12
- DATE_FORMATS["DAY_DD_MM_YY_COMPACT"] = "DAY_DD_MM_YY_COMPACT";
13
- DATE_FORMATS["HH_MM_AM_PM"] = "HH_MM_AM_PM";
14
- DATE_FORMATS["HH_MM_SS_AM_PM"] = "HH_MM_SS_AM_PM";
15
- })(DATE_FORMATS || (exports.DATE_FORMATS = DATE_FORMATS = {}));
16
- var formatDate = function (str, format) {
17
- var _a;
18
- var _b, _c;
19
- var dateObj = new Date(str);
20
- var cleanMonthNumber = dateObj.getMonth() + 1;
21
- var monthNumberInTwoDigits = String(cleanMonthNumber).length < 2
22
- ? "0".concat(cleanMonthNumber)
23
- : cleanMonthNumber;
24
- var cleanDateNumber = dateObj.getDate();
25
- var dateNumberInTowDigits = String(cleanDateNumber).length < 2
26
- ? "0".concat(cleanDateNumber)
27
- : cleanDateNumber;
28
- // Format time for HH:MM AM/PM and HH:MM:SS AM/PM
29
- var hours = dateObj.getHours();
30
- var minutes = dateObj.getMinutes();
31
- var seconds = dateObj.getSeconds();
32
- var ampm = hours >= 12 ? 'PM' : 'AM';
33
- hours = hours % 12;
34
- hours = hours ? hours : 12; // the hour '0' should be '12'
35
- var minutesInTwoDigits = minutes < 10 ? "0".concat(minutes) : minutes;
36
- var secondsInTwoDigits = seconds < 10 ? "0".concat(seconds) : seconds;
37
- var hoursInTwoDigits = hours < 10 ? "0".concat(hours) : hours;
38
- var dateMap = (_a = {},
39
- _a[DATE_FORMATS.LOCALE_DATE] = dateObj.toLocaleDateString(),
40
- _a[DATE_FORMATS.DD_MM] = "".concat(dateObj.getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj.getMonth())),
41
- _a[DATE_FORMATS.YYYY_MM_DD] = "".concat(dateObj.getFullYear(), "-").concat(monthNumberInTwoDigits, "-").concat(dateNumberInTowDigits),
42
- _a[DATE_FORMATS.DAY_DD_MM_YYYY] = "".concat((0, get_day_name_1.getDayName)(dateObj.getDay()), ", ").concat(dateObj.getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj.getMonth()), " ").concat(dateObj.getFullYear()),
43
- _a[DATE_FORMATS.DAY_DD_MM_YY_COMPACT] = "".concat((_b = (0, get_day_name_1.getDayName)(dateObj.getDay())) === null || _b === void 0 ? void 0 : _b.slice(0, 3), ", ").concat(dateObj.getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj.getMonth()), " ").concat((_c = String(dateObj.getFullYear())) === null || _c === void 0 ? void 0 : _c.slice(2, 5)),
44
- _a[DATE_FORMATS.HH_MM_AM_PM] = "".concat(hoursInTwoDigits, ":").concat(minutesInTwoDigits, " ").concat(ampm),
45
- _a[DATE_FORMATS.HH_MM_SS_AM_PM] = "".concat(hoursInTwoDigits, ":").concat(minutesInTwoDigits, ":").concat(secondsInTwoDigits, " ").concat(ampm),
46
- _a);
47
- return dateMap[format];
48
- };
49
- exports.formatDate = formatDate;
1
+ var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var S=(_,e)=>{for(var t in e)a(_,t,{get:e[t],enumerable:!0})},h=(_,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let D of H(e))!T.call(_,D)&&D!==t&&a(_,D,{get:()=>e[D],enumerable:!(n=l(e,D))||n.enumerable});return _};var P=_=>h(a({},"__esModule",{value:!0}),_);var O={};S(O,{DATE_FORMATS:()=>c,formatDate:()=>C});module.exports=P(O);var r=require("./get-day-name"),o=require("./get-month-name"),c=(M=>(M.LOCALE_DATE="LOCALE_DATE",M.DD_MM="DD_MM",M.YYYY_MM_DD="YYYY_MM_DD",M.DAY_DD_MM_YYYY="DAY_DD_MM_YYYY",M.DAY_DD_MM_YY_COMPACT="DAY_DD_MM_YY_COMPACT",M.HH_MM_AM_PM="HH_MM_AM_PM",M.HH_MM_SS_AM_PM="HH_MM_SS_AM_PM",M))(c||{});const C=(_,e)=>{const t=new Date(_),n=t.getMonth()+1,D=String(n).length<2?`0${n}`:n,Y=t.getDate(),m=String(Y).length<2?`0${Y}`:Y;let M=t.getHours();const s=t.getMinutes(),g=t.getSeconds(),$=M>=12?"PM":"AM";M=M%12,M=M||12;const A=s<10?`0${s}`:s,u=g<10?`0${g}`:g,i=M<10?`0${M}`:M;return{LOCALE_DATE:t.toLocaleDateString(),DD_MM:`${t.getDate()} ${(0,o.getMonthName)(t.getMonth())}`,YYYY_MM_DD:`${t.getFullYear()}-${D}-${m}`,DAY_DD_MM_YYYY:`${(0,r.getDayName)(t.getDay())}, ${t.getDate()} ${(0,o.getMonthName)(t.getMonth())} ${t.getFullYear()}`,DAY_DD_MM_YY_COMPACT:`${(0,r.getDayName)(t.getDay())?.slice(0,3)}, ${t.getDate()} ${(0,o.getMonthName)(t.getMonth())} ${String(t.getFullYear())?.slice(2,5)}`,HH_MM_AM_PM:`${i}:${A} ${$}`,HH_MM_SS_AM_PM:`${i}:${A}:${u} ${$}`}[e]};0&&(module.exports={DATE_FORMATS,formatDate});
@@ -1,6 +1,16 @@
1
- export type FormatOptions = {
1
+ type FormatOptions = {
2
2
  decimals?: number;
3
3
  useLocale?: boolean;
4
4
  customSuffixes?: Array<string>;
5
5
  };
6
- export declare const formatNumber: (input: any, options?: FormatOptions) => string;
6
+ /**
7
+ * Formats a number with abbreviations (K, M, B, etc.) and optional locale formatting.
8
+ * @param input - The number or numeric string to format.
9
+ * @param options.decimals - Number of decimal places (default 2).
10
+ * @param options.useLocale - Whether to use locale separators (default true).
11
+ * @param options.customSuffixes - Custom suffix array for magnitudes.
12
+ * @returns The formatted number string.
13
+ */
14
+ declare const formatNumber: (input: any, options?: FormatOptions) => string;
15
+
16
+ export { type FormatOptions, formatNumber };
@@ -1,35 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatNumber = void 0;
4
- var formatNumber = function (input, options) {
5
- if (options === void 0) { options = {}; }
6
- var _a = options.decimals, decimals = _a === void 0 ? 2 : _a, _b = options.useLocale, useLocale = _b === void 0 ? true : _b, customSuffixes = options.customSuffixes;
7
- // Attempt to convert input to a number
8
- var number = Number(input);
9
- if (Number.isNaN(number) || !Number.isFinite(number)) {
10
- return 'Invalid number';
11
- }
12
- if (input === 0 || input === '0') {
13
- return '0';
14
- }
15
- var absNumber = Math.abs(number);
16
- var sign = number < 0 ? '-' : '';
17
- // Define suffixes (default or custom)
18
- var defaultSuffixes = ['', 'K', 'M', 'B', 'T', 'Q'];
19
- var suffixes = customSuffixes || defaultSuffixes;
20
- // Find magnitude
21
- var tier = Math.floor(Math.log10(absNumber) / 3);
22
- if (tier === 0) {
23
- var formatted_1 = useLocale
24
- ? absNumber.toLocaleString()
25
- : absNumber.toFixed(decimals);
26
- return sign + formatted_1;
27
- }
28
- var suffix = suffixes[tier] || "e".concat(tier * 3);
29
- var scale = Math.pow(10, tier * 3);
30
- var scaled = absNumber / scale;
31
- var rounded = scaled.toFixed(decimals);
32
- var formatted = useLocale ? Number(rounded).toLocaleString() : rounded;
33
- return "".concat(sign).concat(formatted).concat(suffix);
34
- };
35
- exports.formatNumber = formatNumber;
1
+ var u=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var F=(t,e)=>{for(var o in e)u(t,o,{get:e[o],enumerable:!0})},M=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of g(e))!S.call(t,s)&&s!==o&&u(t,s,{get:()=>e[s],enumerable:!(r=N(e,s))||r.enumerable});return t};var h=t=>M(u({},"__esModule",{value:!0}),t);var L={};F(L,{formatNumber:()=>p});module.exports=h(L);const p=(t,e={})=>{const{decimals:o=2,useLocale:r=!0,customSuffixes:s}=e,n=Number(t);if(Number.isNaN(n)||!Number.isFinite(n))return"Invalid number";if(t===0||t==="0")return"0";const a=Math.abs(n),i=n<0?"-":"",m=s||["","K","M","B","T","Q"],c=Math.floor(Math.log10(a)/3);if(c===0){const x=r?a.toLocaleString():a.toFixed(o);return i+x}const l=m[c]||`e${c*3}`,d=Math.pow(10,c*3),f=(a/d).toFixed(o),b=r?Number(f).toLocaleString():f;return`${i}${b}${l}`};0&&(module.exports={formatNumber});
@@ -1 +1,9 @@
1
- export declare function formatPhoneDisplay(value: unknown, defaultCountry?: string): string | undefined;
1
+ /**
2
+ * Formats a phone number for display in international format with fallback.
3
+ * @param value - The raw phone number value.
4
+ * @param defaultCountry - Optional default country code for parsing.
5
+ * @returns The formatted phone number, or undefined if invalid.
6
+ */
7
+ declare function formatPhoneDisplay(value: unknown, defaultCountry?: string): string | undefined;
8
+
9
+ export { formatPhoneDisplay };
@@ -1,32 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatPhoneDisplay = formatPhoneDisplay;
4
- var libphonenumber_js_1 = require("libphonenumber-js");
5
- function formatPhoneDisplay(value, defaultCountry) {
6
- if (value === null || value === undefined)
7
- return undefined;
8
- var input = String(value).trim();
9
- if (input === '')
10
- return undefined;
11
- try {
12
- // First attempt: parse the input as-is (handles +E.164 and numbers with punctuation)
13
- var pn = (0, libphonenumber_js_1.parsePhoneNumberFromString)(input, defaultCountry);
14
- // If parse failed and input is digits-only, try parsing as E.164 by prefixing +
15
- if ((!pn || !pn.isValid()) && /^\d+$/.test(input)) {
16
- pn = (0, libphonenumber_js_1.parsePhoneNumberFromString)("+".concat(input));
17
- }
18
- if (pn && pn.isValid()) {
19
- return pn.formatInternational();
20
- }
21
- }
22
- catch (_a) {
23
- // fall through to digits-only fallback
24
- }
25
- // Fallback: return digits-only or prefixed with + for long international-like numbers
26
- var digits = input.replace(/\D/g, '');
27
- if (!digits)
28
- return undefined;
29
- if (digits.length > 12)
30
- return "+".concat(digits);
31
- return digits;
32
- }
1
+ var f=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(r,t)=>{for(var i in t)f(r,i,{get:t[i],enumerable:!0})},g=(r,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of o(t))!s.call(r,n)&&n!==i&&f(r,n,{get:()=>t[n],enumerable:!(e=u(t,n))||e.enumerable});return r};var l=r=>g(f({},"__esModule",{value:!0}),r);var p={};a(p,{formatPhoneDisplay:()=>m});module.exports=l(p);var d=require("libphonenumber-js");function m(r,t){if(r==null)return;const i=String(r).trim();if(i==="")return;try{let n=(0,d.parsePhoneNumberFromString)(i,t);if((!n||!n.isValid())&&/^\d+$/.test(i)&&(n=(0,d.parsePhoneNumberFromString)(`+${i}`)),n&&n.isValid())return n.formatInternational()}catch{}const e=i.replace(/\D/g,"");if(e)return e.length>12?`+${e}`:e}0&&(module.exports={formatPhoneDisplay});
@@ -1,7 +1,15 @@
1
1
  import { CountryCode } from 'libphonenumber-js';
2
+
2
3
  interface FormattedPhoneNumber {
3
4
  e164: string;
4
5
  international: string;
5
6
  }
6
- export declare const formatPhone: (phone: string, defaultCountry?: CountryCode) => FormattedPhoneNumber | null;
7
- export {};
7
+ /**
8
+ * Parses and formats a phone number into E.164 and international formats.
9
+ * @param phone - The phone number string.
10
+ * @param defaultCountry - Default country code (default 'US').
11
+ * @returns Object with `e164` and `international` strings, or null if invalid.
12
+ */
13
+ declare const formatPhone: (phone: string, defaultCountry?: CountryCode) => FormattedPhoneNumber | null;
14
+
15
+ export { formatPhone };
@@ -1,20 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatPhone = void 0;
4
- var libphonenumber_js_1 = require("libphonenumber-js");
5
- var formatPhone = function (phone, defaultCountry) {
6
- if (defaultCountry === void 0) { defaultCountry = 'US'; }
7
- var updatedPhone = phone;
8
- if (!phone.startsWith('+')) {
9
- updatedPhone = "+".concat(phone);
10
- }
11
- var phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberFromString)(updatedPhone, defaultCountry);
12
- if (phoneNumber && phoneNumber.isValid()) {
13
- return {
14
- e164: phoneNumber.format('E.164'),
15
- international: phoneNumber.formatInternational(),
16
- };
17
- }
18
- return null;
19
- };
20
- exports.formatPhone = formatPhone;
1
+ var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var s=(t,r)=>{for(var n in r)a(t,n,{get:r[n],enumerable:!0})},d=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of u(r))!l.call(t,o)&&o!==n&&a(t,o,{get:()=>r[o],enumerable:!(e=m(r,o))||e.enumerable});return t};var f=t=>d(a({},"__esModule",{value:!0}),t);var P={};s(P,{formatPhone:()=>h});module.exports=f(P);var i=require("libphonenumber-js");const h=(t,r="US")=>{let n=t;t.startsWith("+")||(n=`+${t}`);const e=(0,i.parsePhoneNumberFromString)(n,r);return e&&e.isValid()?{e164:e.format("E.164"),international:e.formatInternational()}:null};0&&(module.exports={formatPhone});
@@ -1 +1,8 @@
1
- export declare const formatPricing: (value: string | number) => string;
1
+ /**
2
+ * Formats a number or numeric string as a USD price with 2 decimal places.
3
+ * @param value - The price value as a number or string.
4
+ * @returns The formatted price string.
5
+ */
6
+ declare const formatPricing: (value: string | number) => string;
7
+
8
+ export { formatPricing };
@@ -1,23 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatPricing = void 0;
4
- var formatPricing = function (value) {
5
- var result = '';
6
- if (typeof value === 'string') {
7
- var pricing = Number(value).toFixed(2);
8
- var formattedPrice = new Intl.NumberFormat('en-US', {
9
- minimumFractionDigits: 2,
10
- maximumFractionDigits: 2,
11
- }).format(Number(pricing));
12
- result = formattedPrice;
13
- }
14
- if (typeof value === 'number') {
15
- var formattedPrice = new Intl.NumberFormat('en-US', {
16
- minimumFractionDigits: 2,
17
- maximumFractionDigits: 2,
18
- }).format(Number(value));
19
- result = formattedPrice;
20
- }
21
- return result;
22
- };
23
- exports.formatPricing = formatPricing;
1
+ var e=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var s=(r,t)=>{for(var i in t)e(r,i,{get:t[i],enumerable:!0})},f=(r,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of c(t))!a.call(r,m)&&m!==i&&e(r,m,{get:()=>t[m],enumerable:!(n=o(t,m))||n.enumerable});return r};var u=r=>f(e({},"__esModule",{value:!0}),r);var b={};s(b,{formatPricing:()=>g});module.exports=u(b);const g=r=>{let t="";if(typeof r=="string"){const i=Number(r).toFixed(2);t=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(i))}return typeof r=="number"&&(t=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(r))),t};0&&(module.exports={formatPricing});
@@ -1 +1,8 @@
1
- export declare const formatSecs: (sec: number) => string;
1
+ /**
2
+ * Formats seconds into a human-readable `Xh Ym Zs` string (handles negative values).
3
+ * @param sec - The number of seconds.
4
+ * @returns The formatted duration string.
5
+ */
6
+ declare const formatSecs: (sec: number) => string;
7
+
8
+ export { formatSecs };
@@ -1,21 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatSecs = void 0;
4
- var formatSecs = function (sec) {
5
- if (sec >= 0) {
6
- var hours = Math.floor(sec / 3600);
7
- var minutes = Math.floor((sec % 3600) / 60);
8
- var secs = sec % 60;
9
- return "".concat(hours, "h ").concat(minutes, "m ").concat(secs, "s");
10
- }
11
- else {
12
- // For negative seconds, convert to negative hours and positive minutes/seconds
13
- var absSec = Math.abs(sec);
14
- var hours = -Math.ceil(absSec / 3600);
15
- var remaining = absSec % 3600;
16
- var minutes = Math.floor((3600 - remaining) / 60) % 60;
17
- var secs = (60 - (absSec % 60)) % 60;
18
- return "".concat(hours, "h ").concat(minutes, "m ").concat(secs, "s");
19
- }
20
- };
21
- exports.formatSecs = formatSecs;
1
+ var c=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(o,t)=>{for(var s in t)c(o,s,{get:t[s],enumerable:!0})},i=(o,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!m.call(o,n)&&n!==s&&c(o,n,{get:()=>t[n],enumerable:!(r=a(t,n))||r.enumerable});return o};var $=o=>i(c({},"__esModule",{value:!0}),o);var l={};u(l,{formatSecs:()=>f});module.exports=$(l);const f=o=>{if(o>=0){const t=Math.floor(o/3600),s=Math.floor(o%3600/60),r=o%60;return`${t}h ${s}m ${r}s`}else{const t=Math.abs(o),s=-Math.ceil(t/3600),r=t%3600,n=Math.floor((3600-r)/60)%60,e=(60-t%60)%60;return`${s}h ${n}m ${e}s`}};0&&(module.exports={formatSecs});
@@ -1,5 +1,11 @@
1
1
  interface Params {
2
2
  seconds: number;
3
3
  }
4
- export declare const formatDuration: ({ seconds }: Params) => string;
5
- export {};
4
+ /**
5
+ * Formats a duration in seconds into a human-friendly string (e.g. "2 mins and 30 secs").
6
+ * @param params.seconds - Duration in seconds (non-negative integer).
7
+ * @returns The formatted duration string.
8
+ */
9
+ declare const formatDuration: ({ seconds }: Params) => string;
10
+
11
+ export { formatDuration };
@@ -1,38 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatDuration = void 0;
4
- var units = [
5
- { divisor: 86400, singular: 'day', plural: 'days' },
6
- { divisor: 3600, singular: 'hour', plural: 'hours' },
7
- { divisor: 60, singular: 'min', plural: 'mins' },
8
- { divisor: 1, singular: 'sec', plural: 'secs' },
9
- ];
10
- var formatDuration = function (_a) {
11
- var seconds = _a.seconds;
12
- /* Edge Case Handling */
13
- if (typeof seconds !== 'number' ||
14
- seconds < 0 ||
15
- !Number.isInteger(seconds)) {
16
- throw new Error('Invalid input: must be a non-negative integer');
17
- }
18
- var remaining = seconds;
19
- var parts = [];
20
- for (var _i = 0, units_1 = units; _i < units_1.length; _i++) {
21
- var unit = units_1[_i];
22
- var value = Math.floor(remaining / unit.divisor);
23
- remaining %= unit.divisor;
24
- if (value > 0) {
25
- parts.push("".concat(value, " ").concat(value === 1 ? unit.singular : unit.plural));
26
- }
27
- }
28
- /* Handle 0 seconds case */
29
- if (parts.length === 0) {
30
- var smallestUnit = units[units.length - 1];
31
- return "0 ".concat(smallestUnit.plural);
32
- }
33
- /* Human-friendly joining */
34
- return parts.length > 1
35
- ? "".concat(parts.slice(0, -1).join(', '), " and ").concat(parts[parts.length - 1])
36
- : parts[0];
37
- };
38
- exports.formatDuration = formatDuration;
1
+ var a=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var g=(r,i)=>{for(var n in i)a(r,n,{get:i[n],enumerable:!0})},m=(r,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of u(i))!o.call(r,t)&&t!==n&&a(r,t,{get:()=>i[t],enumerable:!(s=e(i,t))||s.enumerable});return r};var p=r=>m(a({},"__esModule",{value:!0}),r);var h={};g(h,{formatDuration:()=>f});module.exports=p(h);const l=[{divisor:86400,singular:"day",plural:"days"},{divisor:3600,singular:"hour",plural:"hours"},{divisor:60,singular:"min",plural:"mins"},{divisor:1,singular:"sec",plural:"secs"}],f=({seconds:r})=>{if(typeof r!="number"||r<0||!Number.isInteger(r))throw new Error("Invalid input: must be a non-negative integer");let i=r;const n=[];for(const s of l){const t=Math.floor(i/s.divisor);i%=s.divisor,t>0&&n.push(`${t} ${t===1?s.singular:s.plural}`)}return n.length===0?`0 ${l[l.length-1].plural}`:n.length>1?`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`:n[0]};0&&(module.exports={formatDuration});
@@ -1 +1,8 @@
1
- export declare const formatValue: (v?: string | number | null) => string;
1
+ /**
2
+ * Returns a string representation of a value, or an em dash if null/undefined/empty.
3
+ * @param v - The value to format.
4
+ * @returns The string representation or '—'.
5
+ */
6
+ declare const formatValue: (v?: string | number | null) => string;
7
+
8
+ export { formatValue };
@@ -1,7 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatValue = void 0;
4
- var formatValue = function (v) {
5
- return v === undefined || v === null || v === '' ? '—' : String(v);
6
- };
7
- exports.formatValue = formatValue;
1
+ var t=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var d=(n,e)=>{for(var r in e)t(n,r,{get:e[r],enumerable:!0})},f=(n,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of o(e))!a.call(n,l)&&l!==r&&t(n,l,{get:()=>e[l],enumerable:!(u=i(e,l))||u.enumerable});return n};var g=n=>f(t({},"__esModule",{value:!0}),n);var s={};d(s,{formatValue:()=>m});module.exports=g(s);const m=n=>n==null||n===""?"\u2014":String(n);0&&(module.exports={formatValue});
@@ -8,5 +8,6 @@ interface Return {
8
8
  * @param year - The year. Defaults to current year.
9
9
  * @returns An object containing startOfMonth and endOfMonth dates in UTC
10
10
  */
11
- export declare const fullMonthRange: (month?: number, year?: number) => Return;
12
- export {};
11
+ declare const fullMonthRange: (month?: number, year?: number) => Return;
12
+
13
+ export { fullMonthRange };
@@ -1,24 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fullMonthRange = void 0;
4
- /**
5
- * Get the full month range for a given month and year
6
- * @param month - The month (0-11, where 0 is January). Defaults to current month.
7
- * @param year - The year. Defaults to current year.
8
- * @returns An object containing startOfMonth and endOfMonth dates in UTC
9
- */
10
- var fullMonthRange = function (month, year) {
11
- var now = new Date();
12
- var targetYear = year !== null && year !== void 0 ? year : now.getUTCFullYear();
13
- var targetMonth = month !== null && month !== void 0 ? month : now.getUTCMonth();
14
- // Start of month: first day at 00:00:00.000 UTC
15
- var startOfMonth = new Date(Date.UTC(targetYear, targetMonth, 1, 0, 0, 0, 0));
16
- // End of month: last day at 23:59:59.999 UTC
17
- // Setting day to 0 of next month gives us the last day of current month
18
- var endOfMonth = new Date(Date.UTC(targetYear, targetMonth + 1, 0, 23, 59, 59, 999));
19
- return {
20
- startOfMonth: startOfMonth,
21
- endOfMonth: endOfMonth,
22
- };
23
- };
24
- exports.fullMonthRange = fullMonthRange;
1
+ var r=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var a in t)r(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of u(t))!D.call(e,n)&&n!==a&&r(e,n,{get:()=>t[n],enumerable:!(o=h(t,n))||o.enumerable});return e};var g=e=>f(r({},"__esModule",{value:!0}),e);var w={};M(w,{fullMonthRange:()=>l});module.exports=g(w);const l=(e,t)=>{const a=new Date,o=t??a.getUTCFullYear(),n=e??a.getUTCMonth(),s=new Date(Date.UTC(o,n,1,0,0,0,0)),c=new Date(Date.UTC(o,n+1,0,23,59,59,999));return{startOfMonth:s,endOfMonth:c}};0&&(module.exports={fullMonthRange});
@@ -7,5 +7,6 @@ interface Return {
7
7
  * @param year - The year. Defaults to current year.
8
8
  * @returns An object containing startOfYear and endOfYear dates
9
9
  */
10
- export declare const fullYearRange: (year?: number) => Return;
11
- export {};
10
+ declare const fullYearRange: (year?: number) => Return;
11
+
12
+ export { fullYearRange };
@@ -1,20 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fullYearRange = void 0;
4
- /**
5
- * Get the full year range for a given year
6
- * @param year - The year. Defaults to current year.
7
- * @returns An object containing startOfYear and endOfYear dates
8
- */
9
- var fullYearRange = function (year) {
10
- var targetYear = year !== null && year !== void 0 ? year : new Date().getUTCFullYear();
11
- // Start of year: January 1st at 00:00:00.000
12
- var startOfYear = new Date(Date.UTC(targetYear, 0, 1, 0, 0, 0, 0));
13
- // End of year: December 31st at 23:59:59.999
14
- var endOfYear = new Date(Date.UTC(targetYear, 11, 31, 23, 59, 59, 999));
15
- return {
16
- startOfYear: startOfYear,
17
- endOfYear: endOfYear,
18
- };
19
- };
20
- exports.fullYearRange = fullYearRange;
1
+ var D=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var a in e)D(t,a,{get:e[a],enumerable:!0})},c=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!s.call(t,r)&&r!==a&&D(t,r,{get:()=>e[r],enumerable:!(n=Y(e,r))||n.enumerable});return t};var o=t=>c(D({},"__esModule",{value:!0}),t);var O={};u(O,{fullYearRange:()=>l});module.exports=o(O);const l=t=>{const e=t??new Date().getUTCFullYear(),a=new Date(Date.UTC(e,0,1,0,0,0,0)),n=new Date(Date.UTC(e,11,31,23,59,59,999));return{startOfYear:a,endOfYear:n}};0&&(module.exports={fullYearRange});
@@ -45,5 +45,6 @@ interface ArticleSchema {
45
45
  articleSection?: string;
46
46
  wordCount?: number;
47
47
  }
48
- export declare const generateArticleSchema: ({ type, headline, description, image, author, publisher, datePublished, dateModified, url, keywords, articleSection, wordCount, }: ArticleSchema) => any;
49
- export {};
48
+ declare const generateArticleSchema: ({ type, headline, description, image, author, publisher, datePublished, dateModified, url, keywords, articleSection, wordCount, }: ArticleSchema) => any;
49
+
50
+ export { generateArticleSchema };
@@ -1,100 +1 @@
1
- "use strict";
2
- /**
3
- * Generate schema.org JSON-LD for `Article`, `NewsArticle`, or `BlogPosting`.
4
- *
5
- * This helper accepts `ArticleSchema` inputs and formats authors,
6
- * publisher/logo, images, and optional fields such as `keywords`,
7
- * `articleSection`, and `wordCount`. Only supplied fields are emitted in
8
- * the resulting object, making the output safe to merge into page
9
- * metadata bundles.
10
- *
11
- * Examples are provided in the interface comments below — consult the
12
- * `ArticleSchema` type for full details of supported inputs.
13
- *
14
- * @param options - Article metadata and optional fields
15
- * @returns A JSON-LD compatible Article/NewsArticle/BlogPosting object
16
- */
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.generateArticleSchema = void 0;
30
- var formatAuthor = function (author) {
31
- if (typeof author === 'string') {
32
- return {
33
- '@type': 'Person',
34
- name: author,
35
- };
36
- }
37
- if (Array.isArray(author)) {
38
- return author.map(function (a) { return (__assign({ '@type': 'Person', name: a.name }, (a.url && { url: a.url }))); });
39
- }
40
- return __assign({ '@type': 'Person', name: author.name }, (author.url && { url: author.url }));
41
- };
42
- var formatImage = function (image) {
43
- if (typeof image === 'string') {
44
- return image;
45
- }
46
- if (Array.isArray(image)) {
47
- return image.map(function (img) {
48
- if (typeof img === 'string') {
49
- return img;
50
- }
51
- return __assign(__assign({ '@type': 'ImageObject', url: img.url }, (img.width && { width: img.width })), (img.height && { height: img.height }));
52
- });
53
- }
54
- return __assign(__assign({ '@type': 'ImageObject', url: image.url }, (image.width && { width: image.width })), (image.height && { height: image.height }));
55
- };
56
- var formatPublisher = function (publisher) {
57
- var publisherData = {
58
- '@type': 'Organization',
59
- name: publisher.name,
60
- };
61
- if (publisher.logo) {
62
- publisherData.logo = __assign(__assign({ '@type': 'ImageObject', url: publisher.logo.url }, (publisher.logo.width && { width: publisher.logo.width })), (publisher.logo.height && { height: publisher.logo.height }));
63
- }
64
- return publisherData;
65
- };
66
- var generateArticleSchema = function (_a) {
67
- var _b = _a.type, type = _b === void 0 ? 'Article' : _b, headline = _a.headline, description = _a.description, image = _a.image, author = _a.author, publisher = _a.publisher, datePublished = _a.datePublished, dateModified = _a.dateModified, url = _a.url, keywords = _a.keywords, articleSection = _a.articleSection, wordCount = _a.wordCount;
68
- var schema = {
69
- '@context': 'https://schema.org',
70
- '@type': type,
71
- headline: headline,
72
- image: formatImage(image),
73
- author: formatAuthor(author),
74
- publisher: formatPublisher(publisher),
75
- datePublished: datePublished,
76
- };
77
- if (description) {
78
- schema.description = description;
79
- }
80
- if (dateModified) {
81
- schema.dateModified = dateModified;
82
- }
83
- if (url) {
84
- schema.mainEntityOfPage = {
85
- '@type': 'WebPage',
86
- '@id': url,
87
- };
88
- }
89
- if (keywords && keywords.length > 0) {
90
- schema.keywords = keywords.join(', ');
91
- }
92
- if (articleSection) {
93
- schema.articleSection = articleSection;
94
- }
95
- if (wordCount) {
96
- schema.wordCount = wordCount;
97
- }
98
- return schema;
99
- };
100
- exports.generateArticleSchema = generateArticleSchema;
1
+ var h=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var r in e)h(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of y(e))!m.call(t,i)&&i!==r&&h(t,i,{get:()=>e[i],enumerable:!(l=f(e,i))||l.enumerable});return t};var w=t=>p(h({},"__esModule",{value:!0}),t);var j={};d(j,{generateArticleSchema:()=>O});module.exports=w(j);const b=t=>typeof t=="string"?{"@type":"Person",name:t}:Array.isArray(t)?t.map(e=>({"@type":"Person",name:e.name,...e.url&&{url:e.url}})):{"@type":"Person",name:t.name,...t.url&&{url:t.url}},P=t=>typeof t=="string"?t: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}}):{"@type":"ImageObject",url:t.url,...t.width&&{width:t.width},...t.height&&{height:t.height}},I=t=>{const e={"@type":"Organization",name:t.name};return t.logo&&(e.logo={"@type":"ImageObject",url:t.logo.url,...t.logo.width&&{width:t.logo.width},...t.logo.height&&{height:t.logo.height}}),e},O=({type:t="Article",headline:e,description:r,image:l,author:i,publisher:u,datePublished:A,dateModified:o,url:c,keywords:g,articleSection:s,wordCount:a})=>{const n={"@context":"https://schema.org","@type":t,headline:e,image:P(l),author:b(i),publisher:I(u),datePublished:A};return r&&(n.description=r),o&&(n.dateModified=o),c&&(n.mainEntityOfPage={"@type":"WebPage","@id":c}),g&&g.length>0&&(n.keywords=g.join(", ")),s&&(n.articleSection=s),a&&(n.wordCount=a),n};0&&(module.exports={generateArticleSchema});
@@ -18,7 +18,7 @@ interface Blog {
18
18
  updatedAt: string;
19
19
  url: string;
20
20
  }
21
- export declare const generateBlogSchema: ({ authorImage, authorName, banner, createdAt, excerpt, title, updatedAt, url, }: Blog) => {
21
+ declare const generateBlogSchema: ({ authorImage, authorName, banner, createdAt, excerpt, title, updatedAt, url, }: Blog) => {
22
22
  '@context': string;
23
23
  '@type': string;
24
24
  headline: string;
@@ -33,4 +33,5 @@ export declare const generateBlogSchema: ({ authorImage, authorName, banner, cre
33
33
  url: string;
34
34
  };
35
35
  };
36
- export {};
36
+
37
+ export { generateBlogSchema };
@@ -1,32 +1 @@
1
- "use strict";
2
- /**
3
- * Generate schema.org `BlogPosting` JSON-LD for a blog entry.
4
- *
5
- * Produces a compact `BlogPosting` object using headline, dates, image and
6
- * author information. Only provided fields are emitted, and the returned
7
- * object is ready to be stringified as JSON-LD.
8
- *
9
- * See the `Blog` interface below for the accepted properties.
10
- * @returns A JSON-LD compatible `BlogPosting` object
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.generateBlogSchema = void 0;
14
- var generateBlogSchema = function (_a) {
15
- var authorImage = _a.authorImage, authorName = _a.authorName, banner = _a.banner, createdAt = _a.createdAt, excerpt = _a.excerpt, title = _a.title, updatedAt = _a.updatedAt, url = _a.url;
16
- return {
17
- '@context': 'https://schema.org',
18
- '@type': 'BlogPosting',
19
- headline: "".concat(title),
20
- dateModified: "".concat(updatedAt),
21
- datePublished: "".concat(createdAt),
22
- description: "".concat(excerpt),
23
- image: "".concat(banner),
24
- url: "".concat(url),
25
- author: {
26
- '@type': 'Person',
27
- name: "".concat(authorName),
28
- url: "".concat(authorImage),
29
- },
30
- };
31
- };
32
- exports.generateBlogSchema = generateBlogSchema;
1
+ var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of l(t))!u.call(e,r)&&r!==n&&a(e,r,{get:()=>t[r],enumerable:!(i=d(t,r))||i.enumerable});return e};var $=e=>h(a({},"__esModule",{value:!0}),e);var m={};c(m,{generateBlogSchema:()=>p});module.exports=$(m);const p=({authorImage:e,authorName:t,banner:n,createdAt:i,excerpt:r,title:g,updatedAt:o,url:s})=>({"@context":"https://schema.org","@type":"BlogPosting",headline:`${g}`,dateModified:`${o}`,datePublished:`${i}`,description:`${r}`,image:`${n}`,url:`${s}`,author:{"@type":"Person",name:`${t}`,url:`${e}`}});0&&(module.exports={generateBlogSchema});
@@ -53,5 +53,6 @@ interface BookSchemaOptions {
53
53
  keywords?: string[];
54
54
  bookFormat?: string;
55
55
  }
56
- export declare const generateBookSchema: ({ title, author, isbn, numberOfPages, inLanguage, publisher, datePublished, image, description, url, keywords, bookFormat, }: BookSchemaOptions) => any;
57
- export {};
56
+ declare const generateBookSchema: ({ title, author, isbn, numberOfPages, inLanguage, publisher, datePublished, image, description, url, keywords, bookFormat, }: BookSchemaOptions) => any;
57
+
58
+ export { generateBookSchema };