@ubnt/store.core 10.11.0-beta.4 → 10.11.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 (500) hide show
  1. package/CHANGELOG.md +21 -289
  2. package/lib/assets/ai-dslr.jpg +0 -0
  3. package/lib/assets/ai-dslr2.jpg +0 -0
  4. package/lib/assets/ai-lpr.jpg +0 -0
  5. package/lib/assets/ai-lpr2.jpg +0 -0
  6. package/lib/assets/ai-theta-pro.jpg +0 -0
  7. package/lib/assets/ai-theta-pro2.jpg +0 -0
  8. package/lib/assets/ai-theta.jpg +0 -0
  9. package/lib/assets/ai-theta2.jpg +0 -0
  10. package/lib/assets/ai-turret.jpg +0 -0
  11. package/lib/assets/ai-turret2.jpg +0 -0
  12. package/lib/assets/door-hub-mini.jpg +0 -0
  13. package/lib/assets/door-hub-mini2.jpg +0 -0
  14. package/lib/assets/flex.jpg +0 -0
  15. package/lib/assets/flex2.jpg +0 -0
  16. package/lib/assets/g3-starter-kit.jpg +0 -0
  17. package/lib/assets/g3-starter-kit2.jpg +0 -0
  18. package/lib/assets/g4-instant.jpg +0 -0
  19. package/lib/assets/g4-instant2.jpg +0 -0
  20. package/lib/assets/g4-ptz.jpg +0 -0
  21. package/lib/assets/g4-ptz3.jpg +0 -0
  22. package/lib/assets/g5-dome-ultra.jpg +0 -0
  23. package/lib/assets/g5-dome-ultra2.jpg +0 -0
  24. package/lib/assets/g5-dome.jpg +0 -0
  25. package/lib/assets/g5-dome2.jpg +0 -0
  26. package/lib/assets/g5-flex.jpg +0 -0
  27. package/lib/assets/g5-flex2.jpg +0 -0
  28. package/lib/assets/g5-ptz.jpg +0 -0
  29. package/lib/assets/g5-ptz3.jpg +0 -0
  30. package/lib/assets/reader-lite.jpg +0 -0
  31. package/lib/assets/reader-lite2.jpg +0 -0
  32. package/lib/assets/u7-pro-max.jpg +0 -0
  33. package/lib/assets/u7-pro-max2.jpg +0 -0
  34. package/lib/assets/ucgFiber.jpg +0 -0
  35. package/lib/assets/ucgFiber2.jpg +0 -0
  36. package/lib/assets/udr2.jpg +0 -0
  37. package/lib/assets/udr3.jpg +0 -0
  38. package/lib/components/Header/AccountMenu/AccountMenu.js +5 -18
  39. package/lib/components/Header/AccountMenu/AccountMenu.js.map +1 -1
  40. package/lib/components/Header/AccountMenu/AccountMenu.mjs +5 -18
  41. package/lib/components/Header/AccountMenu/AccountMenu.mjs.map +1 -1
  42. package/lib/components/Header/CartIcon/CartIcon.d.ts +1 -1
  43. package/lib/components/Header/CartIcon/CartIcon.js +1 -5
  44. package/lib/components/Header/CartIcon/CartIcon.js.map +1 -1
  45. package/lib/components/Header/CartIcon/CartIcon.mjs +1 -5
  46. package/lib/components/Header/CartIcon/CartIcon.mjs.map +1 -1
  47. package/lib/components/Header/CartIcon/CartIcon.types.d.ts +0 -2
  48. package/lib/components/Header/Header.js +1 -1
  49. package/lib/components/Header/Header.js.map +1 -1
  50. package/lib/components/Header/Header.mjs +2 -2
  51. package/lib/components/Header/Header.mjs.map +1 -1
  52. package/lib/components/Header/Header.stories.d.ts +0 -2
  53. package/lib/components/Header/Header.styles.d.ts +3 -5
  54. package/lib/components/Header/Header.styles.js +10 -11
  55. package/lib/components/Header/Header.styles.js.map +1 -1
  56. package/lib/components/Header/Header.styles.mjs +10 -12
  57. package/lib/components/Header/Header.styles.mjs.map +1 -1
  58. package/lib/components/Header/Header.types.d.ts +0 -7
  59. package/lib/components/Header/Header.types.js.map +1 -1
  60. package/lib/components/Header/Header.types.mjs.map +1 -1
  61. package/lib/components/Header/ProHeader/ProHeader.d.ts +0 -1
  62. package/lib/components/Header/ProHeader/ProHeader.js +27 -59
  63. package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
  64. package/lib/components/Header/ProHeader/ProHeader.mjs +29 -61
  65. package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
  66. package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +0 -4
  67. package/lib/components/Header/ProHeader/ProHeader.styles.js +0 -50
  68. package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
  69. package/lib/components/Header/ProHeader/ProHeader.styles.mjs +1 -47
  70. package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
  71. package/lib/components/Microsites/MicrositeProductPage.js +1 -1
  72. package/lib/components/Microsites/MicrositeProductPage.js.map +1 -1
  73. package/lib/components/Microsites/MicrositeProductPage.mjs +1 -1
  74. package/lib/components/Microsites/MicrositeProductPage.mjs.map +1 -1
  75. package/lib/components/Microsites/Microsites.types.d.ts +2 -5
  76. package/lib/components/Microsites/Microsites.types.js.map +1 -1
  77. package/lib/components/Microsites/Microsites.types.mjs.map +1 -1
  78. package/lib/components/ModelCompareV3/ModelCompareV3.d.ts +18 -2
  79. package/lib/components/ModelCompareV3/ModelCompareV3.js +12 -25
  80. package/lib/components/ModelCompareV3/ModelCompareV3.js.map +1 -1
  81. package/lib/components/ModelCompareV3/ModelCompareV3.mjs +13 -26
  82. package/lib/components/ModelCompareV3/ModelCompareV3.mjs.map +1 -1
  83. package/lib/components/ModelCompareV3/data/index.d.ts +56 -56
  84. package/lib/components/ModelCompareV3/data/index.js +166 -335
  85. package/lib/components/ModelCompareV3/data/index.js.map +1 -1
  86. package/lib/components/ModelCompareV3/data/index.mjs +165 -225
  87. package/lib/components/ModelCompareV3/data/index.mjs.map +1 -1
  88. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js +2 -607
  89. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js.map +1 -1
  90. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs +2 -603
  91. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs.map +1 -1
  92. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.d.ts +1 -5
  93. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js +0 -4
  94. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js.map +1 -1
  95. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs +0 -4
  96. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs.map +1 -1
  97. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.js +5 -1
  98. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.js.map +1 -1
  99. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.mjs +6 -2
  100. package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.mjs.map +1 -1
  101. package/lib/components/ResourceCalculatorV1/translations/en.json.js +0 -4
  102. package/lib/components/ResourceCalculatorV1/translations/en.json.js.map +1 -1
  103. package/lib/components/ResourceCalculatorV1/translations/en.json.mjs +0 -4
  104. package/lib/components/ResourceCalculatorV1/translations/en.json.mjs.map +1 -1
  105. package/lib/components/ResourceCalculatorV1/translations/useResourceCalculatorTranslation.d.ts +2 -2
  106. package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.js +1 -1
  107. package/lib/constants/modelCompareData/assets/Bullet/ai-dslr.jpg.mjs +2 -2
  108. package/lib/constants/modelCompareData/assets/Bullet/ai-lpr.jpg.js +1 -1
  109. package/lib/constants/modelCompareData/assets/Bullet/ai-lpr.jpg.mjs +2 -2
  110. package/lib/constants/modelCompareData/assets/CameraSecurity/ai-theta-pro.jpg.js +5 -5
  111. package/lib/constants/modelCompareData/assets/CameraSecurity/ai-theta-pro.jpg.mjs +2 -2
  112. package/lib/constants/modelCompareData/assets/CameraSecurity/g4-ptz.jpg.js +5 -5
  113. package/lib/constants/modelCompareData/assets/CameraSecurity/g4-ptz.jpg.mjs +2 -2
  114. package/lib/constants/modelCompareData/assets/CameraSecurity/g5-ptz.jpg.js +5 -5
  115. package/lib/constants/modelCompareData/assets/CameraSecurity/g5-ptz.jpg.mjs +2 -2
  116. package/lib/constants/modelCompareData/assets/Compact/g4-instant.jpg.js +1 -1
  117. package/lib/constants/modelCompareData/assets/Compact/g4-instant.jpg.mjs +2 -2
  118. package/lib/constants/modelCompareData/assets/Compact/g5-flex.jpg.js +1 -1
  119. package/lib/constants/modelCompareData/assets/Compact/g5-flex.jpg.mjs +2 -2
  120. package/lib/constants/modelCompareData/assets/Consoles/bigCompare/ucgFiber.jpg.js +5 -5
  121. package/lib/constants/modelCompareData/assets/Consoles/bigCompare/ucgFiber.jpg.mjs +2 -2
  122. package/lib/constants/modelCompareData/assets/Consoles/bigCompare/udr.jpg.js +1 -1
  123. package/lib/constants/modelCompareData/assets/Consoles/bigCompare/udr.jpg.mjs +2 -2
  124. package/lib/constants/modelCompareData/assets/Consoles/ucgFiber.jpg.js +1 -1
  125. package/lib/constants/modelCompareData/assets/Consoles/ucgFiber.jpg.mjs +2 -2
  126. package/lib/constants/modelCompareData/assets/Consoles/udr.jpg.js +1 -1
  127. package/lib/constants/modelCompareData/assets/Consoles/udr.jpg.mjs +2 -2
  128. package/lib/constants/modelCompareData/assets/DomeTurret/ai-turret.jpg.js +1 -1
  129. package/lib/constants/modelCompareData/assets/DomeTurret/ai-turret.jpg.mjs +2 -2
  130. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome-ultra.jpg.js +1 -1
  131. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome-ultra.jpg.mjs +2 -2
  132. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.js +1 -1
  133. package/lib/constants/modelCompareData/assets/DomeTurret/g5-dome.jpg.mjs +2 -2
  134. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.js +1 -1
  135. package/lib/constants/modelCompareData/assets/DoorAccess/door-hub-mini.jpg.mjs +2 -2
  136. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.js +1 -1
  137. package/lib/constants/modelCompareData/assets/DoorAccess/g3-starter-kit.jpg.mjs +2 -2
  138. package/lib/constants/modelCompareData/assets/DoorAccess/reader-lite.jpg.js +1 -1
  139. package/lib/constants/modelCompareData/assets/DoorAccess/reader-lite.jpg.mjs +2 -2
  140. package/lib/constants/modelCompareData/assets/Flagship/u7-pro-max.jpg.js +1 -1
  141. package/lib/constants/modelCompareData/assets/Flagship/u7-pro-max.jpg.mjs +2 -2
  142. package/lib/constants/modelCompareData/assets/Interior/ai-theta-pro.jpg.js +1 -1
  143. package/lib/constants/modelCompareData/assets/Interior/ai-theta-pro.jpg.mjs +2 -2
  144. package/lib/constants/modelCompareData/assets/Interior/ai-theta.jpg.js +1 -1
  145. package/lib/constants/modelCompareData/assets/Interior/ai-theta.jpg.mjs +2 -2
  146. package/lib/constants/modelCompareData/assets/Switching/flex.jpg.js +1 -1
  147. package/lib/constants/modelCompareData/assets/Switching/flex.jpg.mjs +2 -2
  148. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.js +1 -1
  149. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-dslr.jpg.mjs +2 -2
  150. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-lpr.jpg.js +1 -1
  151. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/bullet/ai-lpr.jpg.mjs +2 -2
  152. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g4-instant.jpg.js +1 -1
  153. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g4-instant.jpg.mjs +2 -2
  154. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g5-flex.jpg.js +1 -1
  155. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/compact/g5-flex.jpg.mjs +2 -2
  156. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-turret.jpg.js +1 -1
  157. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/ai-turret.jpg.mjs +2 -2
  158. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome-ultra.jpg.js +1 -1
  159. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome-ultra.jpg.mjs +2 -2
  160. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.js +1 -1
  161. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/dome-and-turret/g5-dome.jpg.mjs +2 -2
  162. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.js +1 -1
  163. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/door-hub-mini.jpg.mjs +2 -2
  164. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.js +1 -1
  165. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/g3-starter-kit.jpg.mjs +2 -2
  166. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/reader-lite.jpg.js +1 -1
  167. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/door-access/reader-lite.jpg.mjs +2 -2
  168. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/interior-design/ai-theta.jpg.js +1 -1
  169. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/interior-design/ai-theta.jpg.mjs +2 -2
  170. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g4-ptz.jpg.js +1 -1
  171. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g4-ptz.jpg.mjs +2 -2
  172. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.js +1 -1
  173. package/lib/constants/modelCompareData/assets/product-list-assets/cameras/ptz/g5-ptz.jpg.mjs +2 -2
  174. package/lib/constants/modelCompareData/assets/product-list-assets/switches/utility/flex.jpg.js +1 -1
  175. package/lib/constants/modelCompareData/assets/product-list-assets/switches/utility/flex.jpg.mjs +2 -2
  176. package/lib/constants/modelCompareData/assets/product-list-assets/wifi/flagship/u7-pro-max.jpg.js +1 -1
  177. package/lib/constants/modelCompareData/assets/product-list-assets/wifi/flagship/u7-pro-max.jpg.mjs +2 -2
  178. package/lib/constants/modelCompareData/data/CameraSecurity.js +7 -7
  179. package/lib/constants/modelCompareData/data/CameraSecurity.mjs +4 -4
  180. package/lib/constants/modelCompareData/data/CloudGateways.js +11 -11
  181. package/lib/constants/modelCompareData/data/CloudGateways.mjs +10 -10
  182. package/lib/constants/modelCompareData/data/DreamMachineConsolev4.js +1 -1
  183. package/lib/constants/modelCompareData/data/DreamMachineConsolev4.mjs +1 -1
  184. package/lib/constants/modelCompareData/data/EnterpriseSwitching.js +2 -3
  185. package/lib/constants/modelCompareData/data/EnterpriseSwitching.js.map +1 -1
  186. package/lib/constants/modelCompareData/data/EnterpriseSwitching.mjs +2 -3
  187. package/lib/constants/modelCompareData/data/EnterpriseSwitching.mjs.map +1 -1
  188. package/lib/constants/modelCompareData/data/MegaCapacityWiFI.js +3 -3
  189. package/lib/constants/modelCompareData/data/MegaCapacityWiFI.mjs +3 -3
  190. package/lib/constants/modelCompareData/data/MobileRouters.js +2 -2
  191. package/lib/constants/modelCompareData/data/MobileRouters.mjs +2 -2
  192. package/lib/constants/modelCompareData/data/ProfessionalMaxSwitching.d.ts +1 -1
  193. package/lib/constants/modelCompareData/data/ProfessionalMaxSwitching.js +4 -5
  194. package/lib/constants/modelCompareData/data/ProfessionalMaxSwitching.js.map +1 -1
  195. package/lib/constants/modelCompareData/data/ProfessionalMaxSwitching.mjs +4 -5
  196. package/lib/constants/modelCompareData/data/ProfessionalMaxSwitching.mjs.map +1 -1
  197. package/lib/constants/modelCompareData/data/Switching.js +1 -2
  198. package/lib/constants/modelCompareData/data/Switching.js.map +1 -1
  199. package/lib/constants/modelCompareData/data/Switching.mjs +1 -2
  200. package/lib/constants/modelCompareData/data/Switching.mjs.map +1 -1
  201. package/lib/constants/modelCompareData/data/index.d.ts +1 -1
  202. package/lib/constants/modelCompareData/data/index.js +1 -1
  203. package/lib/constants/modelCompareData/data/index.mjs +1 -1
  204. package/lib/constants/modelCompareData/data/products/aggregation.js +0 -7
  205. package/lib/constants/modelCompareData/data/products/aggregation.js.map +1 -1
  206. package/lib/constants/modelCompareData/data/products/aggregation.mjs +0 -7
  207. package/lib/constants/modelCompareData/data/products/aggregation.mjs.map +1 -1
  208. package/lib/constants/modelCompareData/data/products/aiDslr.js +2 -2
  209. package/lib/constants/modelCompareData/data/products/aiDslr.mjs +2 -2
  210. package/lib/constants/modelCompareData/data/products/aiLpr.js +2 -2
  211. package/lib/constants/modelCompareData/data/products/aiLpr.mjs +2 -2
  212. package/lib/constants/modelCompareData/data/products/aiTurret.js +2 -2
  213. package/lib/constants/modelCompareData/data/products/aiTurret.mjs +2 -2
  214. package/lib/constants/modelCompareData/data/products/doorHubMini.js +2 -2
  215. package/lib/constants/modelCompareData/data/products/doorHubMini.mjs +2 -2
  216. package/lib/constants/modelCompareData/data/products/efg.js +3 -3
  217. package/lib/constants/modelCompareData/data/products/efg.mjs +2 -2
  218. package/lib/constants/modelCompareData/data/products/elevatorHub.js +12 -6
  219. package/lib/constants/modelCompareData/data/products/elevatorHub.js.map +1 -1
  220. package/lib/constants/modelCompareData/data/products/elevatorHub.mjs +12 -6
  221. package/lib/constants/modelCompareData/data/products/elevatorHub.mjs.map +1 -1
  222. package/lib/constants/modelCompareData/data/products/enterpriseAggregation.js +0 -7
  223. package/lib/constants/modelCompareData/data/products/enterpriseAggregation.js.map +1 -1
  224. package/lib/constants/modelCompareData/data/products/enterpriseAggregation.mjs +0 -7
  225. package/lib/constants/modelCompareData/data/products/enterpriseAggregation.mjs.map +1 -1
  226. package/lib/constants/modelCompareData/data/products/enterpriseCampus24PoE.js +0 -7
  227. package/lib/constants/modelCompareData/data/products/enterpriseCampus24PoE.js.map +1 -1
  228. package/lib/constants/modelCompareData/data/products/enterpriseCampus24PoE.mjs +0 -7
  229. package/lib/constants/modelCompareData/data/products/enterpriseCampus24PoE.mjs.map +1 -1
  230. package/lib/constants/modelCompareData/data/products/enterpriseCampus48PoE.js +0 -7
  231. package/lib/constants/modelCompareData/data/products/enterpriseCampus48PoE.js.map +1 -1
  232. package/lib/constants/modelCompareData/data/products/enterpriseCampus48PoE.mjs +0 -7
  233. package/lib/constants/modelCompareData/data/products/enterpriseCampus48PoE.mjs.map +1 -1
  234. package/lib/constants/modelCompareData/data/products/express.js +3 -3
  235. package/lib/constants/modelCompareData/data/products/express.mjs +2 -2
  236. package/lib/constants/modelCompareData/data/products/express7.js +3 -3
  237. package/lib/constants/modelCompareData/data/products/express7.mjs +2 -2
  238. package/lib/constants/modelCompareData/data/products/flex.js +2 -2
  239. package/lib/constants/modelCompareData/data/products/flex.mjs +2 -2
  240. package/lib/constants/modelCompareData/data/products/g3StarterKit.js +2 -2
  241. package/lib/constants/modelCompareData/data/products/g3StarterKit.mjs +2 -2
  242. package/lib/constants/modelCompareData/data/products/g3TouchEnterprise.js +1 -1
  243. package/lib/constants/modelCompareData/data/products/g3TouchEnterprise.mjs +1 -1
  244. package/lib/constants/modelCompareData/data/products/g3TouchWall.js +1 -1
  245. package/lib/constants/modelCompareData/data/products/g3TouchWall.mjs +1 -1
  246. package/lib/constants/modelCompareData/data/products/g4Instant.js +2 -2
  247. package/lib/constants/modelCompareData/data/products/g4Instant.mjs +2 -2
  248. package/lib/constants/modelCompareData/data/products/g4Ptz.js +1 -1
  249. package/lib/constants/modelCompareData/data/products/g4Ptz.mjs +1 -1
  250. package/lib/constants/modelCompareData/data/products/g5Dome.js +2 -2
  251. package/lib/constants/modelCompareData/data/products/g5Dome.mjs +2 -2
  252. package/lib/constants/modelCompareData/data/products/g5DomeUltra.js +2 -2
  253. package/lib/constants/modelCompareData/data/products/g5DomeUltra.mjs +2 -2
  254. package/lib/constants/modelCompareData/data/products/g5Flex.js +2 -2
  255. package/lib/constants/modelCompareData/data/products/g5Flex.mjs +2 -2
  256. package/lib/constants/modelCompareData/data/products/g5Ptz.js +1 -1
  257. package/lib/constants/modelCompareData/data/products/g5Ptz.mjs +1 -1
  258. package/lib/constants/modelCompareData/data/products/highCapacityAggregation.js +0 -7
  259. package/lib/constants/modelCompareData/data/products/highCapacityAggregation.js.map +1 -1
  260. package/lib/constants/modelCompareData/data/products/highCapacityAggregation.mjs +0 -7
  261. package/lib/constants/modelCompareData/data/products/highCapacityAggregation.mjs.map +1 -1
  262. package/lib/constants/modelCompareData/data/products/missionCritical.js +0 -7
  263. package/lib/constants/modelCompareData/data/products/missionCritical.js.map +1 -1
  264. package/lib/constants/modelCompareData/data/products/missionCritical.mjs +0 -7
  265. package/lib/constants/modelCompareData/data/products/missionCritical.mjs.map +1 -1
  266. package/lib/constants/modelCompareData/data/products/professionalMax16.js +0 -7
  267. package/lib/constants/modelCompareData/data/products/professionalMax16.js.map +1 -1
  268. package/lib/constants/modelCompareData/data/products/professionalMax16.mjs +0 -7
  269. package/lib/constants/modelCompareData/data/products/professionalMax16.mjs.map +1 -1
  270. package/lib/constants/modelCompareData/data/products/professionalMax16PoE.js +0 -7
  271. package/lib/constants/modelCompareData/data/products/professionalMax16PoE.js.map +1 -1
  272. package/lib/constants/modelCompareData/data/products/professionalMax16PoE.mjs +0 -7
  273. package/lib/constants/modelCompareData/data/products/professionalMax16PoE.mjs.map +1 -1
  274. package/lib/constants/modelCompareData/data/products/professionalMax24.js +0 -7
  275. package/lib/constants/modelCompareData/data/products/professionalMax24.js.map +1 -1
  276. package/lib/constants/modelCompareData/data/products/professionalMax24.mjs +0 -7
  277. package/lib/constants/modelCompareData/data/products/professionalMax24.mjs.map +1 -1
  278. package/lib/constants/modelCompareData/data/products/professionalMax24PoE.js +0 -7
  279. package/lib/constants/modelCompareData/data/products/professionalMax24PoE.js.map +1 -1
  280. package/lib/constants/modelCompareData/data/products/professionalMax24PoE.mjs +0 -7
  281. package/lib/constants/modelCompareData/data/products/professionalMax24PoE.mjs.map +1 -1
  282. package/lib/constants/modelCompareData/data/products/professionalMax48.js +0 -7
  283. package/lib/constants/modelCompareData/data/products/professionalMax48.js.map +1 -1
  284. package/lib/constants/modelCompareData/data/products/professionalMax48.mjs +0 -7
  285. package/lib/constants/modelCompareData/data/products/professionalMax48.mjs.map +1 -1
  286. package/lib/constants/modelCompareData/data/products/professionalMax48PoE.js +0 -7
  287. package/lib/constants/modelCompareData/data/products/professionalMax48PoE.js.map +1 -1
  288. package/lib/constants/modelCompareData/data/products/professionalMax48PoE.mjs +0 -7
  289. package/lib/constants/modelCompareData/data/products/professionalMax48PoE.mjs.map +1 -1
  290. package/lib/constants/modelCompareData/data/products/readerLite.js +2 -2
  291. package/lib/constants/modelCompareData/data/products/readerLite.mjs +2 -2
  292. package/lib/constants/modelCompareData/data/products/shared-product-data/e7Audience.js +1 -1
  293. package/lib/constants/modelCompareData/data/products/shared-product-data/e7Audience.mjs +1 -1
  294. package/lib/constants/modelCompareData/data/products/switchesEnterprise.js +0 -8
  295. package/lib/constants/modelCompareData/data/products/switchesEnterprise.js.map +1 -1
  296. package/lib/constants/modelCompareData/data/products/switchesEnterprise.mjs +0 -8
  297. package/lib/constants/modelCompareData/data/products/switchesEnterprise.mjs.map +1 -1
  298. package/lib/constants/modelCompareData/data/products/switchesProfessional.js +0 -7
  299. package/lib/constants/modelCompareData/data/products/switchesProfessional.js.map +1 -1
  300. package/lib/constants/modelCompareData/data/products/switchesProfessional.mjs +0 -7
  301. package/lib/constants/modelCompareData/data/products/switchesProfessional.mjs.map +1 -1
  302. package/lib/constants/modelCompareData/data/products/switchesProfessionalMax.js +1 -10
  303. package/lib/constants/modelCompareData/data/products/switchesProfessionalMax.js.map +1 -1
  304. package/lib/constants/modelCompareData/data/products/switchesProfessionalMax.mjs +1 -10
  305. package/lib/constants/modelCompareData/data/products/switchesProfessionalMax.mjs.map +1 -1
  306. package/lib/constants/modelCompareData/data/products/switchesStandard.js +0 -7
  307. package/lib/constants/modelCompareData/data/products/switchesStandard.js.map +1 -1
  308. package/lib/constants/modelCompareData/data/products/switchesStandard.mjs +0 -7
  309. package/lib/constants/modelCompareData/data/products/switchesStandard.mjs.map +1 -1
  310. package/lib/constants/modelCompareData/data/products/theta.js +2 -2
  311. package/lib/constants/modelCompareData/data/products/theta.mjs +2 -2
  312. package/lib/constants/modelCompareData/data/products/thetaPro.js +1 -1
  313. package/lib/constants/modelCompareData/data/products/thetaPro.mjs +1 -1
  314. package/lib/constants/modelCompareData/data/products/u6Extender.js +1 -1
  315. package/lib/constants/modelCompareData/data/products/u6Extender.mjs +1 -1
  316. package/lib/constants/modelCompareData/data/products/u7proMax.js +2 -2
  317. package/lib/constants/modelCompareData/data/products/u7proMax.mjs +2 -2
  318. package/lib/constants/modelCompareData/data/products/u7proOutdoor.mjs +1 -1
  319. package/lib/constants/modelCompareData/data/products/ucgFiber.js +3 -3
  320. package/lib/constants/modelCompareData/data/products/ucgFiber.mjs +2 -2
  321. package/lib/constants/modelCompareData/data/products/ucgMax.js +3 -3
  322. package/lib/constants/modelCompareData/data/products/ucgMax.mjs +2 -2
  323. package/lib/constants/modelCompareData/data/products/ucgUltra.js +3 -3
  324. package/lib/constants/modelCompareData/data/products/ucgUltra.mjs +2 -2
  325. package/lib/constants/modelCompareData/data/products/udmPro.js +3 -3
  326. package/lib/constants/modelCompareData/data/products/udmPro.mjs +2 -2
  327. package/lib/constants/modelCompareData/data/products/udmProMax.js +3 -3
  328. package/lib/constants/modelCompareData/data/products/udmProMax.mjs +2 -2
  329. package/lib/constants/modelCompareData/data/products/udmProSpecial.js +3 -3
  330. package/lib/constants/modelCompareData/data/products/udmProSpecial.mjs +2 -2
  331. package/lib/constants/modelCompareData/data/products/udr.js +5 -5
  332. package/lib/constants/modelCompareData/data/products/udr.mjs +5 -5
  333. package/lib/constants/modelCompareData/data/products/udr7.js +2 -2
  334. package/lib/constants/modelCompareData/data/products/udr7.mjs +1 -1
  335. package/lib/constants/modelCompareData/data/products/udw.js +3 -3
  336. package/lib/constants/modelCompareData/data/products/udw.mjs +2 -2
  337. package/lib/constants/modelCompareData/data/products/uispSwitch.js +3 -3
  338. package/lib/constants/modelCompareData/data/products/uispSwitch.mjs +2 -2
  339. package/lib/constants/modelCompareData/data/products/uispSwitchPlus.js +3 -3
  340. package/lib/constants/modelCompareData/data/products/uispSwitchPlus.mjs +2 -2
  341. package/lib/constants/modelCompareData/data/products/umr.mjs +1 -1
  342. package/lib/constants/modelCompareData/data/products/umrIndustrial.mjs +1 -1
  343. package/lib/constants/modelCompareData/data/products/umrUltra.js +1 -1
  344. package/lib/constants/modelCompareData/data/products/umrUltra.mjs +2 -2
  345. package/lib/constants/modelCompareData/data/products/wanSwitch.js +2 -2
  346. package/lib/constants/modelCompareData/data/products/wanSwitch.js.map +1 -1
  347. package/lib/constants/modelCompareData/data/products/wanSwitch.mjs +2 -2
  348. package/lib/constants/modelCompareData/data/products/wanSwitch.mjs.map +1 -1
  349. package/lib/constants/modelCompareData/data/properties/index.d.ts +0 -1
  350. package/lib/constants/modelCompareData/data/properties/index.js +0 -2
  351. package/lib/constants/modelCompareData/data/properties/index.js.map +1 -1
  352. package/lib/constants/modelCompareData/data/properties/index.mjs +0 -1
  353. package/lib/constants/modelCompareData/data/properties/index.mjs.map +1 -1
  354. package/lib/constants/modelCompareData/translations/en.json.js +0 -2
  355. package/lib/constants/modelCompareData/translations/en.json.js.map +1 -1
  356. package/lib/constants/modelCompareData/translations/en.json.mjs +0 -2
  357. package/lib/constants/modelCompareData/translations/en.json.mjs.map +1 -1
  358. package/lib/constants/modelCompareData/translations/es.json.js +1 -2
  359. package/lib/constants/modelCompareData/translations/es.json.js.map +1 -1
  360. package/lib/constants/modelCompareData/translations/es.json.mjs +1 -2
  361. package/lib/constants/modelCompareData/translations/es.json.mjs.map +1 -1
  362. package/lib/constants/modelCompareData/translations/useModelCompareTranslation.d.ts +2 -2
  363. package/lib/constants/modelCompareData/types.d.ts +0 -1
  364. package/lib/constants/modelCompareData/types.js +0 -1
  365. package/lib/constants/modelCompareData/types.js.map +1 -1
  366. package/lib/constants/modelCompareData/types.mjs +0 -1
  367. package/lib/constants/modelCompareData/types.mjs.map +1 -1
  368. package/lib/constants/proStoreCategories/mapping/filters.d.ts +1 -1
  369. package/lib/constants/proStoreCategories/mapping/filters.js +1 -1
  370. package/lib/constants/proStoreCategories/mapping/filters.js.map +1 -1
  371. package/lib/constants/proStoreCategories/mapping/filters.mjs +1 -1
  372. package/lib/constants/proStoreCategories/mapping/filters.mjs.map +1 -1
  373. package/lib/constants/proStoreCategories/mapping/index.d.ts +0 -2
  374. package/lib/constants/proStoreCategories/mapping/index.js +4 -14
  375. package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
  376. package/lib/constants/proStoreCategories/mapping/index.mjs +4 -14
  377. package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
  378. package/lib/constants/proStoreCategories/mapping/unifi.d.ts +1 -3
  379. package/lib/constants/proStoreCategories/mapping/unifi.js +0 -2
  380. package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
  381. package/lib/constants/proStoreCategories/mapping/unifi.mjs +0 -2
  382. package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
  383. package/lib/constants/proStoreCategories/translations/ar.json.js +1 -5
  384. package/lib/constants/proStoreCategories/translations/ar.json.js.map +1 -1
  385. package/lib/constants/proStoreCategories/translations/ar.json.mjs +2 -5
  386. package/lib/constants/proStoreCategories/translations/ar.json.mjs.map +1 -1
  387. package/lib/constants/proStoreCategories/translations/de.json.js +1 -5
  388. package/lib/constants/proStoreCategories/translations/de.json.js.map +1 -1
  389. package/lib/constants/proStoreCategories/translations/de.json.mjs +2 -5
  390. package/lib/constants/proStoreCategories/translations/de.json.mjs.map +1 -1
  391. package/lib/constants/proStoreCategories/translations/el.json.js +1 -5
  392. package/lib/constants/proStoreCategories/translations/el.json.js.map +1 -1
  393. package/lib/constants/proStoreCategories/translations/el.json.mjs +2 -5
  394. package/lib/constants/proStoreCategories/translations/el.json.mjs.map +1 -1
  395. package/lib/constants/proStoreCategories/translations/en.json.js +1 -5
  396. package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
  397. package/lib/constants/proStoreCategories/translations/en.json.mjs +2 -5
  398. package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
  399. package/lib/constants/proStoreCategories/translations/es.json.js +1 -5
  400. package/lib/constants/proStoreCategories/translations/es.json.js.map +1 -1
  401. package/lib/constants/proStoreCategories/translations/es.json.mjs +2 -5
  402. package/lib/constants/proStoreCategories/translations/es.json.mjs.map +1 -1
  403. package/lib/constants/proStoreCategories/translations/fr.json.js +1 -5
  404. package/lib/constants/proStoreCategories/translations/fr.json.js.map +1 -1
  405. package/lib/constants/proStoreCategories/translations/fr.json.mjs +2 -5
  406. package/lib/constants/proStoreCategories/translations/fr.json.mjs.map +1 -1
  407. package/lib/constants/proStoreCategories/translations/it.json.js +1 -5
  408. package/lib/constants/proStoreCategories/translations/it.json.js.map +1 -1
  409. package/lib/constants/proStoreCategories/translations/it.json.mjs +2 -5
  410. package/lib/constants/proStoreCategories/translations/it.json.mjs.map +1 -1
  411. package/lib/constants/proStoreCategories/translations/ja.json.js +1 -5
  412. package/lib/constants/proStoreCategories/translations/ja.json.js.map +1 -1
  413. package/lib/constants/proStoreCategories/translations/ja.json.mjs +2 -5
  414. package/lib/constants/proStoreCategories/translations/ja.json.mjs.map +1 -1
  415. package/lib/constants/proStoreCategories/translations/pt-BR.json.js +1 -5
  416. package/lib/constants/proStoreCategories/translations/pt-BR.json.js.map +1 -1
  417. package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs +2 -5
  418. package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs.map +1 -1
  419. package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +1 -5
  420. package/lib/constants/proStoreCategories/translations/zh-Hans.json.js.map +1 -1
  421. package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +2 -5
  422. package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs.map +1 -1
  423. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +1 -5
  424. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js.map +1 -1
  425. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +2 -5
  426. package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs.map +1 -1
  427. package/lib/constants/proStoreFilters/mapping.d.ts +1 -2
  428. package/lib/constants/proStoreFilters/mapping.js +6 -8
  429. package/lib/constants/proStoreFilters/mapping.js.map +1 -1
  430. package/lib/constants/proStoreFilters/mapping.mjs +6 -8
  431. package/lib/constants/proStoreFilters/mapping.mjs.map +1 -1
  432. package/lib/contexts/MenuContext/context.js +2 -30
  433. package/lib/contexts/MenuContext/context.js.map +1 -1
  434. package/lib/contexts/MenuContext/context.mjs +3 -31
  435. package/lib/contexts/MenuContext/context.mjs.map +1 -1
  436. package/lib/contexts/MenuContext/types.d.ts +0 -3
  437. package/lib/contexts/MenuContext/types.js +0 -1
  438. package/lib/contexts/MenuContext/types.js.map +1 -1
  439. package/lib/contexts/MenuContext/types.mjs +0 -1
  440. package/lib/contexts/MenuContext/types.mjs.map +1 -1
  441. package/lib/utils/money/constants.d.ts +0 -6
  442. package/lib/utils/money/constants.js +1 -23
  443. package/lib/utils/money/constants.js.map +1 -1
  444. package/lib/utils/money/constants.mjs +2 -23
  445. package/lib/utils/money/constants.mjs.map +1 -1
  446. package/lib/utils/money/index.js +0 -1
  447. package/lib/utils/money/index.js.map +1 -1
  448. package/lib/utils/money/index.mjs +1 -1
  449. package/lib/utils/shipping.d.ts +2 -8
  450. package/lib/utils/shipping.js +2 -46
  451. package/lib/utils/shipping.js.map +1 -1
  452. package/lib/utils/shipping.mjs +2 -40
  453. package/lib/utils/shipping.mjs.map +1 -1
  454. package/package.json +26 -26
  455. package/lib/assets/crestron.svg +0 -3
  456. package/lib/assets/ucg-fiber.png +0 -0
  457. package/lib/assets/udr7.png +0 -0
  458. package/lib/assets/ux.png +0 -0
  459. package/lib/assets/ux7.png +0 -0
  460. package/lib/components/BodyPortal/BodyPortal.d.ts +0 -6
  461. package/lib/components/BodyPortal/BodyPortal.js +0 -18
  462. package/lib/components/BodyPortal/BodyPortal.js.map +0 -1
  463. package/lib/components/BodyPortal/BodyPortal.mjs +0 -16
  464. package/lib/components/BodyPortal/BodyPortal.mjs.map +0 -1
  465. package/lib/components/BodyPortal/index.d.ts +0 -1
  466. package/lib/components/BodyPortal/index.js +0 -6
  467. package/lib/components/BodyPortal/index.js.map +0 -1
  468. package/lib/components/BodyPortal/index.mjs +0 -3
  469. package/lib/components/BodyPortal/index.mjs.map +0 -1
  470. package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +0 -29
  471. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-fiber.png.js +0 -27
  472. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-fiber.png.js.map +0 -1
  473. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-fiber.png.mjs +0 -3
  474. package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-fiber.png.mjs.map +0 -1
  475. package/lib/components/ResourceCalculatorV1/assets/consoles/udr7.png.js +0 -27
  476. package/lib/components/ResourceCalculatorV1/assets/consoles/udr7.png.js.map +0 -1
  477. package/lib/components/ResourceCalculatorV1/assets/consoles/udr7.png.mjs +0 -3
  478. package/lib/components/ResourceCalculatorV1/assets/consoles/udr7.png.mjs.map +0 -1
  479. package/lib/components/ResourceCalculatorV1/assets/consoles/ux.png.js +0 -27
  480. package/lib/components/ResourceCalculatorV1/assets/consoles/ux.png.js.map +0 -1
  481. package/lib/components/ResourceCalculatorV1/assets/consoles/ux.png.mjs +0 -3
  482. package/lib/components/ResourceCalculatorV1/assets/consoles/ux.png.mjs.map +0 -1
  483. package/lib/components/ResourceCalculatorV1/assets/consoles/ux7.png.js +0 -27
  484. package/lib/components/ResourceCalculatorV1/assets/consoles/ux7.png.js.map +0 -1
  485. package/lib/components/ResourceCalculatorV1/assets/consoles/ux7.png.mjs +0 -3
  486. package/lib/components/ResourceCalculatorV1/assets/consoles/ux7.png.mjs.map +0 -1
  487. package/lib/constants/modelCompareData/assets/crestron.svg.js +0 -27
  488. package/lib/constants/modelCompareData/assets/crestron.svg.js.map +0 -1
  489. package/lib/constants/modelCompareData/assets/crestron.svg.mjs +0 -3
  490. package/lib/constants/modelCompareData/assets/crestron.svg.mjs.map +0 -1
  491. package/lib/constants/modelCompareData/data/properties/crestronNaxNvxCertified.d.ts +0 -2
  492. package/lib/constants/modelCompareData/data/properties/crestronNaxNvxCertified.js +0 -18
  493. package/lib/constants/modelCompareData/data/properties/crestronNaxNvxCertified.js.map +0 -1
  494. package/lib/constants/modelCompareData/data/properties/crestronNaxNvxCertified.mjs +0 -10
  495. package/lib/constants/modelCompareData/data/properties/crestronNaxNvxCertified.mjs.map +0 -1
  496. package/lib/hooks/useIsTouchDevice.d.ts +0 -1
  497. package/lib/hooks/useIsTouchDevice.js +0 -20
  498. package/lib/hooks/useIsTouchDevice.js.map +0 -1
  499. package/lib/hooks/useIsTouchDevice.mjs +0 -18
  500. package/lib/hooks/useIsTouchDevice.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CNY,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PHP,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { down, halfAwayFromZero, halfUp } from \"dinero.js\";\n\nimport type { StoreId } from \"../../types\";\nimport { Currency } from \"../../types\";\nimport type {\n Cents,\n DinoCurrency,\n LocalizedCurrency,\n RoundingFn,\n} from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to nearest FULL 0/5/9 (and strip cents)\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestFull059: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-5.00\n if (input <= 5) {\n return 5;\n }\n\n /**\n * Input comes as float, for this rounding we don't need cents, so round\n * to nearest full number\n */\n const roundedNumber = Math.round(input);\n\n // Determine nearest rounding value\n const remainder = roundedNumber % 10;\n if (remainder <= 2) {\n // Round down to nearest 0\n return roundedNumber - remainder;\n } else if (remainder <= 7) {\n // Round to nearest 5\n return roundedNumber - remainder + 5;\n } else {\n // Round up to nearest 9\n return roundedNumber - remainder + 9;\n }\n};\n\nexport const roundToNearestValidUiCarePrice: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-5.00\n if (input <= 5) {\n return 5;\n }\n\n // Determine nearest rounding value\n const remainder = input % 10;\n if (remainder <= 2) {\n // Round down to nearest 9\n return input - remainder - 1;\n } else if (remainder <= 5) {\n // Round to nearest 5\n return input - remainder + 5;\n } else {\n // Round up to nearest 9\n return input - remainder + 9;\n }\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest decimal cent. e.g. 1.53 = 1.50 / 1.57 = 1.60\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestDecimalCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.09\n if (input <= 0.1) {\n return 0.1;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n */\n return parseFloat((Math.round(input * 10) / 10).toFixed(1));\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest .50 or .00. e.g. 11.22 = 11 / 11.55 = 11.50 / 11.90 = 12\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestHalfUnitCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.5\n if (input <= 0.5) {\n return 0.5;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n *\n * Multiply by 2, round to the nearest integer, then divide by 2 to get the nearest .5 or .0\n * Return with fixed precision to avoid floating-point artifacts\n */\n return parseFloat((Math.round(input * 2) / 2).toFixed(2));\n};\n\nexport const Round = {\n /**\n * !!!!!!!!!!!!!!\n * ! Update 2024\n * ! We ar changing from `halfEven` (bankers rounding) to `halfAwayFromZero` (symmetric rounding) to match Avalara tax\n * @see https://knowledge.avalara.com/bundle/dqa1657870670369_dqa1657870670369/page/Change_how_AvaTax_rounds_the_tax_amount.html\n * @see https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n * !!!!!!!!!!!!!!\n *\n * OLD: halfEven docs\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalize the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/v2.0.0-alpha.8/packages/core/src/round/halfEven.ts\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behavior\n * based on if the rounded number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding\n * (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\n Financial: halfAwayFromZero,\n // https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n // TODO: maybe we should have separate rounding functions depending on the input value?\n // Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n // But the \"Round half to even\" seems better for when working with float like values\n // financialRound = Math.round;\n Shipping: roundToNearestDecimalCent,\n Prettify: down,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyFull059: roundToNearestFull059,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyDecimalCents: roundToNearestDecimalCent,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyHalfUnitCents: roundToNearestHalfUnitCent,\n Subunit: halfUp,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n * ! For correct rounding UI Care prices, used for auto managed UI Care products.\n */\n ValidUiCarePrice: roundToNearestValidUiCarePrice,\n} satisfies Record<string, RoundingFn>;\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n [MXN.code, 20],\n]);\n\n/**\n * Map of dinero code to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<string, [Cents, RoundingFn]>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, Round.Subunit]],\n]);\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const localizedCurrencyLookup = new Map<Currency, LocalizedCurrency>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n [Currency.Php, { currency: PHP, locale: \"en-PH\" }],\n [Currency.Cny, { currency: CNY, locale: \"zh-CN\" }],\n]);\n\n// #############################################################################\n// Tax Rate\n// #############################################################################\n/**\n * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a\n * single line. Rest of the stores inherit default behavior that tax calculated on whole line item\n *\n * ! IMPORTANT: When changing need to sync that store.backend `AVATAX_CUSTOM_COMPANY_CODES` is updated to reflect the change\n *\n * FIXME: as PR for the change as unfinished currently disabled to enable the functionality that calculates tax per single item as requires\n * specific testing both for our custom tax and Avalara stores that use custom company codes. So the groundwork for\n * different tax calculations is there just need to enable on the share side and test if it works\n */\nexport const storesWithPerItemTaxRate = new Set([\n // #############################################################################\n // Stores with custom tax rates\n // #############################################################################\n // StoreId.Br,\n // StoreId.Tw,\n // #############################################################################\n // Stores with Avalara, but will have custom company codes to handle per-item tax rate\n // #############################################################################\n // StoreId.Jp,\n // StoreId.Sg,\n] as StoreId[]);\n\n/**\n * Dinero currency option block for working with tax rates within dinero\n */\nexport const TAX_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We expect the tax rate to be in the range of 0..1\n * 0 --> 0%\n * 1 --> 100%\n * 0.21 --> 21%\n * 0.2169 --> 21.69%\n * 0.12345678 --> 12.345678%\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 8,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n\n// #############################################################################\n// Exchange Rate\n// #############################################################################\n\nexport const EXCHANGE_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We support having certain decimal places for exchange rates\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 6,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n"],"names":["roundToNearestFull059","input","roundedNumber","Math","round","remainder","roundToNearestValidUiCarePrice","roundToNearestDecimalCent","parseFloat","toFixed","roundToNearestHalfUnitCent","Round","Financial","halfAwayFromZero","Shipping","Prettify","down","PrettifyFull059","PrettifyDecimalCents","PrettifyHalfUnitCents","Subunit","halfUp","ValidUiCarePrice","prettifyPriceLookup","Map","USD","code","AED","ZAR","MXN","smallestSubunitLookup","TWD","localizedCurrencyLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","CAD","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","EUR","Gbp","GBP","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","JPY","Twd","Mxn","Php","PHP","Cny","CNY","storesWithPerItemTaxRate","Set","TAX_RATE_DINERO_CURRENCY","base","exponent","EXCHANGE_RATE_DINERO_CURRENCY"],"mappings":";;;;;;;AA+Ca,MAAAA,qBAAA,GAAqCC,KAAkB,IAAA;EAClE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,SAAS,CAAG,EAAA;IACP,OAAA,CAAA;EAAA;EAOH,MAAAC,aAAA,GAAgBC,IAAK,CAAAC,KAAA,CAAMH,KAAK,CAAA;EAGtC,MAAMI,YAAYH,aAAgB,GAAA,EAAA;EAClC,IAAIG,aAAa,CAAG,EAAA;IAElB,OAAOH,aAAgB,GAAAG,SAAA;EAAA,CACzB,MAAA,IAAWA,aAAa,CAAG,EAAA;IAEzB,OAA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AK,EAAA;EAAE1C,UAAU2C,UAAK,CAAAA,GAAA;EAAA1C,MAAA,EAAQ;AAAS,CAAA,CAAA,CAClD,CAAA;AAeY,MAAA2C,wBAAA,GAAA,mBAA+BC,GAAI,CAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA,CAWlC,CAAA;AAKP,MAAMC,wBAA2B,GAAA;EACtCC,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;AAMO,MAAM0D,6BAAgC,GAAA;EAC3CF,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;EAKNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CNY,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PHP,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { down, halfAwayFromZero, halfUp } from \"dinero.js\";\n\nimport type { StoreId } from \"../../types\";\nimport { Currency } from \"../../types\";\nimport type {\n Cents,\n DinoCurrency,\n LocalizedCurrency,\n RoundingFn,\n} from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to nearest FULL 0/5/9 (and strip cents)\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestFull059: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-5.00\n if (input <= 5) {\n return 5;\n }\n\n /**\n * Input comes as float, for this rounding we don't need cents, so round\n * to nearest full number\n */\n const roundedNumber = Math.round(input);\n\n // Determine nearest rounding value\n const remainder = roundedNumber % 10;\n if (remainder <= 2) {\n // Round down to nearest 0\n return roundedNumber - remainder;\n } else if (remainder <= 7) {\n // Round to nearest 5\n return roundedNumber - remainder + 5;\n } else {\n // Round up to nearest 9\n return roundedNumber - remainder + 9;\n }\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest decimal cent. e.g. 1.53 = 1.50 / 1.57 = 1.60\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestDecimalCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.09\n if (input <= 0.1) {\n return 0.1;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n */\n return parseFloat((Math.round(input * 10) / 10).toFixed(1));\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest .50 or .00. e.g. 11.22 = 11 / 11.55 = 11.50 / 11.90 = 12\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestHalfUnitCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.5\n if (input <= 0.5) {\n return 0.5;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n *\n * Multiply by 2, round to the nearest integer, then divide by 2 to get the nearest .5 or .0\n * Return with fixed precision to avoid floating-point artifacts\n */\n return parseFloat((Math.round(input * 2) / 2).toFixed(2));\n};\n\nexport const Round = {\n /**\n * !!!!!!!!!!!!!!\n * ! Update 2024\n * ! We ar changing from `halfEven` (bankers rounding) to `halfAwayFromZero` (symmetric rounding) to match Avalara tax\n * @see https://knowledge.avalara.com/bundle/dqa1657870670369_dqa1657870670369/page/Change_how_AvaTax_rounds_the_tax_amount.html\n * @see https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n * !!!!!!!!!!!!!!\n *\n * OLD: halfEven docs\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalize the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/v2.0.0-alpha.8/packages/core/src/round/halfEven.ts\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behavior\n * based on if the rounded number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding\n * (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\n Financial: halfAwayFromZero,\n // https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n // TODO: maybe we should have separate rounding functions depending on the input value?\n // Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n // But the \"Round half to even\" seems better for when working with float like values\n // financialRound = Math.round;\n Shipping: roundToNearestDecimalCent,\n Prettify: down,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyFull059: roundToNearestFull059,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyDecimalCents: roundToNearestDecimalCent,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyHalfUnitCents: roundToNearestHalfUnitCent,\n Subunit: halfUp,\n} satisfies Record<string, RoundingFn>;\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n [MXN.code, 20],\n]);\n\n/**\n * Map of dinero code to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<string, [Cents, RoundingFn]>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, Round.Subunit]],\n]);\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const localizedCurrencyLookup = new Map<Currency, LocalizedCurrency>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n [Currency.Php, { currency: PHP, locale: \"en-PH\" }],\n [Currency.Cny, { currency: CNY, locale: \"zh-CN\" }],\n]);\n\n// #############################################################################\n// Tax Rate\n// #############################################################################\n/**\n * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a\n * single line. Rest of the stores inherit default behavior that tax calculated on whole line item\n *\n * ! IMPORTANT: When changing need to sync that store.backend `AVATAX_CUSTOM_COMPANY_CODES` is updated to reflect the change\n *\n * FIXME: as PR for the change as unfinished currently disabled to enable the functionality that calculates tax per single item as requires\n * specific testing both for our custom tax and Avalara stores that use custom company codes. So the groundwork for\n * different tax calculations is there just need to enable on the share side and test if it works\n */\nexport const storesWithPerItemTaxRate = new Set([\n // #############################################################################\n // Stores with custom tax rates\n // #############################################################################\n // StoreId.Br,\n // StoreId.Tw,\n // #############################################################################\n // Stores with Avalara, but will have custom company codes to handle per-item tax rate\n // #############################################################################\n // StoreId.Jp,\n // StoreId.Sg,\n] as StoreId[]);\n\n/**\n * Dinero currency option block for working with tax rates within dinero\n */\nexport const TAX_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We expect the tax rate to be in the range of 0..1\n * 0 --> 0%\n * 1 --> 100%\n * 0.21 --> 21%\n * 0.2169 --> 21.69%\n * 0.12345678 --> 12.345678%\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 8,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n\n// #############################################################################\n// Exchange Rate\n// #############################################################################\n\nexport const EXCHANGE_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We support having certain decimal places for exchange rates\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 6,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n"],"names":["roundToNearestFull059","input","roundedNumber","Math","round","remainder","roundToNearestDecimalCent","parseFloat","toFixed","roundToNearestHalfUnitCent","Round","Financial","halfAwayFromZero","Shipping","Prettify","down","PrettifyFull059","PrettifyDecimalCents","PrettifyHalfUnitCents","Subunit","halfUp","prettifyPriceLookup","Map","USD","code","AED","ZAR","MXN","smallestSubunitLookup","TWD","localizedCurrencyLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","CAD","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","EUR","Gbp","GBP","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","JPY","Twd","Mxn","Php","PHP","Cny","CNY","storesWithPerItemTaxRate","Set","TAX_RATE_DINERO_CURRENCY","base","exponent","EXCHANGE_RATE_DINERO_CURRENCY"],"mappings":";;;;;;;AA+Ca,MAAAA,qBAAA,GAAqCC,KAAkB,IAAA;EAClE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,SAAS,CAAG,EAAA;IACP,OAAA,CAAA;EAAA;EAOH,MAAAC,aAAA,GAAgBC,IAAK,CAAAC,KAAA,CAAMH,KAAK,CAAA;EAGtC,MAAMI,YAAYH,aAAgB,GAAA,EAAA;EAClC,IAAIG,aAAa,CAAG,EAAA;IAElB,OAAOH,aAAgB,GAAAG,SAAA;EAAA,CACzB,MAAA,IAAWA,aAAa,CAAG,EAAA;IAEzB,OAAOH,gBAAgBG,SAAY,GAAA,CAAA;EAAA,CAC9B,MAAA;IAEL,OAAOH,gBAAgBG,SAAY,GAAA,CAAA;EAAA;AAEvC,CAAA;AASa,MAAAC,yBAAA,GAAyCL,KAAkB,IAAA;EACtE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,SAAS,GAAK,EAAA;IACT,OAAA,GAAA;EAAA;EAOF,OAAAM,UAAA,CAAA,CAAYJ,KAAKC,KAAM,CAAAH,KAAA,GAAQ,EAAE,CAAI,GAAA,EAAA,EAAIO,OAAQ,CAAA,CAAC,CAAC,CAAA;AAC5D,CAAA;AASa,MAAAC,0BAAA,GAA0CR,KAAkB,IAAA;EACvE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,SAAS,GAAK,EAAA;IACT,OAAA,GAAA;EAAA;EAUF,OAAAM,UAAA,CAAA,CAAYJ,KAAKC,KAA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EACjD,CAACH,SAAAA,CAAAA,SAAS0C,GAAK,EAAA;EAAExC,UAAUyC,UAAAA,CAAAA,GAAK;EAAAxC,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAAAA,CAAAA,SAAS4C,GAAK,EAAA;EAAE1C,UAAU2C,UAAK,CAAAA,GAAA;EAAA1C,MAAA,EAAQ;AAAS,CAAA,CAAA,CAClD,CAAA;AAeY,MAAA2C,wBAAA,GAAA,mBAA+BC,GAAI,CAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA,CAWlC,CAAA;AAKP,MAAMC,wBAA2B,GAAA;EACtCC,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;AAMO,MAAM0D,6BAAgC,GAAA;EAC3CF,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;EAKNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;;;;;;;;;;"}
