@bigbinary/neeto-commons-frontend 3.0.6 → 3.0.9

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 (420) hide show
  1. package/cjs/configs/babel.js +50 -0
  2. package/cjs/configs/eslint/globals.js +14 -0
  3. package/cjs/configs/eslint/helpers/index.js +74 -0
  4. package/cjs/configs/eslint/imports/enforced.js +29 -0
  5. package/cjs/configs/eslint/imports/order.js +65 -0
  6. package/cjs/configs/eslint/index.js +171 -0
  7. package/cjs/configs/eslint/overrides.js +30 -0
  8. package/cjs/configs/eslint/promise.js +8 -0
  9. package/cjs/configs/eslint/react.js +92 -0
  10. package/cjs/configs/nanos/eslint/imports/order.js +25 -0
  11. package/cjs/configs/nanos/eslint/index.js +28 -0
  12. package/cjs/configs/nanos/tailwind.js +11 -0
  13. package/cjs/configs/nanos/webpack/resolve.js +48 -0
  14. package/cjs/configs/nextjs/eslint/imports/order.js +25 -0
  15. package/cjs/configs/nextjs/eslint/index.js +22 -0
  16. package/cjs/configs/nextjs/webpack/resolve.js +1 -0
  17. package/cjs/configs/prettier.js +16 -0
  18. package/cjs/configs/scripts/dead-code-eliminator/constants.js +12 -0
  19. package/cjs/configs/scripts/dead-code-eliminator/index.js +266 -0
  20. package/cjs/configs/scripts/getPkgTranslations.js +45 -0
  21. package/cjs/configs/scripts/jsdoc-builder/constants.mjs +42 -0
  22. package/cjs/configs/scripts/jsdoc-builder/index.mjs +67 -0
  23. package/cjs/configs/scripts/jsdoc-builder/utils.mjs +219 -0
  24. package/cjs/configs/scripts/remove-unused-translation-keys/constants.js +11 -0
  25. package/cjs/configs/scripts/remove-unused-translation-keys/index.js +186 -0
  26. package/cjs/configs/tailwind.js +13 -0
  27. package/cjs/configs/webpack/helpers/customize-default-rules.js +54 -0
  28. package/cjs/configs/webpack/index.js +58 -0
  29. package/cjs/configs/webpack/resolve.js +53 -0
  30. package/cjs/configs/webpack/rules.js +34 -0
  31. package/{constants.cjs.js → cjs/constants/index.js} +11 -10
  32. package/cjs/constants/index.js.map +1 -0
  33. package/cjs/cypress-configs/initializer.js +32 -0
  34. package/cjs/cypress-configs/plugins.js +105 -0
  35. package/cjs/cypress-configs/resolve.js +17 -0
  36. package/cjs/cypress-configs/webpack.config.js +19 -0
  37. package/cjs/cypress-utils/commands.js +276 -0
  38. package/cjs/cypress-utils/commands.js.map +1 -0
  39. package/cjs/cypress-utils/constants/index.js +14 -0
  40. package/cjs/cypress-utils/constants/index.js.map +1 -0
  41. package/cjs/cypress-utils/constants/routes.js +40 -0
  42. package/cjs/cypress-utils/constants/routes.js.map +1 -0
  43. package/cjs/cypress-utils/constants/selectors/common.js +103 -0
  44. package/cjs/cypress-utils/constants/selectors/common.js.map +1 -0
  45. package/cjs/cypress-utils/constants/selectors/editor.js +29 -0
  46. package/cjs/cypress-utils/constants/selectors/editor.js.map +1 -0
  47. package/cjs/cypress-utils/constants/selectors/ipRestriction.js +19 -0
  48. package/cjs/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
  49. package/cjs/cypress-utils/constants/selectors/login.js +21 -0
  50. package/cjs/cypress-utils/constants/selectors/login.js.map +1 -0
  51. package/cjs/cypress-utils/constants/selectors/member.js +65 -0
  52. package/cjs/cypress-utils/constants/selectors/member.js.map +1 -0
  53. package/cjs/cypress-utils/constants/selectors/navigation.js +28 -0
  54. package/cjs/cypress-utils/constants/selectors/navigation.js.map +1 -0
  55. package/cjs/cypress-utils/constants/selectors/roles.js +24 -0
  56. package/cjs/cypress-utils/constants/selectors/roles.js.map +1 -0
  57. package/cjs/cypress-utils/constants/selectors/signUp.js +23 -0
  58. package/cjs/cypress-utils/constants/selectors/signUp.js.map +1 -0
  59. package/cjs/cypress-utils/constants/selectors/tags.js +31 -0
  60. package/cjs/cypress-utils/constants/selectors/tags.js.map +1 -0
  61. package/cjs/cypress-utils/constants/texts/common.js +40 -0
  62. package/cjs/cypress-utils/constants/texts/common.js.map +1 -0
  63. package/cjs/cypress-utils/constants/texts/member.js +68 -0
  64. package/cjs/cypress-utils/constants/texts/member.js.map +1 -0
  65. package/cjs/cypress-utils/constants/texts/navigation.js +24 -0
  66. package/cjs/cypress-utils/constants/texts/navigation.js.map +1 -0
  67. package/cjs/cypress-utils/constants/texts/roles.js +25 -0
  68. package/cjs/cypress-utils/constants/texts/roles.js.map +1 -0
  69. package/cjs/cypress-utils/constants/texts/signUp.js +14 -0
  70. package/cjs/cypress-utils/constants/texts/signUp.js.map +1 -0
  71. package/cjs/cypress-utils/constants/texts/tags.js +28 -0
  72. package/cjs/cypress-utils/constants/texts/tags.js.map +1 -0
  73. package/cjs/cypress-utils/fixtures/fake.js +177 -0
  74. package/cjs/cypress-utils/fixtures/fake.js.map +1 -0
  75. package/cjs/cypress-utils/index.js +226 -0
  76. package/cjs/cypress-utils/index.js.map +1 -0
  77. package/cjs/cypress-utils/utils/authentication.js +45 -0
  78. package/cjs/cypress-utils/utils/authentication.js.map +1 -0
  79. package/cjs/cypress-utils/utils/common.js +92 -0
  80. package/cjs/cypress-utils/utils/common.js.map +1 -0
  81. package/cjs/cypress-utils/utils/date.js +28 -0
  82. package/cjs/cypress-utils/utils/date.js.map +1 -0
  83. package/cjs/cypress-utils/utils/email.js +165 -0
  84. package/cjs/cypress-utils/utils/email.js.map +1 -0
  85. package/cjs/cypress-utils/utils/member.js +352 -0
  86. package/cjs/cypress-utils/utils/member.js.map +1 -0
  87. package/cjs/cypress-utils/utils/navigation.js +208 -0
  88. package/cjs/cypress-utils/utils/navigation.js.map +1 -0
  89. package/cjs/cypress-utils/utils/organization.js +109 -0
  90. package/cjs/cypress-utils/utils/organization.js.map +1 -0
  91. package/cjs/cypress-utils/utils/validation.js +17 -0
  92. package/cjs/cypress-utils/utils/validation.js.map +1 -0
  93. package/cjs/initializers/axios/index.js +199 -0
  94. package/cjs/initializers/axios/index.js.map +1 -0
  95. package/cjs/initializers/axios/paramsSerializer.js +27 -0
  96. package/cjs/initializers/axios/paramsSerializer.js.map +1 -0
  97. package/cjs/initializers/constants.js +23 -0
  98. package/cjs/initializers/constants.js.map +1 -0
  99. package/cjs/initializers/globalProps.js +15 -0
  100. package/cjs/initializers/globalProps.js.map +1 -0
  101. package/cjs/initializers/i18n.js +74 -0
  102. package/cjs/initializers/i18n.js.map +1 -0
  103. package/cjs/initializers/index.js +51 -0
  104. package/cjs/initializers/index.js.map +1 -0
  105. package/cjs/initializers/logger.js +17 -0
  106. package/cjs/initializers/logger.js.map +1 -0
  107. package/cjs/initializers/reactDevTools.js +26 -0
  108. package/cjs/initializers/reactDevTools.js.map +1 -0
  109. package/cjs/initializers/utils/customFormatters.js +52 -0
  110. package/cjs/initializers/utils/customFormatters.js.map +1 -0
  111. package/cjs/initializers/utils/customPostProcessors.js +21 -0
  112. package/cjs/initializers/utils/customPostProcessors.js.map +1 -0
  113. package/cjs/initializers/utils.js +37 -0
  114. package/cjs/initializers/utils.js.map +1 -0
  115. package/cjs/react-utils/BrowserPushNotifications/devices.js +26 -0
  116. package/cjs/react-utils/BrowserPushNotifications/devices.js.map +1 -0
  117. package/cjs/react-utils/BrowserPushNotifications/index.js +19 -0
  118. package/cjs/react-utils/BrowserPushNotifications/index.js.map +1 -0
  119. package/cjs/react-utils/BrowserPushNotifications/pushHelper.js +116 -0
  120. package/cjs/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
  121. package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js +146 -0
  122. package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
  123. package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +153 -0
  124. package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
  125. package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js +9 -0
  126. package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
  127. package/cjs/react-utils/HoneybadgerErrorBoundary/index.js +59 -0
  128. package/cjs/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
  129. package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js +17 -0
  130. package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
  131. package/cjs/react-utils/PrivateRoute.js +80 -0
  132. package/cjs/react-utils/PrivateRoute.js.map +1 -0
  133. package/cjs/react-utils/constants/constants.js +11 -0
  134. package/cjs/react-utils/constants/constants.js.map +1 -0
  135. package/cjs/react-utils/constants/index.js +28 -0
  136. package/cjs/react-utils/constants/index.js.map +1 -0
  137. package/cjs/react-utils/constants/query.js +11 -0
  138. package/cjs/react-utils/constants/query.js.map +1 -0
  139. package/cjs/react-utils/index.js +242 -0
  140. package/cjs/react-utils/index.js.map +1 -0
  141. package/cjs/react-utils/metaClick.js +16 -0
  142. package/cjs/react-utils/metaClick.js.map +1 -0
  143. package/cjs/react-utils/useDebounce.js +28 -0
  144. package/cjs/react-utils/useDebounce.js.map +1 -0
  145. package/cjs/react-utils/useDisplayErrorPage.js +23 -0
  146. package/cjs/react-utils/useDisplayErrorPage.js.map +1 -0
  147. package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js +17 -0
  148. package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
  149. package/cjs/react-utils/useFetchNeetoApps/index.js +14 -0
  150. package/cjs/react-utils/useFetchNeetoApps/index.js.map +1 -0
  151. package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +27 -0
  152. package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
  153. package/cjs/react-utils/useFieldSubmit.js +33 -0
  154. package/cjs/react-utils/useFieldSubmit.js.map +1 -0
  155. package/cjs/react-utils/useFuncDebounce.js +27 -0
  156. package/cjs/react-utils/useFuncDebounce.js.map +1 -0
  157. package/cjs/react-utils/useHotKeys/constants.js +36 -0
  158. package/cjs/react-utils/useHotKeys/constants.js.map +1 -0
  159. package/cjs/react-utils/useHotKeys/index.js +14 -0
  160. package/cjs/react-utils/useHotKeys/index.js.map +1 -0
  161. package/cjs/react-utils/useHotKeys/useHotKeys.js +65 -0
  162. package/cjs/react-utils/useHotKeys/useHotKeys.js.map +1 -0
  163. package/cjs/react-utils/useHotKeys/utils.js +37 -0
  164. package/cjs/react-utils/useHotKeys/utils.js.map +1 -0
  165. package/cjs/react-utils/useIsElementVisibleInDom/index.js +14 -0
  166. package/cjs/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
  167. package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js +23 -0
  168. package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
  169. package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +34 -0
  170. package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
  171. package/cjs/react-utils/useKeyboardShortcutsPaneState.js +36 -0
  172. package/cjs/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
  173. package/cjs/react-utils/useLocalStorage.js +39 -0
  174. package/cjs/react-utils/useLocalStorage.js.map +1 -0
  175. package/cjs/react-utils/useMutationWithInvalidation.js +33 -0
  176. package/cjs/react-utils/useMutationWithInvalidation.js.map +1 -0
  177. package/cjs/react-utils/useOnClickOutside.js +32 -0
  178. package/cjs/react-utils/useOnClickOutside.js.map +1 -0
  179. package/cjs/react-utils/usePersistedQuery.js +59 -0
  180. package/cjs/react-utils/usePersistedQuery.js.map +1 -0
  181. package/cjs/react-utils/usePrevious.js +17 -0
  182. package/cjs/react-utils/usePrevious.js.map +1 -0
  183. package/cjs/react-utils/useQueryParams.js +15 -0
  184. package/cjs/react-utils/useQueryParams.js.map +1 -0
  185. package/cjs/react-utils/useRegisterNavigationCheckpoint.js +43 -0
  186. package/cjs/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
  187. package/cjs/react-utils/useStateWithDependency.js +23 -0
  188. package/cjs/react-utils/useStateWithDependency.js.map +1 -0
  189. package/cjs/react-utils/useTimer.js +51 -0
  190. package/cjs/react-utils/useTimer.js.map +1 -0
  191. package/cjs/react-utils/useUpdateEffect.js +21 -0
  192. package/cjs/react-utils/useUpdateEffect.js.map +1 -0
  193. package/cjs/react-utils/withImmutableActions.js +29 -0
  194. package/cjs/react-utils/withImmutableActions.js.map +1 -0
  195. package/cjs/react-utils/withT.js +14 -0
  196. package/cjs/react-utils/withT.js.map +1 -0
  197. package/cjs/react-utils/withTitle.js +44 -0
  198. package/cjs/react-utils/withTitle.js.map +1 -0
  199. package/cjs/utils/axios.js +17 -0
  200. package/cjs/utils/axios.js.map +1 -0
  201. package/cjs/utils/createSubscription.js +22 -0
  202. package/cjs/utils/createSubscription.js.map +1 -0
  203. package/cjs/utils/currencyFormat.js +50 -0
  204. package/cjs/utils/currencyFormat.js.map +1 -0
  205. package/cjs/utils/datetime.js +69 -0
  206. package/cjs/utils/datetime.js.map +1 -0
  207. package/cjs/utils/general.js +193 -0
  208. package/cjs/utils/general.js.map +1 -0
  209. package/cjs/utils/index.js +72 -0
  210. package/cjs/utils/index.js.map +1 -0
  211. package/cjs/utils/permissions.js +25 -0
  212. package/cjs/utils/permissions.js.map +1 -0
  213. package/configs/scripts/getPkgTranslations.js +1 -1
  214. package/configs/scripts/jsdoc-builder/constants.mjs +1 -1
  215. package/configs/scripts/jsdoc-builder/index.mjs +1 -1
  216. package/configs/webpack/rules.js +2 -1
  217. package/constants/index.js +13 -0
  218. package/constants/index.js.map +1 -0
  219. package/cypress-utils/commands.js +268 -0
  220. package/cypress-utils/commands.js.map +1 -0
  221. package/cypress-utils/constants/index.js +7 -0
  222. package/cypress-utils/constants/index.js.map +1 -0
  223. package/cypress-utils/constants/routes.js +33 -0
  224. package/cypress-utils/constants/routes.js.map +1 -0
  225. package/cypress-utils/constants/selectors/common.js +94 -0
  226. package/cypress-utils/constants/selectors/common.js.map +1 -0
  227. package/cypress-utils/constants/selectors/editor.js +22 -0
  228. package/cypress-utils/constants/selectors/editor.js.map +1 -0
  229. package/cypress-utils/constants/selectors/ipRestriction.js +12 -0
  230. package/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
  231. package/cypress-utils/constants/selectors/login.js +14 -0
  232. package/cypress-utils/constants/selectors/login.js.map +1 -0
  233. package/cypress-utils/constants/selectors/member.js +56 -0
  234. package/cypress-utils/constants/selectors/member.js.map +1 -0
  235. package/cypress-utils/constants/selectors/navigation.js +20 -0
  236. package/cypress-utils/constants/selectors/navigation.js.map +1 -0
  237. package/cypress-utils/constants/selectors/roles.js +17 -0
  238. package/cypress-utils/constants/selectors/roles.js.map +1 -0
  239. package/cypress-utils/constants/selectors/signUp.js +16 -0
  240. package/cypress-utils/constants/selectors/signUp.js.map +1 -0
  241. package/cypress-utils/constants/selectors/tags.js +23 -0
  242. package/cypress-utils/constants/selectors/tags.js.map +1 -0
  243. package/cypress-utils/constants/texts/common.js +33 -0
  244. package/cypress-utils/constants/texts/common.js.map +1 -0
  245. package/cypress-utils/constants/texts/member.js +59 -0
  246. package/cypress-utils/constants/texts/member.js.map +1 -0
  247. package/cypress-utils/constants/texts/navigation.js +16 -0
  248. package/cypress-utils/constants/texts/navigation.js.map +1 -0
  249. package/cypress-utils/constants/texts/roles.js +18 -0
  250. package/cypress-utils/constants/texts/roles.js.map +1 -0
  251. package/cypress-utils/constants/texts/signUp.js +7 -0
  252. package/cypress-utils/constants/texts/signUp.js.map +1 -0
  253. package/cypress-utils/constants/texts/tags.js +21 -0
  254. package/cypress-utils/constants/texts/tags.js.map +1 -0
  255. package/cypress-utils/fixtures/fake.js +171 -0
  256. package/cypress-utils/fixtures/fake.js.map +1 -0
  257. package/cypress-utils/index.js +21 -0
  258. package/cypress-utils/index.js.map +1 -0
  259. package/cypress-utils/utils/authentication.js +38 -0
  260. package/cypress-utils/utils/authentication.js.map +1 -0
  261. package/cypress-utils/utils/common.js +75 -0
  262. package/cypress-utils/utils/common.js.map +1 -0
  263. package/cypress-utils/utils/date.js +20 -0
  264. package/cypress-utils/utils/date.js.map +1 -0
  265. package/cypress-utils/utils/email.js +156 -0
  266. package/cypress-utils/utils/email.js.map +1 -0
  267. package/cypress-utils/utils/member.js +344 -0
  268. package/cypress-utils/utils/member.js.map +1 -0
  269. package/cypress-utils/utils/navigation.js +200 -0
  270. package/cypress-utils/utils/navigation.js.map +1 -0
  271. package/cypress-utils/utils/organization.js +102 -0
  272. package/cypress-utils/utils/organization.js.map +1 -0
  273. package/cypress-utils/utils/validation.js +10 -0
  274. package/cypress-utils/utils/validation.js.map +1 -0
  275. package/initializers/axios/index.js +192 -0
  276. package/initializers/axios/index.js.map +1 -0
  277. package/initializers/axios/paramsSerializer.js +18 -0
  278. package/initializers/axios/paramsSerializer.js.map +1 -0
  279. package/initializers/constants.js +13 -0
  280. package/initializers/constants.js.map +1 -0
  281. package/initializers/globalProps.js +8 -0
  282. package/initializers/globalProps.js.map +1 -0
  283. package/initializers/i18n.js +67 -0
  284. package/initializers/i18n.js.map +1 -0
  285. package/initializers/index.js +28 -0
  286. package/initializers/index.js.map +1 -0
  287. package/initializers/logger.js +10 -0
  288. package/initializers/logger.js.map +1 -0
  289. package/initializers/reactDevTools.js +19 -0
  290. package/initializers/reactDevTools.js.map +1 -0
  291. package/initializers/utils/customFormatters.js +43 -0
  292. package/initializers/utils/customFormatters.js.map +1 -0
  293. package/initializers/utils/customPostProcessors.js +14 -0
  294. package/initializers/utils/customPostProcessors.js.map +1 -0
  295. package/initializers/utils.js +29 -0
  296. package/initializers/utils.js.map +1 -0
  297. package/package.json +51 -158
  298. package/pure.d.ts +384 -0
  299. package/react-utils/BrowserPushNotifications/devices.js +18 -0
  300. package/react-utils/BrowserPushNotifications/devices.js.map +1 -0
  301. package/react-utils/BrowserPushNotifications/index.js +1 -0
  302. package/react-utils/BrowserPushNotifications/index.js.map +1 -0
  303. package/react-utils/BrowserPushNotifications/pushHelper.js +107 -0
  304. package/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
  305. package/react-utils/BrowserPushNotifications/registerServiceWorker.js +137 -0
  306. package/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
  307. package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +144 -0
  308. package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
  309. package/react-utils/HoneybadgerErrorBoundary/constants.js +1 -0
  310. package/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
  311. package/react-utils/HoneybadgerErrorBoundary/index.js +52 -0
  312. package/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
  313. package/react-utils/HoneybadgerErrorBoundary/utils.js +9 -0
  314. package/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
  315. package/react-utils/PrivateRoute.js +72 -0
  316. package/react-utils/PrivateRoute.js.map +1 -0
  317. package/react-utils/constants/constants.js +3 -0
  318. package/react-utils/constants/constants.js.map +1 -0
  319. package/react-utils/constants/index.js +3 -0
  320. package/react-utils/constants/index.js.map +1 -0
  321. package/react-utils/constants/query.js +4 -0
  322. package/react-utils/constants/query.js.map +1 -0
  323. package/react-utils/index.js +33 -0
  324. package/react-utils/index.js.map +1 -0
  325. package/react-utils/metaClick.js +8 -0
  326. package/react-utils/metaClick.js.map +1 -0
  327. package/react-utils/useDebounce.js +20 -0
  328. package/react-utils/useDebounce.js.map +1 -0
  329. package/react-utils/useDisplayErrorPage.js +15 -0
  330. package/react-utils/useDisplayErrorPage.js.map +1 -0
  331. package/react-utils/useFetchNeetoApps/apis/neeto_apps.js +9 -0
  332. package/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
  333. package/react-utils/useFetchNeetoApps/index.js +1 -0
  334. package/react-utils/useFetchNeetoApps/index.js.map +1 -0
  335. package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +19 -0
  336. package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
  337. package/react-utils/useFieldSubmit.js +26 -0
  338. package/react-utils/useFieldSubmit.js.map +1 -0
  339. package/react-utils/useFuncDebounce.js +20 -0
  340. package/react-utils/useFuncDebounce.js.map +1 -0
  341. package/react-utils/useHotKeys/constants.js +25 -0
  342. package/react-utils/useHotKeys/constants.js.map +1 -0
  343. package/react-utils/useHotKeys/index.js +1 -0
  344. package/react-utils/useHotKeys/index.js.map +1 -0
  345. package/react-utils/useHotKeys/useHotKeys.js +57 -0
  346. package/react-utils/useHotKeys/useHotKeys.js.map +1 -0
  347. package/react-utils/useHotKeys/utils.js +29 -0
  348. package/react-utils/useHotKeys/utils.js.map +1 -0
  349. package/react-utils/useIsElementVisibleInDom/index.js +1 -0
  350. package/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
  351. package/react-utils/useIsElementVisibleInDom/useForceUpdate.js +15 -0
  352. package/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
  353. package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +26 -0
  354. package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
  355. package/react-utils/useKeyboardShortcutsPaneState.js +29 -0
  356. package/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
  357. package/react-utils/useLocalStorage.js +31 -0
  358. package/react-utils/useLocalStorage.js.map +1 -0
  359. package/react-utils/useMutationWithInvalidation.js +25 -0
  360. package/react-utils/useMutationWithInvalidation.js.map +1 -0
  361. package/react-utils/useOnClickOutside.js +25 -0
  362. package/react-utils/useOnClickOutside.js.map +1 -0
  363. package/react-utils/usePersistedQuery.js +51 -0
  364. package/react-utils/usePersistedQuery.js.map +1 -0
  365. package/react-utils/usePrevious.js +10 -0
  366. package/react-utils/usePrevious.js.map +1 -0
  367. package/react-utils/useQueryParams.js +8 -0
  368. package/react-utils/useQueryParams.js.map +1 -0
  369. package/react-utils/useRegisterNavigationCheckpoint.js +35 -0
  370. package/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
  371. package/react-utils/useStateWithDependency.js +15 -0
  372. package/react-utils/useStateWithDependency.js.map +1 -0
  373. package/react-utils/useTimer.js +43 -0
  374. package/react-utils/useTimer.js.map +1 -0
  375. package/react-utils/useUpdateEffect.js +14 -0
  376. package/react-utils/useUpdateEffect.js.map +1 -0
  377. package/react-utils/withImmutableActions.js +22 -0
  378. package/react-utils/withImmutableActions.js.map +1 -0
  379. package/react-utils/withT.js +7 -0
  380. package/react-utils/withT.js.map +1 -0
  381. package/react-utils/withTitle.js +36 -0
  382. package/react-utils/withTitle.js.map +1 -0
  383. package/react-utils.d.ts +14 -2
  384. package/translations/en.json +100 -0
  385. package/utils/axios.js +10 -0
  386. package/utils/axios.js.map +1 -0
  387. package/utils/createSubscription.js +15 -0
  388. package/utils/createSubscription.js.map +1 -0
  389. package/utils/currencyFormat.js +42 -0
  390. package/utils/currencyFormat.js.map +1 -0
  391. package/utils/datetime.js +60 -0
  392. package/utils/datetime.js.map +1 -0
  393. package/utils/general.js +172 -0
  394. package/utils/general.js.map +1 -0
  395. package/utils/index.js +7 -0
  396. package/utils/index.js.map +1 -0
  397. package/utils/permissions.js +16 -0
  398. package/utils/permissions.js.map +1 -0
  399. package/utils.d.ts +18 -2
  400. package/README.md +0 -173
  401. package/constants.cjs.js.map +0 -1
  402. package/constants.js +0 -15
  403. package/constants.js.map +0 -1
  404. package/cypress-utils.cjs.js +0 -1819
  405. package/cypress-utils.cjs.js.map +0 -1
  406. package/cypress-utils.js +0 -1773
  407. package/cypress-utils.js.map +0 -1
  408. package/initializers.cjs.js +0 -2648
  409. package/initializers.cjs.js.map +0 -1
  410. package/initializers.js +0 -2634
  411. package/initializers.js.map +0 -1
  412. package/react-utils.cjs.js +0 -4915
  413. package/react-utils.cjs.js.map +0 -1
  414. package/react-utils.js +0 -4860
  415. package/react-utils.js.map +0 -1
  416. package/utils.cjs.js +0 -1280
  417. package/utils.cjs.js.map +0 -1
  418. package/utils.js +0 -1248
  419. package/utils.js.map +0 -1
  420. /package/{src → cjs}/translations/en.json +0 -0
