@rpcbase/client 0.227.0 → 0.231.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 (237) hide show
  1. package/package.json +11 -113
  2. package/src/apiClient/getServerApiClient.ts +131 -0
  3. package/src/apiClient/index.ts +86 -0
  4. package/src/index.ts +3 -0
  5. package/src/initClient.ts +32 -0
  6. package/src/types.ts +7 -0
  7. package/AppProvider/AnalyticsContainer.js +0 -56
  8. package/AppProvider/debug.js +0 -4
  9. package/AppProvider/index.tsx +0 -79
  10. package/access-control/ACLForm/components/GrantField/OpSelector.tsx +0 -129
  11. package/access-control/ACLForm/components/GrantField/ResourceSelector.tsx +0 -86
  12. package/access-control/ACLForm/components/GrantField/UsersSelector.tsx +0 -96
  13. package/access-control/ACLForm/components/GrantField/grant-field.scss +0 -26
  14. package/access-control/ACLForm/components/GrantField/icons/CheckMark.tsx +0 -16
  15. package/access-control/ACLForm/components/GrantField/icons/CollapseArrow.tsx +0 -14
  16. package/access-control/ACLForm/components/GrantField/icons/ExpandArrow.tsx +0 -14
  17. package/access-control/ACLForm/components/GrantField/index.tsx +0 -91
  18. package/access-control/ACLForm/components/GrantsList.tsx +0 -48
  19. package/access-control/ACLForm/components/RoleForm.tsx +0 -134
  20. package/access-control/ACLForm/components/RoleView.tsx +0 -115
  21. package/access-control/ACLForm/components/RolesList.tsx +0 -79
  22. package/access-control/ACLForm/components/constants.tsx +0 -1
  23. package/access-control/ACLForm/components/resolver.ts +0 -57
  24. package/access-control/ACLForm/components/role-form.scss +0 -19
  25. package/access-control/ACLForm/index.tsx +0 -48
  26. package/access-control/ACLModal/acl-modal.scss +0 -7
  27. package/access-control/ACLModal/index.tsx +0 -66
  28. package/access-control/PolicyEditor/TargetSelector/QueryBuilder.tsx +0 -48
  29. package/access-control/PolicyEditor/TargetSelector/index.tsx +0 -5
  30. package/access-control/PolicyEditor/TargetSelector/query-builder.scss +0 -9
  31. package/access-control/PolicyEditor/index.tsx +0 -165
  32. package/access-control/index.ts +0 -3
  33. package/apiClient.js +0 -15
  34. package/auth/authProps.js +0 -8
  35. package/auth/components/AccountsList/AccountListItem.js +0 -61
  36. package/auth/components/AccountsList/account-list-item.scss +0 -5
  37. package/auth/components/AccountsList/index.js +0 -17
  38. package/auth/components/Footer/index.js +0 -11
  39. package/auth/components/ForgotPassword/forgot-password.scss +0 -37
  40. package/auth/components/ForgotPassword/index.js +0 -114
  41. package/auth/components/SetNewPassword/index.js +0 -130
  42. package/auth/components/SetNewPassword/set-new-password.scss +0 -47
  43. package/auth/components/SignIn/SignInEmailForm.tsx +0 -115
  44. package/auth/components/SignIn/index.js +0 -69
  45. package/auth/components/SignIn/sign-in.scss +0 -56
  46. package/auth/components/SignOut/index.js +0 -144
  47. package/auth/components/SignOut/sign-out.scss +0 -34
  48. package/auth/components/SignUp/SignUpEmailForm.tsx +0 -98
  49. package/auth/components/SignUp/index.js +0 -66
  50. package/auth/components/SignUp/sign-up.scss +0 -56
  51. package/auth/getTenantId.js +0 -12
  52. package/auth/getUid.js +0 -11
  53. package/auth/helpers/redirectSignIn.native.js +0 -9
  54. package/auth/helpers/redirectSignIn.web.js +0 -7
  55. package/auth/index.js +0 -146
  56. package/auth/signOut.js +0 -20
  57. package/auth/useAuthRouter.js +0 -56
  58. package/env.d.ts +0 -3
  59. package/firebase/index.js +0 -1
  60. package/firebase/sw.js +0 -1
  61. package/form/FileInput/FileUploadContext.tsx +0 -162
  62. package/form/FileInput/FileUploadForm/index.tsx +0 -139
  63. package/form/FileInput/FileUploadForm/usePreventUnload.js +0 -21
  64. package/form/FileInput/UploadButton.tsx +0 -23
  65. package/form/FileInput/constants.ts +0 -16
  66. package/form/FileInput/file-input.scss +0 -1
  67. package/form/FileInput/index.tsx +0 -21
  68. package/form/FileInput/upload-worker/get_file_hash.js +0 -63
  69. package/form/FileInput/upload-worker/index.js +0 -16
  70. package/form/FileInput/upload-worker/no_compress_exts.ts +0 -33
  71. package/form/FileInput/upload-worker/upload_file.js +0 -129
  72. package/form/Form.tsx +0 -23
  73. package/form/Input.tsx +0 -62
  74. package/form/SubmitButton/index.tsx +0 -58
  75. package/form/hook-form.tsx +0 -7
  76. package/form/index.tsx +0 -5
  77. package/getBaseUrl.js +0 -14
  78. package/getObjectId.ts +0 -31
  79. package/hashState.js +0 -158
  80. package/helpers/createBatcher/index.js +0 -36
  81. package/helpers/getInitials.js +0 -39
  82. package/helpers/onReady.js +0 -15
  83. package/helpers/post.js +0 -18
  84. package/helpers/postRPC.js +0 -42
  85. package/helpers/useRPC.js +0 -41
  86. package/helpers/useStoredValue/batchedGetStoredValues.js +0 -30
  87. package/helpers/useStoredValue/index.js +0 -107
  88. package/helpers/useStoredValue/setStoredValues.js +0 -14
  89. package/i18n/en/rb.nav.json +0 -13
  90. package/i18n/en/rb.sign_in.json +0 -11
  91. package/i18n/en/rb.sign_out.json +0 -5
  92. package/i18n/fr/rb.sign_in.json +0 -11
  93. package/i18n/fr/rb.sign_out.json +0 -5
  94. package/i18n/index.js +0 -63
  95. package/index.js +0 -6
  96. package/isEqualValues.js +0 -47
  97. package/jest.config.js +0 -16
  98. package/notifications/Notification/index.js +0 -36
  99. package/notifications/Notification/notification.scss +0 -1
  100. package/notifications/NotificationItem/HeaderStatus.js +0 -93
  101. package/notifications/NotificationItem/index.js +0 -65
  102. package/notifications/NotificationItem/notification-item.scss +0 -25
  103. package/notifications/NotificationsContainer/index.js +0 -37
  104. package/notifications/NotificationsContainer/notifications-container.scss +0 -38
  105. package/notifications/NotificationsContainer/useLLTs.js +0 -28
  106. package/notifications/NotificationsContext/index.js +0 -71
  107. package/notifications/NotificationsContext/useNotificationsList.js +0 -75
  108. package/notifications/NotificationsSettingsModal/SettingsForm.js +0 -52
  109. package/notifications/NotificationsSettingsModal/index.js +0 -48
  110. package/notifications/NotificationsSettingsModal/notifications-settings.scss +0 -1
  111. package/notifications/config.js +0 -1
  112. package/notifications/index.js +0 -4
  113. package/page.js +0 -9
  114. package/publish-output.txt +0 -0
  115. package/rpc.js +0 -32
  116. package/rr-trace/get_fingerprint.js +0 -10
  117. package/rr-trace/get_perf_vitals.js +0 -24
  118. package/rr-trace/get_session_id.js +0 -29
  119. package/rr-trace/index.js +0 -138
  120. package/rr-trace/write_session_data.js +0 -86
  121. package/rts/boot.js +0 -3
  122. package/rts/getUseDocument.js +0 -21
  123. package/rts/getUseQuery/index.js +0 -233
  124. package/rts/getUseQuery/useData.js +0 -55
  125. package/rts/index.js +0 -10
  126. package/rts/rts.js +0 -243
  127. package/rts/signout.ts +0 -8
  128. package/rts/store/constants.js +0 -3
  129. package/rts/store/debug.js +0 -24
  130. package/rts/store/get_collection.js +0 -55
  131. package/rts/store/index.js +0 -100
  132. package/rts/store/replace_query_keys.js +0 -30
  133. package/rts/store/satisfies_projection.js +0 -32
  134. package/rts/store/update_docs.js +0 -47
  135. package/storage/index.jest.js +0 -15
  136. package/storage/index.native.js +0 -38
  137. package/storage/index.web.js +0 -25
  138. package/types.ts +0 -6
  139. package/ui/ActivityIndicator/index.js +0 -113
  140. package/ui/Avatar/index.native.js +0 -31
  141. package/ui/Avatar/index.web.js +0 -37
  142. package/ui/Avatar/styles.js +0 -41
  143. package/ui/ErrorBoundary/index.js +0 -12
  144. package/ui/ExpandableFloatView/exp.scss +0 -15
  145. package/ui/ExpandableFloatView/index.tsx +0 -123
  146. package/ui/ExpandableFloatView/useBackdrop.js +0 -45
  147. package/ui/LottiePlayer/LottiePlayer.js +0 -4
  148. package/ui/LottiePlayer/index.js +0 -8
  149. package/ui/Modal/HashStateModal.js +0 -30
  150. package/ui/Modal/Modal.js +0 -93
  151. package/ui/Modal/ModalForm/AlertBanner.js +0 -82
  152. package/ui/Modal/ModalForm/index.js +0 -188
  153. package/ui/Modal/ModalForm/modal-form.scss +0 -63
  154. package/ui/Modal/index.js +0 -10
  155. package/ui/Modal/modal.scss +0 -101
  156. package/ui/Modal/withHashStateModal.js +0 -24
  157. package/ui/RedboxError/index.js +0 -3
  158. package/ui/Search/SearchHistory/index.js +0 -45
  159. package/ui/Search/SearchHistory/search-history.scss +0 -9
  160. package/ui/Search/SearchHistory/useSearchHistory.tsx +0 -57
  161. package/ui/Search/SearchResults/index.tsx +0 -90
  162. package/ui/Search/index.tsx +0 -298
  163. package/ui/Search/search.scss +0 -0
  164. package/ui/SelectPills/index.tsx +0 -96
  165. package/ui/SelectPills/select-pills.scss +0 -66
  166. package/ui/Tabs/index.tsx +0 -161
  167. package/ui/Tabs/tabs.scss +0 -53
  168. package/ui/Tree/index.js +0 -257
  169. package/ui/Tree/model.js +0 -71
  170. package/ui/Tree/node.js +0 -112
  171. package/ui/Tree/tree.scss +0 -98
  172. package/ui/UserAvatar/default_colors.json +0 -82
  173. package/ui/UserAvatar/index.js +0 -55
  174. package/ui/View/index.tsx +0 -17
  175. package/ui/View/index.web.js +0 -44
  176. package/ui/animations/checkmark.json +0 -1
  177. package/ui/helpers/SizeContext/index.tsx +0 -11
  178. package/ui/helpers/helpers.scss +0 -61
  179. package/ui/helpers/index.ts +0 -6
  180. package/ui/helpers/stopEventPropagation.js +0 -5
  181. package/ui/helpers/useActiveListItemIndex/index.tsx +0 -45
  182. package/ui/helpers/useScrollSelectorIntoView/index.tsx +0 -14
  183. package/ui/helpers/useThrottledMeasure/index.js +0 -47
  184. package/ui/helpers/withSuspense/index.js +0 -37
  185. package/ui/icons/AddAccount.tsx +0 -5
  186. package/ui/icons/Billing.tsx +0 -6
  187. package/ui/icons/Close.tsx +0 -14
  188. package/ui/icons/Organization.tsx +0 -5
  189. package/ui/icons/Signout.tsx +0 -5
  190. package/ui/icons/index.tsx +0 -6
  191. package/ui/nav/AccountsDropdown/SwitchAccounts.tsx +0 -28
  192. package/ui/nav/AccountsDropdown/accounts-dropdown.scss +0 -51
  193. package/ui/nav/AccountsDropdown/index.tsx +0 -90
  194. package/ui/nav/AccountsToggle/index.tsx +0 -24
  195. package/ui/nav/ContentView/ContentViewContext.ts +0 -23
  196. package/ui/nav/ContentView/index.tsx +0 -115
  197. package/ui/nav/HeaderContainer/header.scss +0 -52
  198. package/ui/nav/HeaderContainer/index.tsx +0 -23
  199. package/ui/nav/HeaderContainer/variables.scss +0 -1
  200. package/ui/nav/MorphingDropdown/MorphingDropdownContext.tsx +0 -151
  201. package/ui/nav/MorphingDropdown/MorphingDropdownMenu.tsx +0 -38
  202. package/ui/nav/MorphingDropdown/MorphingDropdownPortal.tsx +0 -166
  203. package/ui/nav/MorphingDropdown/MorphingDropdownToggle.tsx +0 -34
  204. package/ui/nav/MorphingDropdown/index.tsx +0 -16
  205. package/ui/nav/MorphingDropdown/morphing-dropdown.scss +0 -35
  206. package/ui/nav/NotificationsDropdown/index.tsx +0 -52
  207. package/ui/nav/NotificationsDropdown/notifications-dropdown.scss +0 -5
  208. package/ui/nav/NotificationsToggle/NotificationsGlyph.tsx +0 -54
  209. package/ui/nav/NotificationsToggle/index.tsx +0 -12
  210. package/ui/nav/NotificationsToggle/notification-animation.json +0 -1
  211. package/ui/nav/NotificationsToggle/notifications-toggle.scss +0 -26
  212. package/ui/nav/SidebarContainer/index.tsx +0 -48
  213. package/ui/nav/SidebarContainer/sidebar-container.scss +0 -21
  214. package/ui/nav/SlideoutContainer/components/Body.tsx +0 -19
  215. package/ui/nav/SlideoutContainer/components/Header.tsx +0 -23
  216. package/ui/nav/SlideoutContainer/components/Wrapper.tsx +0 -46
  217. package/ui/nav/SlideoutContainer/index.tsx +0 -50
  218. package/ui/nav/SlideoutContainer/slideout-container.scss +0 -40
  219. package/ui/nav/index.ts +0 -13
  220. package/ui/oauth/GitHub.js +0 -38
  221. package/ui/oauth/getGitHubSigninUrl.js +0 -30
  222. package/ui/oauth/index.js +0 -9
  223. package/ui/oauth/oauth.scss +0 -16
  224. package/ui/sortable-hoc/AutoScroller.js +0 -76
  225. package/ui/sortable-hoc/DragHandle.js +0 -31
  226. package/ui/sortable-hoc/Manager.js +0 -54
  227. package/ui/sortable-hoc/README.md +0 -1
  228. package/ui/sortable-hoc/SortableContainer/defaultGetHelperDimensions.js +0 -7
  229. package/ui/sortable-hoc/SortableContainer/defaultShouldCancelStart.js +0 -24
  230. package/ui/sortable-hoc/SortableContainer/index.js +0 -994
  231. package/ui/sortable-hoc/SortableContainer/props.js +0 -81
  232. package/ui/sortable-hoc/SortableElement.js +0 -111
  233. package/ui/sortable-hoc/SortableHandle.js +0 -45
  234. package/ui/sortable-hoc/drag-handle.scss +0 -14
  235. package/ui/sortable-hoc/index.js +0 -9
  236. package/ui/sortable-hoc/utils.js +0 -292
  237. package/ui/springs.ts +0 -17