@@ -20,22 +20,6 @@ const roundToNearestFull059 = input => {
20
20
  return roundedNumber - remainder + 9;
21
21
  }
22
22
  };
23
- const roundToNearestValidUiCarePrice = input => {
24
- if (input === 0) {
25
- return 0;
26
- }
27
- if (input <= 5) {
28
- return 5;
29
- }
30
- const remainder = input % 10;
31
- if (remainder <= 2) {
32
- return input - remainder - 1;
33
- } else if (remainder <= 5) {
34
- return input - remainder + 5;
35
- } else {
36
- return input - remainder + 9;
37
- }
38
- };
39
23
  const roundToNearestDecimalCent = input => {
40
24
  if (input === 0) {
41
25
  return 0;
@@ -100,12 +84,7 @@ const Round = {
100
84
  * ! Disclaimer may not work for "weird" currencies as expected
101
85
  */
102
86
  PrettifyHalfUnitCents: roundToNearestHalfUnitCent,
103
- Subunit: halfUp,
104
- /**
105
- * ! Disclaimer may not work for "weird" currencies as expected
106
- * ! For correct rounding UI Care prices, used for auto managed UI Care products.
107
- */
108
- ValidUiCarePrice: roundToNearestValidUiCarePrice
87
+ Subunit: halfUp
109
88
  };
110
89
  const prettifyPriceLookup = /* @__PURE__ */new Map([[USD.code, 20], [AED.code, 50],
111
90
  // Approximately every price above ~1.1 usd will be rounded in ZAR
@@ -229,5 +208,5 @@ const EXCHANGE_RATE_DINERO_CURRENCY = {
229
208
  code: ""
230
209
  // Not important
231
210
  };
232
- export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, roundToNearestDecimalCent, roundToNearestFull059, roundToNearestHalfUnitCent, roundToNearestValidUiCarePrice, smallestSubunitLookup, storesWithPerItemTaxRate };
211
+ export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, roundToNearestDecimalCent, roundToNearestFull059, roundToNearestHalfUnitCent, smallestSubunitLookup, storesWithPerItemTaxRate };
233
212
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CNY,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PHP,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { down, halfAwayFromZero, halfUp } from \"dinero.js\";\n\nimport type { StoreId } from \"../../types\";\nimport { Currency } from \"../../types\";\nimport type {\n Cents,\n DinoCurrency,\n LocalizedCurrency,\n RoundingFn,\n} from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to nearest FULL 0/5/9 (and strip cents)\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestFull059: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-5.00\n if (input <= 5) {\n return 5;\n }\n\n /**\n * Input comes as float, for this rounding we don't need cents, so round\n * to nearest full number\n */\n const roundedNumber = Math.round(input);\n\n // Determine nearest rounding value\n const remainder = roundedNumber % 10;\n if (remainder <= 2) {\n // Round down to nearest 0\n return roundedNumber - remainder;\n } else if (remainder <= 7) {\n // Round to nearest 5\n return roundedNumber - remainder + 5;\n } else {\n // Round up to nearest 9\n return roundedNumber - remainder + 9;\n }\n};\n\nexport const roundToNearestValidUiCarePrice: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-5.00\n if (input <= 5) {\n return 5;\n }\n\n // Determine nearest rounding value\n const remainder = input % 10;\n if (remainder <= 2) {\n // Round down to nearest 9\n return input - remainder - 1;\n } else if (remainder <= 5) {\n // Round to nearest 5\n return input - remainder + 5;\n } else {\n // Round up to nearest 9\n return input - remainder + 9;\n }\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest decimal cent. e.g. 1.53 = 1.50 / 1.57 = 1.60\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestDecimalCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.09\n if (input <= 0.1) {\n return 0.1;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n */\n return parseFloat((Math.round(input * 10) / 10).toFixed(1));\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest .50 or .00. e.g. 11.22 = 11 / 11.55 = 11.50 / 11.90 = 12\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestHalfUnitCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.5\n if (input <= 0.5) {\n return 0.5;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n *\n * Multiply by 2, round to the nearest integer, then divide by 2 to get the nearest .5 or .0\n * Return with fixed precision to avoid floating-point artifacts\n */\n return parseFloat((Math.round(input * 2) / 2).toFixed(2));\n};\n\nexport const Round = {\n /**\n * !!!!!!!!!!!!!!\n * ! Update 2024\n * ! We ar changing from `halfEven` (bankers rounding) to `halfAwayFromZero` (symmetric rounding) to match Avalara tax\n * @see https://knowledge.avalara.com/bundle/dqa1657870670369_dqa1657870670369/page/Change_how_AvaTax_rounds_the_tax_amount.html\n * @see https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n * !!!!!!!!!!!!!!\n *\n * OLD: halfEven docs\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalize the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/v2.0.0-alpha.8/packages/core/src/round/halfEven.ts\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behavior\n * based on if the rounded number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding\n * (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\n Financial: halfAwayFromZero,\n // https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n // TODO: maybe we should have separate rounding functions depending on the input value?\n // Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n // But the \"Round half to even\" seems better for when working with float like values\n // financialRound = Math.round;\n Shipping: roundToNearestDecimalCent,\n Prettify: down,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyFull059: roundToNearestFull059,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyDecimalCents: roundToNearestDecimalCent,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyHalfUnitCents: roundToNearestHalfUnitCent,\n Subunit: halfUp,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n * ! For correct rounding UI Care prices, used for auto managed UI Care products.\n */\n ValidUiCarePrice: roundToNearestValidUiCarePrice,\n} satisfies Record<string, RoundingFn>;\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n [MXN.code, 20],\n]);\n\n/**\n * Map of dinero code to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<string, [Cents, RoundingFn]>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, Round.Subunit]],\n]);\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const localizedCurrencyLookup = new Map<Currency, LocalizedCurrency>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n [Currency.Php, { currency: PHP, locale: \"en-PH\" }],\n [Currency.Cny, { currency: CNY, locale: \"zh-CN\" }],\n]);\n\n// #############################################################################\n// Tax Rate\n// #############################################################################\n/**\n * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a\n * single line. Rest of the stores inherit default behavior that tax calculated on whole line item\n *\n * ! IMPORTANT: When changing need to sync that store.backend `AVATAX_CUSTOM_COMPANY_CODES` is updated to reflect the change\n *\n * FIXME: as PR for the change as unfinished currently disabled to enable the functionality that calculates tax per single item as requires\n * specific testing both for our custom tax and Avalara stores that use custom company codes. So the groundwork for\n * different tax calculations is there just need to enable on the share side and test if it works\n */\nexport const storesWithPerItemTaxRate = new Set([\n // #############################################################################\n // Stores with custom tax rates\n // #############################################################################\n // StoreId.Br,\n // StoreId.Tw,\n // #############################################################################\n // Stores with Avalara, but will have custom company codes to handle per-item tax rate\n // #############################################################################\n // StoreId.Jp,\n // StoreId.Sg,\n] as StoreId[]);\n\n/**\n * Dinero currency option block for working with tax rates within dinero\n */\nexport const TAX_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We expect the tax rate to be in the range of 0..1\n * 0 --> 0%\n * 1 --> 100%\n * 0.21 --> 21%\n * 0.2169 --> 21.69%\n * 0.12345678 --> 12.345678%\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 8,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n\n// #############################################################################\n// Exchange Rate\n// #############################################################################\n\nexport const EXCHANGE_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We support having certain decimal places for exchange rates\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 6,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n"],"names":["roundToNearestFull059","input","roundedNumber","Math","round","remainder","roundToNearestValidUiCarePrice","roundToNearestDecimalCent","parseFloat","toFixed","roundToNearestHalfUnitCent","Round","Financial","halfAwayFromZero","Shipping","Prettify","down","PrettifyFull059","PrettifyDecimalCents","PrettifyHalfUnitCents","Subunit","halfUp","ValidUiCarePrice","prettifyPriceLookup","Map","USD","code","AED","ZAR","MXN","smallestSubunitLookup","TWD","localizedCurrencyLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","CAD","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","EUR","Gbp","GBP","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","JPY","Twd","Mxn","Php","PHP","Cny","CNY","storesWithPerItemTaxRate","Set","TAX_RATE_DINERO_CURRENCY","base","exponent","EXCHANGE_RATE_DINERO_CURRENCY"],"mappings":";;;;;AA+Ca,MAAAA,qBAAA,GAAqCC,KAAkB,IAAA;EAClE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,SAAS,CAAG,EAAA;IACP,OAAA,CAAA;EAAA;EAOH,MAAAC,aAAA,GAAgBC,IAAK,CAAAC,KAAA,CAAMH,KAAK,CAAA;EAGtC,MAAMI,YAAYH,aAAgB,GAAA,EAAA;EAClC,IAAIG,aAAa,CAAG,EAAA;IAElB,OAAOH,aAAgB,GAAAG,SAAA;EAAA,CACzB,MAAA,IAAWA,aAAa,CAAG,EAAA;IAEzB,OAAOH,gBAAgBG,SAAY,GAAA,CAAA;EAAA,CAC9B,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AAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAASsC,GAAK,EAAA;EAAEpC,UAAUqC,GAAK;EAAApC,MAAA,EAAQ;CAAS,CAAA;AAAA;AAEjD,CAACH,SAASwC,GAAK,EAAA;EAAEtC,UAAUJ,GAAK;EAAAK,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAASyC,GAAK,EAAA;EAAEvC,UAAUN,GAAK;EAAAO,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAAS0C,GAAK,EAAA;EAAExC,UAAUyC,GAAK;EAAAxC,MAAA,EAAQ;CAAS,CAAA,EACjD,CAACH,SAAS4C,GAAK,EAAA;EAAE1C,UAAU2C,GAAK;EAAA1C,MAAA,EAAQ;AAAS,CAAA,CAAA,CAClD,CAAA;AAeY,MAAA2C,wBAAA,GAAA,mBAA+BC,GAAI,CAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA,CAWlC,CAAA;AAKP,MAAMC,wBAA2B,GAAA;EACtCC,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;AAMO,MAAM0D,6BAAgC,GAAA;EAC3CF,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;EAKNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;"}
1
+ {"version":3,"file":"constants.mjs","sources":["../../../src/utils/money/constants.ts"],"sourcesContent":["import {\n AED,\n BGN,\n BRL,\n CAD,\n CHF,\n CNY,\n CZK,\n DKK,\n EUR,\n GBP,\n HRK,\n HUF,\n INR,\n JPY,\n MXN,\n NOK,\n PHP,\n PLN,\n RON,\n SEK,\n SGD,\n TWD,\n USD,\n ZAR,\n} from \"@dinero.js/currencies\";\nimport { down, halfAwayFromZero, halfUp } from \"dinero.js\";\n\nimport type { StoreId } from \"../../types\";\nimport { Currency } from \"../../types\";\nimport type {\n Cents,\n DinoCurrency,\n LocalizedCurrency,\n RoundingFn,\n} from \"./types\";\n\n// #############################################################################\n// Constants\n// #############################################################################\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to nearest FULL 0/5/9 (and strip cents)\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestFull059: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-5.00\n if (input <= 5) {\n return 5;\n }\n\n /**\n * Input comes as float, for this rounding we don't need cents, so round\n * to nearest full number\n */\n const roundedNumber = Math.round(input);\n\n // Determine nearest rounding value\n const remainder = roundedNumber % 10;\n if (remainder <= 2) {\n // Round down to nearest 0\n return roundedNumber - remainder;\n } else if (remainder <= 7) {\n // Round to nearest 5\n return roundedNumber - remainder + 5;\n } else {\n // Round up to nearest 9\n return roundedNumber - remainder + 9;\n }\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest decimal cent. e.g. 1.53 = 1.50 / 1.57 = 1.60\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestDecimalCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.09\n if (input <= 0.1) {\n return 0.1;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n */\n return parseFloat((Math.round(input * 10) / 10).toFixed(1));\n};\n\n/**\n * Custom rounding method to be used with dinero.js\n * This rounding method will round to\n * nearest .50 or .00. e.g. 11.22 = 11 / 11.55 = 11.50 / 11.90 = 12\n *\n * @see: https://ubiquiti.atlassian.net/browse/NEP-3846\n */\nexport const roundToNearestHalfUnitCent: RoundingFn = (input: number) => {\n if (input === 0) {\n return 0;\n }\n\n // Special handling of 0.01-0.5\n if (input <= 0.5) {\n return 0.5;\n }\n\n /**\n * Input comes as float, just to be on the safe side use toFixed to mitigate\n * risk of running to floating point precision issues\n *\n * Multiply by 2, round to the nearest integer, then divide by 2 to get the nearest .5 or .0\n * Return with fixed precision to avoid floating-point artifacts\n */\n return parseFloat((Math.round(input * 2) / 2).toFixed(2));\n};\n\nexport const Round = {\n /**\n * !!!!!!!!!!!!!!\n * ! Update 2024\n * ! We ar changing from `halfEven` (bankers rounding) to `halfAwayFromZero` (symmetric rounding) to match Avalara tax\n * @see https://knowledge.avalara.com/bundle/dqa1657870670369_dqa1657870670369/page/Change_how_AvaTax_rounds_the_tax_amount.html\n * @see https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n * !!!!!!!!!!!!!!\n *\n * OLD: halfEven docs\n * ⚠️ Instead of using Math.round, we HAVE to use this method to round the financial numbers everywhere where we CAN'T\n * deal with dinero.js (Dinero.js should be the priority). But often for converting from API requests we have to\n * normalize the values so we use this method.\n *\n * It just a re-export of the dinero.js halfEven (a.k.a bankers rounding) method which is the default rounding method.\n * @see https://github.com/dinerojs/dinero.js/blob/v2.0.0-alpha.8/packages/core/src/round/halfEven.ts\n *\n * Compared to Math.round (arithmetic rounding) it differentiates that it changes the `.5` round up or down behavior\n * based on if the rounded number would be an even number. So 1.5 would round to 2 while 2.5 would round to 2.\n * See the youtube link below for a brief exclamation on why it's important to use this method over regular rounding\n * (half-up):\n * https://youtu.be/yuRdYlZvs1E\n *\n * If you really want to get knee-deep in the rounding subject, you can read the following:\n * https://en.wikipedia.org/wiki/Rounding#Round_half_toward_zero\n */\n Financial: halfAwayFromZero,\n // https://ui.slack.com/archives/C07P7L7S3CP/p1728313196140639\n // TODO: maybe we should have separate rounding functions depending on the input value?\n // Reading from wiki \"Round half toward zero\" is better if the value is already \"normalized to cents\"\n // But the \"Round half to even\" seems better for when working with float like values\n // financialRound = Math.round;\n Shipping: roundToNearestDecimalCent,\n Prettify: down,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyFull059: roundToNearestFull059,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyDecimalCents: roundToNearestDecimalCent,\n /**\n * ! Disclaimer may not work for \"weird\" currencies as expected\n */\n PrettifyHalfUnitCents: roundToNearestHalfUnitCent,\n Subunit: halfUp,\n} satisfies Record<string, RoundingFn>;\n\n/**\n * Mapping of how prices should be rounded down to \"whole numbers\" after certain threshold\n */\nexport const prettifyPriceLookup = new Map([\n [USD.code, 20],\n [AED.code, 50],\n // Approximately every price above ~1.1 usd will be rounded in ZAR\n [ZAR.code, 20],\n [MXN.code, 20],\n]);\n\n/**\n * Map of dinero code to subunit digit count.\n */\nexport const smallestSubunitLookup = new Map<string, [Cents, RoundingFn]>([\n /**\n * TWD does not use subunits at all in day to day transactions.\n */\n [TWD.code, [0, Round.Subunit]],\n]);\n\n/**\n * Precompiled list for faster currency and locale lookups\n */\nexport const localizedCurrencyLookup = new Map<Currency, LocalizedCurrency>([\n [Currency.Aed, { currency: AED, locale: \"ar-AE\" }],\n [Currency.Bgn, { currency: BGN, locale: \"bg-BG\" }],\n [Currency.Cad, { currency: CAD, locale: \"en-CA\" }],\n [Currency.Chf, { currency: CHF, locale: \"it-CH\" }],\n [Currency.Czk, { currency: CZK, locale: \"cs-CZ\" }],\n [Currency.Dkk, { currency: DKK, locale: \"da-DK\" }],\n [Currency.Eur, { currency: EUR, locale: \"de-DE\" }],\n [Currency.Gbp, { currency: GBP, locale: \"en-GB\" }],\n [Currency.Hrk, { currency: HRK, locale: \"hr-HR\" }],\n [Currency.Huf, { currency: HUF, locale: \"hu-HU\" }],\n [Currency.Nok, { currency: NOK, locale: \"no-NO\" }],\n [Currency.Pln, { currency: PLN, locale: \"pl-PL\" }],\n [Currency.Ron, { currency: RON, locale: \"ro-RO\" }],\n [Currency.Sek, { currency: SEK, locale: \"sv-SE\" }],\n [Currency.Usd, { currency: USD, locale: \"en-US\" }],\n [Currency.Zar, { currency: ZAR, locale: \"en-ZA\" }],\n [Currency.Inr, { currency: INR, locale: \"en-IN\" }],\n [Currency.Sgd, { currency: SGD, locale: \"en-SG\" }],\n [Currency.Brl, { currency: BRL, locale: \"pt-BR\" }],\n // NOTE: en-JP Doesn't exist\n [Currency.Jpy, { currency: JPY, locale: \"en-JP\" }],\n // NOTE: en-TW Doesn't exist\n [Currency.Twd, { currency: TWD, locale: \"en-TW\" }],\n [Currency.Mxn, { currency: MXN, locale: \"es-MX\" }],\n [Currency.Php, { currency: PHP, locale: \"en-PH\" }],\n [Currency.Cny, { currency: CNY, locale: \"zh-CN\" }],\n]);\n\n// #############################################################################\n// Tax Rate\n// #############################################################################\n/**\n * List of stores that require calculating per single item qty and then combining them to get the total tax amount for a\n * single line. Rest of the stores inherit default behavior that tax calculated on whole line item\n *\n * ! IMPORTANT: When changing need to sync that store.backend `AVATAX_CUSTOM_COMPANY_CODES` is updated to reflect the change\n *\n * FIXME: as PR for the change as unfinished currently disabled to enable the functionality that calculates tax per single item as requires\n * specific testing both for our custom tax and Avalara stores that use custom company codes. So the groundwork for\n * different tax calculations is there just need to enable on the share side and test if it works\n */\nexport const storesWithPerItemTaxRate = new Set([\n // #############################################################################\n // Stores with custom tax rates\n // #############################################################################\n // StoreId.Br,\n // StoreId.Tw,\n // #############################################################################\n // Stores with Avalara, but will have custom company codes to handle per-item tax rate\n // #############################################################################\n // StoreId.Jp,\n // StoreId.Sg,\n] as StoreId[]);\n\n/**\n * Dinero currency option block for working with tax rates within dinero\n */\nexport const TAX_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We expect the tax rate to be in the range of 0..1\n * 0 --> 0%\n * 1 --> 100%\n * 0.21 --> 21%\n * 0.2169 --> 21.69%\n * 0.12345678 --> 12.345678%\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 8,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n\n// #############################################################################\n// Exchange Rate\n// #############################################################################\n\nexport const EXCHANGE_RATE_DINERO_CURRENCY = {\n base: 10,\n /**\n * We support having certain decimal places for exchange rates\n * !!! Don't change as this value is tied to store.backend DB schema !!!\n */\n exponent: 6,\n code: \"\", // Not important\n} satisfies DinoCurrency;\n"],"names":["roundToNearestFull059","input","roundedNumber","Math","round","remainder","roundToNearestDecimalCent","parseFloat","toFixed","roundToNearestHalfUnitCent","Round","Financial","halfAwayFromZero","Shipping","Prettify","down","PrettifyFull059","PrettifyDecimalCents","PrettifyHalfUnitCents","Subunit","halfUp","prettifyPriceLookup","Map","USD","code","AED","ZAR","MXN","smallestSubunitLookup","TWD","localizedCurrencyLookup","Currency","Aed","currency","locale","Bgn","BGN","Cad","CAD","Chf","CHF","Czk","CZK","Dkk","DKK","Eur","EUR","Gbp","GBP","Hrk","HRK","Huf","HUF","Nok","NOK","Pln","PLN","Ron","RON","Sek","SEK","Usd","Zar","Inr","INR","Sgd","SGD","Brl","BRL","Jpy","JPY","Twd","Mxn","Php","PHP","Cny","CNY","storesWithPerItemTaxRate","Set","TAX_RATE_DINERO_CURRENCY","base","exponent","EXCHANGE_RATE_DINERO_CURRENCY"],"mappings":";;;;;AA+Ca,MAAAA,qBAAA,GAAqCC,KAAkB,IAAA;EAClE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,SAAS,CAAG,EAAA;IACP,OAAA,CAAA;EAAA;EAOH,MAAAC,aAAA,GAAgBC,IAAK,CAAAC,KAAA,CAAMH,KAAK,CAAA;EAGtC,MAAMI,YAAYH,aAAgB,GAAA,EAAA;EAClC,IAAIG,aAAa,CAAG,EAAA;IAElB,OAAOH,aAAgB,GAAAG,SAAA;EAAA,CACzB,MAAA,IAAWA,aAAa,CAAG,EAAA;IAEzB,OAAOH,gBAAgBG,SAAY,GAAA,CAAA;EAAA,CAC9B,MAAA;IAEL,OAAOH,gBAAgBG,SAAY,GAAA,CAAA;EAAA;AAEvC,CAAA;AASa,MAAAC,yBAAA,GAAyCL,KAAkB,IAAA;EACtE,IAAIA,UAAU,CAAG,EAAA;IACR,OAAA,CAAA;EAAA;EAIT,IAAIA,S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AA,EAAA;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;AAMO,MAAM0D,6BAAgC,GAAA;EAC3CF,IAAM,EAAA,EAAA;EAAA;AAAA;AAAA;AAAA;EAKNC,QAAU,EAAA,CAAA;EACVzD,IAAM,EAAA;EAAA;AACR,CAAA;"}
@@ -20,7 +20,6 @@ exports.prettifyPriceLookup = constants.prettifyPriceLookup;
20
20
  exports.roundToNearestDecimalCent = constants.roundToNearestDecimalCent;