@@ -0,0 +1,219 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ import * as babelParser from "@babel/parser";
5
+ import { curry, __, mergeLeft } from "ramda";
6
+ import remarkParse from "remark-parse";
7
+ import { unified } from "unified";
8
+
9
+ import {
10
+ ASTERISK,
11
+ ASTERISK_WITH_SPACES,
12
+ CODE_PATTERN,
13
+ DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT,
14
+ EXPORTED_TYPES_FOLDER_NAME,
15
+ HTML_EXCEPT_IMG_PATTERN,
16
+ IMG_PATTERN,
17
+ JSDOC_EXAMPLE_TAG,
18
+ JSDOC_END_EXAMPLE_TAG,
19
+ JSDOC_IMG_HEIGHT,
20
+ JSDOC_IMG_WIDTH,
21
+ LINE_BREAK,
22
+ PARAGRAPH_PATTERN,
23
+ SUBHEADING_PATTERN,
24
+ TYPES_FOLDER_NAME,
25
+ WHITESPACE_PARENTHESIS_REGEX,
26
+ } from "./constants.mjs";
27
+ import * as babelTypes from "@babel/types";
28
+ import _traverse from "@babel/traverse";
29
+ import _generate from "@babel/generator";
30
+
31
+ import { matches } from "@bigbinary/neeto-cist";
32
+
33
+ const traverse = _traverse.default;
34
+ const generate = _generate.default;
35
+
36
+ const removeWhiteSpaceAndParentheses = string =>
37
+ string.replace(WHITESPACE_PARENTHESIS_REGEX, "");
38
+
39
+ const addLeadingCommentForTextWithLineBreaks = ({
40
+ text,
41
+ addCommentForFirstItem = true,
42
+ addDoubleLineBreaks = true,
43
+ }) => {
44
+ if (!hasLineBreaks(text)) return addLeadingComment(text);
45
+ const joinString = addDoubleLineBreaks
46
+ ? DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT
47
+ : LINE_BREAK;
48
+
49
+ return text
50
+ .split(LINE_BREAK)
51
+ .map((item, idx) => {
52
+ if (!addCommentForFirstItem && idx === 0) return item;
53
+
54
+ return addLeadingComment(item);
55
+ })
56
+ .join(joinString);
57
+ };
58
+
59
+ const addLeadingComment = (text, trimWhiteSpace = false) =>
60
+ (trimWhiteSpace ? ASTERISK : ASTERISK_WITH_SPACES) + text;
61
+
62
+ const transformCode = node => {
63
+ let text = "";
64
+ text += addLeadingComment(JSDOC_EXAMPLE_TAG);
65
+ text += DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
66
+ text += addLeadingCommentForTextWithLineBreaks({
67
+ text: removeCommentTags(node.value),
68
+ addDoubleLineBreaks: false,
69
+ });
70
+ text += LINE_BREAK;
71
+ text += addLeadingComment(JSDOC_END_EXAMPLE_TAG);
72
+ text += LINE_BREAK;
73
+
74
+ return text;
75
+ };
76
+
77
+ const hasLineBreaks = text => text?.includes(LINE_BREAK);
78
+
79
+ const getParagraphChildrenText = node => {
80
+ const children = node.children;
81
+ if (children.length === 1) return children[0].value;
82
+
83
+ return children.map(child => child.value || child.children[0].value).join("");
84
+ };
85
+
86
+ const transformParagraph = node => {
87
+ let text = "";
88
+ text += ASTERISK_WITH_SPACES;
89
+ const childrenText = getParagraphChildrenText(node);
90
+
91
+ if (hasLineBreaks(childrenText)) {
92
+ text += addLeadingCommentForTextWithLineBreaks({
93
+ text: childrenText,
94
+ addCommentForFirstItem: false,
95
+ });
96
+ } else {
97
+ text += childrenText;
98
+ }
99
+ text += DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
100
+
101
+ return text;
102
+ };
103
+
104
+ const transformImg = node => {
105
+ const { src, alt } = parseImgTag(node.value);
106
+ let text = ASTERISK_WITH_SPACES;
107
+ text += `![${alt}](${src}|height=${JSDOC_IMG_HEIGHT}|width=${JSDOC_IMG_WIDTH})`;
108
+ text += DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
109
+
110
+ return text;
111
+ };
112
+
113
+ const transformNodesToText = nodes => {
114
+ let text = DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
115
+
116
+ nodes.forEach(node => {
117
+ if (matches(CODE_PATTERN, node)) {
118
+ text += transformCode(node);
119
+ } else if (matches(IMG_PATTERN, node)) {
120
+ text += transformImg(node);
121
+ } else if (matches(PARAGRAPH_PATTERN, node)) {
122
+ text += transformParagraph(node);
123
+ }
124
+ });
125
+
126
+ return addLeadingComment(text, true);
127
+ };
128
+
129
+ const parseImgTag = imgTagStr =>
130
+ imgTagStr.split(" ").reduce((acc, item) => {
131
+ let [attrName, attrValue] = item.split("=");
132
+ attrValue = attrValue?.replaceAll(">", "").replaceAll('"', "");
133
+
134
+ return mergeLeft({ [attrName]: attrValue }, acc);
135
+ }, {});
136
+
137
+ const removeCommentTags = str => str.replaceAll("/*", "").replaceAll("*/", "");
138
+
139
+ export const parseTypeFile = typeFileContent =>
140
+ babelParser.parse(typeFileContent, {
141
+ sourceType: "module",
142
+ plugins: [["typescript", { dts: true }]],
143
+ });
144
+
145
+ export const buildEntityTitleToEntityDescMap = (nodes, map) => {
146
+ nodes.forEach((node, idx) => {
147
+ if (!matches(SUBHEADING_PATTERN, node)) return;
148
+
149
+ const entityName = removeWhiteSpaceAndParentheses(node.children[0].value);
150
+ const entityRightSiblings = [];
151
+
152
+ for (let i = idx + 1; i < nodes.length; i++) {
153
+ const siblingNode = nodes[i];
154
+
155
+ if (matches(HTML_EXCEPT_IMG_PATTERN, siblingNode)) continue;
156
+
157
+ if (matches(SUBHEADING_PATTERN, siblingNode)) break;
158
+
159
+ entityRightSiblings.push(siblingNode);
160
+ }
161
+ const entityRightSiblingsText = transformNodesToText(entityRightSiblings);
162
+ map[entityName] = entityRightSiblingsText;
163
+ });
164
+ };
165
+
166
+ export const defaultTypeFileTraverser = ({
167
+ typeFileAST,
168
+ typeFileName,
169
+ entityTitleToDescMapOfAllFiles,
170
+ }) =>
171
+ traverse(typeFileAST, {
172
+ ExportNamedDeclaration: ({ node }) => {
173
+ const entityName = findEntityName(node);
174
+ const entityDesc = entityTitleToDescMapOfAllFiles[entityName];
175
+
176
+ if (!entityName || !entityDesc) {
177
+ return;
178
+ }
179
+
180
+ babelTypes.addComment(node, "leading", entityDesc);
181
+
182
+ const { code } = generate(typeFileAST, {});
183
+
184
+ fs.writeFileSync(path.resolve(typeFileName), code);
185
+ },
186
+ });
187
+
188
+ export const syncTypeFiles = exportedTypesFolderName => {
189
+ const sourceDir = path.resolve(TYPES_FOLDER_NAME);
190
+ const destDir = path.resolve(exportedTypesFolderName);
191
+
192
+ fs.cpSync(sourceDir, destDir, { recursive: true });
193
+ };
194
+
195
+ export const getFileNameList = dirPath => {
196
+ let files = [];
197
+ const items = fs.readdirSync(dirPath, { withFileTypes: true });
198
+
199
+ for (const item of items) {
200
+ if (item.isDirectory()) {
201
+ files = [...files, ...getFileNameList(path.join(dirPath, item.name))];
202
+ } else {
203
+ files.push(path.join(dirPath, item.name));
204
+ }
205
+ }
206
+
207
+ return files;
208
+ };
209
+
210
+ export const getFileContent = fileName =>
211
+ fs.readFileSync(path.resolve(fileName), "utf8").toString();
212
+
213
+ export const parseMarkdown = fileContent =>
214
+ unified().use(remarkParse).parse(fileContent);
215
+
216
+ export const findEntityName = node =>
217
+ node?.declaration?.declarations?.[0]?.id?.name || node?.declaration?.id?.name;
218
+
219
+ export const matchesAny = curry((list, obj) => list.some(matches(__, obj)));
@@ -0,0 +1,11 @@
1
+ const I18NEXT_PLURALS = ["zero", "one", "two", "few", "many", "other"];
2
+
3
+ /*
4
+ Matches the following:
5
+ - t(`some.${key}`), t(key), t(getKey()), t(key, { count: 1 })
6
+ - i18nKey={`some.${key}`}, i18nKey={key}, i18nKey={getKey()}
7
+ */
8
+ const INTERPOLATED_TRANSLATION_KEY_REGEX =
9
+ /(?<![a-z0-9])t\((?:\s*`.*`|\s*[a-z0-9\-_()]*)(?:,.*)?\s*\)|i18nKey={\s*(`.*`|[a-z0-9-_()]*)\s*}/gi;
10
+
11
+ module.exports = { I18NEXT_PLURALS, INTERPOLATED_TRANSLATION_KEY_REGEX };
@@ -0,0 +1,186 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-console */
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+
7
+ const { Command } = require("commander");
8
+ const { isEmpty, path: rPath } = require("ramda");
9
+
10
+ const {
11
+ I18NEXT_PLURALS,
12
+ INTERPOLATED_TRANSLATION_KEY_REGEX,
13
+ } = require("./constants");
14
+
15
+ const isI18nextPlural = key =>
16
+ I18NEXT_PLURALS.some(pluralKey => key.endsWith(`_${pluralKey}`));
17
+
18
+ const logUnusedKeysAndInterpolatedKeys = (
19
+ unusedTranslationKeys,
20
+ transFuncWithInterpolatedKeys
21
+ ) => {
22
+ console.log("\nUnused translation keys");
23
+ console.log("-----------------------");
24
+
25
+ if (isEmpty(unusedTranslationKeys)) {
26
+ console.log("No unused keys found.");
27
+ } else {
28
+ const unusedKeyCount = unusedTranslationKeys.length;
29
+ unusedTranslationKeys.forEach(key => console.log(key));
30
+ console.log(`\nDeleted ${unusedKeyCount} unused keys successfully.`);
31
+ }
32
+
33
+ console.log("\n\nTranslation functions with interpolated keys");
34
+ console.log("--------------------------------------------");
35
+
36
+ if (isEmpty(transFuncWithInterpolatedKeys)) {
37
+ console.log("No translation functions with interpolated keys found.\n");
38
+ } else {
39
+ transFuncWithInterpolatedKeys.forEach(hash => {
40
+ console.log(`Code: ${hash.code}`);
41
+ console.log(`File path: ${hash.filePath}\n`);
42
+ });
43
+
44
+ console.log(
45
+ "Please verify whether the keys required by the above translation functions have been removed or not. If removed, please restore them.\n"
46
+ );
47
+ }
48
+ };
49
+
50
+ const deleteUnusedKeysFromData = (translationData, unusedTranslationKeys) => {
51
+ unusedTranslationKeys.forEach(translationKey => {
52
+ const keys = translationKey.split(".");
53
+ const lastKey = keys.pop();
54
+
55
+ if (isEmpty(keys)) {
56
+ delete translationData[lastKey];
57
+ } else {
58
+ const currentData = rPath(keys, translationData);
59
+ if (currentData) delete currentData[lastKey];
60
+ }
61
+ });
62
+ };
63
+
64
+ const deleteEmptyValuesFromData = translationData => {
65
+ for (const [key, value] of Object.entries(translationData)) {
66
+ if (typeof value === "object") {
67
+ if (isEmpty(value)) delete translationData[key];
68
+ else deleteEmptyValuesFromData(value);
69
+ }
70
+ }
71
+ };
72
+
73
+ const deleteUsedKeysFromKeysList = (dirPath, keys) => {
74
+ fs.readdirSync(dirPath).forEach(fileName => {
75
+ const filePath = path.join(dirPath, fileName);
76
+ if (fs.statSync(filePath).isFile()) {
77
+ const extension = path.extname(filePath);
78
+ if (![".js", ".jsx", ".rb", ".jbuilder"].includes(extension)) return;
79
+
80
+ const data = fs.readFileSync(filePath, "utf8");
81
+ for (let i = 0; i < keys.length; i++) {
82
+ const key = keys[i];
83
+ const isKeyFound =
84
+ data.includes(key) ||
85
+ (isI18nextPlural(key) && data.includes(key.replace(/_[^_]*$/, "")));
86
+
87
+ if (isKeyFound) {
88
+ keys.splice(i, 1);
89
+ i--;
90
+ }
91
+ }
92
+ } else if (fs.statSync(filePath).isDirectory()) {
93
+ deleteUsedKeysFromKeysList(filePath, keys);
94
+ }
95
+ });
96
+ };
97
+
98
+ const getUnusedKeys = (searchPath, translationKeys) => {
99
+ const keys = [...translationKeys];
100
+ deleteUsedKeysFromKeysList(searchPath, keys);
101
+
102
+ return keys;
103
+ };
104
+
105
+ const findTransFuncWithInterpolatedKeys = dirPath => {
106
+ const transFuncWithInterpolatedKeys = [];
107
+
108
+ fs.readdirSync(dirPath).forEach(fileName => {
109
+ const filePath = path.join(dirPath, fileName);
110
+ if (fs.statSync(filePath).isFile()) {
111
+ const extension = path.extname(filePath);
112
+ if (![".js", ".jsx"].includes(extension)) return;
113
+
114
+ const data = fs.readFileSync(filePath, "utf8");
115
+ const relativePath = path.relative(process.cwd(), filePath);
116
+ const matchedCodes = data.match(INTERPOLATED_TRANSLATION_KEY_REGEX);
117
+
118
+ matchedCodes?.forEach(code => {
119
+ transFuncWithInterpolatedKeys.push({
120
+ code,
121
+ filePath: relativePath,
122
+ });
123
+ });
124
+ } else if (fs.statSync(filePath).isDirectory()) {
125
+ transFuncWithInterpolatedKeys.push(
126
+ ...findTransFuncWithInterpolatedKeys(filePath)
127
+ );
128
+ }
129
+ });
130
+
131
+ return transFuncWithInterpolatedKeys;
132
+ };
133
+
134
+ const generateTranslationKeys = (data, parentKey = null) => {
135
+ const translationKeys = [];
136
+
137
+ for (const [key, value] of Object.entries(data)) {
138
+ const currentKey = parentKey ? `${parentKey}.${key}` : key;
139
+
140
+ if (typeof value === "object") {
141
+ translationKeys.push(...generateTranslationKeys(value, currentKey));
142
+ } else {
143
+ translationKeys.push(currentKey);
144
+ }
145
+ }
146
+
147
+ return translationKeys;
148
+ };
149
+
150
+ const getCommandLineOptions = () => {
151
+ const program = new Command();
152
+ program
153
+ .option("--translation-path <path>", "Path to translation file")
154
+ .option("--search-path <path>", "Path to search for unused keys")
155
+ .parse(process.argv);
156
+
157
+ return program.opts();
158
+ };
159
+
160
+ // Script execution starts here
161
+ const {
162
+ translationPath = "app/javascript/src/translations/en.json",
163
+ searchPath = "app",
164
+ } = getCommandLineOptions();
165
+
166
+ console.log("\nPlease wait, this may take a few seconds...");
167
+
168
+ const translationData = JSON.parse(fs.readFileSync(translationPath, "utf8"));
169
+ const translationKeys = generateTranslationKeys(translationData);
170
+ const unusedTranslationKeys = getUnusedKeys(searchPath, translationKeys);
171
+
172
+ deleteUnusedKeysFromData(translationData, unusedTranslationKeys);
173
+ deleteEmptyValuesFromData(translationData);
174
+
175
+ fs.writeFileSync(
176
+ translationPath,
177
+ `${JSON.stringify(translationData, null, 2)}\n`
178
+ );
179
+
180
+ const transFuncWithInterpolatedKeys =
181
+ findTransFuncWithInterpolatedKeys(searchPath);
182
+
183
+ logUnusedKeysAndInterpolatedKeys(
184
+ unusedTranslationKeys,
185
+ transFuncWithInterpolatedKeys
186
+ );
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ important: true,
3
+ purge: {
4
+ enabled: process.env.NODE_ENV === "production",
5
+ content: [
6
+ "./app/javascript/**/*.{js,jsx}",
7
+ "./app/views/**/*.html.erb",
8
+ "./app/views/**/*.slim",
9
+ "./node_modules/@bigbinary/**/*.js",
10
+ ],
11
+ defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
12
+ },
13
+ };
@@ -0,0 +1,54 @@
1
+ /*
2
+ Customize default webpack rules/loaders configuration.
3
+ A custom helpers till shakapacker introduces the feature.
4
+ Track the following the issues to get the status of feature development in shakapacker:
5
+ https://github.com/shakacode/shakapacker/issues/80
6
+ https://github.com/shakacode/shakapacker/issues/87
7
+ Usage:
8
+ const customizeWebpackDefaultRules = require("./helpers/customize-default-rules");
9
+ const defaultRules = {
10
+ "asset/resource": {
11
+ test: /\.(bmp|gif|jpe?g|png|tiff|ico|avif|webp|eot|otf|ttf|woff|woff2)$/
12
+ },
13
+ "asset/source": {
14
+ exclude: /\.(js|mjs|jsx|ts|tsx|js)$/,
15
+ },
16
+ };
17
+ const customWebpackConfig = customizeWebpackDefaultRules(webpackConfig, defaultRules);
18
+ NOTE:
19
+ - Check if the option to output default configuration is introduced or not before upgrading further.
20
+ - Update the defaultRuleType constant whenever shakapacker introduces a new default rule/loader.
21
+ */
22
+ const { findBy, findIndexBy } = require("@bigbinary/neeto-cist");
23
+
24
+ const modifyDefaultRulesConfig = (webpackConfig, rules = {}) => {
25
+ const defaultRuleType = ["asset/resource", "asset/source"];
26
+
27
+ Object.keys(rules).forEach(ruleName => {
28
+ if (defaultRuleType.includes(ruleName)) {
29
+ const rule = findBy(
30
+ { type: "asset/resource" },
31
+ webpackConfig.module.rules
32
+ );
33
+
34
+ const rulePosition = findIndexBy(
35
+ { type: ruleName },
36
+ webpackConfig.module.rules
37
+ );
38
+
39
+ Object.keys(rules[ruleName]).forEach(attribute => {
40
+ if (rule[attribute] !== undefined) {
41
+ rule[attribute] = rules[ruleName][attribute];
42
+ }
43
+ });
44
+
45
+ webpackConfig.module.rules[rulePosition] = rule;
46
+ } else {
47
+ throw new Error("Invalid default rule type");
48
+ }
49
+ });
50
+
51
+ return webpackConfig;
52
+ };
53
+
54
+ module.exports = modifyDefaultRulesConfig;
@@ -0,0 +1,58 @@
1
+ const process = require("process");
2
+
3
+ const Dotenv = require("dotenv-webpack");
4
+ const { webpackConfig, merge } = require("shakapacker");
5
+ const webpack = require("webpack");
6
+
7
+ const customizeWebpackDefaultRules = require("./helpers/customize-default-rules");
8
+ const resolve = require("./resolve");
9
+ const rules = require("./rules");
10
+
11
+ const dotEnvFileSuffix =
12
+ process.env.NODE_ENV === "production" ? "" : `.${process.env.NODE_ENV}`;
13
+
14
+ let devtool = "hidden-source-map",
15
+ mode = "production";
16
+ if (process.env.RAILS_ENV === "test") {
17
+ devtool = false;
18
+ mode = "none";
19
+ } else if (process.env.RAILS_ENV === "development") {
20
+ devtool = "eval-cheap-module-source-map";
21
+ mode = "development";
22
+ }
23
+
24
+ const commonOptions = {
25
+ mode,
26
+ infrastructureLogging: { level: "warn" },
27
+ devtool,
28
+ resolve,
29
+ optimization: {
30
+ splitChunks: {
31
+ maxSize: 15000000, // 15MB
32
+ },
33
+ },
34
+ module: { rules },
35
+ plugins: [
36
+ new webpack.ProvidePlugin({ process: "process/browser" }),
37
+ new Dotenv({
38
+ path: `./.env${dotEnvFileSuffix}`,
39
+ systemvars: true,
40
+ silent: true,
41
+ }),
42
+ ],
43
+ ignoreWarnings: [/Failed to parse source map/],
44
+ };
45
+
46
+ // This rule is causing issues to react-svg-loader
47
+ const defaultRules = {
48
+ "asset/resource": {
49
+ test: /\.(bmp|gif|jpe?g|png|tiff|ico|avif|webp|eot|otf|ttf|woff|woff2)$/,
50
+ },
51
+ };
52
+
53
+ const customWebpackConfig = customizeWebpackDefaultRules(
54
+ webpackConfig,
55
+ defaultRules
56
+ );
57
+
58
+ module.exports = merge(customWebpackConfig, commonOptions);
@@ -0,0 +1,53 @@
1
+ const path = require("path");
2
+
3
+ const absolutePath = basePath =>
4
+ path.resolve(__dirname, "../../../../../", `app/javascript/${basePath}`);
5
+
6
+ module.exports = {
7
+ alias: {
8
+ apis: absolutePath("src/apis"),
9
+ assets: absolutePath("src/assets"),
10
+ components: absolutePath("src/components"),
11
+ hooks: absolutePath("src/hooks"),
12
+ reducers: absolutePath("src/reducers"),
13
+ routes: absolutePath("src/routes"),
14
+ stores: absolutePath("src/stores"),
15
+ translations: absolutePath("src/translations"),
16
+ utils: absolutePath("src/utils"),
17
+ src: absolutePath("src"),
18
+ neetoui: "@bigbinary/neetoui",
19
+ neetocommons: "@bigbinary/neeto-commons-frontend",
20
+ neetoicons: "@bigbinary/neeto-icons",
21
+ neetoteam: "@bigbinary/neeto-team-members-frontend",
22
+ neetoeditor: "@bigbinary/neeto-editor",
23
+ neetofilters: "@bigbinary/neeto-filters-frontend",
24
+ neetomolecules: "@bigbinary/neeto-molecules",
25
+ neetopayments: "@bigbinary/neeto-payments-frontend",
26
+ neetocist: "@bigbinary/neeto-cist",
27
+ images: path.resolve(__dirname, "../../../../../", "app/assets/images"),
28
+ },
29
+ extensions: [
30
+ ".ts",
31
+ ".mjs",
32
+ ".js",
33
+ ".sass",
34
+ ".scss",
35
+ ".css",
36
+ ".module.sass",
37
+ ".module.scss",
38
+ ".module.css",
39
+ ".png",
40
+ ".svg",
41
+ ".gif",
42
+ ".jpeg",
43
+ ".jpg",
44
+ ],
45
+ fallback: {
46
+ util: require.resolve("util/"),
47
+ url: require.resolve("url/"),
48
+ fs: false,
49
+ buffer: require.resolve("buffer/"),
50
+ crypto: require.resolve("crypto-browserify"),
51
+ stream: require.resolve("stream-browserify"),
52
+ },
53
+ };
@@ -0,0 +1,34 @@
1
+ module.exports = [
2
+ {
3
+ test: /\.svg$/i,
4
+ use: [
5
+ {
6
+ loader: "@svgr/webpack",
7
+ options: { svgoConfig: { plugins: ["preset-default"] } },
8
+ },
9
+ ],
10
+ },
11
+ {
12
+ test: /\.ts$/,
13
+ exclude: /node_modules/,
14
+ use: {
15
+ loader: "babel-loader",
16
+ options: {
17
+ presets: ["@babel/preset-env", "@babel/preset-typescript"],
18
+ },
19
+ },
20
+ },
21
+ {
22
+ test: /\.js$/,
23
+ include:
24
+ /node_modules\/@bigbinary\/neeto-commons-frontend\/initializers\/i18n/,
25
+ use: { loader: "babel-loader", options: { plugins: ["preval"] } },
26
+ },
27
+ {
28
+ test: /\.m?js$/,
29
+ resolve: {
30
+ fullySpecified: false, // allows webpack to ignore some package rules as the Strict EcmaScript Module mode.
31
+ },
32
+ },
33
+ { test: /\.js$/, enforce: "pre", use: ["source-map-loader"] },
34
+ ];
@@ -1,24 +1,25 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
4
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SINGULAR = exports.PLURAL = exports.DEFAULT_STALE_TIME = exports.DEFAULT_PAGE_SIZE = exports.DEFAULT_PAGE_INDEX = exports.BASE_API_V1_URL = void 0;
5
7
  var BASE_API_V1_URL = "/api/v1";
