@selfcommunity/react-core 0.1.2-alpha.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 (285) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +13 -0
  3. package/lib/cjs/components/provider/SCAlertMessagesProvider/index.js +67 -0
  4. package/lib/cjs/components/provider/SCContextProvider/index.js +117 -0
  5. package/lib/cjs/components/provider/SCLocaleProvider/index.js +158 -0
  6. package/lib/cjs/components/provider/SCNotificationProvider/index.js +73 -0
  7. package/lib/cjs/components/provider/SCPreferencesProvider/index.js +93 -0
  8. package/lib/cjs/components/provider/SCRoutingProvider/index.js +146 -0
  9. package/lib/cjs/components/provider/SCThemeProvider/index.js +123 -0
  10. package/lib/cjs/components/provider/SCUserProvider/index.js +310 -0
  11. package/lib/cjs/components/router/index.js +91 -0
  12. package/lib/cjs/constants/Actions.js +6 -0
  13. package/lib/cjs/constants/ContextProviders.js +29 -0
  14. package/lib/cjs/constants/Device.js +11 -0
  15. package/lib/cjs/constants/Errors.js +10 -0
  16. package/lib/cjs/constants/Features.js +84 -0
  17. package/lib/cjs/constants/Locale.js +19 -0
  18. package/lib/cjs/constants/Notification.js +67 -0
  19. package/lib/cjs/constants/Notifications.js +27 -0
  20. package/lib/cjs/constants/Preferences.js +344 -0
  21. package/lib/cjs/constants/Routes.js +68 -0
  22. package/lib/cjs/constants/Session.js +22 -0
  23. package/lib/cjs/constants/Theme.js +6 -0
  24. package/lib/cjs/constants/WebSocket.js +10 -0
  25. package/lib/cjs/hooks/useSCAuth.js +340 -0
  26. package/lib/cjs/hooks/useSCCachingManager.js +58 -0
  27. package/lib/cjs/hooks/useSCConnectionsManager.js +285 -0
  28. package/lib/cjs/hooks/useSCFetchCategories.js +71 -0
  29. package/lib/cjs/hooks/useSCFetchCategory.js +68 -0
  30. package/lib/cjs/hooks/useSCFetchCommentObject.js +68 -0
  31. package/lib/cjs/hooks/useSCFetchCommentObjects.js +296 -0
  32. package/lib/cjs/hooks/useSCFetchCustomAdv.js +84 -0
  33. package/lib/cjs/hooks/useSCFetchFeedObject.js +79 -0
  34. package/lib/cjs/hooks/useSCFetchIncubator.js +68 -0
  35. package/lib/cjs/hooks/useSCFetchTag.js +68 -0
  36. package/lib/cjs/hooks/useSCFetchUser.js +68 -0
  37. package/lib/cjs/hooks/useSCFollowedCategoriesManager.js +162 -0
  38. package/lib/cjs/hooks/useSCFollowersManager.js +232 -0
  39. package/lib/cjs/hooks/useSCMediaClick.js +27 -0
  40. package/lib/cjs/hooks/useSCSubscribedIncubatorsManager.js +165 -0
  41. package/lib/cjs/hooks/useSCWebPushMessaging.js +286 -0
  42. package/lib/cjs/hooks/useSCWebSocket.js +120 -0
  43. package/lib/cjs/index.js +169 -0
  44. package/lib/cjs/scss/styles.scss +1 -0
  45. package/lib/cjs/themes/theme.js +165 -0
  46. package/lib/cjs/types/context.js +3 -0
  47. package/lib/cjs/types/index.js +22 -0
  48. package/lib/cjs/utils/errors.js +196 -0
  49. package/lib/cjs/utils/locale.js +56 -0
  50. package/lib/cjs/utils/logger.js +32 -0
  51. package/lib/cjs/utils/object.js +44 -0
  52. package/lib/cjs/utils/session.js +17 -0
  53. package/lib/cjs/utils/string.js +57 -0
  54. package/lib/cjs/utils/url.js +70 -0
  55. package/lib/cjs/utils/user.js +83 -0
  56. package/lib/cjs/utils/validator.js +771 -0
  57. package/lib/cjs/utils/webPushMessaging.js +110 -0
  58. package/lib/cjs/utils/websocket.js +307 -0
  59. package/lib/esm/api-services/src/client/index.d.ts +115 -0
  60. package/lib/esm/api-services/src/client/index.d.ts.map +1 -0
  61. package/lib/esm/api-services/src/constants/Endpoints.d.ts +10 -0
  62. package/lib/esm/api-services/src/constants/Endpoints.d.ts.map +1 -0
  63. package/lib/esm/api-services/src/index.d.ts +24 -0
  64. package/lib/esm/api-services/src/index.d.ts.map +1 -0
  65. package/lib/esm/api-services/src/services/category/index.d.ts +13 -0
  66. package/lib/esm/api-services/src/services/category/index.d.ts.map +1 -0
  67. package/lib/esm/api-services/src/services/feature/index.d.ts +10 -0
  68. package/lib/esm/api-services/src/services/feature/index.d.ts.map +1 -0
  69. package/lib/esm/api-services/src/services/preference/index.d.ts +16 -0
  70. package/lib/esm/api-services/src/services/preference/index.d.ts.map +1 -0
  71. package/lib/esm/api-services/src/services/user/index.d.ts +16 -0
  72. package/lib/esm/api-services/src/services/user/index.d.ts.map +1 -0
  73. package/lib/esm/api-services/src/utils/http.d.ts +6 -0
  74. package/lib/esm/api-services/src/utils/http.d.ts.map +1 -0
  75. package/lib/esm/api-services/src/utils/token.d.ts +16 -0
  76. package/lib/esm/api-services/src/utils/token.d.ts.map +1 -0
  77. package/lib/esm/components/provider/SCAlertMessagesProvider/index.js +67 -0
  78. package/lib/esm/components/provider/SCContextProvider/index.js +117 -0
  79. package/lib/esm/components/provider/SCLocaleProvider/index.js +158 -0
  80. package/lib/esm/components/provider/SCNotificationProvider/index.js +73 -0
  81. package/lib/esm/components/provider/SCPreferencesProvider/index.js +93 -0
  82. package/lib/esm/components/provider/SCRoutingProvider/index.js +146 -0
  83. package/lib/esm/components/provider/SCThemeProvider/index.js +123 -0
  84. package/lib/esm/components/provider/SCUserProvider/index.js +310 -0
  85. package/lib/esm/components/router/index.js +91 -0
  86. package/lib/esm/constants/Actions.js +6 -0
  87. package/lib/esm/constants/ContextProviders.js +29 -0
  88. package/lib/esm/constants/Device.js +11 -0
  89. package/lib/esm/constants/Errors.js +10 -0
  90. package/lib/esm/constants/Features.js +84 -0
  91. package/lib/esm/constants/Locale.js +19 -0
  92. package/lib/esm/constants/Notification.js +67 -0
  93. package/lib/esm/constants/Notifications.js +27 -0
  94. package/lib/esm/constants/Preferences.js +344 -0
  95. package/lib/esm/constants/Routes.js +68 -0
  96. package/lib/esm/constants/Session.js +22 -0
  97. package/lib/esm/constants/Theme.js +6 -0
  98. package/lib/esm/constants/WebSocket.js +10 -0
  99. package/lib/esm/hooks/useSCAuth.js +340 -0
  100. package/lib/esm/hooks/useSCCachingManager.js +58 -0
  101. package/lib/esm/hooks/useSCConnectionsManager.js +285 -0
  102. package/lib/esm/hooks/useSCFetchCategories.js +71 -0
  103. package/lib/esm/hooks/useSCFetchCategory.js +68 -0
  104. package/lib/esm/hooks/useSCFetchCommentObject.js +68 -0
  105. package/lib/esm/hooks/useSCFetchCommentObjects.js +296 -0
  106. package/lib/esm/hooks/useSCFetchCustomAdv.js +84 -0
  107. package/lib/esm/hooks/useSCFetchFeedObject.js +79 -0
  108. package/lib/esm/hooks/useSCFetchIncubator.js +68 -0
  109. package/lib/esm/hooks/useSCFetchTag.js +68 -0
  110. package/lib/esm/hooks/useSCFetchUser.js +68 -0
  111. package/lib/esm/hooks/useSCFollowedCategoriesManager.js +162 -0
  112. package/lib/esm/hooks/useSCFollowersManager.js +232 -0
  113. package/lib/esm/hooks/useSCMediaClick.js +27 -0
  114. package/lib/esm/hooks/useSCSubscribedIncubatorsManager.js +165 -0
  115. package/lib/esm/hooks/useSCWebPushMessaging.js +286 -0
  116. package/lib/esm/hooks/useSCWebSocket.js +120 -0
  117. package/lib/esm/index.js +169 -0
  118. package/lib/esm/react-core/src/components/provider/SCAlertMessagesProvider/index.d.ts +37 -0
  119. package/lib/esm/react-core/src/components/provider/SCAlertMessagesProvider/index.d.ts.map +1 -0
  120. package/lib/esm/react-core/src/components/provider/SCContextProvider/index.d.ts +35 -0
  121. package/lib/esm/react-core/src/components/provider/SCContextProvider/index.d.ts.map +1 -0
  122. package/lib/esm/react-core/src/components/provider/SCLocaleProvider/index.d.ts +42 -0
  123. package/lib/esm/react-core/src/components/provider/SCLocaleProvider/index.d.ts.map +1 -0
  124. package/lib/esm/react-core/src/components/provider/SCNotificationProvider/index.d.ts +37 -0
  125. package/lib/esm/react-core/src/components/provider/SCNotificationProvider/index.d.ts.map +1 -0
  126. package/lib/esm/react-core/src/components/provider/SCPreferencesProvider/index.d.ts +38 -0
  127. package/lib/esm/react-core/src/components/provider/SCPreferencesProvider/index.d.ts.map +1 -0
  128. package/lib/esm/react-core/src/components/provider/SCRoutingProvider/index.d.ts +39 -0
  129. package/lib/esm/react-core/src/components/provider/SCRoutingProvider/index.d.ts.map +1 -0
  130. package/lib/esm/react-core/src/components/provider/SCThemeProvider/index.d.ts +49 -0
  131. package/lib/esm/react-core/src/components/provider/SCThemeProvider/index.d.ts.map +1 -0
  132. package/lib/esm/react-core/src/components/provider/SCUserProvider/index.d.ts +38 -0
  133. package/lib/esm/react-core/src/components/provider/SCUserProvider/index.d.ts.map +1 -0
  134. package/lib/esm/react-core/src/components/router/index.d.ts +34 -0
  135. package/lib/esm/react-core/src/components/router/index.d.ts.map +1 -0
  136. package/lib/esm/react-core/src/constants/Actions.d.ts +2 -0
  137. package/lib/esm/react-core/src/constants/Actions.d.ts.map +1 -0
  138. package/lib/esm/react-core/src/constants/ContextProviders.d.ts +6 -0
  139. package/lib/esm/react-core/src/constants/ContextProviders.d.ts.map +1 -0
  140. package/lib/esm/react-core/src/constants/Device.d.ts +6 -0
  141. package/lib/esm/react-core/src/constants/Device.d.ts.map +1 -0
  142. package/lib/esm/react-core/src/constants/Errors.d.ts +5 -0
  143. package/lib/esm/react-core/src/constants/Errors.d.ts.map +1 -0
  144. package/lib/esm/react-core/src/constants/Features.d.ts +41 -0
  145. package/lib/esm/react-core/src/constants/Features.d.ts.map +1 -0
  146. package/lib/esm/react-core/src/constants/Locale.d.ts +8 -0
  147. package/lib/esm/react-core/src/constants/Locale.d.ts.map +1 -0
  148. package/lib/esm/react-core/src/constants/Notification.d.ts +55 -0
  149. package/lib/esm/react-core/src/constants/Notification.d.ts.map +1 -0
  150. package/lib/esm/react-core/src/constants/Notifications.d.ts +11 -0
  151. package/lib/esm/react-core/src/constants/Notifications.d.ts.map +1 -0
  152. package/lib/esm/react-core/src/constants/Routes.d.ts +29 -0
  153. package/lib/esm/react-core/src/constants/Routes.d.ts.map +1 -0
  154. package/lib/esm/react-core/src/constants/Session.d.ts +10 -0
  155. package/lib/esm/react-core/src/constants/Session.d.ts.map +1 -0
  156. package/lib/esm/react-core/src/constants/Theme.d.ts +2 -0
  157. package/lib/esm/react-core/src/constants/Theme.d.ts.map +1 -0
  158. package/lib/esm/react-core/src/hooks/useSCAuth.d.ts +56 -0
  159. package/lib/esm/react-core/src/hooks/useSCAuth.d.ts.map +1 -0
  160. package/lib/esm/react-core/src/hooks/useSCCachingManager.d.ts +19 -0
  161. package/lib/esm/react-core/src/hooks/useSCCachingManager.d.ts.map +1 -0
  162. package/lib/esm/react-core/src/hooks/useSCConnectionsManager.d.ts +40 -0
  163. package/lib/esm/react-core/src/hooks/useSCConnectionsManager.d.ts.map +1 -0
  164. package/lib/esm/react-core/src/hooks/useSCFetchCategories.d.ts +17 -0
  165. package/lib/esm/react-core/src/hooks/useSCFetchCategories.d.ts.map +1 -0
  166. package/lib/esm/react-core/src/hooks/useSCFetchCategory.d.ts +19 -0
  167. package/lib/esm/react-core/src/hooks/useSCFetchCategory.d.ts.map +1 -0
  168. package/lib/esm/react-core/src/hooks/useSCFetchCommentObject.d.ts +19 -0
  169. package/lib/esm/react-core/src/hooks/useSCFetchCommentObject.d.ts.map +1 -0
  170. package/lib/esm/react-core/src/hooks/useSCFetchCommentObjects.d.ts +54 -0
  171. package/lib/esm/react-core/src/hooks/useSCFetchCommentObjects.d.ts.map +1 -0
  172. package/lib/esm/react-core/src/hooks/useSCFetchCustomAdv.d.ts +19 -0
  173. package/lib/esm/react-core/src/hooks/useSCFetchCustomAdv.d.ts.map +1 -0
  174. package/lib/esm/react-core/src/hooks/useSCFetchFeedObject.d.ts +21 -0
  175. package/lib/esm/react-core/src/hooks/useSCFetchFeedObject.d.ts.map +1 -0
  176. package/lib/esm/react-core/src/hooks/useSCFetchIncubator.d.ts +19 -0
  177. package/lib/esm/react-core/src/hooks/useSCFetchIncubator.d.ts.map +1 -0
  178. package/lib/esm/react-core/src/hooks/useSCFetchTag.d.ts +19 -0
  179. package/lib/esm/react-core/src/hooks/useSCFetchTag.d.ts.map +1 -0
  180. package/lib/esm/react-core/src/hooks/useSCFetchUser.d.ts +19 -0
  181. package/lib/esm/react-core/src/hooks/useSCFetchUser.d.ts.map +1 -0
  182. package/lib/esm/react-core/src/hooks/useSCFollowedCategoriesManager.d.ts +37 -0
  183. package/lib/esm/react-core/src/hooks/useSCFollowedCategoriesManager.d.ts.map +1 -0
  184. package/lib/esm/react-core/src/hooks/useSCFollowersManager.d.ts +37 -0
  185. package/lib/esm/react-core/src/hooks/useSCFollowersManager.d.ts.map +1 -0
  186. package/lib/esm/react-core/src/hooks/useSCMediaClick.d.ts +4 -0
  187. package/lib/esm/react-core/src/hooks/useSCMediaClick.d.ts.map +1 -0
  188. package/lib/esm/react-core/src/hooks/useSCSubscribedIncubatorsManager.d.ts +27 -0
  189. package/lib/esm/react-core/src/hooks/useSCSubscribedIncubatorsManager.d.ts.map +1 -0
  190. package/lib/esm/react-core/src/hooks/useSCWebPushMessaging.d.ts +9 -0
  191. package/lib/esm/react-core/src/hooks/useSCWebPushMessaging.d.ts.map +1 -0
  192. package/lib/esm/react-core/src/hooks/useSCWebSocket.d.ts +12 -0
  193. package/lib/esm/react-core/src/hooks/useSCWebSocket.d.ts.map +1 -0
  194. package/lib/esm/react-core/src/index.d.ts +77 -0
  195. package/lib/esm/react-core/src/index.d.ts.map +1 -0
  196. package/lib/esm/react-core/src/types/context.d.ts +428 -0
  197. package/lib/esm/react-core/src/types/context.d.ts.map +1 -0
  198. package/lib/esm/react-core/src/types/index.d.ts +3 -0
  199. package/lib/esm/react-core/src/types/index.d.ts.map +1 -0
  200. package/lib/esm/react-core/src/utils/errors.d.ts +98 -0
  201. package/lib/esm/react-core/src/utils/errors.d.ts.map +1 -0
  202. package/lib/esm/react-core/src/utils/locale.d.ts +10 -0
  203. package/lib/esm/react-core/src/utils/locale.d.ts.map +1 -0
  204. package/lib/esm/react-core/src/utils/logger.d.ts +11 -0
  205. package/lib/esm/react-core/src/utils/logger.d.ts.map +1 -0
  206. package/lib/esm/react-core/src/utils/object.d.ts +13 -0
  207. package/lib/esm/react-core/src/utils/object.d.ts.map +1 -0
  208. package/lib/esm/react-core/src/utils/session.d.ts +6 -0
  209. package/lib/esm/react-core/src/utils/session.d.ts.map +1 -0
  210. package/lib/esm/react-core/src/utils/string.d.ts +21 -0
  211. package/lib/esm/react-core/src/utils/string.d.ts.map +1 -0
  212. package/lib/esm/react-core/src/utils/url.d.ts +22 -0
  213. package/lib/esm/react-core/src/utils/url.d.ts.map +1 -0
  214. package/lib/esm/react-core/src/utils/user.d.ts +41 -0
  215. package/lib/esm/react-core/src/utils/user.d.ts.map +1 -0
  216. package/lib/esm/react-core/src/utils/validator.d.ts +239 -0
  217. package/lib/esm/react-core/src/utils/validator.d.ts.map +1 -0
  218. package/lib/esm/react-core/src/utils/webPushMessaging.d.ts +14 -0
  219. package/lib/esm/react-core/src/utils/webPushMessaging.d.ts.map +1 -0
  220. package/lib/esm/react-core/src/utils/websocket.d.ts +177 -0
  221. package/lib/esm/react-core/src/utils/websocket.d.ts.map +1 -0
  222. package/lib/esm/react-i18n/src/index.d.ts +815 -0
  223. package/lib/esm/react-i18n/src/index.d.ts.map +1 -0
  224. package/lib/esm/scss/styles.scss +1 -0
  225. package/lib/esm/themes/theme.js +165 -0
  226. package/lib/esm/types/context.js +3 -0
  227. package/lib/esm/types/index.js +22 -0
  228. package/lib/esm/types/src/index.d.ts +9 -0
  229. package/lib/esm/types/src/index.d.ts.map +1 -0
  230. package/lib/esm/types/src/types/auth.d.ts +26 -0
  231. package/lib/esm/types/src/types/auth.d.ts.map +1 -0
  232. package/lib/esm/types/src/types/broadcastMessage.d.ts +73 -0
  233. package/lib/esm/types/src/types/broadcastMessage.d.ts.map +1 -0
  234. package/lib/esm/types/src/types/category.d.ts +100 -0
  235. package/lib/esm/types/src/types/category.d.ts.map +1 -0
  236. package/lib/esm/types/src/types/comment.d.ts +97 -0
  237. package/lib/esm/types/src/types/comment.d.ts.map +1 -0
  238. package/lib/esm/types/src/types/customAdv.d.ts +53 -0
  239. package/lib/esm/types/src/types/customAdv.d.ts.map +1 -0
  240. package/lib/esm/types/src/types/customNotification.d.ts +28 -0
  241. package/lib/esm/types/src/types/customNotification.d.ts.map +1 -0
  242. package/lib/esm/types/src/types/embed.d.ts +33 -0
  243. package/lib/esm/types/src/types/embed.d.ts.map +1 -0
  244. package/lib/esm/types/src/types/feed.d.ts +208 -0
  245. package/lib/esm/types/src/types/feed.d.ts.map +1 -0
  246. package/lib/esm/types/src/types/incubator.d.ts +53 -0
  247. package/lib/esm/types/src/types/incubator.d.ts.map +1 -0
  248. package/lib/esm/types/src/types/index.d.ts +22 -0
  249. package/lib/esm/types/src/types/index.d.ts.map +1 -0
  250. package/lib/esm/types/src/types/location.d.ts +61 -0
  251. package/lib/esm/types/src/types/location.d.ts.map +1 -0
  252. package/lib/esm/types/src/types/media.d.ts +52 -0
  253. package/lib/esm/types/src/types/media.d.ts.map +1 -0
  254. package/lib/esm/types/src/types/notification.d.ts +416 -0
  255. package/lib/esm/types/src/types/notification.d.ts.map +1 -0
  256. package/lib/esm/types/src/types/poll.d.ts +77 -0
  257. package/lib/esm/types/src/types/poll.d.ts.map +1 -0
  258. package/lib/esm/types/src/types/privateMessage.d.ts +109 -0
  259. package/lib/esm/types/src/types/privateMessage.d.ts.map +1 -0
  260. package/lib/esm/types/src/types/prize.d.ts +48 -0
  261. package/lib/esm/types/src/types/prize.d.ts.map +1 -0
  262. package/lib/esm/types/src/types/tag.d.ts +47 -0
  263. package/lib/esm/types/src/types/tag.d.ts.map +1 -0
  264. package/lib/esm/types/src/types/user.d.ts +227 -0
  265. package/lib/esm/types/src/types/user.d.ts.map +1 -0
  266. package/lib/esm/utils/errors.js +196 -0
  267. package/lib/esm/utils/locale.js +56 -0
  268. package/lib/esm/utils/logger.js +32 -0
  269. package/lib/esm/utils/object.js +44 -0
  270. package/lib/esm/utils/session.js +17 -0
  271. package/lib/esm/utils/src/index.d.ts +7 -0
  272. package/lib/esm/utils/src/index.d.ts.map +1 -0
  273. package/lib/esm/utils/src/utils/string.d.ts +21 -0
  274. package/lib/esm/utils/src/utils/string.d.ts.map +1 -0
  275. package/lib/esm/utils/src/utils/url.d.ts +22 -0
  276. package/lib/esm/utils/src/utils/url.d.ts.map +1 -0
  277. package/lib/esm/utils/string.js +57 -0
  278. package/lib/esm/utils/url.js +70 -0
  279. package/lib/esm/utils/user.js +83 -0
  280. package/lib/esm/utils/validator.js +771 -0
  281. package/lib/esm/utils/webPushMessaging.js +110 -0
  282. package/lib/esm/utils/websocket.js +307 -0
  283. package/lib/umd/react-core.js +2 -0
  284. package/lib/umd/react-core.js.LICENSE.txt +1 -0
  285. package/package.json +128 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Interface SCTagType.