@@ -1,79 +0,0 @@
1
- import {useState} from "react"
2
- // import {arrayMoveImmutable} from "array-move"
3
-
4
- import {DragHandle, SortableContainer, SortableElement} from "../../../ui/sortable-hoc"
5
- import {useQuery} from "../../../rts"
6
-
7
- import {RoleForm} from "./RoleForm"
8
- import {RoleView} from "./RoleView"
9
-
10
-
11
- const SortableItem = SortableElement(({value, index, active, onClick}) => (
12
- <div id={`${value._id}-role-list-item-${index}`} className="d-block px-1 py-2">
13
- <div className={cx(["d-flex", "align-items-start", {active}])} onClick={onClick}>
14
- <DragHandle variant="dots" className="mt-1" />
15
- <RoleView role={value} />
16
- </div>
17
- </div>
18
- ))
19
-
20
- const SortableList = SortableContainer(({ref, items, onClickHandler, activeTab, className = ""}) => {
21
- return (
22
- <div ref={ref} className={cx(className)}>
23
- {items.map((value, index) => (
24
- <SortableItem
25
- key={`item-${value._id}`}
26
- index={index}
27
- value={value}
28
- active={`${index}` === activeTab}
29
- onClick={onClickHandler(`${index}`)}
30
- />
31
- ))}
32
- </div>
33
- )
34
- })
35
-
36
- export const RolesList = () => {
37
- // const [roles, setRoles] = useState([])
38
- // const rolesQuery = useQuery("ACLRole", {})
39
- const rolesQuery = {}
40
-
41
- const [isAddingRole, setIsAddingRole] = useState(false)
42
-
43
- const onClickAddRole = () => setIsAddingRole(true)
44
-
45
- const onSortEnd = ({oldIndex, newIndex}) => {
46
- // setItems(arrayMoveImmutable(items, oldIndex, newIndex))
47
- console.log("update sort roles", oldIndex, newIndex)
48
- }
49
-
50
- const getOnClickHandler = (arg) => () => {
51
- console.log("sortable on click handler", arg)
52
- }
53
-
54
- return (
55
- <div className="d-block bg-white mb-2">
56
- {isAddingRole && <RoleForm onDone={() => setIsAddingRole(false)} />}
57
-
58
- {!isAddingRole && (
59
- <button className="btn btn-link ms-1" onClick={onClickAddRole}>
60
- + Add Role
61
- </button>
62
- )}
63
-
64
- {rolesQuery.data && (
65
- <SortableList
66
- className="mt-3"
67
- axis="y"
68
- lockAxis={"y"}
69
- // distance={2} // PUTAIN
70
- items={rolesQuery.data}
71
- onSortEnd={onSortEnd}
72
- onClickHandler={getOnClickHandler}
73
- transitionDuration={200}
74
- useDragHandle
75
- />
76
- )}
77
- </div>
78
- )
79
- }
@@ -1 +0,0 @@
1
- export const GRANTS_FIELD = "grants"
@@ -1,57 +0,0 @@
1
- import _set from "lodash/set"
2
-
3
- import {GRANTS_FIELD} from "./constants"
4
-
5
- const validateGrants = (grants, errors) => {
6
- grants.forEach((grant, index) => {
7
- const fieldKey = `${GRANTS_FIELD}.${index}`
8
-
9
- // Ops
10
- const ops = grant.ops || {}
11
- const hasOps = Object.keys(ops).length > 0
12
- if (!hasOps) {
13
- const opsErrKey = `${fieldKey}.ops`
14
- _set(errors, opsErrKey, {type: "error", message: "You must select at least one Operation"})
15
- }
16
-
17
- // Resources
18
- const resources = grant.resources || {}
19
- const hasResources = Object.keys(resources).length > 0
20
-
21
- if (!hasResources) {
22
- const resErrKey = `${fieldKey}.resources`
23
- _set(errors, resErrKey, {type: "error", message: "You must select at least one Resource"})
24
- }
25
-
26
- // Users
27
- const users = grant.users || {}
28
- const hasUsers = Object.keys(users).length > 0
29
-
30
- if (!hasUsers) {
31
- const usersErrKey = `${fieldKey}.users`
32
- _set(errors, usersErrKey, {type: "error", message: "You must select at least one User"})
33
- }
34
- })
35
- }
36
-
37
- export const resolver = (values) => {
38
- const errors = {}
39
-
40
- if (!values.name) {
41
- errors.name = {message: "Please enter a valid name"}
42
- }
43
-
44
- if (!values.description) {
45
- errors.description = {message: "Please enter a valid description"}
46
- }
47
-
48
- validateGrants(values.grants, errors)
49
- if (values.grants.length === 0) {
50
- errors.grants = {message: "You must add at least one Grant"}
51
- }
52
-
53
- return {
54
- values,
55
- errors,
56
- }
57
- }
@@ -1,19 +0,0 @@
1
- @import "helpers";
2
-
3
- .role-remove-button {
4
- position: absolute;
5
- width: 14px;
6
- height: 14px;
7
- right: 0;
8
- top: 0;
9
- cursor: pointer;
10
- color: $gray-500;
11
-
12
- &:hover {
13
- color: $gray-700;
14
- }
15
-
16
- &:active {
17
- color: $gray-900;
18
- }
19
- }
@@ -1,48 +0,0 @@
1
- import {useState} from "react"
2
-
3
- import {SelectPills} from "../../ui/SelectPills"
4
-
5
- import {RolesList} from "./components/RolesList"
6
-
7
- const VISIBILITY_ITEMS = [
8
- {
9
- name: "Private",
10
- key: "private",
11
- description: "Members cannot discover this group and have to be added manually",
12
- icon: "/static/icons/acl/acl-visibility-private.svg",
13
- },
14
- {
15
- name: "Public",
16
- key: "public",
17
- description: "Members of your organisation will be able to see this group",
18
- icon: "/static/icons/acl/acl-visibility-public.svg",
19
- },
20
- ]
21
-
22
- export const ACLForm = () => {
23
- const [activeVisibilityKey, setActiveVisibilityKey] = useState("private")
24
-
25
- const onUpdateGroupVisibility = (k) => setActiveVisibilityKey(k)
26
-
27
- return (
28
- <div>
29
- {/* Visibility */}
30
- <div className="mx-3">
31
- <label className="fw-bold mb-1">Group Visibility</label>
32
- <SelectPills
33
- direction="row"
34
- size="sm"
35
- items={VISIBILITY_ITEMS}
36
- activeKey={activeVisibilityKey}
37
- onChange={onUpdateGroupVisibility}
38
- />
39
- </div>
40
-
41
- {/* Roles */}
42
- <div>
43
- <label className="fw-bold mb-1 ms-3">Roles</label>
44
- <RolesList />
45
- </div>
46
- </div>
47
- )
48
- }
@@ -1,7 +0,0 @@
1
- @import "helpers";
2
-
3
- .group-acl-modal {
4
- .modal-dialog {
5
- min-width: 640px;
6
- }
7
- }
@@ -1,66 +0,0 @@
1
- import {useState, useEffect} from "react"
2
-
3
- import {useHashState} from "../../hashState"
4
- import Modal from "../../ui/Modal"
5
-
6
- import {ACLForm} from "../ACLForm"
7
-
8
- import "./acl-modal.scss"
9
-
10
-
11
- export const ACLModal = ({}) => {
12
- const {hashState, serializeHashState} = useHashState()
13
-
14
- const [isShown, setIsShown] = useState(false)
15
-
16
- // useEffect(() => {
17
- // console.log("GOURP", envContext)
18
- // }, [envContext])
19
-
20
- useEffect(() => {
21
- if (hashState.showGroupAccessControlModal) {
22
- setIsShown(true)
23
- } else {
24
- setIsShown(false)
25
- }
26
- }, [hashState, setIsShown])
27
-
28
- const onHide = () => {
29
- serializeHashState({
30
- showGroupAccessControlModal: null,
31
- })
32
- }
33
-
34
- if (!isShown) return null
35
-
36
- return (
37
- <Modal className="group-acl-modal" onHide={onHide} size="large">
38
- <Modal.Header className="close-top" closeButton>
39
- <img
40
- width={26}
41
- height={26}
42
- style={{marginTop: 0}}
43
- className="me-2 align-self-start"
44
- src={`/static/icons/acl-shield.svg`}
45
- />
46
- <div className="">
47
- <div>
48
- Permissions for <kbd>wow group name</kbd>
49
- </div>
50
- <small className="text-secondary fw-normal">
51
- Permissions and Grants that control who can see what in your Group
52
- </small>
53
- </div>
54
- </Modal.Header>
55
- <Modal.Body className="px-0">
56
- <ACLForm />
57
- </Modal.Body>
58
- <Modal.Footer className="justify-content-start">
59
- Learn more about Access Control and Permissions in &nbsp;
60
- <a target="_blank" rel="noopener noreferrer" href={`/docs/access-control`}>
61
- /docs/access-control
62
- </a>
63
- </Modal.Footer>
64
- </Modal>
65
- )
66
- }
@@ -1,48 +0,0 @@
1
- import {
2
- QueryBuilderBootstrap,
3
- bootstrapControlClassnames,
4
- bootstrapControlElements,
5
- } from "@react-querybuilder/bootstrap"
6
- import {QueryBuilder as ReactQueryBuilder} from "react-querybuilder"
7
- import {QueryBuilderDnD as ReactQueryBuilderDnD} from "@react-querybuilder/dnd"
8
- import * as ReactDnD from "react-dnd"
9
- import * as ReactDnDHtml5Backend from "react-dnd-html5-backend"
10
-
11
- // import FieldSelector from "./FieldSelector"
12
- // import OperatorSelector from "./OperatorSelector"
13
- // import ValueEditor from "./ValueEditor"
14
-
15
- import "./query-builder.scss"
16
-
17
-
18
- const controlClassnames = {...bootstrapControlClassnames}
19
- controlClassnames.queryBuilder += " queryBuilder-branches"
20
-
21
- const QueryBuilder = ({controlElements = {}, ...props}) => {
22
- return (
23
- <ReactQueryBuilderDnD dnd={{...ReactDnD, ...ReactDnDHtml5Backend}}>
24
- <QueryBuilderBootstrap>
25
- <ReactQueryBuilder
26
- addRuleToNewGroups
27
- // TODO: why is DnD not working??
28
- // https://react-querybuilder.js.org/docs/components/querybuilder#enabledraganddrop
29
- enableDragAndDrop
30
- showCombinatorsBetweenRules={false}
31
- showNotToggle
32
- showCloneButtons
33
- controlClassnames={controlClassnames}
34
- controlElements={{
35
- ...bootstrapControlElements,
36
- ...controlElements,
37
- // fieldSelector: FieldSelector,
38
- // operatorSelector: OperatorSelector,
39
- // valueEditor: ValueEditor,
40
- }}
41
- {...props}
42
- />
43
- </QueryBuilderBootstrap>
44
- </ReactQueryBuilderDnD>
45
- )
46
- }
47
-
48
- export default QueryBuilder
@@ -1,5 +0,0 @@
1
-
2
-
3
- export const TargetSelector = () => {
4
-
5
- }
@@ -1,9 +0,0 @@
1
- @import "helpers";
2
-
3
- .queryBuilder {
4
- .dropdown-item.active {
5
- .text-secondary {
6
- color: $gray-200 !important;
7
- }
8
- }
9
- }
@@ -1,165 +0,0 @@
1
- import {useState} from "react"
2
-
3
-
4
- const POLICY_EFFECT = [
5
- {
6
- name: "Grant",
7
- key: "grant",
8
- },
9
- {
10
- name: "Deny",
11
- key: "deny",
12
- },
13
- ]
14
-
15
- const TARGET_TYPES = [
16
- {
17
- name: "Collection:",
18
- key: "collections",
19
- description: "Applies to all documents within the collection",
20
- },
21
- {
22
- name: "Documents:",
23
- key: "documents",
24
- description: "Applies only to certain specific documents",
25
- },
26
- {
27
- name: "Field:",
28
- key: "fields",
29
- description: "Applies only specific fields of documents",
30
- },
31
- ]
32
-
33
- const OPERATIONS = [
34
- {
35
- name: "Create",
36
- key: "create",
37
- },
38
- {
39
- name: "Read",
40
- key: "read",
41
- },
42
- {
43
- name: "Update",
44
- key: "update",
45
- },
46
- {
47
- name: "Delete",
48
- key: "delete",
49
- },
50
- {
51
- name: "All of the above",
52
- key: "all",
53
- },
54
- ]
55
-
56
-
57
- //
58
- const APPLIES_TO = [
59
- {
60
- name: "Users",
61
- key: "users",
62
- },
63
- {
64
- name: "Groups",
65
- key: "groups",
66
- },
67
- ]
68
-
69
- export const PolicyEditor = () => {
70
- const [targetType, setTargetType] = useState("collection")
71
-
72
- const onChangeTargetType = (event) => {
73
- setTargetType(event.target.value)
74
- }
75
-
76
- return (
77
- <div>
78
- <h6>Policy Editor</h6>
79
- <hr />
80
-
81
- <h6>Effect:</h6>
82
- <div className="mb-3" style={{maxWidth: 300}}>
83
- {POLICY_EFFECT.map((type) => (
84
- <div key={type.key} className="d-flex flex-row mb-1">
85
- <input
86
- className="form-check-input"
87
- type="radio"
88
- name="targetTypeOptions"
89
- id={type.key}
90
- value={type.key}
91
- checked={targetType === type.key}
92
- onChange={onChangeTargetType}
93
- />
94
- <label
95
- className="form-check-label cursor-pointer ps-2"
96
- htmlFor={type.key}
97
- >
98
- <b>{type.name}</b>
99
- </label>
100
- </div>
101
- ))}
102
- </div>
103
-
104
- <div className="d-flex flex-row">
105
- <div className="me-2">
106
- <h6>Target Type:</h6>
107
- <div style={{maxWidth: 300}}>
108
- {TARGET_TYPES.map((type) => (
109
- <div key={type.key} className="d-flex flex-row mb-1">
110
- <input
111
- className="form-check-input"
112
- type="radio"
113
- name="targetTypeOptions"
114
- id={type.key}
115
- value={type.key}
116
- checked={targetType === type.key}
117
- onChange={onChangeTargetType}
118
- />
119
- <label
120
- className="form-check-label cursor-pointer ps-2"
121
- htmlFor={type.key}
122
- >
123
- <b>{type.name}</b> {type.description}
124
- </label>
125
- </div>
126
- ))}
127
- </div>
128
- </div>
129
-
130
- <div>
131
- <h6>Targets:</h6>
132
- <div>
133
- <input type="text" />
134
- </div>
135
- </div>
136
- </div>
137
-
138
- <h6 className="mt-3">Operation:</h6>
139
- <div className="" style={{maxWidth: 300}}>
140
- {OPERATIONS.map((type) => (
141
- <div key={type.key} className="d-flex flex-row mb-1">
142
- <input
143
- className="form-check-input"
144
- type="radio"
145
- name="targetTypeOptions"
146
- id={type.key}
147
- value={type.key}
148
- checked={targetType === type.key}
149
- onChange={onChangeTargetType}
150
- />
151
- <label
152
- className="form-check-label cursor-pointer ps-2"
153
- htmlFor={type.key}
154
- >
155
- <b>{type.name}</b>
156
- </label>
157
- </div>
158
- ))}
159
- </div>
160
-
161
- <br />
162
- to attributes / conditions add support for expiry date
163
- </div>
164
- )
165
- }
@@ -1,3 +0,0 @@
1
- export * from "./ACLModal"
2
- export * from "./ACLForm"
3
- export * from "./PolicyEditor"
package/apiClient.js DELETED
@@ -1,15 +0,0 @@
1
- import axios from "axios"
2
-
3
- import getBaseUrl from "./getBaseUrl"
4
- import getTenantId from "./auth/getTenantId"
5
-
6
-
7
- export const apiClient = axios.create({
8
- baseURL: getBaseUrl(),
9
- withCredentials: true,
10
- headers: {
11
- "rb-tenant-id": getTenantId(),
12
- },
13
- })
14
-
15
- export default apiClient
package/auth/authProps.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- let authProps = null
3
-
4
- export const getAuthProps = () => authProps
5
-
6
- export const setAuthProps = (newAuthProps) => {
7
- authProps = newAuthProps
8
- }
@@ -1,61 +0,0 @@
1
- /* @flow */
2
- import getInitials from "../../../helpers/getInitials"
3
- import Avatar from "../../../ui/Avatar"
4
-
5
- import "./account-list-item.scss"
6
-
7
- const getAvatarText = (user) => {
8
- if (user.initials) return user.initials
9
-
10
- const fullName = `${user.first_name || ""} ${user.last_name || ""}`
11
- let initials = getInitials(fullName)
12
-
13
- if (!initials) initials = "?"
14
-
15
- return initials
16
- }
17
-
18
-
19
- const getTenantName = (tenant) => {
20
- if (tenant.short_name) return tenant.short_name
21
- else if (tenant.name) return tenant.name
22
- else return tenant.slug
23
- }
24
-
25
- const getUserName = (user) => {
26
- let name = ""
27
-
28
- if (user.first_name) {
29
- name += user.first_name
30
- }
31
-
32
- if (user.last_name) {
33
- name += ` ${user.last_name}`
34
- }
35
-
36
- if (!name && user.initials) {
37
- name += user.initials
38
- }
39
-
40
- if (!name) {
41
- name = user.email
42
- }
43
-
44
- return name
45
- }
46
-
47
- export const AccountListItem = ({account, onClick, avatarProps}) => {
48
-
49
- return (
50
- <div
51
- key={`acc-${account.user._id}`}
52
- className="account-list-item d-flex flex-row"
53
- onClick={() => onClick(account)}
54
- >
55
- <div>
56
- <Avatar className="me-2" size="small" text={getAvatarText(account.user)} color={account.user.avatar_color} {...avatarProps} />
57
- </div>
58
- <div style={{wordBreak: "break-all"}}>{getTenantName(account.tenant)} / {getUserName(account.user)}</div>
59
- </div>
60
- )
61
- }
@@ -1,5 +0,0 @@
1
- @import "helpers";
2
-
3
- .account-list-item {
4
- cursor: pointer;
5
- }
@@ -1,17 +0,0 @@
1
- /* @flow */
2
- import {AccountListItem} from "./AccountListItem"
3
-
4
-
5
- export const AccountsList = ({accounts}) => {
6
-
7
- return (
8
- <>
9
- {accounts.map((acc) => (
10
- <AccountListItem
11
- key={`acc-${acc.user._id}`}
12
- account={acc}
13
- />
14
- ))}
15
- </>
16
- )
17
- }
@@ -1,11 +0,0 @@
1
- /* @flow */
2
- const year = (new Date).getFullYear()
3
-
4
- export const Footer = ({name}) => {
5
-
6
- return (
7
- <footer className="pt-5 my-5 text-muted border-top">
8
- &copy; {year} <span className="ms-1">{name}</span>
9
- </footer>
10
- )
11
- }
@@ -1,37 +0,0 @@
1
- @import "helpers";
2
-
3
- #forgot-password-wrapper {
4
- height: 100%;
5
- display: flex;
6
- flex-direction: column;
7
- align-items: center;
8
- padding-top: 40px;
9
- padding-bottom: 40px;
10
- // background-color: var(--bs-secondary);
11
- background-color: $gray-500;
12
-
13
- hr {
14
- background-color: $gray-500;
15
- }
16
-
17
- footer {
18
- color: $light !important;
19
- border-top: none !important;
20
- padding-top: 0 !important;
21
- margin-bottom: 0 !important;
22
- }
23
-
24
-
25
- .form-forgot {
26
- width: 100%;
27
- max-width: 380px;
28
- margin: auto;
29
- background-color: $light;
30
- border-radius: 22px;
31
- // border: 1px solid $gray-600;
32
- }
33
-
34
- .form-forgot .form-floating:focus-within {
35
- z-index: 2;
36
- }
37
- }