8
+ exports.BASE_API_V1_URL = BASE_API_V1_URL;
6
9
  var DEFAULT_PAGE_SIZE = 30;
10
+ exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
7
11
  var DEFAULT_PAGE_INDEX = 1;
12
+ exports.DEFAULT_PAGE_INDEX = DEFAULT_PAGE_INDEX;
8
13
  var DEFAULT_STALE_TIME = 3600000; // 1 hour
9
14
 
10
15
  // Constants for translation
16
+ exports.DEFAULT_STALE_TIME = DEFAULT_STALE_TIME;
11
17
  var SINGULAR = {
12
18
  count: 1
13
19
  };
20
+ exports.SINGULAR = SINGULAR;
14
21
  var PLURAL = {
15
22
  count: 2
16
23
  };
17
-
18
- exports.BASE_API_V1_URL = BASE_API_V1_URL;
19
- exports.DEFAULT_PAGE_INDEX = DEFAULT_PAGE_INDEX;
20
- exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
21
- exports.DEFAULT_STALE_TIME = DEFAULT_STALE_TIME;
22
24
  exports.PLURAL = PLURAL;
23
- exports.SINGULAR = SINGULAR;
24
- //# sourceMappingURL=constants.cjs.js.map
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["BASE_API_V1_URL","exports","DEFAULT_PAGE_SIZE","DEFAULT_PAGE_INDEX","DEFAULT_STALE_TIME","SINGULAR","count","PLURAL"],"sources":["../../../src/constants/index.js"],"sourcesContent":["export const BASE_API_V1_URL = \"/api/v1\";\n\nexport const DEFAULT_PAGE_SIZE = 30;\nexport const DEFAULT_PAGE_INDEX = 1;\nexport const DEFAULT_STALE_TIME = 3_600_000; // 1 hour\n\n// Constants for translation\nexport const SINGULAR = { count: 1 };\nexport const PLURAL = { count: 2 };\n"],"mappings":";;;;;;AAAO,IAAMA,eAAe,GAAG,SAAS;AAACC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAElC,IAAME,iBAAiB,GAAG,EAAE;AAACD,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAC7B,IAAMC,kBAAkB,GAAG,CAAC;AAACF,OAAA,CAAAE,kBAAA,GAAAA,kBAAA;AAC7B,IAAMC,kBAAkB,GAAG,OAAS,CAAC,CAAC;;AAE7C;AAAAH,OAAA,CAAAG,kBAAA,GAAAA,kBAAA;AACO,IAAMC,QAAQ,GAAG;EAAEC,KAAK,EAAE;AAAE,CAAC;AAACL,OAAA,CAAAI,QAAA,GAAAA,QAAA;AAC9B,IAAME,MAAM,GAAG;EAAED,KAAK,EAAE;AAAE,CAAC;AAACL,OAAA,CAAAM,MAAA,GAAAA,MAAA"}