@ubnt/store.core 9.9.0-alpha.9 → 9.9.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 (295) hide show
  1. package/CHANGELOG.md +0 -30
  2. package/lib/_virtual/_virtual_multi-entry.js +0 -2
  3. package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
  4. package/lib/_virtual/_virtual_multi-entry.mjs +0 -2
  5. package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
  6. package/lib/assets/attention.svg +5 -5
  7. package/lib/assets/attention2.svg +5 -5
  8. package/lib/assets/pause.svg +3 -3
  9. package/lib/assets/pause2.svg +3 -3
  10. package/lib/assets/socialMedia/{x.svg.js → twitter.svg.js} +6 -6
  11. package/lib/assets/socialMedia/twitter.svg.js.map +1 -0
  12. package/lib/assets/socialMedia/twitter.svg.mjs +3 -0
  13. package/lib/assets/socialMedia/twitter.svg.mjs.map +1 -0
  14. package/lib/assets/twitter.svg +3 -0
  15. package/lib/assets/ucgMax.jpg +0 -0
  16. package/lib/assets/ucgMax2.jpg +0 -0
  17. package/lib/components/Footer/Footer.d.ts +1 -1
  18. package/lib/components/Footer/Footer.js +74 -192
  19. package/lib/components/Footer/Footer.js.map +1 -1
  20. package/lib/components/Footer/Footer.mjs +76 -174
  21. package/lib/components/Footer/Footer.mjs.map +1 -1
  22. package/lib/components/Footer/Footer.styles.d.ts +5 -17
  23. package/lib/components/Footer/Footer.styles.js +44 -91
  24. package/lib/components/Footer/Footer.styles.js.map +1 -1
  25. package/lib/components/Footer/Footer.styles.mjs +44 -87
  26. package/lib/components/Footer/Footer.styles.mjs.map +1 -1
  27. package/lib/components/Footer/Footer.types.d.ts +0 -40
  28. package/lib/components/Footer/Footer.types.js +0 -16
  29. package/lib/components/Footer/Footer.types.js.map +1 -1
  30. package/lib/components/Footer/Footer.types.mjs +0 -15
  31. package/lib/components/Footer/Footer.types.mjs.map +1 -1
  32. package/lib/components/Footer/index.js +1 -3
  33. package/lib/components/Footer/index.js.map +1 -1
  34. package/lib/components/Footer/index.mjs +1 -1
  35. package/lib/components/Header/AccountMenu/AccountMenu.js +3 -6
  36. package/lib/components/Header/AccountMenu/AccountMenu.js.map +1 -1
  37. package/lib/components/Header/AccountMenu/AccountMenu.mjs +3 -6
  38. package/lib/components/Header/AccountMenu/AccountMenu.mjs.map +1 -1
  39. package/lib/components/Header/Navigation/MobileMenu/MobileMenu.js +6 -11
  40. package/lib/components/Header/Navigation/MobileMenu/MobileMenu.js.map +1 -1
  41. package/lib/components/Header/Navigation/MobileMenu/MobileMenu.mjs +6 -11
  42. package/lib/components/Header/Navigation/MobileMenu/MobileMenu.mjs.map +1 -1
  43. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js +4 -8
  44. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js.map +1 -1
  45. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs +4 -8
  46. package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs.map +1 -1
  47. package/lib/components/Header/ProHeader/ProHeader.js +2 -19
  48. package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
  49. package/lib/components/Header/ProHeader/ProHeader.mjs +2 -19
  50. package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
  51. package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +0 -1
  52. package/lib/components/Header/ProHeader/ProHeader.styles.js +0 -6
  53. package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
  54. package/lib/components/Header/ProHeader/ProHeader.styles.mjs +0 -6
  55. package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
  56. package/lib/components/LandingPagePro/LandingPagePro.d.ts +0 -3
  57. package/lib/components/LandingPagePro/LandingPagePro.js +3 -3
  58. package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
  59. package/lib/components/LandingPagePro/LandingPagePro.mjs +2 -2
  60. package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
  61. package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.js +1 -1
  62. package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.mjs +1 -1
  63. package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.js +1 -1
  64. package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.mjs +2 -2
  65. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.js +5 -5
  66. package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.mjs +2 -2
  67. package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.js +1 -1
  68. package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.mjs +2 -2
  69. package/lib/components/ModelCompareV3/data/CloudGateways.js +3 -3
  70. package/lib/components/ModelCompareV3/data/CloudGateways.mjs +2 -2
  71. package/lib/components/ModelCompareV3/data/products/ucgMax.js +1 -1
  72. package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
  73. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js +1 -6
  74. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js.map +1 -1
  75. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs +1 -6
  76. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs.map +1 -1
  77. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +2 -2
  78. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js.map +1 -1
  79. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +2 -2
  80. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs.map +1 -1
  81. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js +0 -2
  82. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js.map +1 -1
  83. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs +0 -2
  84. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs.map +1 -1
  85. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
  86. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
  87. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
  88. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
  89. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
  90. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
  91. package/lib/components/VideoPlayerNew/VideoPlayer.js +1 -1
  92. package/lib/components/VideoPlayerNew/VideoPlayer.mjs +1 -1
  93. package/lib/components/VideoPlayerNew/assets/pause.svg.js +1 -1
  94. package/lib/components/VideoPlayerNew/assets/pause.svg.mjs +2 -2
  95. package/lib/constants/footerContent.d.ts +145 -0
  96. package/lib/constants/footerContent.js +313 -0
  97. package/lib/constants/footerContent.js.map +1 -0
  98. package/lib/constants/footerContent.mjs +293 -0
  99. package/lib/constants/footerContent.mjs.map +1 -0
  100. package/lib/constants/proStoreCategories/mapping/index.d.ts +0 -3
  101. package/lib/constants/proStoreCategories/mapping/index.js +10 -20
  102. package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
  103. package/lib/constants/proStoreCategories/mapping/index.mjs +10 -20
  104. package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
  105. package/lib/constants/proStoreCategories/mapping/unifi.d.ts +1 -3
  106. package/lib/constants/proStoreCategories/mapping/unifi.js +0 -2
  107. package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
  108. package/lib/constants/proStoreCategories/mapping/unifi.mjs +0 -2
  109. package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
  110. package/lib/constants/proStoreCategories/translations/ar.json.js +1 -1
  111. package/lib/constants/proStoreCategories/translations/ar.json.mjs +1 -1
  112. package/lib/constants/proStoreCategories/translations/de.json.js +1 -1
  113. package/lib/constants/proStoreCategories/translations/de.json.mjs +1 -1
  114. package/lib/constants/proStoreCategories/translations/el.json.js +1 -1
  115. package/lib/constants/proStoreCategories/translations/el.json.mjs +1 -1
  116. package/lib/constants/proStoreCategories/translations/en.json.js +0 -5
  117. package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
  118. package/lib/constants/proStoreCategories/translations/en.json.mjs +1 -5
  119. package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
  120. package/lib/constants/proStoreCategories/translations/es.json.js +1 -1
  121. package/lib/constants/proStoreCategories/translations/es.json.mjs +1 -1
  122. package/lib/constants/proStoreCategories/translations/fr.json.js +2 -2
  123. package/lib/constants/proStoreCategories/translations/fr.json.mjs +2 -2
  124. package/lib/constants/proStoreCategories/translations/it.json.js +1 -1
  125. package/lib/constants/proStoreCategories/translations/it.json.mjs +1 -1
  126. package/lib/constants/proStoreCategories/translations/ja.json.js +1 -1
  127. package/lib/constants/proStoreCategories/translations/ja.json.mjs +1 -1
  128. package/lib/constants/proStoreCategories/translations/pt-BR.json.js +1 -1
  129. package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs +1 -1
  130. package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +2 -2
  131. package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +2 -2
  132. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +2 -2
  133. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +2 -2
  134. package/lib/constants/url.d.ts +4 -4
  135. package/lib/constants/url.js +4 -4
  136. package/lib/constants/url.js.map +1 -1
  137. package/lib/constants/url.mjs +4 -4
  138. package/lib/constants/url.mjs.map +1 -1
  139. package/lib/contexts/MenuContext/mapping.js +0 -41
  140. package/lib/contexts/MenuContext/mapping.js.map +1 -1
  141. package/lib/contexts/MenuContext/mapping.mjs +0 -41
  142. package/lib/contexts/MenuContext/mapping.mjs.map +1 -1
  143. package/lib/contexts/MenuContext/presets.js.map +1 -1
  144. package/lib/contexts/MenuContext/presets.mjs.map +1 -1
  145. package/lib/utils/address.d.ts +61 -61
  146. package/lib/utils/index.d.ts +0 -1
  147. package/lib/utils/index.js +0 -2
  148. package/lib/utils/index.js.map +1 -1
  149. package/lib/utils/index.mjs +0 -2
  150. package/lib/utils/index.mjs.map +1 -1
  151. package/lib/utils/money/constants.d.ts +25 -56
  152. package/lib/utils/money/constants.js +7 -72
  153. package/lib/utils/money/constants.js.map +1 -1
  154. package/lib/utils/money/constants.mjs +7 -70
  155. package/lib/utils/money/constants.mjs.map +1 -1
  156. package/lib/utils/money/format.d.ts +5 -10
  157. package/lib/utils/money/format.js +14 -22
  158. package/lib/utils/money/format.js.map +1 -1
  159. package/lib/utils/money/format.mjs +16 -23
  160. package/lib/utils/money/format.mjs.map +1 -1
  161. package/lib/utils/money/index.d.ts +1 -4
  162. package/lib/utils/money/index.js +8 -26
  163. package/lib/utils/money/index.js.map +1 -1
  164. package/lib/utils/money/index.mjs +4 -8
  165. package/lib/utils/money/index.mjs.map +1 -1
  166. package/lib/utils/money/misc.d.ts +28 -68
  167. package/lib/utils/money/misc.js +64 -35
  168. package/lib/utils/money/misc.js.map +1 -1
  169. package/lib/utils/money/misc.mjs +43 -32
  170. package/lib/utils/money/misc.mjs.map +1 -1
  171. package/lib/utils/money/tax.d.ts +2 -38
  172. package/lib/utils/money/tax.js +10 -46
  173. package/lib/utils/money/tax.js.map +1 -1
  174. package/lib/utils/money/tax.mjs +11 -42
  175. package/lib/utils/money/tax.mjs.map +1 -1
  176. package/lib/utils/money/types.d.ts +3 -78
  177. package/lib/utils/number.d.ts +1 -1
  178. package/lib/utils/number.js +1 -1
  179. package/lib/utils/number.js.map +1 -1
  180. package/lib/utils/number.mjs +1 -1
  181. package/lib/utils/number.mjs.map +1 -1
  182. package/lib/utils/validations.d.ts +15 -0
  183. package/lib/utils/validations.js +23 -0
  184. package/lib/utils/validations.js.map +1 -0
  185. package/lib/utils/validations.mjs +21 -0
  186. package/lib/utils/validations.mjs.map +1 -0
  187. package/package.json +1 -1
  188. package/lib/assets/socialMedia/x.svg.js.map +0 -1
  189. package/lib/assets/socialMedia/x.svg.mjs +0 -3
  190. package/lib/assets/socialMedia/x.svg.mjs.map +0 -1
  191. package/lib/assets/x.svg +0 -3
  192. package/lib/components/Footer/hooks/useFooterContent.d.ts +0 -94
  193. package/lib/components/Footer/hooks/useFooterContent.js +0 -384
  194. package/lib/components/Footer/hooks/useFooterContent.js.map +0 -1
  195. package/lib/components/Footer/hooks/useFooterContent.mjs +0 -348
  196. package/lib/components/Footer/hooks/useFooterContent.mjs.map +0 -1
  197. package/lib/components/Footer/translations/ar.json.js +0 -47
  198. package/lib/components/Footer/translations/ar.json.js.map +0 -1
  199. package/lib/components/Footer/translations/ar.json.mjs +0 -42
  200. package/lib/components/Footer/translations/ar.json.mjs.map +0 -1
  201. package/lib/components/Footer/translations/de.json.js +0 -47
  202. package/lib/components/Footer/translations/de.json.js.map +0 -1
  203. package/lib/components/Footer/translations/de.json.mjs +0 -42
  204. package/lib/components/Footer/translations/de.json.mjs.map +0 -1
  205. package/lib/components/Footer/translations/el.json.js +0 -47
  206. package/lib/components/Footer/translations/el.json.js.map +0 -1
  207. package/lib/components/Footer/translations/el.json.mjs +0 -42
  208. package/lib/components/Footer/translations/el.json.mjs.map +0 -1
  209. package/lib/components/Footer/translations/en.json.js +0 -46
  210. package/lib/components/Footer/translations/en.json.js.map +0 -1
  211. package/lib/components/Footer/translations/en.json.mjs +0 -41
  212. package/lib/components/Footer/translations/en.json.mjs.map +0 -1
  213. package/lib/components/Footer/translations/es.json.js +0 -47
  214. package/lib/components/Footer/translations/es.json.js.map +0 -1
  215. package/lib/components/Footer/translations/es.json.mjs +0 -42
  216. package/lib/components/Footer/translations/es.json.mjs.map +0 -1
  217. package/lib/components/Footer/translations/fr.json.js +0 -47
  218. package/lib/components/Footer/translations/fr.json.js.map +0 -1
  219. package/lib/components/Footer/translations/fr.json.mjs +0 -42
  220. package/lib/components/Footer/translations/fr.json.mjs.map +0 -1
  221. package/lib/components/Footer/translations/it.json.js +0 -47
  222. package/lib/components/Footer/translations/it.json.js.map +0 -1
  223. package/lib/components/Footer/translations/it.json.mjs +0 -42
  224. package/lib/components/Footer/translations/it.json.mjs.map +0 -1
  225. package/lib/components/Footer/translations/ja.json.js +0 -47
  226. package/lib/components/Footer/translations/ja.json.js.map +0 -1
  227. package/lib/components/Footer/translations/ja.json.mjs +0 -42
  228. package/lib/components/Footer/translations/ja.json.mjs.map +0 -1
  229. package/lib/components/Footer/translations/pt-BR.json.js +0 -47
  230. package/lib/components/Footer/translations/pt-BR.json.js.map +0 -1
  231. package/lib/components/Footer/translations/pt-BR.json.mjs +0 -42
  232. package/lib/components/Footer/translations/pt-BR.json.mjs.map +0 -1
  233. package/lib/components/Footer/translations/zh-Hans.json.js +0 -47
  234. package/lib/components/Footer/translations/zh-Hans.json.js.map +0 -1
  235. package/lib/components/Footer/translations/zh-Hans.json.mjs +0 -42
  236. package/lib/components/Footer/translations/zh-Hans.json.mjs.map +0 -1
  237. package/lib/components/Footer/translations/zh-Hant-TW.json.js +0 -47
  238. package/lib/components/Footer/translations/zh-Hant-TW.json.js.map +0 -1
  239. package/lib/components/Footer/translations/zh-Hant-TW.json.mjs +0 -42
  240. package/lib/components/Footer/translations/zh-Hant-TW.json.mjs.map +0 -1
  241. package/lib/components/Tooltip/Tooltip.d.ts +0 -2
  242. package/lib/components/Tooltip/Tooltip.js +0 -45
  243. package/lib/components/Tooltip/Tooltip.js.map +0 -1
  244. package/lib/components/Tooltip/Tooltip.mjs +0 -43
  245. package/lib/components/Tooltip/Tooltip.mjs.map +0 -1
  246. package/lib/components/Tooltip/Tooltip.styles.d.ts +0 -32
  247. package/lib/components/Tooltip/Tooltip.styles.js +0 -44
  248. package/lib/components/Tooltip/Tooltip.styles.js.map +0 -1
  249. package/lib/components/Tooltip/Tooltip.styles.mjs +0 -34
  250. package/lib/components/Tooltip/Tooltip.styles.mjs.map +0 -1
  251. package/lib/components/Tooltip/index.d.ts +0 -1
  252. package/lib/components/Tooltip/index.js +0 -6
  253. package/lib/components/Tooltip/index.js.map +0 -1
  254. package/lib/components/Tooltip/index.mjs +0 -3
  255. package/lib/components/Tooltip/index.mjs.map +0 -1
  256. package/lib/utils/money/allocators/fixedAmount.d.ts +0 -26
  257. package/lib/utils/money/allocators/fixedAmount.js +0 -55
  258. package/lib/utils/money/allocators/fixedAmount.js.map +0 -1
  259. package/lib/utils/money/allocators/fixedAmount.mjs +0 -53
  260. package/lib/utils/money/allocators/fixedAmount.mjs.map +0 -1
  261. package/lib/utils/money/allocators/index.d.ts +0 -2
  262. package/lib/utils/money/allocators/index.js +0 -8
  263. package/lib/utils/money/allocators/index.js.map +0 -1
  264. package/lib/utils/money/allocators/index.mjs +0 -4
  265. package/lib/utils/money/allocators/index.mjs.map +0 -1
  266. package/lib/utils/money/allocators/productAmount.d.ts +0 -13
  267. package/lib/utils/money/allocators/productAmount.js +0 -110
  268. package/lib/utils/money/allocators/productAmount.js.map +0 -1
  269. package/lib/utils/money/allocators/productAmount.mjs +0 -108
  270. package/lib/utils/money/allocators/productAmount.mjs.map +0 -1
  271. package/lib/utils/money/exchangeRate.d.ts +0 -31
  272. package/lib/utils/money/exchangeRate.js +0 -27
  273. package/lib/utils/money/exchangeRate.js.map +0 -1
  274. package/lib/utils/money/exchangeRate.mjs +0 -23
  275. package/lib/utils/money/exchangeRate.mjs.map +0 -1
  276. package/lib/utils/money/misc.private.d.ts +0 -23
  277. package/lib/utils/money/misc.private.js +0 -46
  278. package/lib/utils/money/misc.private.js.map +0 -1
  279. package/lib/utils/money/misc.private.mjs +0 -21
  280. package/lib/utils/money/misc.private.mjs.map +0 -1
  281. package/lib/utils/money/shipping.d.ts +0 -5
  282. package/lib/utils/money/shipping.js +0 -8
  283. package/lib/utils/money/shipping.js.map +0 -1
  284. package/lib/utils/money/shipping.mjs +0 -6
  285. package/lib/utils/money/shipping.mjs.map +0 -1
  286. package/lib/utils/money/tax.private.d.ts +0 -17
  287. package/lib/utils/money/tax.private.js +0 -65
  288. package/lib/utils/money/tax.private.js.map +0 -1
  289. package/lib/utils/money/tax.private.mjs +0 -60
  290. package/lib/utils/money/tax.private.mjs.map +0 -1
  291. package/lib/utils/typeGuards.d.ts +0 -1
  292. package/lib/utils/typeGuards.js +0 -6
  293. package/lib/utils/typeGuards.js.map +0 -1
  294. package/lib/utils/typeGuards.mjs +0 -5
  295. package/lib/utils/typeGuards.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"number.mjs","sources":["../../src/utils/number.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n\n/**\n * Custom isFloat validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.parseFloat would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L34-L38\n * @throws If given input is not a valid float\n */\nexport function isFloat(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n}\n\n/**\n * Returns a string representing a number in fixed-point notation.\n * Overload: Returns the rate parsed as a number\n * @example\n * toFixed(1.2345, 2) // => \"1.23\"\n * toFixed(1.2345, 0) // => \"1\"\n * toFixed(1.23, 4) // => \"1.2300\"\n */\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber?: boolean,\n): string;\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber: true,\n): number;\nexport function toFixedRate(rate: number, scale: number, asNumber?: boolean) {\n // Verify rate\n isFloat(rate, \"Rate\");\n\n const fixedRate = rate.toFixed(scale);\n\n return asNumber ? +fixedRate : fixedRate;\n}\n\n/**\n * Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of\n * doing it. Removes any redundant trailing zeros.\n * @example\n * numberToString(1.23) // => \"1.23\"\n * numberToString(10.00) // => \"10\"\n * @throws If given input is not a valid number\n */\nexport const numberToString = (num: number): string => {\n isFloat(num);\n return num.toString(10);\n};\n\n/**\n * @see https://stackoverflow.com/a/35000557\n */\nexport const findClosestNumber = <T extends number>(\n haystack: T[],\n needle: number,\n): T => {\n return haystack.reduce((prev, curr) =>\n Math.abs(curr - needle) < Math.abs(prev - needle) ? curr : prev,\n );\n};\n\n/**\n * Splits number into array by max value provided.\n * E.g. splitNumberBy(100, 30) => [30, 30, 30, 10]\n */\nexport const splitNumberBy = (value: number, by: number) => {\n const chunks = new Array(Math.floor(value / by)).fill(by);\n const remainder = value % by;\n\n if (remainder > 0) {\n chunks.push(remainder);\n }\n\n return chunks;\n};\n\n/**\n * Clamp value to a given range\n */\nexport const clamp = (val: number, min: number, max: number) => {\n const trueMin = Math.min(min, max);\n const trueMax = Math.max(min, max);\n\n return Math.min(trueMax, Math.max(trueMin, val));\n};\n\n/**\n * Interpolate a number to a new range\n *\n * @example\n * linearInterpolate(5, [0, 10], [0, 100]); // 50\n */\nexport const linearInterpolate = (\n inputY: number,\n [fromMin, fromMax]: [number, number],\n [toMin, toMax]: [number, number],\n clampResult = true,\n) => {\n const percent = (inputY - fromMin) / (fromMax - fromMin);\n const outputX = percent * (toMax - toMin) + toMin;\n\n return clampResult ? clamp(outputX, toMin, toMax) : outputX;\n};\n\n/**\n * Increase value and start over once the range is overflown\n */\nexport const incrementLoopValue = (\n value: number,\n [min, max]: [number, number],\n) => {\n if (value === max) {\n return min;\n }\n return value + 1;\n};\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger","isFloat","toFixedRate","rate","scale","asNumber","fixedRate","toFixed","numberToString","num","toString","findClosestNumber","haystack","needle","reduce","prev","curr","Math","abs","splitNumberBy","by","chunks","Array","floor","fill","remainder","push","clamp","val","min","max","trueMin","trueMax","linearInterpolate","inputY","fromMin","fromMax","toMin","toMax","clampResult","percent","outputX","incrementLoopValue"],"mappings":";;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KA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AAA,GAAQD,KAAS,CAAA,GAAAA,KAAA;EAE5C,OAAOE,WAAc,GAAAZ,KAAA,CAAMc,OAAS,EAAAJ,KAAA,EAAOC,KAAK,CAAI,GAAAG,OAAA;AACtD,CAAA;AAKO,MAAMC,qBAAqBA,CAChCnD,KAAA,EACA,CAACsC,GAAA,EAAKC,GAAG,CACN,KAAA;EACH,IAAIvC,UAAUuC,GAAK,EAAA;IACV,OAAAD,GAAA;EACT;EACA,OAAOtC,KAAQ,GAAA,CAAA;AACjB,CAAA;"}