21
21
  exports.roundToNearestFull059 = constants.roundToNearestFull059;
22
22
  exports.roundToNearestHalfUnitCent = constants.roundToNearestHalfUnitCent;
23
- exports.roundToNearestValidUiCarePrice = constants.roundToNearestValidUiCarePrice;
24
23
  exports.smallestSubunitLookup = constants.smallestSubunitLookup;
25
24
  exports.storesWithPerItemTaxRate = constants.storesWithPerItemTaxRate;
26
25
  exports.invertExchangeRate = exchangeRate.invertExchangeRate;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  export { FixedAmountAllocator } from './allocators/fixedAmount.mjs';
2
2
  export { ProductAmountAllocator } from './allocators/productAmount.mjs';
3
- export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, roundToNearestDecimalCent, roundToNearestFull059, roundToNearestHalfUnitCent, roundToNearestValidUiCarePrice, smallestSubunitLookup, storesWithPerItemTaxRate } from './constants.mjs';
3
+ export { EXCHANGE_RATE_DINERO_CURRENCY, Round, TAX_RATE_DINERO_CURRENCY, localizedCurrencyLookup, prettifyPriceLookup, roundToNearestDecimalCent, roundToNearestFull059, roundToNearestHalfUnitCent, smallestSubunitLookup, storesWithPerItemTaxRate } from './constants.mjs';
4
4
  export { invertExchangeRate, toFixedExchangeRate, toSnapshotExchangeRate } from './exchangeRate.mjs';