3
+ * Tag Schema.
4
+ */
5
+ export interface SCTagType {
6
+ /**
7
+ * Unique integer value identifying this tag.
8
+ */
9
+ id: number;
10
+ /**
11
+ * The type of the tag (unique together name).
12
+ */
13
+ type?: string;
14
+ /**
15
+ * The name of the tag (unique together type).
16
+ */
17
+ name: string;
18
+ /**
19
+ * Short description of the tag.
20
+ */
21
+ description: string;
22
+ /**
23
+ * Hexadecimal format color code with prefix '#'.
24
+ */
25
+ color: string;
26
+ /**
27
+ * Tag publicly visible.
28
+ */
29
+ visible?: boolean;
30
+ /**
31
+ * The tag has a visibility boost.
32
+ */
33
+ visibility_boost?: boolean;
34
+ /**
35
+ * Creation date time.
36
+ */
37
+ created_at?: string;
38
+ /**
39
+ * Tag active or not
40
+ */
41
+ active?: boolean;
42
+ /**
43
+ * Tag deleted or not
44
+ */
45
+ deleted: boolean;
46
+ }
47
+ //# sourceMappingURL=tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../../../../types/src/types/tag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Interface SCUserType.
3
+ * User Schema.
4
+ */
5
+ import { SCTagType } from './tag';
6
+ /**
7
+ * User Fields
8
+ */
9
+ export declare enum SCUserFields {
10
+ USERNAME = "username",
11
+ REAL_NAME = "real_name",
12
+ DATE_JOINED = "date_joined",
13
+ BIO = "bio",
14
+ LOCATION = "location",
15
+ DATE_OF_BIRTH = "date_of_birth",
16
+ DESCRIPTION = "description",
17
+ GENDER = "gender",
18
+ WEBSITE = "website"
19
+ }
20
+ /**
21
+ * User status
22
+ */
23
+ export declare enum SCUserStatus {
24
+ APPROVED = "a",
25
+ BLOCKED = "b",
26
+ DELETED = "d",
27
+ UNREGISTERED = "u"
28
+ }
29
+ export interface SCUserType {
30
+ /**
31
+ * The ID of the user.
32
+ */
33
+ id: number;
34
+ /**
35
+ * The username of the user.
36
+ */
37
+ username: string;
38
+ /**
39
+ * Real name of the user.
40
+ */
41
+ real_name: string;
42
+ /**
43
+ * Email of the user.
44
+ */
45
+ email?: string;
46
+ /**
47
+ * Email is valid. Default: False.
48
+ */
49
+ email_isvalid?: boolean;
50
+ /**
51
+ * Date joined to the community.
52
+ */
53
+ date_joined: Date;
54
+ /**
55
+ * User biography.
56
+ */
57
+ bio: string;
58
+ /**
59
+ * Location
60
+ */
61
+ location: string;
62
+ /**
63
+ * Location in coordinates. Format: lat,lng.
64
+ */
65
+ location_lat_lng?: string;
66
+ /**
67
+ * User current position. Format: lat,lng.
68
+ */
69
+ position_lat_lng?: string;
70
+ /**
71
+ * Date of birth. Format: YYYY-MM-DD (ISO 8601).
72
+ */
73
+ date_of_birth?: Date;
74
+ /**
75
+ * User description.
76
+ */
77
+ description: string;
78
+ /**
79
+ * Gender of the user. Values: Male, Female, Unspecified. Default: Unspecified.
80
+ */
81
+ gender: string;
82
+ /**
83
+ * User status. Values: a (approved), b (blocked), d (deleted; soft deleted), u (unregistered). Default: a.
84
+ * A blocked user can't:
85
+ * - create contribution (post/discussion/status)
86
+ * - create comment
87
+ * - vote/unvote contribution
88
+ * - follow/connect user
89
+ * - edit contribution
90
+ * - suggest an incubator
91
+ * - flag a contribution
92
+ * - send a private message
93
+ * - edit info profile
94
+ * but he can't:
95
+ * - follow/unfollow a post/discussion/status
96
+ * - follow/unfollow a category
97
+ * - unfollow user
98
+ */
99
+ status: string;
100
+ /**
101
+ * User website.
102
+ */
103
+ website: string;
104
+ /**
105
+ * Avatar of the user.
106
+ */
107
+ avatar: string;
108
+ /**
109
+ * Image Cover of the user.
110
+ */
111
+ cover?: string;
112
+ /**
113
+ * The external ID of the user. It is assigned only during signup if necessary.
114
+ */
115
+ ext_id?: number;
116
+ /**
117
+ * User's tag list. List of Tag.
118
+ */
119
+ tags: Array<SCTagType>;
120
+ /**
121
+ * User reputation.
122
+ */
123
+ reputation: number;
124
+ /**
125
+ * List of user permission. Only for the resource /user/me/.
126
+ */
127
+ permission?: Array<string>;
128
+ /**
129
+ * The connection status between the request user and this user.
130
+ */
131
+ connection_status?: string;
132
+ /**
133
+ * Number of connection requests sent by the user.
134
+ */
135
+ connection_requests_sent_counter?: number;
136
+ /**
137
+ * Number of connection requests received by the user.
138
+ */
139
+ connection_requests_received_counter?: number;
140
+ /**
141
+ * Number of connections of the user.
142
+ */
143
+ connections_counter?: number;
144
+ /**
145
+ * Number of followings of the user
146
+ */
147
+ followings_counter?: number;
148
+ /**
149
+ * Number of followers of the user
150
+ */
151
+ followers_counter?: number;
152
+ /**
153
+ * Number of posts created by the user.
154
+ */
155
+ posts_counter?: number;
156
+ /**
157
+ * Number of discussions created by the user.
158
+ */
159
+ discussions_counter?: number;
160
+ /**
161
+ * Number of statuses created by the user.
162
+ */
163
+ statuses_counter?: number;
164
+ /**
165
+ * Number of polls created by the user.
166
+ */
167
+ polls_counter?: number;
168
+ /**
169
+ * User role
170
+ */
171
+ role: string;
172
+ /**
173
+ * interactions counter
174
+ */
175
+ unseen_interactions_counter?: number;
176
+ /**
177
+ * notification banner counter
178
+ */
179
+ unseen_notification_banners_counter?: number;
180
+ }
181
+ /**
182
+ * User Settings
183
+ */
184
+ export interface SCUserSettingsType {
185
+ /**
186
+ * Frequency of the email notifications for all interactions (except for private messages notifications)
187
+ */
188
+ qa_frequency: number;
189
+ /**
190
+ * Enable private messages notifications also via mail
191
+ */
192
+ email_notification_not_qa: number;
193
+ /**
194
+ * Enable mobile app/PWA notifications
195
+ */
196
+ mobile_notifications_scmty: number;
197
+ /**
198
+ * Shows a popup when the user receive a notification
199
+ */
200
+ show_toast_notifications: number;
201
+ /**
202
+ * Emit a sound when the notification popup is shown. See 'show_toast_notifications'
203
+ */
204
+ toast_notifications_emit_sound: number;
205
+ }
206
+ /**
207
+ * User Blocked Settings
208
+ */
209
+ export interface SCUserBlockedSettingsType {
210
+ /**
211
+ * N° days of block
212
+ */
213
+ days_blocked: number;
214
+ /**
215
+ * Reputation stolen
216
+ */
217
+ reputation_delta: number;
218
+ /**
219
+ * Start User Block datetime
220
+ */
221
+ blocked_at?: Date;
222
+ /**
223
+ * End User Block datetime
224
+ */
225
+ expire_at?: Date;
226
+ }
227
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../../types/src/types/user.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.ValidationWarnings = exports.ValidationResult = exports.ValidationError = void 0;
5
+ exports.isFunc = isFunc;
6
+
7
+ var _Locale = require("../constants/Locale");
8
+
9
+ var Session = _interopRequireWildcard(require("../constants/Session"));
10
+
11
+ var _logger = require("./logger");
12
+
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+
17
+ /**
18
+ * Manage Validation Error
19
+ * Used to check the initial configurations
20
+ */
21
+ class ValidationError {
22
+ constructor(errorCode, errorData, errorMessage = ValidationError.defaultErrorMessageMap[errorCode]) {
23
+ this.errorCode = null;
24
+ this.errorData = null;
25
+ this.errorMessage = null;
26
+ this.errorCode = errorCode;
27
+ this.errorData = errorData;
28
+ this.errorMessage = errorMessage;
29
+ }
30
+
31
+ }
32
+ /**
33
+ * Manage Validation Warnings
34
+ * Used to check the initial configurations
35
+ */
36
+
37
+
38
+ exports.ValidationError = ValidationError;
39
+ ValidationError.ERROR_INVALID_CONF = 3100;
40
+ ValidationError.ERROR_INVALID_SESSION = 4100;
41
+ ValidationError.ERROR_INVALID_SESSION_TYPE = 4101;
42
+ ValidationError.ERROR_INVALID_SESSION_AUTH_TOKEN = 4102;
43
+ ValidationError.ERROR_INVALID_SESSION_CLIENT_ID = 4103;
44
+ ValidationError.ERROR_INVALID_SESSION_REFRESH_TOKEN_CALLBACK = 4104;
45
+ ValidationError.ERROR_INVALID_PORTAL = 4200;
46
+ ValidationError.ERROR_INVALID_LOCALE = 4300;
47
+ ValidationError.ERROR_INVALID_TRANSLATIONS = 4400;
48
+ ValidationError.ERROR_INVALID_THEME = 4500;
49
+ ValidationError.ERROR_INVALID_ROUTER = 4600;
50
+ ValidationError.ERROR_INVALID_PROVIDERS = 4700;
51
+ ValidationError.ERROR_INVALID_HANDLE_ANONYMOUS_ACTION = 4800;
52
+ ValidationError.ERROR_INVALID_NOTIFICATIONS = 4900;
53
+ ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET = 4901;
54
+ ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_DISABLE_TOAST_MESSAGE = 4902;
55
+ ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING = 4921;
56
+ ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_DISABLE_TOAST_MESSAGE = 4922;
57
+ ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_APPLICATION_SERVER_KEY = 4923;
58
+ ValidationError.defaultErrorMessageMap = {
59
+ [ValidationError.ERROR_INVALID_CONF]: 'Invalid or missing library configuration. Check the configuration that is passed to the SCContextProvider.',
60
+ [ValidationError.ERROR_INVALID_SESSION]: 'Invalid session format.',
61
+ [ValidationError.ERROR_INVALID_SESSION_TYPE]: `Invalid sessionType. Available options are ${Session.sessionTypes.join(', ')}.`,
62
+ [ValidationError.ERROR_INVALID_SESSION_AUTH_TOKEN]: 'Invalid auth token format',
63
+ [ValidationError.ERROR_INVALID_SESSION_CLIENT_ID]: 'Invalid clientId in the initial configuration.',
64
+ [ValidationError.ERROR_INVALID_SESSION_REFRESH_TOKEN_CALLBACK]: 'Invalid refresh token callback',
65
+ [ValidationError.ERROR_INVALID_PORTAL]: `Invalid portal. Check if the url format is valid.`,
66
+ [ValidationError.ERROR_INVALID_LOCALE]: `Invalid locale. Available options are ${_Locale.LOCALES.join(', ')}.`,
67
+ [ValidationError.ERROR_INVALID_TRANSLATIONS]: `Invalid locale messages(translations) options.`,
68
+ [ValidationError.ERROR_INVALID_THEME]: 'Invalid theme options.',
69
+ [ValidationError.ERROR_INVALID_ROUTER]: 'Invalid router configuration',
70
+ [ValidationError.ERROR_INVALID_PROVIDERS]: `Invalid providers. Check if the list of providers is valid.`,
71
+ [ValidationError.ERROR_INVALID_HANDLE_ANONYMOUS_ACTION]: 'Invalid handle anonymous action callback',
72
+ [ValidationError.ERROR_INVALID_NOTIFICATIONS]: 'Invalid notifications conf.',
73
+ [ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET]: 'Invalid notifications (websocket) option.',
74
+ [ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_DISABLE_TOAST_MESSAGE]: 'Invalid notifications websocket conf: disableToastMessage must be a boolean value.',
75
+ [ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING]: 'Invalid notifications (web push messaging) option.',
76
+ [ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_DISABLE_TOAST_MESSAGE]: "Invalid notifications web push messaging option. 'disableToastMessage' must be a boolean value.",
77
+ [ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_APPLICATION_SERVER_KEY]: "Invalid notifications web push messaging option. 'applicationServerKey' must be a string value."
78
+ };
79
+
80
+ class ValidationWarnings {
81
+ constructor(warningCode, warningData, warningMessage = ValidationWarnings.defaultErrorMessageMap[warningCode]) {
82
+ this.warningCode = null;
83
+ this.warningData = null;
84
+ this.warningMessage = null;
85
+ this.warningCode = warningCode;
86
+ this.warningData = warningData;
87
+ this.warningMessage = warningMessage;
88
+ }
89
+
90
+ }
91
+ /**
92
+ * /**
93
+ * Manage Validation Error/Warnings
94
+ * of the initial configuration
95
+ */
96
+
97
+
98
+ exports.ValidationWarnings = ValidationWarnings;
99
+ ValidationWarnings.WARNING_SESSION_REFRESH_TOKEN_CALLBACK_NOT_FOUND = 3100;
100
+ ValidationWarnings.WARNING_LOCALE_FALLBACK = 3300;
101
+ ValidationWarnings.WARNING_ROUTER_FALLBACK = 3500;
102
+ ValidationWarnings.WARNING_HANDLE_ANONYMOUS_ACTION_FALLBACK = 3700;
103
+ ValidationWarnings.defaultErrorMessageMap = {
104
+ [ValidationWarnings.WARNING_SESSION_REFRESH_TOKEN_CALLBACK_NOT_FOUND]: "The 'handleRefreshToken' is not defined in initial conf. When the token expires it will not be renewed and the user session will be lost.",
105
+ [ValidationWarnings.WARNING_LOCALE_FALLBACK]: `The 'locale' is not defined in initial conf, fallback to the default ${_Locale.DEFAULT_LANGUAGE_UI}.`,
106
+ [ValidationWarnings.WARNING_ROUTER_FALLBACK]: "The 'router' is not defined in initial conf, fallback to the default configurations.",
107
+ [ValidationWarnings.WARNING_HANDLE_ANONYMOUS_ACTION_FALLBACK]: "The 'handleAnonymousAction' is not defined in initial conf, fallback to the default configurations."
108
+ };
109
+
110
+ class ValidationResult {
111
+ constructor(scope = '[Report Error]') {
112
+ this.errors = [];
113
+ this.warnings = [];
114
+ this.scope = '';
115
+ this.scope = scope;
116
+ }
117
+ /**
118
+ * Add an error
119
+ * @param errorCode
120
+ * @param errorData
121
+ */
122
+
123
+
124
+ addError(errorCode, errorData) {
125
+ this.errors.push(new ValidationError(errorCode, errorData));
126
+ return this.errors;
127
+ }
128
+ /**
129
+ * Add a warning
130
+ * @param errorCode
131
+ * @param errorData
132
+ */
133
+
134
+
135
+ addWarnings(warningCode, warningData) {
136
+ this.warnings.push(new ValidationWarnings(warningCode, warningData));
137
+ return this.errors;
138
+ }
139
+ /**
140
+ * Check if contains errors
141
+ */
142
+
143
+
144
+ hasErrors() {
145
+ return this.errors.length > 0;
146
+ }
147
+ /**
148
+ * Check if contains warnings
149
+ */
150
+
151
+
152
+ hasWarnings() {
153
+ return this.warnings.length > 0;
154
+ }
155
+ /**
156
+ * Emit in console all the errors
157
+ */
158
+
159
+
160
+ emitErrors() {
161
+ if (this.hasErrors()) {
162
+ this.errors.map(e => _logger.Logger.error(this.scope, e.errorMessage));
163
+ }
164
+ }
165
+ /**
166
+ * Emit in console all the warnings
167
+ */
168
+
169
+
170
+ emitWarnings() {
171
+ if (this.hasWarnings()) {
172
+ this.warnings.map(w => _logger.Logger.warn(this.scope, w.warningMessage));
173
+ }
174
+ }
175
+ /**
176
+ * Emit in console errors/warnings
177
+ */
178
+
179
+
180
+ emit() {
181
+ this.emitErrors();
182
+ this.emitWarnings();
183
+ }
184
+
185
+ }
186
+ /**
187
+ * Check if v is a func
188
+ * @param v
189
+ */
190
+
191
+
192
+ exports.ValidationResult = ValidationResult;
193
+
194
+ function isFunc(v) {
195
+ return typeof v === 'function';
196
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ exports.loadLocaleData = loadLocaleData;
6
+
7
+ var _Locale = require("../constants/Locale");
8
+
9
+ var _reactI18n = _interopRequireDefault(require("@selfcommunity/react-i18n"));
10
+
11
+ var _reactIntl = require("react-intl");
12
+
13
+ var _logger = require("./logger");
14
+
15
+ var _Errors = require("../constants/Errors");
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ /**
20
+ * Load Locale Data
21
+ */
22
+ function loadLocaleData(locale, settings) {
23
+ let _locale = locale;
24
+ let locales = settings.locale && settings.locale.messages ? settings.locale.messages : _reactI18n.default;
25
+
26
+ if (!locales[_locale]) {
27
+ _locale = _Locale.DEFAULT_LANGUAGE_UI;
28
+
29
+ if (settings.messages) {
30
+ _logger.Logger.warn(_Errors.SCOPE_SC_CORE, `Locale ${_locale} not found in messages configuration. Fallback to 'en'.`);
31
+ } else {
32
+ _logger.Logger.warn(_Errors.SCOPE_SC_CORE, `Locale ${_locale} not found in sc-i18n package. Fallback to 'en'.`);
33
+ }
34
+ }
35
+
36
+ try {
37
+ return {
38
+ messages: locales[_locale],
39
+ locale: _locale
40
+ };
41
+ } catch (e) {
42
+ if (settings.messages) {
43
+ locales = _reactI18n.default;
44
+
45
+ _logger.Logger.error(_Errors.SCOPE_SC_CORE, `Configuration Locale.messages doesn't contains ${_locale}. Fallback to 'en' of 'sc-i18n'`);
46
+ }
47
+
48
+ return {
49
+ messages: locales[_Locale.LOCALE_EN],
50
+ locale: _Locale.DEFAULT_LANGUAGE_UI
51
+ };
52
+ }
53
+ }
54
+
55
+ var _default = _reactIntl.createIntl;
56
+ exports.default = _default;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.Logger = void 0;
5
+
6
+ /**
7
+ * Emit styled message
8
+ */
9
+ class Logger {
10
+ static info(scope, message) {
11
+ console.info(`%c[${scope}]`, 'color:#008080', ` ${message}`);
12
+ }
13
+
14
+ static warn(scope, message) {
15
+ console.warn(`%c[${scope}]`, 'color:#008080', ` ${message}`);
16
+ }
17
+
18
+ static error(scope, message) {
19
+ console.error(`%c[${scope}]`, 'color:#008080', ` ${message}`);
20
+ }
21
+
22
+ static log(scope, message) {
23
+ console.log(`%c[${scope}]`, 'color:#008080', ` ${message}`);
24
+ }
25
+
26
+ static debug(scope, message) {
27
+ console.debug(`%c[${scope}]`, 'color:#008080', ` ${message}`);
28
+ }
29
+
30
+ }
31
+
32
+ exports.Logger = Logger;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.isObject = isObject;
5
+ exports.mergeDeep = mergeDeep;
6
+
7
+ /**
8
+ * Check if v is an object
9
+ * @param v
10
+ */
11
+ function isObject(v) {
12
+ return typeof v === 'object' && !Array.isArray(v) && v !== null;
13
+ }
14
+ /**
15
+ * Perfrom deep merge of two objects (not a shallow merge)
16
+ * @param target
17
+ * @param source
18
+ * @return {*}
19
+ */
20
+
21
+
22
+ function mergeDeep(target, source) {
23
+ let output = Object.assign({}, target);
24
+
25
+ if (isObject(target) && isObject(source)) {
26
+ Object.keys(source).forEach(key => {
27
+ if (isObject(source[key])) {
28
+ if (!(key in target)) {
29
+ Object.assign(output, {
30
+ [key]: source[key]
31
+ });
32
+ } else {
33
+ output[key] = mergeDeep(target[key], source[key]);
34
+ }
35
+ } else {
36
+ Object.assign(output, {
37
+ [key]: source[key]
38
+ });
39
+ }
40
+ });
41
+ }
42
+
43
+ return output;
44
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.parseJwt = parseJwt;
5
+
6
+ /**
7
+ * Extract from a jwt token payload
8
+ * @param token
9
+ */
10
+ function parseJwt(token) {
11
+ let base64Url = token.split('.')[1];
12
+ let base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
13
+ let jsonPayload = decodeURIComponent(atob(base64).split('').map(function (c) {
14
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
15
+ }).join(''));
16
+ return JSON.parse(jsonPayload);
17
+ }
@@ -0,0 +1,7 @@
1
+ import { capitalize, isString, stripHtml, camelCase } from './utils/string';
2
+ import { isValidUrl, isValidUrls, urlReplacer, getDomain } from './utils/url';
3
+ /**
4
+ * Export all utilities
5
+ */
6
+ export { capitalize, isString, stripHtml, camelCase, isValidUrl, isValidUrls, urlReplacer, getDomain };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../utils/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAE5E;;GAEG;AACH,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Check if v is a string
3
+ * @param v
4
+ */
5
+ export declare function isString(v: any): boolean;
6
+ /**
7
+ * Capitalize a string
8
+ * @param str
9
+ */
10
+ export declare function capitalize(str: string): string;
11
+ /**
12
+ * CamelCase a string
13
+ * @param str
14
+ */
15
+ export declare function camelCase(str: string): string;
16
+ /**
17
+ * Stripe html tags from a string
18
+ * @param str
19
+ */
20
+ export declare function stripHtml(str: string): string;
21
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../../../utils/src/utils/string.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,KAAA,WAEzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO9C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiB7C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Utility Url Replacer
3
+ * @param path
4
+ */
5
+ export declare const urlReplacer: (path: string) => (params: object) => any;
6
+ /**
7
+ * Get domain
8
+ * @param url
9
+ */
10
+ export declare const getDomain: (url: string) => string;
11
+ /**
12
+ * Check a str is a valid url pattern
13
+ * @param url
14
+ */
15
+ export declare const isValidUrl: (url: string) => boolean;
16
+ /**
17
+ * Check a str is a valid list of urls separated by delimiter
18
+ * @param value
19
+ * @param delimiter
20
+ */
21
+ export declare const isValidUrls: (value: string, delimiter: string) => boolean;
22
+ //# sourceMappingURL=url.d.ts.map