1
+ {"version":3,"file":"number.mjs","sources":["../../src/utils/number.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n\n/**\n * Custom isFloat validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.parseFloat would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L34-L38\n * @throws If given input is not a valid float\n */\nexport function isFloat(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n}\n\n/**\n * Returns a string representing a number in fixed-point notation.\n * Overload: Returns the rate parsed as a number\n * @example\n * toFixed(1.2345, 2) // => \"1.23\"\n * toFixed(1.2345, 0) // => \"1\"\n * toFixed(1.23, 4) // => \"1.2300\"\n */\nexport function toFixedRate(rate: number, scale: number): string;\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber: true,\n): number;\nexport function toFixedRate(rate: number, scale = 0, asNumber = false) {\n // Verify rate\n isFloat(rate, \"Rate\");\n\n const fixedRate = rate.toFixed(scale);\n\n return asNumber ? +fixedRate : fixedRate;\n}\n\n/**\n * Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of\n * doing it. Removes any redundant trailing zeros.\n * @example\n * numberToString(1.23) // => \"1.23\"\n * numberToString(10.00) // => \"10\"\n * @throws If given input is not a valid number\n */\nexport const numberToString = (num: number): string => {\n isFloat(num);\n return num.toString(10);\n};\n\n/**\n * @see https://stackoverflow.com/a/35000557\n */\nexport const findClosestNumber = <T extends number>(\n haystack: T[],\n needle: number,\n): T => {\n return haystack.reduce((prev, curr) =>\n Math.abs(curr - needle) < Math.abs(prev - needle) ? curr : prev,\n );\n};\n\n/**\n * Splits number into array by max value provided.\n * E.g. splitNumberBy(100, 30) => [30, 30, 30, 10]\n */\nexport const splitNumberBy = (value: number, by: number) => {\n const chunks = new Array(Math.floor(value / by)).fill(by);\n const remainder = value % by;\n\n if (remainder > 0) {\n chunks.push(remainder);\n }\n\n return chunks;\n};\n\n/**\n * Clamp value to a given range\n */\nexport const clamp = (val: number, min: number, max: number) => {\n const trueMin = Math.min(min, max);\n const trueMax = Math.max(min, max);\n\n return Math.min(trueMax, Math.max(trueMin, val));\n};\n\n/**\n * Interpolate a number to a new range\n *\n * @example\n * linearInterpolate(5, [0, 10], [0, 100]); // 50\n */\nexport const linearInterpolate = (\n inputY: number,\n [fromMin, fromMax]: [number, number],\n [toMin, toMax]: [number, number],\n clampResult = true,\n) => {\n const percent = (inputY - fromMin) / (fromMax - fromMin);\n const outputX = percent * (toMax - toMin) + toMin;\n\n return clampResult ? clamp(outputX, toMin, toMax) : outputX;\n};\n\n/**\n * Increase value and start over once the range is overflown\n */\nexport const incrementLoopValue = (\n value: number,\n [min, max]: [number, number],\n) => {\n if (value === max) {\n return min;\n }\n return value + 1;\n};\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger","isFloat","toFixedRate","rate","scale","asNumber","fixedRate","toFixed","numberToString","num","toString","findClosestNumber","haystack","needle","reduce","prev","curr","Math","abs","splitNumberBy","by","chunks","Array","floor","fill","remainder","push","clamp","val","min","max","trueMin","trueMax","linearInterpolate","inputY","fromMin","fromMax","toMin","toMax","clampResult","percent","outputX","incrementLoopValue"],"mappings":";;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAO,EAAA,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAO,EAAA,CAAA;EACnE;AACF;AAWO,SAASO,KACdA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AQ,GAAA,CAAA;AACjB,CAAA;"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)
3
+ * @throws If given input is not a finite number
4
+ */
5
+ export declare function isFiniteNumber(value: unknown, entity?: string, ErrorClass?: new (message: string) => void): asserts value is number;
6
+ /**
7
+ * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a
8
+ * Number.isSafeInteger would be sufficient.
9
+ *
10
+ * Code inspired from graphql-scalars library.
11
+ * @see
12
+ * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32
13
+ * @throws If given input is not a valid integer
14
+ */
15
+ export declare function isInt(value: unknown, entity?: string, ErrorClass?: new (message: string) => void): asserts value is number;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+ "use strict";
3
+
4
+ function isFiniteNumber(value, entity = "Value", ErrorClass = TypeError) {
5
+ if (typeof value !== "number" || Number.isNaN(value)) {
6
+ throw new ErrorClass(`${entity} is not a number: ${value}`);
7
+ }
8
+ if (!Number.isFinite(value)) {
9
+ throw new ErrorClass(`${entity} is not a finite number: ${value}`);
10
+ }
11
+ }
12
+ function isInt(value, entity = "Value", ErrorClass = TypeError) {
13
+ isFiniteNumber(value, entity, ErrorClass);
14
+ if (!Number.isInteger(value)) {
15
+ throw new ErrorClass(`${entity} is not an integer: ${value}`);
16
+ }
17
+ if (!Number.isSafeInteger(value)) {
18
+ throw new ErrorClass(`${entity} is not a safe integer: ${value}`);
19
+ }
20
+ }
21
+ exports.isFiniteNumber = isFiniteNumber;
22
+ exports.isInt = isInt;
23
+ //# sourceMappingURL=validations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.js","sources":["../../src/utils/validations.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger"],"mappings":";;;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAO,EAAA,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAO,EAAA,CAAA;EACnE;AACF;AAWO,SAASO,KACdA,CAAAP,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;EAExC,IAAI,CAACE,MAAA,CAAOI,SAAU,CAAAR,KAAK,CAAG,EAAA;IAE5B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,uBAAuBD,KAAO,EAAA,CAAA;EAC9D;EAEA,IAAI,CAACI,MAAA,CAAOK,aAAc,CAAAT,KAAK,CAAG,EAAA;IAEhC,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,2BAA2BD,KAAO,EAAA,CAAA;EAClE;AACF;;"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ function isFiniteNumber(value, entity = "Value", ErrorClass = TypeError) {
4
+ if (typeof value !== "number" || Number.isNaN(value)) {
5
+ throw new ErrorClass(`${entity} is not a number: ${value}`);
6
+ }
7
+ if (!Number.isFinite(value)) {
8
+ throw new ErrorClass(`${entity} is not a finite number: ${value}`);
9
+ }
10
+ }
11
+ function isInt(value, entity = "Value", ErrorClass = TypeError) {
12
+ isFiniteNumber(value, entity, ErrorClass);
13
+ if (!Number.isInteger(value)) {
14
+ throw new ErrorClass(`${entity} is not an integer: ${value}`);
15
+ }
16
+ if (!Number.isSafeInteger(value)) {
17
+ throw new ErrorClass(`${entity} is not a safe integer: ${value}`);
18
+ }
19
+ }
20
+ export { isFiniteNumber, isInt };
21
+ //# sourceMappingURL=validations.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.mjs","sources":["../../src/utils/validations.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger"],"mappings":";;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAO,EAAA,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAO,EAAA,CAAA;EACnE;AACF;AAWO,SAASO,KACdA,CAAAP,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;EAExC,IAAI,CAACE,MAAA,CAAOI,SAAU,CAAAR,KAAK,CAAG,EAAA;IAE5B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,uBAAuBD,KAAO,EAAA,CAAA;EAC9D;EAEA,IAAI,CAACI,MAAA,CAAOK,aAAc,CAAAT,KAAK,CAAG,EAAA;IAEhC,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,2BAA2BD,KAAO,EAAA,CAAA;EAClE;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubnt/store.core",
3
- "version": "9.9.0-alpha.9",
3
+ "version": "9.9.0",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"x.svg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,3 +0,0 @@
1
- export * from "../x.svg";
2
- export { default } from "../x.svg";
3
- //# sourceMappingURL=x.svg.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"x.svg.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/lib/assets/x.svg DELETED
@@ -1,3 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path opacity="0.9" d="M8.32633 5.92873L13.5347 0H12.3009L7.77659 5.14678L4.16573 0H0L5.46152 7.78358L0 14H1.23377L6.00846 8.56366L9.82261 14H13.9883M1.67907 0.911107H3.57449L12.3 13.1337H10.4041" fill="black" fill-opacity="0.45"/>
3
- </svg>
@@ -1,94 +0,0 @@
1
- import type { StaticImageData } from "next/image";
2
- import { ExternalUrl } from "../../../constants/url";
3
- export declare enum FooterHeaderId {
4
- Company = "company",
5
- Training = "training",
6
- Buy = "buy",
7
- Tools = "tools",
8
- Social = "social",
9
- Terms = "terms"
10
- }
11
- export declare enum FooterLinkId {
12
- Careers = "careers",
13
- Contact = "contact",
14
- Investors = "investors",
15
- Courses = "courses",
16
- Calendar = "calendar",
17
- Trainers = "trainers",
18
- BecomeTrainer = "becomeTrainer",
19
- FindDistributor = "findDistributor",
20
- BecomeDistributor = "becomeDistributor",
21
- DesignCenter = "designCenter",
22
- WiFiman = "wifiman",
23
- UISP = "uisp",
24
- UispDesignCenter = "uispDesignCenter",
25
- Facebook = "facebook",
26
- X = "x",// Twitter
27
- Youtube = "youtube",
28
- Instagram = "instagram",
29
- Conditions = "conditions",
30
- Service = "service",
31
- Privacy = "privacy",
32
- Return = "return",
33
- Cookie = "cookie",
34
- Legal = "legal",
35
- Store = "store",
36
- Faq = "faq",
37
- Downloads = "downloads"
38
- }
39
- export declare const FOOTER_LINKS: {
40
- careers: ExternalUrl;
41
- contact: ExternalUrl;
42
- investors: ExternalUrl;
43
- courses: ExternalUrl;
44
- calendar: ExternalUrl;
45
- trainers: ExternalUrl;
46
- becomeTrainer: ExternalUrl;
47
- findDistributor: ExternalUrl;
48
- becomeDistributor: ExternalUrl;
49
- designCenter: ExternalUrl;
50
- wifiman: ExternalUrl;
51
- uisp: ExternalUrl;
52
- uispDesignCenter: ExternalUrl;
53
- facebook: ExternalUrl;
54
- x: ExternalUrl;
55
- youtube: ExternalUrl;
56
- instagram: ExternalUrl;
57
- service: ExternalUrl;
58
- privacy: ExternalUrl;
59
- return: ExternalUrl;
60
- };
61
- type FooterItem = {
62
- id: FooterLinkId;
63
- label: string;
64
- src: string;
65
- target?: string;
66
- icon?: string | StaticImageData;
67
- };
68
- type FooterSection = {
69
- header: {
70
- id: FooterHeaderId;
71
- label: string;
72
- };
73
- items: FooterItem[];
74
- };
75
- type FooterSections = {
76
- company: FooterSection;
77
- training: FooterSection;
78
- buy: FooterSection;
79
- tools: FooterSection;
80
- };
81
- export declare const useFooterContent: () => {
82
- footerContent: FooterSections;
83
- socialContent: FooterSection;
84
- termsContent: FooterSection;
85
- urls: {
86
- termsAndConditions: string;
87
- };
88
- };
89
- /**
90
- * One-trust cookie policy related id & class that connects with their SDK's
91
- */
92
- export declare const COOKIE_POLICY_BTN_ID = "ot-sdk-btn";
93
- export declare const COOKIE_POLICY_BTN_ID_CLASSNAME = "ot-sdk-show-settings";
94
- export {};
@@ -1,384 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- require('../../../assets/socialMedia/facebook.svg.js');
5
- require('../../../assets/socialMedia/instagram.svg.js');
6
- require('../../../assets/socialMedia/x.svg.js');
7
- require('../../../assets/socialMedia/youtube.svg.js');
8
- var url = require('../../../constants/url.js');
9
- require('../../../contexts/MenuContext/index.js');
10
- var mapping = require('../../../contexts/MenuContext/mapping.js');
11
- require('../../../hooks/index.js');
12
- require('../../../types/index.js');
13
- var typeGuards = require('../../../utils/typeGuards.js');
14
- var en = require('../translations/en.json.js');
15
- var generated = require('../../../types/generated.js');
16
- var context = require('../../../contexts/MenuContext/context.js');
17
- var useTranslation = require('../../../hooks/useTranslation.js');
18
- var constants = require('../../../types/constants.js');
19
- var FacebookIcon = require("../../../assets/facebook.svg");
20
- var XIcon = require("../../../assets/x.svg");
21
- var YoutubeIcon = require("../../../assets/youtube.svg");
22
- var InstagramIcon = require("../../../assets/instagram.svg");
23
- function _interopDefault(e) {
24
- return e && e.__esModule ? e : {
25
- default: e
26
- };
27
- }
28
- var FacebookIcon__default = /*#__PURE__*/_interopDefault(FacebookIcon);
29
- var XIcon__default = /*#__PURE__*/_interopDefault(XIcon);
30
- var YoutubeIcon__default = /*#__PURE__*/_interopDefault(YoutubeIcon);
31
- var InstagramIcon__default = /*#__PURE__*/_interopDefault(InstagramIcon);
32
- "use strict";
33
- var FooterHeaderId = /* @__PURE__ */(FooterHeaderId2 => {
34
- FooterHeaderId2["Company"] = "company";
35
- FooterHeaderId2["Training"] = "training";
36
- FooterHeaderId2["Buy"] = "buy";
37
- FooterHeaderId2["Tools"] = "tools";
38
- FooterHeaderId2["Social"] = "social";
39
- FooterHeaderId2["Terms"] = "terms";
40
- return FooterHeaderId2;
41
- })(FooterHeaderId || {});
42
- var FooterLinkId = /* @__PURE__ */(FooterLinkId2 => {
43
- FooterLinkId2["Careers"] = "careers";
44
- FooterLinkId2["Contact"] = "contact";
45
- FooterLinkId2["Investors"] = "investors";
46
- FooterLinkId2["Courses"] = "courses";
47
- FooterLinkId2["Calendar"] = "calendar";
48
- FooterLinkId2["Trainers"] = "trainers";
49
- FooterLinkId2["BecomeTrainer"] = "becomeTrainer";
50
- FooterLinkId2["FindDistributor"] = "findDistributor";
51
- FooterLinkId2["BecomeDistributor"] = "becomeDistributor";
52
- FooterLinkId2["DesignCenter"] = "designCenter";
53
- FooterLinkId2["WiFiman"] = "wifiman";
54
- FooterLinkId2["UISP"] = "uisp";
55
- FooterLinkId2["UispDesignCenter"] = "uispDesignCenter";
56
- FooterLinkId2["Facebook"] = "facebook";
57
- FooterLinkId2["X"] = "x";
58
- FooterLinkId2["Youtube"] = "youtube";
59
- FooterLinkId2["Instagram"] = "instagram";
60
- FooterLinkId2["Conditions"] = "conditions";
61
- FooterLinkId2["Service"] = "service";
62
- FooterLinkId2["Privacy"] = "privacy";
63
- FooterLinkId2["Return"] = "return";
64
- FooterLinkId2["Cookie"] = "cookie";
65
- FooterLinkId2["Legal"] = "legal";
66
- FooterLinkId2["Store"] = "store";
67
- FooterLinkId2["Faq"] = "faq";
68
- FooterLinkId2["Downloads"] = "downloads";
69
- return FooterLinkId2;
70
- })(FooterLinkId || {});
71
- const FOOTER_LINKS = {
72
- ["careers" /* Careers */]: url.ExternalUrl.CAREERS,
73
- ["contact" /* Contact */]: url.ExternalUrl.CONTACT,
74
- ["investors" /* Investors */]: url.ExternalUrl.INVESTORS,
75
- ["courses" /* Courses */]: url.ExternalUrl.COURSES,
76
- ["calendar" /* Calendar */]: url.ExternalUrl.CALENDAR,
77
- ["trainers" /* Trainers */]: url.ExternalUrl.PARTNERS,
78
- ["becomeTrainer" /* BecomeTrainer */]: url.ExternalUrl.TRAINERS,
79
- ["findDistributor" /* FindDistributor */]: url.ExternalUrl.FIND_DISTRIBUTOR,
80
- ["becomeDistributor" /* BecomeDistributor */]: url.ExternalUrl.BECOME_DISTRIBUTOR,
81
- ["designCenter" /* DesignCenter */]: url.ExternalUrl.DESIGN_CENTER,
82
- ["wifiman" /* WiFiman */]: url.ExternalUrl.WIFIMAN,
83
- ["uisp" /* UISP */]: url.ExternalUrl.UISP,
84
- ["uispDesignCenter" /* UispDesignCenter */]: url.ExternalUrl.UISP_DESIGN_CENTER,
85
- ["facebook" /* Facebook */]: url.ExternalUrl.FACEBOOK,
86
- ["x" /* X */]: url.ExternalUrl.X,
87
- // Twitter
88
- ["youtube" /* Youtube */]: url.ExternalUrl.YOUTUBE,
89
- ["instagram" /* Instagram */]: url.ExternalUrl.INSTAGRAM,
90
- ["service" /* Service */]: url.ExternalUrl.TERMS_SERVICE,
91
- ["privacy" /* Privacy */]: url.ExternalUrl.PRIVACY_POLICY,
92
- ["return" /* Return */]: url.ExternalUrl.RETURN_POLICY
93
- };
94
- const TOC_LINKS = {
95
- [generated.GlobalStoreId.Ca]: "https://www.ui.com/legal/ui-ca-store/termsandconditions/",
96
- [generated.GlobalStoreId.Us]: "https://www.ui.com/legal/ui-store/termsandconditions/",
97
- [generated.GlobalStoreId.Eu]: "https://www.ui.com/legal/ui-eu-store/termsandconditions/",
98
- [generated.GlobalStoreId.Za]: "https://www.ui.com/legal/ui-za-store/termsandconditions/",
99
- [generated.GlobalStoreId.Me]: "https://www.ui.com/legal/ui-me-store/termsandconditions/",
100
- [generated.GlobalStoreId.Uk]: "https://cdn.ecomm.ui.com/terms-and-conditions/UK+Store+Terms+and+Conditions.pdf",
101
- [generated.GlobalStoreId.In]: "https://www.ui.com/legal/ui-in-store/termsandconditions/",
102
- [generated.GlobalStoreId.Sg]: "https://www.ui.com/legal/ui-sg-store/termsandconditions/",
103
- [generated.GlobalStoreId.Br]: "https://www.ui.com/legal/ui-br-store/termsandconditions/",
104
- [generated.GlobalStoreId.Mx]: "https://www.ui.com/legal/ui-mx-store/termsandconditions/",
105
- [generated.GlobalStoreId.Jp]: "https://www.ui.com/legal/ui-jp-store/termsandconditions/",
106
- [generated.GlobalStoreId.Tw]: "https://www.ui.com/legal/ui-tw-store/termsandconditions/",
107
- [generated.GlobalStoreId.Ph]: "https://www.ui.com/legal/ui-ph-store/termsandconditions/",
108
- [generated.GlobalStoreId.Cn]: "https://www.ui.com.cn/legal/ui-store/termsandconditions/"
109
- };
110
- const CONTACT_LINKS = {
111
- [generated.GlobalStoreId.Us]: url.ExternalUrl.CONTACT,
112
- [generated.GlobalStoreId.Tw]: "https://tw.ui.com/contact/"
113
- };
114
- const BECOME_DISTRIBUTOR_LINKS = {
115
- [generated.GlobalStoreId.Us]: url.ExternalUrl.BECOME_DISTRIBUTOR,
116
- [generated.GlobalStoreId.Tw]: "https://tw.ui.com/distributors/become-authorized-distributor/"
117
- };
118
- const TOS_LINKS = {
119
- [generated.GlobalStoreId.Us]: url.ExternalUrl.TERMS_SERVICE
120
- };
121
- const FACEBOOK_LINKS = {
122
- [generated.GlobalStoreId.Us]: url.ExternalUrl.FACEBOOK,
123
- [generated.GlobalStoreId.Jp]: "https://www.facebook.com/UbiquitiJapan"
124
- };
125
- const getRegionalLink = (links, storeId = generated.GlobalStoreId.Us) => {
126
- const link = links[storeId];
127
- if (link) {
128
- return link;
129
- }
130
- return links[generated.StoreId.Us];
131
- };
132
- const useFooterContent = () => {
133
- const {
134
- storeId: globalStoreId,
135
- context: context$1,
136
- createSiteUrl
137
- } = context.useMenu();
138
- const {
139
- formatMessage
140
- } = useTranslation.useTranslation({
141
- defaultTranslation: en["default"],
142
- additionalTranslations: {
143
- [constants.Language.Ja]: () => Promise.resolve().then(function () {
144
- return require('../translations/ja.json.js');
145
- }).then(res => res.default),
146
- [constants.Language.Ar]: () => Promise.resolve().then(function () {
147
- return require('../translations/ar.json.js');
148
- }).then(res => res.default),
149
- [constants.Language.De]: () => Promise.resolve().then(function () {
150
- return require('../translations/de.json.js');
151
- }).then(res => res.default),
152
- [constants.Language.Es]: () => Promise.resolve().then(function () {
153
- return require('../translations/es.json.js');
154
- }).then(res => res.default),
155
- [constants.Language.El]: () => Promise.resolve().then(function () {
156
- return require('../translations/el.json.js');
157
- }).then(res => res.default),
158
- [constants.Language.It]: () => Promise.resolve().then(function () {
159
- return require('../translations/it.json.js');
160
- }).then(res => res.default),
161
- [constants.Language.Pt]: () => Promise.resolve().then(function () {
162
- return require('../translations/pt-BR.json.js');
163
- }).then(res => res.default),
164
- [constants.Language.Zh]: () => Promise.resolve().then(function () {
165
- return require('../translations/zh-Hans.json.js');
166
- }).then(res => res.default),
167
- [constants.Language.Fr]: () => Promise.resolve().then(function () {
168
- return require('../translations/fr.json.js');
169
- }).then(res => res.default),
170
- [constants.Language.Tw]: () => Promise.resolve().then(function () {
171
- return require('../translations/zh-Hant-TW.json.js');
172
- }).then(res => res.default)
173
- }
174
- });
175
- const urls = react.useMemo(() => {
176
- return {
177
- termsAndConditions: getRegionalLink(TOC_LINKS, globalStoreId)
178
- };
179
- }, [globalStoreId]);
180
- const footerContent = react.useMemo(() => ({
181
- company: {
182
- header: {
183
- id: "company" /* Company */,
184
- label: formatMessage("footer.header.company")
185
- },
186
- items: [{
187
- id: "careers" /* Careers */,
188
- label: formatMessage("footer.link.careers"),
189
- src: FOOTER_LINKS["careers" /* Careers */],
190
- target: "_blank"
191
- }, {
192
- id: "contact" /* Contact */,
193
- label: formatMessage("footer.link.contact"),
194
- src: getRegionalLink(CONTACT_LINKS, globalStoreId),
195
- target: "_blank"
196
- }, {
197
- id: "investors" /* Investors */,
198
- label: formatMessage("footer.link.investors"),
199
- src: FOOTER_LINKS["investors" /* Investors */],
200
- target: "_blank"
201
- }].filter(typeGuards.isNonNullish)
202
- },
203
- training: {
204
- header: {
205
- id: "training" /* Training */,
206
- label: formatMessage("footer.header.training")
207
- },
208
- items: [{
209
- id: "courses" /* Courses */,
210
- label: formatMessage("footer.link.courses"),
211
- src: FOOTER_LINKS["courses" /* Courses */],
212
- target: "_blank"
213
- }, {
214
- id: "calendar" /* Calendar */,
215
- label: formatMessage("footer.link.calendar"),
216
- src: FOOTER_LINKS["calendar" /* Calendar */],
217
- target: "_blank"
218
- }, {
219
- id: "trainers" /* Trainers */,
220
- label: formatMessage("footer.link.trainers"),
221
- src: FOOTER_LINKS["trainers" /* Trainers */],
222
- target: "_blank"
223
- }, {
224
- id: "becomeTrainer" /* BecomeTrainer */,
225
- label: formatMessage("footer.link.becomeTrainer"),
226
- src: FOOTER_LINKS["becomeTrainer" /* BecomeTrainer */],
227
- target: "_blank"
228
- }].filter(typeGuards.isNonNullish)
229
- },
230
- buy: {
231
- header: {
232
- id: "buy" /* Buy */,
233
- label: formatMessage("footer.header.buy")
234
- },
235
- items: [context$1 !== mapping.SiteId.Store ? {
236
- id: "store" /* Store */,
237
- label: formatMessage("footer.link.store"),
238
- src: createSiteUrl([mapping.SiteId.Store, "/"]),
239
- target: "_blank"
240
- } : null, {
241
- id: "findDistributor" /* FindDistributor */,
242
- label: formatMessage("footer.link.distributor.find"),
243
- src: FOOTER_LINKS["findDistributor" /* FindDistributor */],
244
- target: "_blank"
245
- }, {
246
- id: "becomeDistributor" /* BecomeDistributor */,
247
- label: formatMessage("footer.link.distributor.become"),
248
- src: getRegionalLink(BECOME_DISTRIBUTOR_LINKS, globalStoreId),
249
- target: "_blank"
250
- }].filter(typeGuards.isNonNullish)
251
- },
252
- tools: {
253
- header: {
254
- id: "tools" /* Tools */,
255
- label: formatMessage("footer.header.tools")
256
- },
257
- items: [{
258
- id: "wifiman" /* WiFiman */,
259
- label: formatMessage("footer.link.wifiman"),
260
- src: FOOTER_LINKS["wifiman" /* WiFiman */],
261
- target: "_blank"
262
- }, {
263
- id: "uisp" /* UISP */,
264
- label: formatMessage("footer.link.uisp"),
265
- src: FOOTER_LINKS["uisp" /* UISP */],
266
- target: "_blank"
267
- }, {
268
- id: "designCenter" /* DesignCenter */,
269
- label: formatMessage("footer.link.designCenter"),
270
- src: FOOTER_LINKS["designCenter" /* DesignCenter */],
271
- target: "_blank"
272
- }, {
273
- id: "uispDesignCenter" /* UispDesignCenter */,
274
- label: formatMessage("footer.link.uispDesignCenter"),
275
- src: FOOTER_LINKS["uispDesignCenter" /* UispDesignCenter */],
276
- target: "_blank"
277
- }, {
278
- id: "downloads" /* Downloads */,
279
- label: formatMessage("footer.link.downloads"),
280
- src: url.ExternalUrl.UI_DOWNLOADS,
281
- target: "_blank"
282
- }].filter(typeGuards.isNonNullish)
283
- }
284
- }), [context$1, createSiteUrl, formatMessage, globalStoreId]);
285
- const socialContent = react.useMemo(() => ({
286
- header: {
287
- id: "social" /* Social */,
288
- label: formatMessage("footer.header.social")
289
- },
290
- items: [{
291
- id: "facebook" /* Facebook */,
292
- label: "Facebook",
293
- src: getRegionalLink(FACEBOOK_LINKS, globalStoreId),
294
- icon: FacebookIcon__default["default"],
295
- target: "_blank"
296
- }, {
297
- id: "x" /* X */,
298
- label: "X",
299
- src: FOOTER_LINKS["x" /* X */],
300
- icon: XIcon__default["default"],
301
- target: "_blank"
302
- }, {
303
- id: "youtube" /* Youtube */,
304
- label: "Youtube",
305
- src: FOOTER_LINKS["youtube" /* Youtube */],
306
- icon: YoutubeIcon__default["default"],
307
- target: "_blank"
308
- }, {
309
- id: "instagram" /* Instagram */,
310
- label: "Instagram",
311
- src: FOOTER_LINKS["instagram" /* Instagram */],
312
- icon: InstagramIcon__default["default"],
313
- target: "_blank"
314
- }].filter(typeGuards.isNonNullish)
315
- }), [formatMessage, globalStoreId]);
316
- const termsContent = react.useMemo(() => ({
317
- header: {
318
- id: "terms" /* Terms */,
319
- label: formatMessage("footer.header.terms")
320
- },
321
- items: [
322
- // Show "Terms and Conditions" only on store
323
- context$1 === mapping.SiteId.Store ? {
324
- id: "conditions" /* Conditions */,
325
- label: formatMessage("footer.link.terms.conditions"),
326
- src: urls.termsAndConditions,
327
- target: "_blank"
328
- } : null, {
329
- id: "service" /* Service */,
330
- label: formatMessage("footer.link.terms.service"),
331
- src: getRegionalLink(TOS_LINKS, globalStoreId),
332
- target: "_blank"
333
- }, {
334
- id: "privacy" /* Privacy */,
335
- label: formatMessage("footer.link.terms.policy.privacy"),
336
- src: FOOTER_LINKS["privacy" /* Privacy */],
337
- target: "_blank"
338
- },
339
- // Show "Legal" only on non-store sites
340
- context$1 !== mapping.SiteId.Store ? {
341
- id: "legal" /* Legal */,
342
- label: formatMessage("footer.link.legal"),
343
- src: "https://www.ui.com/legal/",
344
- target: "_blank"
345
- } : null,
346
- // Show "Return Policy" only on store
347
- context$1 === mapping.SiteId.Store ? {
348
- id: "return" /* Return */,
349
- label: formatMessage("footer.link.terms.policy.return"),
350
- /**
351
- * Currently the same URL as per request of @kaspars.kristapsons
352
- * @see https://ui.enterprise.slack.com/files/U03KX6R6519/F0594F39XGS/screenshot_2023-05-23_at_20.49.36.png
353
- */
354
- src: getRegionalLink(TOC_LINKS, globalStoreId),
355
- target: "_blank"
356
- } : null, {
357
- id: "cookie" /* Cookie */,
358
- label: formatMessage("footer.link.terms.cookie"),
359
- src: ""
360
- },
361
- // Show "FAQ" only on store
362
- context$1 === mapping.SiteId.Store ? {
363
- id: "faq" /* Faq */,
364
- label: formatMessage("footer.link.terms.faq"),
365
- src: createSiteUrl([mapping.SiteId.Store, "/faq"]),
366
- target: "_blank"
367
- } : null].filter(typeGuards.isNonNullish)
368
- }), [context$1, createSiteUrl, formatMessage, globalStoreId, urls.termsAndConditions]);
369
- return {
370
- footerContent,
371
- socialContent,
372
- termsContent,
373
- urls
374
- };
375
- };
376
- const COOKIE_POLICY_BTN_ID = "ot-sdk-btn";
377
- const COOKIE_POLICY_BTN_ID_CLASSNAME = "ot-sdk-show-settings";
378
- exports.COOKIE_POLICY_BTN_ID = COOKIE_POLICY_BTN_ID;
379
- exports.COOKIE_POLICY_BTN_ID_CLASSNAME = COOKIE_POLICY_BTN_ID_CLASSNAME;
380
- exports.FOOTER_LINKS = FOOTER_LINKS;
381
- exports.FooterHeaderId = FooterHeaderId;
382
- exports.FooterLinkId = FooterLinkId;
383
- exports.useFooterContent = useFooterContent;
384
- //# sourceMappingURL=useFooterContent.js.map