5
5
  export { formatPrice, formatPriceRaw, getLocalizedCurrency, prettifyTotal } from './format.mjs';
6
6
  export { addMany, amount, centsToCurrencyUnit, currency, dineroToCurrencyUnit, getDinero, getDineroCurrency, money, multiplyByFullPercent, parseCurrencyCode, parseFloatToDinero, parseFloatToDineroRaw, roundDinero, stringAmountToDinero, subtractMany, toSmallestSubunit } from './misc.mjs';
@@ -7,15 +7,9 @@ import type { Money } from "./money/types";
7
7
  export declare const getFreeShippingDaysPerStore: (storeId: Nullish<StoreId>) => Nullish<number>;
8
8
  export declare const getIsSignatureRequired: (options: {
9
9
  storeId: StoreId;
10
- items: {
11
- subtotal: Money;
12
- sku: string[];
13
- };
14
- shipment: {
15
- isNextDay: boolean;
16
- };
10
+ subtotal: Money;
17
11
  customer: Nullish<{
18
- ssoCreatedAt: Nullish<Date>;
12
+ isGuest: boolean;
19
13
  }>;
20
14
  paymentProvider: Nullish<PaymentProvider>;
21
15
  }) => boolean;
@@ -1,17 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var dayjs = require('dayjs');
4
3
  var dinero_js = require('dinero.js');
5
4
  require('../types/index.js');
6
5
  var errors = require('./errors.js');
7
6
  var misc = require('./money/misc.js');
8
7
  var generated = require('../types/generated.js');
9
- function _interopDefault(e) {
10
- return e && e.__esModule ? e : {
11
- default: e
12
- };
13
- }
14
- var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
15
8
  "use strict";
16
9
  const getFreeShippingDaysPerStore = storeId => {
17
10
  if (!storeId) {
@@ -49,6 +42,7 @@ const getFreeShippingDaysPerStore = storeId => {
49
42
  }
50
43
  };
51
44
  const getIsSignatureRequired = options => {
45
+ const isGuest = options.customer ? options.customer.isGuest : true;
52
46
  switch (options.storeId) {
53
47
  case generated.StoreId.Br:
54
48
  case generated.StoreId.Ca:
@@ -68,46 +62,8 @@ const getIsSignatureRequired = options => {
68
62
  }
69
63
  case generated.StoreId.Us:
70
64
  {
71
- let isGuestLike = true;
72
- if (options.customer?.ssoCreatedAt) {
73
- const daysSinceCreation = dayjs__default["default"]().diff(dayjs__default["default"](options.customer.ssoCreatedAt), "days");
74
- if (daysSinceCreation >= 90) {
75
- isGuestLike = false;
76
- }
77
- }
78
- if (!isGuestLike) {
79
- return false;
80
- }
81
65
  const threshold = options.paymentProvider === generated.PaymentProvider.Paypal ? misc.getDinero(1e5, generated.Currency.Usd) : misc.getDinero(2e5, generated.Currency.Usd);
82
- if (options.shipment.isNextDay) {
83
- if (options.items.sku.length === 1) {
84
- return true;
85
- }
86
- const {
87
- hasUswPro,
88
- hasUacc,
89
- hasUCable
90
- } = options.items.sku.reduce((acc, curr) => {
91
- if (curr.toLowerCase().startsWith("usw-pro")) {
92
- acc.hasUswPro = true;
93
- }
94
- if (curr.toLowerCase().startsWith("uacc")) {
95
- acc.hasUacc = true;
96
- }
97
- if (curr.toLowerCase().startsWith("u-cable")) {
98
- acc.hasUCable = true;
99
- }
100
- return acc;
101
- }, {
102
- hasUswPro: false,
103
- hasUacc: false,
104
- hasUCable: false
105
- });
106
- if (hasUswPro && (hasUacc || hasUCable)) {
107
- return true;
108
- }
109
- }
110
- return dinero_js.greaterThanOrEqual(misc.getDinero(options.items.subtotal.amount, options.items.subtotal.currency), threshold);
66
+ return isGuest && dinero_js.greaterThanOrEqual(misc.getDinero(options.subtotal.amount, options.subtotal.currency), threshold);
111
67
  }
112
68
  default:
113
69
  {
@@ -1 +1 @@
1
- {"version":3,"file":"shipping.js","sources":["../../src/utils/shipping.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport { greaterThanOrEqual } from \"dinero.js\";\n\nimport type { Nullish } from \"../types\";\nimport { Currency, PaymentProvider, StoreId } from \"../types\";\nimport { checkUnreachable } from \"./errors\";\nimport { getDinero } from \"./money/misc\";\nimport type { Money } from \"./money/types\";\n\n/**\n * Utility to get how many days free shipping will be for a specific store, defaulting to a fallback value\n */\nexport const getFreeShippingDaysPerStore = (\n // Instead of using StoreId type using plain string so if we add a new store it won't break types as we already have\n // configured a explicity default behavior\n storeId: Nullish<StoreId>,\n): Nullish<number> => {\n if (!storeId) {\n // Return undefined to indicate detect \"loading state\" as we can't determine it yet\n return undefined;\n }\n\n /**\n * Reasoning for values:\n * - Singapore - https://ui.slack.com/archives/C02CXF2Q7B4/p1709209947062139\n * - Brazil - we read dynamically latest option as free so there is no guarantee\n * - Japan - same as other just standard 5-days\n */\n switch (storeId) {\n case StoreId.Ca:\n case StoreId.Za:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Jp:\n case StoreId.Ph: {\n return 5;\n }\n case StoreId.Me: {\n return 2;\n }\n case StoreId.Us:\n case StoreId.Mx:\n case StoreId.Eu:\n case StoreId.Uk:\n case StoreId.In:\n case StoreId.Cn:\n case StoreId.Br: {\n // Return null to indicate \"no match\"\n return null;\n }\n\n default: {\n checkUnreachable(storeId);\n // Return null to indicate \"no match\"\n return null;\n }\n }\n};\n\nexport const getIsSignatureRequired = (options: {\n storeId: StoreId;\n items: {\n subtotal: Money;\n sku: string[];\n };\n shipment: {\n isNextDay: boolean;\n };\n customer: Nullish<{ ssoCreatedAt: Nullish<Date> }>;\n paymentProvider: Nullish<PaymentProvider>;\n}): boolean => {\n switch (options.storeId) {\n case StoreId.Br:\n case StoreId.Ca:\n case StoreId.Cn:\n case StoreId.Eu:\n case StoreId.In:\n case StoreId.Jp:\n case StoreId.Me:\n case StoreId.Mx:\n case StoreId.Ph:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Uk:\n case StoreId.Za: {\n return false;\n }\n\n case StoreId.Us: {\n // Assume by default customer is guest like\n let isGuestLike = true;\n\n // Consider customer as guest like, if their account was created within last 3 months\n if (options.customer?.ssoCreatedAt) {\n // Using dayjs\n const daysSinceCreation = dayjs().diff(\n dayjs(options.customer.ssoCreatedAt),\n \"days\",\n );\n if (daysSinceCreation >= 90) {\n isGuestLike = false;\n }\n }\n\n // If customer is not guest like, we don't need to check for signature requirement\n if (!isGuestLike) {\n return false;\n }\n\n const threshold =\n options.paymentProvider === PaymentProvider.Paypal\n ? getDinero(1000_00, Currency.Usd)\n : getDinero(2000_00, Currency.Usd);\n\n // Next day shipment scenario:\n if (options.shipment.isNextDay) {\n if (options.items.sku.length === 1) {\n return true;\n }\n\n const { hasUswPro, hasUacc, hasUCable } = options.items.sku.reduce<{\n hasUswPro: boolean;\n hasUacc: boolean;\n hasUCable: boolean;\n }>(\n (acc, curr) => {\n if (curr.toLowerCase().startsWith(\"usw-pro\")) {\n acc.hasUswPro = true;\n }\n\n if (curr.toLowerCase().startsWith(\"uacc\")) {\n acc.hasUacc = true;\n }\n\n if (curr.toLowerCase().startsWith(\"u-cable\")) {\n acc.hasUCable = true;\n }\n\n return acc;\n },\n {\n hasUswPro: false,\n hasUacc: false,\n hasUCable: false,\n },\n );\n\n if (hasUswPro && (hasUacc || hasUCable)) {\n return true;\n }\n }\n\n // Threshold scenario:\n return greaterThanOrEqual(\n getDinero(\n options.items.subtotal.amount,\n options.items.subtotal.currency,\n ),\n threshold,\n );\n }\n\n default: {\n checkUnreachable(options.storeId);\n return false;\n }\n }\n};\n"],"names":["getFreeShippingDaysPerStore","storeId","StoreId","Ca","Za","Sg","Tw","Jp","Ph","Me","Us","Mx","Eu","Uk","In","Cn","Br","checkUnreachable","getIsSignatureRequired","options","isGuestLike","customer","ssoCreatedAt","daysSinceCreation","dayjs","diff","threshold","paymentProvider","PaymentProvider","Paypal","getDinero","Currency","Usd","shipment","isNextDay","items","sku","length","hasUswPro","hasUacc","hasUCable","reduce","acc","curr","toLowerCase","startsWith","greaterThanOrEqual","subtotal","amount","currency"],"mappings":";;;;;;;;;;;;;;;AAYa,MAAAA,2BAAA,GAGXC,OACo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AAAK,MAAA,CAK1D,CAACC,KAAKC,IAAS,KAAA;YACb,IAAIA,IAAK,CAAAC,WAAA,CAAA,CAAc,CAAAC,UAAA,CAAW,SAAS,CAAG,EAAA;cAC5CH,GAAA,CAAIJ,SAAY,GAAA,IAAA;YAAA;YAGlB,IAAIK,IAAK,CAAAC,WAAA,CAAA,CAAc,CAAAC,UAAA,CAAW,MAAM,CAAG,EAAA;cACzCH,GAAA,CAAIH,OAAU,GAAA,IAAA;YAAA;YAGhB,IAAII,IAAK,CAAAC,WAAA,CAAA,CAAc,CAAAC,UAAA,CAAW,SAAS,CAAG,EAAA;cAC5CH,GAAA,CAAIF,SAAY,GAAA,IAAA;YAAA;YAGX,OAAAE,GAAA;UACT,CAAA,EACA;YACEJ,SAAW,EAAA,KAAA;YACXC,OAAS,EAAA,KAAA;YACTC,SAAW,EAAA;UAAA,CAEf,CAAA;UAEI,IAAAF,SAAA,KAAcC,WAAWC,SAAY,CAAA,EAAA;YAChC,OAAA,IAAA;UAAA;QACT;QAIK,OAAAM,SAAA,CAAAA,kBAAA,CACLhB,IAAA,CAAAA,SAAA,CACEX,OAAA,CAAQgB,MAAMY,QAAS,CAAAC,MAAA,EACvB7B,OAAA,CAAQgB,MAAMY,QAAS,CAAAE,QACzB,CAAA,EACAvB,SACF,CAAA;MAAA;IAGF;MAAS;QACPT,MAAA,CAAAA,gBAAA,CAAiBE,QAAQlB,OAAO,CAAA;QACzB,OAAA,KAAA;MAAA;EACT;AAEJ,CAAA;;"}
1
+ {"version":3,"file":"shipping.js","sources":["../../src/utils/shipping.ts"],"sourcesContent":["import { greaterThanOrEqual } from \"dinero.js\";\n\nimport type { Nullish } from \"../types\";\nimport { Currency, PaymentProvider, StoreId } from \"../types\";\nimport { checkUnreachable } from \"./errors\";\nimport { getDinero } from \"./money/misc\";\nimport type { Money } from \"./money/types\";\n\n/**\n * Utility to get how many days free shipping will be for a specific store, defaulting to a fallback value\n */\nexport const getFreeShippingDaysPerStore = (\n // Instead of using StoreId type using plain string so if we add a new store it won't break types as we already have\n // configured a explicity default behavior\n storeId: Nullish<StoreId>,\n): Nullish<number> => {\n if (!storeId) {\n // Return undefined to indicate detect \"loading state\" as we can't determine it yet\n return undefined;\n }\n\n /**\n * Reasoning for values:\n * - Singapore - https://ui.slack.com/archives/C02CXF2Q7B4/p1709209947062139\n * - Brazil - we read dynamically latest option as free so there is no guarantee\n * - Japan - same as other just standard 5-days\n */\n switch (storeId) {\n case StoreId.Ca:\n case StoreId.Za:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Jp:\n case StoreId.Ph: {\n return 5;\n }\n case StoreId.Me: {\n return 2;\n }\n case StoreId.Us:\n case StoreId.Mx:\n case StoreId.Eu:\n case StoreId.Uk:\n case StoreId.In:\n case StoreId.Cn:\n case StoreId.Br: {\n // Return null to indicate \"no match\"\n return null;\n }\n\n default: {\n checkUnreachable(storeId);\n // Return null to indicate \"no match\"\n return null;\n }\n }\n};\n\nexport const getIsSignatureRequired = (options: {\n storeId: StoreId;\n subtotal: Money;\n customer: Nullish<{ isGuest: boolean }>;\n paymentProvider: Nullish<PaymentProvider>;\n}): boolean => {\n // If customer is not present, assume it's guest by default\n const isGuest = options.customer ? options.customer.isGuest : true;\n\n switch (options.storeId) {\n case StoreId.Br:\n case StoreId.Ca:\n case StoreId.Cn:\n case StoreId.Eu:\n case StoreId.In:\n case StoreId.Jp:\n case StoreId.Me:\n case StoreId.Mx:\n case StoreId.Ph:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Uk:\n case StoreId.Za: {\n return false;\n }\n\n case StoreId.Us: {\n const threshold =\n options.paymentProvider === PaymentProvider.Paypal\n ? getDinero(1000_00, Currency.Usd)\n : getDinero(2000_00, Currency.Usd);\n\n return (\n isGuest &&\n greaterThanOrEqual(\n getDinero(options.subtotal.amount, options.subtotal.currency),\n threshold,\n )\n );\n }\n\n default: {\n checkUnreachable(options.storeId);\n return false;\n }\n }\n};\n"],"names":["getFreeShippingDaysPerStore","storeId","StoreId","Ca","Za","Sg","Tw","Jp","Ph","Me","Us","Mx","Eu","Uk","In","Cn","Br","checkUnreachable","getIsSignatureRequired","options","isGuest","customer","threshold","paymentProvider","PaymentProvider","Paypal","getDinero","Currency","Usd","greaterThanOrEqual","subtotal","amount","currency"],"mappings":";;;;;;;;AAWa,MAAAA,2BAAA,GAGXC,OACoB,IAAA;EACpB,IAAI,CAACA,OAAS,EAAA;IAEL,OAAA,KAAA,CAAA;EAAA;EAST,QAAQA,OAAS;IACf,KAAKC,SAAQ,CAAAA,OAAA,CAAAC,EAAA;IACb,KAAKD,SAAQ,CAAAA,OAAA,CAAAE,EAAA;IACb,KAAKF,SAAQ,CAAAA,OAAA,CAAAG,EAAA;IACb,KAAKH,SAAQ,CAAAA,OAAA,CAAAI,EAAA;IACb,KAAKJ,SAAQ,CAAAA,OAAA,CAAAK,EAAA;IACb,KAAKL,SAAAA,CAAAA,QAAQM,EAAI;MAAA;QACR,OAAA,CAAA;MAAA;IAET,KAAKN,SAAAA,CAAAA,QAAQO,EAAI;MAAA;QACR,OAAA,CAAA;MAAA;IAET,KAAKP,SAAQ,CAAAA,OAAA,CAAAQ,EAAA;IACb,KAAKR,SAAQ,CAAAA,OAAA,CAAAS,EAAA;IACb,KAAKT,SAAQ,CAAAA,OAAA,CAAAU,EAAA;IACb,KAAKV,SAAQ,CAAAA,OAAA,CAAAW,EAAA;IACb,KAAKX,SAAQ,CAAAA,OAAA,CAAAY,EAAA;IACb,KAAKZ,SAAQ,CAAAA,OAAA,CAAAa,EAAA;IACb,KAAKb,SAAAA,CAAAA,QAAQc,EAAI;MAAA;QAER,OAAA,IAAA;MAAA;IAGT;MAAS;QACPC,MAAAA,CAAAA,gBAAA,CAAiBhB,OAAO,CAAA;QAEjB,OAAA,IAAA;MAAA;EACT;AAEJ,CAAA;AAEa,MAAAiB,sBAAA,GAA0BC,OAKxB,IAAA;EAEb,MAAMC,OAAU,GAAAD,OAAA,CAAQE,QAAW,GAAAF,OAAA,CAA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J,CAAA;;"}
@@ -1,4 +1,3 @@
1
- import dayjs from 'dayjs';
2
1
  import { greaterThanOrEqual } from 'dinero.js';
3
2
  import '../types/index.mjs';
4
3
  import { checkUnreachable } from './errors.mjs';
@@ -41,6 +40,7 @@ const getFreeShippingDaysPerStore = storeId => {
41
40
  }
42
41
  };
43
42
  const getIsSignatureRequired = options => {
43
+ const isGuest = options.customer ? options.customer.isGuest : true;
44
44
  switch (options.storeId) {
45
45
  case StoreId.Br:
46
46
  case StoreId.Ca:
@@ -60,46 +60,8 @@ const getIsSignatureRequired = options => {
60
60
  }
61
61
  case StoreId.Us:
62
62
  {
63
- let isGuestLike = true;
64
- if (options.customer?.ssoCreatedAt) {
65
- const daysSinceCreation = dayjs().diff(dayjs(options.customer.ssoCreatedAt), "days");
66
- if (daysSinceCreation >= 90) {
67
- isGuestLike = false;
68
- }
69
- }
70
- if (!isGuestLike) {
71
- return false;
72
- }
73
63
  const threshold = options.paymentProvider === PaymentProvider.Paypal ? getDinero(1e5, Currency.Usd) : getDinero(2e5, Currency.Usd);
74
- if (options.shipment.isNextDay) {
75
- if (options.items.sku.length === 1) {
76
- return true;
77
- }
78
- const {
79
- hasUswPro,
80
- hasUacc,
81
- hasUCable
82
- } = options.items.sku.reduce((acc, curr) => {
83
- if (curr.toLowerCase().startsWith("usw-pro")) {
84
- acc.hasUswPro = true;
85
- }
86
- if (curr.toLowerCase().startsWith("uacc")) {
87
- acc.hasUacc = true;
88
- }
89
- if (curr.toLowerCase().startsWith("u-cable")) {
90
- acc.hasUCable = true;
91
- }
92
- return acc;
93
- }, {
94
- hasUswPro: false,
95
- hasUacc: false,
96
- hasUCable: false
97
- });
98
- if (hasUswPro && (hasUacc || hasUCable)) {
99
- return true;
100
- }
101
- }
102
- return greaterThanOrEqual(getDinero(options.items.subtotal.amount, options.items.subtotal.currency), threshold);
64
+ return isGuest && greaterThanOrEqual(getDinero(options.subtotal.amount, options.subtotal.currency), threshold);
103
65
  }
104
66
  default:
105
67
  {
@@ -1 +1 @@
1
- {"version":3,"file":"shipping.mjs","sources":["../../src/utils/shipping.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport { greaterThanOrEqual } from \"dinero.js\";\n\nimport type { Nullish } from \"../types\";\nimport { Currency, PaymentProvider, StoreId } from \"../types\";\nimport { checkUnreachable } from \"./errors\";\nimport { getDinero } from \"./money/misc\";\nimport type { Money } from \"./money/types\";\n\n/**\n * Utility to get how many days free shipping will be for a specific store, defaulting to a fallback value\n */\nexport const getFreeShippingDaysPerStore = (\n // Instead of using StoreId type using plain string so if we add a new store it won't break types as we already have\n // configured a explicity default behavior\n storeId: Nullish<StoreId>,\n): Nullish<number> => {\n if (!storeId) {\n // Return undefined to indicate detect \"loading state\" as we can't determine it yet\n return undefined;\n }\n\n /**\n * Reasoning for values:\n * - Singapore - https://ui.slack.com/archives/C02CXF2Q7B4/p1709209947062139\n * - Brazil - we read dynamically latest option as free so there is no guarantee\n * - Japan - same as other just standard 5-days\n */\n switch (storeId) {\n case StoreId.Ca:\n case StoreId.Za:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Jp:\n case StoreId.Ph: {\n return 5;\n }\n case StoreId.Me: {\n return 2;\n }\n case StoreId.Us:\n case StoreId.Mx:\n case StoreId.Eu:\n case StoreId.Uk:\n case StoreId.In:\n case StoreId.Cn:\n case StoreId.Br: {\n // Return null to indicate \"no match\"\n return null;\n }\n\n default: {\n checkUnreachable(storeId);\n // Return null to indicate \"no match\"\n return null;\n }\n }\n};\n\nexport const getIsSignatureRequired = (options: {\n storeId: StoreId;\n items: {\n subtotal: Money;\n sku: string[];\n };\n shipment: {\n isNextDay: boolean;\n };\n customer: Nullish<{ ssoCreatedAt: Nullish<Date> }>;\n paymentProvider: Nullish<PaymentProvider>;\n}): boolean => {\n switch (options.storeId) {\n case StoreId.Br:\n case StoreId.Ca:\n case StoreId.Cn:\n case StoreId.Eu:\n case StoreId.In:\n case StoreId.Jp:\n case StoreId.Me:\n case StoreId.Mx:\n case StoreId.Ph:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Uk:\n case StoreId.Za: {\n return false;\n }\n\n case StoreId.Us: {\n // Assume by default customer is guest like\n let isGuestLike = true;\n\n // Consider customer as guest like, if their account was created within last 3 months\n if (options.customer?.ssoCreatedAt) {\n // Using dayjs\n const daysSinceCreation = dayjs().diff(\n dayjs(options.customer.ssoCreatedAt),\n \"days\",\n );\n if (daysSinceCreation >= 90) {\n isGuestLike = false;\n }\n }\n\n // If customer is not guest like, we don't need to check for signature requirement\n if (!isGuestLike) {\n return false;\n }\n\n const threshold =\n options.paymentProvider === PaymentProvider.Paypal\n ? getDinero(1000_00, Currency.Usd)\n : getDinero(2000_00, Currency.Usd);\n\n // Next day shipment scenario:\n if (options.shipment.isNextDay) {\n if (options.items.sku.length === 1) {\n return true;\n }\n\n const { hasUswPro, hasUacc, hasUCable } = options.items.sku.reduce<{\n hasUswPro: boolean;\n hasUacc: boolean;\n hasUCable: boolean;\n }>(\n (acc, curr) => {\n if (curr.toLowerCase().startsWith(\"usw-pro\")) {\n acc.hasUswPro = true;\n }\n\n if (curr.toLowerCase().startsWith(\"uacc\")) {\n acc.hasUacc = true;\n }\n\n if (curr.toLowerCase().startsWith(\"u-cable\")) {\n acc.hasUCable = true;\n }\n\n return acc;\n },\n {\n hasUswPro: false,\n hasUacc: false,\n hasUCable: false,\n },\n );\n\n if (hasUswPro && (hasUacc || hasUCable)) {\n return true;\n }\n }\n\n // Threshold scenario:\n return greaterThanOrEqual(\n getDinero(\n options.items.subtotal.amount,\n options.items.subtotal.currency,\n ),\n threshold,\n );\n }\n\n default: {\n checkUnreachable(options.storeId);\n return false;\n }\n }\n};\n"],"names":["getFreeShippingDaysPerStore","storeId","StoreId","Ca","Za","Sg","Tw","Jp","Ph","Me","Us","Mx","Eu","Uk","In","Cn","Br","checkUnreachable","getIsSignatureRequired","options","isGuestLike","customer","ssoCreatedAt","daysSinceCreation","dayjs","diff","threshold","paymentProvider","PaymentProvider","Paypal","getDinero","Currency","Usd","shipment","isNextDay","items","sku","length","hasUswPro","hasUacc","hasUCable","reduce","acc","curr","toLowerCase","startsWith","greaterThanOrEqual","subtotal","amount","currency"],"mappings":";;;;;;;AAYa,MAAAA,2BAAA,GAGXC,OACoB,IAAA;EACpB,IAAI,CAACA,OAAS,EAAA;IAEL,OAAA,KAAA,CAAA;EAAA;EAST,QAAQA,OAAS;IACf,KAAKC,OAAQ,CAAAC,EAAA;IACb,KAAKD,OAAQ,CAAAE,EAAA;IACb,KAAKF,OAAQ,CAAAG,EAAA;IACb,KAAKH,OAAQ,CAAAI,EAAA;IACb,KAAKJ,OAAQ,CAAAK,EAAA;IACb,KAAKL,QAAQM,EAAI;MAAA;QACR,OAAA,CAAA;MAAA;IAET,KAAKN,QAAQO,EAAI;MAAA;QACR,OAAA,CAAA;MAAA;IAET,KAAKP,OAAQ,CAAAQ,EAAA;IACb,KAAKR,OAAQ,CAAAS,EAAA;IACb,KAAKT,OAAQ,CAAAU,EAAA;IACb,KAAKV,OAAQ,CAAAW,EAAA;IACb,KAAKX,OAAQ,CAAAY,EAAA;IACb,KAAKZ,OAAQ,CAAAa,EAAA;IACb,KAAKb,QAAQc,EAAI;MAAA;QAER,OAAA,IAAA;MAAA;IAGT;MAAS;QACPC,gBAAA,CAAiBhB,OAAO,CAAA;QAEjB,OAAA,IAAA;MAAA;EACT;AAEJ,CAAA;AAEa,MAAAiB,sBAAA,GAA0BC,OAWxB,IAAA;EACb,QAAQA,QAAQlB,OAAS;IACvB,KAAKC,OAAQ,CAAAc,EAAA;IACb,KAAKd,OAAQ,CAAAC,EAAA;IACb,KAAKD,OAAQ,CAAAa,EAAA;IACb,KAAKb,OAAQ,CAAAU,EAAA;IACb,KAAKV,OAAQ,CAAAY,EAAA;IACb,KAAKZ,OAAQ,CAAAK,EAAA;IACb,KAAKL,OAAQ,CAAAO,EAAA;IACb,KAAKP,OAAQ,CAAAS,EAAA;IACb,KAAKT,OAAQ,CAAAM,EAAA;IAC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A;YAGhB,IAAII,IAAK,CAAAC,WAAA,CAAA,CAAc,CAAAC,UAAA,CAAW,SAAS,CAAG,EAAA;cAC5CH,GAAA,CAAIF,SAAY,GAAA,IAAA;YAAA;YAGX,OAAAE,GAAA;UACT,CAAA,EACA;YACEJ,SAAW,EAAA,KAAA;YACXC,OAAS,EAAA,KAAA;YACTC,SAAW,EAAA;UAAA,CAEf,CAAA;UAEI,IAAAF,SAAA,KAAcC,WAAWC,SAAY,CAAA,EAAA;YAChC,OAAA,IAAA;UAAA;QACT;QAIK,OAAAM,kBAAA,CACLhB,SAAA,CACEX,OAAA,CAAQgB,MAAMY,QAAS,CAAAC,MAAA,EACvB7B,OAAA,CAAQgB,MAAMY,QAAS,CAAAE,QACzB,CAAA,EACAvB,SACF,CAAA;MAAA;IAGF;MAAS;QACPT,gBAAA,CAAiBE,QAAQlB,OAAO,CAAA;QACzB,OAAA,KAAA;MAAA;EACT;AAEJ,CAAA;"}
1
+ {"version":3,"file":"shipping.mjs","sources":["../../src/utils/shipping.ts"],"sourcesContent":["import { greaterThanOrEqual } from \"dinero.js\";\n\nimport type { Nullish } from \"../types\";\nimport { Currency, PaymentProvider, StoreId } from \"../types\";\nimport { checkUnreachable } from \"./errors\";\nimport { getDinero } from \"./money/misc\";\nimport type { Money } from \"./money/types\";\n\n/**\n * Utility to get how many days free shipping will be for a specific store, defaulting to a fallback value\n */\nexport const getFreeShippingDaysPerStore = (\n // Instead of using StoreId type using plain string so if we add a new store it won't break types as we already have\n // configured a explicity default behavior\n storeId: Nullish<StoreId>,\n): Nullish<number> => {\n if (!storeId) {\n // Return undefined to indicate detect \"loading state\" as we can't determine it yet\n return undefined;\n }\n\n /**\n * Reasoning for values:\n * - Singapore - https://ui.slack.com/archives/C02CXF2Q7B4/p1709209947062139\n * - Brazil - we read dynamically latest option as free so there is no guarantee\n * - Japan - same as other just standard 5-days\n */\n switch (storeId) {\n case StoreId.Ca:\n case StoreId.Za:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Jp:\n case StoreId.Ph: {\n return 5;\n }\n case StoreId.Me: {\n return 2;\n }\n case StoreId.Us:\n case StoreId.Mx:\n case StoreId.Eu:\n case StoreId.Uk:\n case StoreId.In:\n case StoreId.Cn:\n case StoreId.Br: {\n // Return null to indicate \"no match\"\n return null;\n }\n\n default: {\n checkUnreachable(storeId);\n // Return null to indicate \"no match\"\n return null;\n }\n }\n};\n\nexport const getIsSignatureRequired = (options: {\n storeId: StoreId;\n subtotal: Money;\n customer: Nullish<{ isGuest: boolean }>;\n paymentProvider: Nullish<PaymentProvider>;\n}): boolean => {\n // If customer is not present, assume it's guest by default\n const isGuest = options.customer ? options.customer.isGuest : true;\n\n switch (options.storeId) {\n case StoreId.Br:\n case StoreId.Ca:\n case StoreId.Cn:\n case StoreId.Eu:\n case StoreId.In:\n case StoreId.Jp:\n case StoreId.Me:\n case StoreId.Mx:\n case StoreId.Ph:\n case StoreId.Sg:\n case StoreId.Tw:\n case StoreId.Uk:\n case StoreId.Za: {\n return false;\n }\n\n case StoreId.Us: {\n const threshold =\n options.paymentProvider === PaymentProvider.Paypal\n ? getDinero(1000_00, Currency.Usd)\n : getDinero(2000_00, Currency.Usd);\n\n return (\n isGuest &&\n greaterThanOrEqual(\n getDinero(options.subtotal.amount, options.subtotal.currency),\n threshold,\n )\n );\n }\n\n default: {\n checkUnreachable(options.storeId);\n return false;\n }\n }\n};\n"],"names":["getFreeShippingDaysPerStore","storeId","StoreId","Ca","Za","Sg","Tw","Jp","Ph","Me","Us","Mx","Eu","Uk","In","Cn","Br","checkUnreachable","getIsSignatureRequired","options","isGuest","customer","threshold","paymentProvider","PaymentProvider","Paypal","getDinero","Currency","Usd","greaterThanOrEqual","subtotal","amount","currency"],"mappings":";;;;;;AAWa,MAAAA,2BAAA,GAGXC,OACoB,IAAA;EACpB,IAAI,CAACA,OAAS,EAAA;IAEL,OAAA,KAAA,CAAA;EAAA;EAST,QAAQA,OAAS;IACf,KAAKC,OAAQ,CAAAC,EA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,MAAMY,SACJ,GAAAH,OAAA,CAAQI,eAAoB,KAAAC,eAAA,CAAgBC,MACxC,GAAAC,SAAA,CAAU,GAAS,EAAAC,QAAA,CAASC,GAAG,CAAA,GAC/BF,SAAU,CAAA,GAAA,EAASC,SAASC,GAAG,CAAA;QAErC,OACER,OACA,IAAAS,kBAAA,CACEH,UAAUP,OAAQ,CAAAW,QAAA,CAASC,MAAQ,EAAAZ,OAAA,CAAQW,SAASE,QAAQ,CAAA,EAC5DV,SACF,CAAA;MAAA;IAIJ;MAAS;QACPL,gBAAA,CAAiBE,QAAQlB,OAAO,CAAA;QACzB,OAAA,KAAA;MAAA;EACT;AAEJ,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubnt/store.core",
3
- "version": "10.11.0-beta.4",
3
+ "version": "10.11.0",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -22,30 +22,6 @@
22
22
  "terser": "5.39.0",
23
23
  "tldts": "6.1.84"
24
24
  },
25
- "devDependencies": {
26
- "@babel/types": "7.26.9",
27
- "@rollup/plugin-commonjs": "28.0.3",
28
- "@rollup/plugin-json": "6.1.0",
29
- "@rollup/plugin-multi-entry": "6.0.1",
30
- "@rollup/plugin-node-resolve": "16.0.0",
31
- "@types/adm-zip": "0.5.7",
32
- "@types/big.js": "6.2.2",
33
- "@types/react": "^17.0.0 || ^18.3.18 || ^19.0.8",
34
- "@types/url-join": "^4.0.3",
35
- "babel-plugin-styled-components": "2.1.4",
36
- "css-loader": "7.1.2",
37
- "nodemon": "2.0.22",
38
- "react-hook-form": "7.54.2",
39
- "rollup": "4.35.0",
40
- "rollup-plugin-copy": "3.5.0",
41
- "rollup-plugin-delete": "3.0.0",
42
- "rollup-plugin-esbuild": "6.2.1",
43
- "rollup-plugin-external-assets": "4.1.1",
44
- "rollup-plugin-peer-deps-external": "2.2.4",
45
- "sass": "1.85.1",
46
- "sass-loader": "16.0.5",
47
- "style-loader": "4.0.0"
48
- },
49
25
  "peerDependencies": {
50
26
  "@babel/core": "7.26.9",
51
27
  "@dinero.js/currencies": "2.0.0-alpha.8",
@@ -64,10 +40,10 @@
64
40
  "libphonenumber-js": "^1.12.4",
65
41
  "lodash-es": "^4.17.21",
66
42
  "next": "^14.2.23 || ^15.1.0",
67
- "react": "^17.0.0 || ^18.3.1 || ^19.0.0",
68
43
  "react-countup": "6.5.3",
69
44
  "react-dom": "^17.0.0 || ^18.3.1 || ^19.0.0",
70
45
  "react-use": "^17.5.1",
46
+ "react": "^17.0.0 || ^18.3.1 || ^19.0.0",
71
47
  "slugify": "^1.6.6",
72
48
  "styled-components": "^6.1.13",
73
49
  "url-join": "^4.0.1",
@@ -95,5 +71,29 @@
95
71
  "styled-components": {
96
72
  "optional": true
97
73
  }
74
+ },
75
+ "devDependencies": {
76
+ "@babel/types": "7.26.9",
77
+ "@rollup/plugin-commonjs": "28.0.3",
78
+ "@rollup/plugin-json": "6.1.0",
79
+ "@rollup/plugin-multi-entry": "6.0.1",
80
+ "@rollup/plugin-node-resolve": "16.0.0",
81
+ "@types/adm-zip": "0.5.7",
82
+ "@types/big.js": "6.2.2",
83
+ "@types/react": "^17.0.0 || ^18.3.18 || ^19.0.8",
84
+ "@types/url-join": "^4.0.3",
85
+ "babel-plugin-styled-components": "2.1.4",
86
+ "css-loader": "7.1.2",
87
+ "nodemon": "2.0.22",
88
+ "react-hook-form": "7.54.2",
89
+ "rollup-plugin-copy": "3.5.0",
90
+ "rollup-plugin-delete": "3.0.0",
91
+ "rollup-plugin-esbuild": "6.2.1",
92
+ "rollup-plugin-external-assets": "4.1.1",
93
+ "rollup-plugin-peer-deps-external": "2.2.4",
94
+ "rollup": "4.35.0",
95
+ "sass-loader": "16.0.5",
96
+ "sass": "1.85.1",
97
+ "style-loader": "4.0.0"
98
98
  }
99
99
  }
@@ -1,3 +0,0 @@
1
- <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20.5934 11.5633C19.4108 10.4229 17.5851 9.44735 13.9717 8.42955H13.9722C13.8487 8.39472 13.8566 8.23964 13.9833 8.21735C14.0147 8.21191 14.0487 8.20558 14.0855 8.19871C14.2595 8.16626 14.4982 8.12174 14.84 8.1022C27.9265 7.34953 25.5408 17.5489 17.3014 17.5684C15.7747 17.5716 14.0534 17.4616 12.9242 16.187C12.8286 16.0788 12.9725 15.9372 13.0788 16.0343C14.9812 17.7625 20.1667 17.1171 21.3368 15.2964C22.2901 13.8115 21.6999 12.6312 20.5934 11.5633ZM25.8905 11.2872C26 11.3406 26.1236 11.4084 26.2508 11.4975L26.2512 11.4989C30.2602 14.3285 27.6438 16.6915 23.7773 17.8834V17.8852C23.7195 17.9014 23.6615 17.9186 23.6032 17.9358L23.6022 17.9361C23.589 17.94 23.5759 17.9439 23.5627 17.9478L23.5419 17.9539C19.9141 19.014 15.0503 19.1761 12.6284 17.8894C12.6284 17.8894 12.1121 17.5802 11.9059 17.3968C11.1217 16.6993 10.4066 15.7999 12.0104 14.6247C12.127 14.5393 12.2551 14.6981 12.1469 14.7947C10.8723 15.9272 12.3535 17.3745 14.7221 17.8829C15.5063 18.051 16.5283 18.1169 17.5428 18.0087C17.8776 17.9735 18.1971 17.9307 18.5012 17.882H18.5137C20.9839 17.4827 22.473 16.6729 23.5642 15.7577C24.8736 14.6586 25.5724 13.3701 25.467 11.27C25.4624 11.1799 25.5394 11.1279 25.6212 11.1655C25.647 11.1774 25.6757 11.19 25.7071 11.2038C25.7614 11.2276 25.8233 11.2548 25.8905 11.2872ZM3.34008 12.1588C6.84248 11.0453 9.39209 10.7087 11.9143 10.7482C14.2749 10.7849 16.636 11.1192 18.7004 12.3273C21.0025 13.6743 19.8041 16.2992 15.8128 16.289C15.6665 16.289 15.6609 16.4993 15.8072 16.5067C18.4422 16.6335 19.4976 15.9291 20.2777 15.221C22.3862 13.3057 19.2594 10.783 15.3614 9.58689C11.3631 8.35969 6.16085 8.34808 3.45663 11.5482C3.36701 11.6545 3.31315 11.7479 3.27647 11.8296C3.25423 11.8786 3.23919 11.9223 3.2261 11.9603C3.21923 11.9802 3.2129 11.9985 3.20636 12.0153C3.16875 12.1114 3.24304 12.1899 3.34055 12.1588H3.34008ZM12.2203 11.9816C9.15574 12.3071 7.4266 13.2028 6.19892 14.2331V14.2322C5.07294 15.1762 4.39874 16.2608 4.29844 17.8799L4.29241 17.8836H4.29844C4.28219 18.1451 4.28126 18.4237 4.29612 18.7199C4.30077 18.8095 4.23205 18.8648 4.13593 18.8397C4.07789 18.8246 4.0121 18.7916 3.93645 18.7536L3.93643 18.7536L3.93636 18.7536C3.914 18.7424 3.89077 18.7307 3.86662 18.719C3.75974 18.6667 3.64629 18.5863 3.52328 18.4992L3.51234 18.4914C3.22167 18.2867 2.96583 18.0842 2.74296 17.8841C-0.173466 15.2709 2.51172 13.1211 6.22121 12.0373C10.2594 10.857 15.8281 10.7902 17.8572 12.5945C18.6414 13.2919 19.357 14.1909 17.7527 15.3661C17.6362 15.4511 17.508 15.2932 17.6162 15.1971C19.3328 13.6713 16.1629 11.5633 12.2203 11.9816ZM26.4221 17.8312C26.3738 17.846 26.326 17.8618 26.2782 17.8795H26.267C22.8445 18.9544 20.333 19.2799 17.8479 19.2418C15.6396 19.207 13.4303 18.9117 11.4634 17.8841H11.4616C11.3274 17.8135 11.1941 17.7402 11.0623 17.6631C8.76014 16.3161 9.95856 13.6913 13.9499 13.7005C14.0962 13.7015 14.1017 13.4902 13.9555 13.4832C11.3204 13.356 10.265 14.0604 9.48495 14.769C8.42211 15.7348 8.68956 16.8547 9.71618 17.8841H9.71943C10.7298 18.8926 12.471 19.8101 14.4017 20.4031C18.4 21.6307 23.6023 21.6414 26.307 18.4413C26.3966 18.3354 26.4504 18.2416 26.4871 18.1604C26.509 18.1116 26.5241 18.0681 26.5372 18.0302L26.5372 18.0302C26.5442 18.0101 26.5506 17.9916 26.5572 17.9747C26.5702 17.9412 26.5698 17.9096 26.5591 17.8846C26.5396 17.8372 26.4862 17.8117 26.4226 17.8316L26.4221 17.8312ZM9.16923 18.4263C10.3514 19.5671 12.1776 20.5422 15.791 21.5605L15.7905 21.56C15.914 21.5948 15.9061 21.7494 15.7794 21.7717C15.7478 21.7772 15.7136 21.7836 15.6765 21.7905C15.5026 21.8229 15.2641 21.8674 14.9227 21.8873C8.7713 22.2412 6.03829 20.1749 5.72534 17.8835C5.37245 15.3004 8.09478 12.4309 12.4613 12.4207C13.988 12.4174 15.7092 12.5279 16.8385 13.8021C16.9346 13.9098 16.7907 14.0519 16.6839 13.9548C14.7815 12.2271 9.59594 12.8725 8.42585 14.6931C7.63092 15.9305 7.90859 16.9571 8.66405 17.8825V17.8839C8.81449 18.0678 8.98489 18.2484 9.16923 18.4263Z" fill="#212124"/>
3
- </svg>
Binary file
Binary file
package/lib/assets/ux.png DELETED
Binary file
Binary file
@@ -1,6 +0,0 @@
1
- interface BodyPortalProps {
2
- isOpen: boolean;
3
- children: React.ReactNode;
4
- }
5
- export declare const BodyPortal: ({ isOpen, children, }: BodyPortalProps) => JSX.Element | null;
6
- export {};
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var reactDom = require('react-dom');
5
- "use strict";
6
- const BodyPortal = ({
7
- isOpen,
8
- children
9
- }) => {
10
- if (!isOpen) {
11
- return null;
12
- }
13
- return reactDom.createPortal(/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {
14
- children
15
- }), document.body);
16
- };
17
- exports.BodyPortal = BodyPortal;
18
- //# sourceMappingURL=BodyPortal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BodyPortal.js","sources":["../../../src/components/BodyPortal/BodyPortal.tsx"],"sourcesContent":["import { createPortal } from \"react-dom\";\n\ninterface BodyPortalProps {\n isOpen: boolean;\n children: React.ReactNode;\n}\n\nexport const BodyPortal = ({\n isOpen,\n children,\n}: BodyPortalProps): JSX.Element | null => {\n if (!isOpen) {\n return null;\n }\n\n return createPortal(<>{children}</>, document.body);\n};\n"],"names":["BodyPortal","isOpen","children","createPortal","jsx","Fragment","document","body"],"mappings":";;;;;AAOO,MAAMA,aAAaA,CAAC;EACzBC,MAAA;EACAC;AACF,CAA2C,KAAA;EACzC,IAAI,CAACD,MAAQ,EAAA;IACJ,OAAA,IAAA;EAAA;EAGT,OAAOE,QAAAA,CAAAA,YAAa,CAAAC,eAAAA,UAAAA,CAAAA,GAAA,CAAAC,UAAA,CAAAA,QAAA,EAAA;IAAGH;GAAS,CAAA,EAAKI,SAASC,IAAI,CAAA;AACpD,CAAA;"}
@@ -1,16 +0,0 @@
1
- import { jsx, Fragment } from 'react/jsx-runtime';
2
- import { createPortal } from 'react-dom';
3
- "use strict";
4
- const BodyPortal = ({
5
- isOpen,
6
- children
7
- }) => {
8
- if (!isOpen) {
9
- return null;
10
- }
11
- return createPortal(/* @__PURE__ */jsx(Fragment, {
12
- children
13
- }), document.body);
14
- };
15
- export { BodyPortal };
16
- //# sourceMappingURL=BodyPortal.mjs.map