datastake-daf 0.6.710 → 0.6.712

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.
@@ -49127,7 +49127,7 @@ const DataChainOfCustody = _ref => {
49127
49127
  onFilterChange: onFilterChange
49128
49128
  });
49129
49129
  };
49130
- var index$3 = withProvider(DataChainOfCustody);
49130
+ var index$2 = withProvider(DataChainOfCustody);
49131
49131
 
49132
49132
  const NODE_GAP_X = 100;
49133
49133
  const NODE_GAP_Y = 50;
@@ -49394,7 +49394,7 @@ function TradeRelationship(_ref) {
49394
49394
  ref: reactFlowWrapper
49395
49395
  });
49396
49396
  }
49397
- var index$2 = withProvider(TradeRelationship);
49397
+ var index$1 = withProvider(TradeRelationship);
49398
49398
 
49399
49399
  const DEFAULT_SIBLING_SPACE = 49;
49400
49400
  const NO_CHILDREN_SIBLING_SPACE = 46;
@@ -49819,7 +49819,7 @@ function StakeholderMappings(_ref3) {
49819
49819
  isPdf: isPdf
49820
49820
  });
49821
49821
  }
49822
- var index$1 = withProvider(StakeholderMappings);
49822
+ var index = withProvider(StakeholderMappings);
49823
49823
 
49824
49824
  const _excluded$1 = ["t", "checkboxConfig", "defaultTableFilters", "columns", "children", "data", "loading", "APP", "getApiBaseUrl", "selectOptions", "selectFilters", "showCreate", "location", "goTo", "getRedirectLink", "defaultUrlParams", "view", "module", "filtersConfig", "isMobile"];
49825
49825
  const BaseScreen = _ref => {
@@ -54745,7 +54745,338 @@ function AdminView(_ref) {
54745
54745
  })]
54746
54746
  });
54747
54747
  }
54748
- var index = withFormsProvider(AdminView);
54748
+ var AdminView$1 = withFormsProvider(AdminView);
54749
+
54750
+ function AdminDashboardScreen({
54751
+ config
54752
+ }) {
54753
+ const {
54754
+ appName = "app",
54755
+ goTo,
54756
+ t,
54757
+ getRedirectLink,
54758
+ getActionWidgetsConfig,
54759
+ getKeyIndicatorsConfig,
54760
+ useWidgetFetch
54761
+ } = config;
54762
+ const {
54763
+ data,
54764
+ loading,
54765
+ userGrowthData,
54766
+ fetchUserGrowth,
54767
+ userGrowthDataLoading
54768
+ } = useWidgetFetch();
54769
+ const actionsWidgetsConfig = React.useMemo(() => getActionWidgetsConfig({
54770
+ getRedirectLink
54771
+ }), [getRedirectLink]);
54772
+ const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsConfig({
54773
+ getRedirectLink,
54774
+ keyIndicatorsData: data?.keyInformation
54775
+ }), [data?.keyInformation, getRedirectLink]);
54776
+
54777
+ // Dummy data for top contributors if not provided
54778
+ const TOTAL_DUMMY = [{
54779
+ label: "Contributor 1",
54780
+ Score: 0
54781
+ }, {
54782
+ label: "Contributor 2",
54783
+ Score: 0
54784
+ }, {
54785
+ label: "Contributor 3",
54786
+ Score: 0
54787
+ }, {
54788
+ label: "Contributor 4",
54789
+ Score: 0
54790
+ }, {
54791
+ label: "Contributor 5",
54792
+ Score: 0
54793
+ }];
54794
+ return /*#__PURE__*/jsxRuntime.jsx(AdminDashboard, {
54795
+ t: t,
54796
+ loading: loading,
54797
+ goTo: goTo,
54798
+ actionWidgetConfig: actionsWidgetsConfig,
54799
+ loadingUserGrowth: userGrowthDataLoading,
54800
+ fetchUserGrowth: fetchUserGrowth,
54801
+ data: {
54802
+ keyIndicatorsData: keyIndicatorsConfig,
54803
+ userActivityData: data?.userActivity,
54804
+ topContributorsData: data?.topContributors || TOTAL_DUMMY,
54805
+ userGrowthData: userGrowthData
54806
+ },
54807
+ adminTranslationIdentifier: appName
54808
+ });
54809
+ }
54810
+
54811
+ function AdminUsersScreen({
54812
+ config
54813
+ }) {
54814
+ const {
54815
+ appName = "app",
54816
+ module,
54817
+ goTo,
54818
+ t,
54819
+ location,
54820
+ isMobile,
54821
+ userRoles,
54822
+ accountTypes,
54823
+ getRedirectLink,
54824
+ AdminService,
54825
+ AuthenticationService,
54826
+ handleError,
54827
+ getAppRedirect
54828
+ } = config;
54829
+ const onImpersonate = React.useCallback(async id => {
54830
+ try {
54831
+ const {
54832
+ data
54833
+ } = await AdminService.impersonate({
54834
+ id
54835
+ });
54836
+ localStorage.setItem("previous", true);
54837
+ localStorage.setItem("previous_app", module);
54838
+ window.location = getAppRedirect({
54839
+ token: data.token
54840
+ });
54841
+ } catch (err) {
54842
+ handleError(err);
54843
+ }
54844
+ }, [AdminService, module, getAppRedirect, handleError]);
54845
+ const onResendVerification = React.useCallback(() => {
54846
+ // TODO: implement in calling app if needed
54847
+ antd.message.success(t("Verification email resent"));
54848
+ }, [t]);
54849
+ const onCopyVerification = React.useCallback(() => {
54850
+ // TODO: implement in calling app if needed
54851
+ antd.message.success(t("Verification link copied"));
54852
+ }, [t]);
54853
+ const onResetPassword = React.useCallback(async email => {
54854
+ antd.Modal.confirm({
54855
+ title: t("Send password reset link?"),
54856
+ content: t("Are you sure you want to send password reset link to this user?"),
54857
+ okText: t("Yes"),
54858
+ cancelText: t("No"),
54859
+ onOk: async () => {
54860
+ try {
54861
+ await AuthenticationService.resetPasswordRequest({
54862
+ email
54863
+ });
54864
+ antd.message.success(t("Password reset link sent to user"));
54865
+ } catch (err) {
54866
+ handleError(err);
54867
+ }
54868
+ }
54869
+ });
54870
+ }, [AuthenticationService, t, handleError]);
54871
+ function getUsers(params) {
54872
+ return AdminService.getUsers(params);
54873
+ }
54874
+ function getAccounts(params) {
54875
+ return AdminService.getAccounts(params);
54876
+ }
54877
+ return /*#__PURE__*/jsxRuntime.jsx(UserTable, {
54878
+ t: t,
54879
+ goTo: goTo,
54880
+ getRedirectLink: getRedirectLink,
54881
+ location: location,
54882
+ module: module,
54883
+ headerTitle: "users",
54884
+ getData: getUsers,
54885
+ getAccounts: getAccounts,
54886
+ isMobile: isMobile,
54887
+ config: {
54888
+ userRoles,
54889
+ accountTypes,
54890
+ tableOnClick: {
54891
+ onResendVerification,
54892
+ onCopyVerification,
54893
+ onImpersonate,
54894
+ onResetPassword
54895
+ }
54896
+ }
54897
+ });
54898
+ }
54899
+
54900
+ function AdminAccountsScreen({
54901
+ config
54902
+ }) {
54903
+ const {
54904
+ appName = "app",
54905
+ module,
54906
+ goTo,
54907
+ t,
54908
+ location,
54909
+ isMobile,
54910
+ accountTypes,
54911
+ getRedirectLink,
54912
+ AdminService,
54913
+ options,
54914
+ useQuery,
54915
+ NewAccountModal
54916
+ } = config;
54917
+ const query = useQuery ? useQuery() : {
54918
+ get: () => null
54919
+ };
54920
+ const [addAccountVisible, setAddAccountVisible] = React.useState(!!query.get("create"));
54921
+ const onResendInvitation = React.useCallback(() => {
54922
+ // TODO: implement in calling app if needed
54923
+ antd.message.success(t("Invitation email resent"));
54924
+ }, [t]);
54925
+ const onCopyInvitation = React.useCallback(() => {
54926
+ antd.message.success(t("Invitation link copied"));
54927
+ }, [t]);
54928
+ const actionButtons = React.useMemo(() => [{
54929
+ type: "primary",
54930
+ onClick: () => setAddAccountVisible(true),
54931
+ tooltip: t("Add"),
54932
+ icon: "Add"
54933
+ }], [t]);
54934
+ function handleGetData(params) {
54935
+ return AdminService.getAccounts(params);
54936
+ }
54937
+ function handleCancelVerification(token) {
54938
+ return AdminService.cancelInvitation(token);
54939
+ }
54940
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54941
+ children: [/*#__PURE__*/jsxRuntime.jsx(AccountTable, {
54942
+ t: t,
54943
+ goTo: goTo,
54944
+ location: location,
54945
+ getRedirectLink: getRedirectLink,
54946
+ isMobile: isMobile,
54947
+ module: module,
54948
+ headerTitle: "accounts",
54949
+ actionButton: actionButtons,
54950
+ getData: handleGetData,
54951
+ config: {
54952
+ accountTypes,
54953
+ options: {
54954
+ countries: options?.countries
54955
+ },
54956
+ onTableClick: {
54957
+ onCanelVerification: handleCancelVerification,
54958
+ onCopyInvitation,
54959
+ onResendInvitation,
54960
+ setAddAccountVisible
54961
+ }
54962
+ }
54963
+ }), NewAccountModal && /*#__PURE__*/jsxRuntime.jsx(NewAccountModal, {
54964
+ fetchData: () => {
54965
+ // Refresh table data - handled by AccountTable internally
54966
+ },
54967
+ addAccountVisible: addAccountVisible,
54968
+ onClose: () => setAddAccountVisible(false)
54969
+ })]
54970
+ });
54971
+ }
54972
+
54973
+ function AdminAccountsViewScreen({
54974
+ config
54975
+ }) {
54976
+ const {
54977
+ module,
54978
+ goTo,
54979
+ t,
54980
+ location,
54981
+ getRedirectLink,
54982
+ renderBreadCrumbs,
54983
+ id,
54984
+ mode,
54985
+ group,
54986
+ userRoles,
54987
+ options,
54988
+ accountTypes,
54989
+ accountStatuses,
54990
+ getAccountData,
54991
+ updateAccount,
54992
+ handleError,
54993
+ toggleAccountStatus,
54994
+ transferAdmin
54995
+ } = config;
54996
+ return /*#__PURE__*/jsxRuntime.jsx(AdminView$1, {
54997
+ t: t,
54998
+ goTo: goTo,
54999
+ getRedirectLink: getRedirectLink,
55000
+ location: location,
55001
+ renderBreadCrumbs: renderBreadCrumbs,
55002
+ id: id,
55003
+ mode: mode,
55004
+ group: group,
55005
+ module: module,
55006
+ userRoles: userRoles,
55007
+ options: options,
55008
+ accountTypes: accountTypes,
55009
+ accountStatuses: accountStatuses,
55010
+ getAccountData: getAccountData,
55011
+ updateAccount: updateAccount,
55012
+ handleError: handleError,
55013
+ toggleAccountStatus: toggleAccountStatus,
55014
+ transferAdmin: transferAdmin
55015
+ });
55016
+ }
55017
+
55018
+ function getAdminRoutes(config) {
55019
+ const {
55020
+ appName,
55021
+ useAdminDashboardConfig,
55022
+ useAdminUsersConfig,
55023
+ useAdminAccountsConfig,
55024
+ useAdminAccountsViewConfig,
55025
+ userIsAdmin
55026
+ } = config;
55027
+ const APP_PREFIX = "APP_".concat(appName.toUpperCase());
55028
+
55029
+ // Wrapper components that use the configuration hooks
55030
+ function DashboardWrapper() {
55031
+ const dashboardConfig = useAdminDashboardConfig();
55032
+ return /*#__PURE__*/jsxRuntime.jsx(AdminDashboardScreen, {
55033
+ config: dashboardConfig
55034
+ });
55035
+ }
55036
+ function UsersWrapper() {
55037
+ const usersConfig = useAdminUsersConfig();
55038
+ return /*#__PURE__*/jsxRuntime.jsx(AdminUsersScreen, {
55039
+ config: usersConfig
55040
+ });
55041
+ }
55042
+ function AccountsWrapper() {
55043
+ const accountsConfig = useAdminAccountsConfig();
55044
+ return /*#__PURE__*/jsxRuntime.jsx(AdminAccountsScreen, {
55045
+ config: accountsConfig
55046
+ });
55047
+ }
55048
+ function AccountsViewWrapper() {
55049
+ const accountsViewConfig = useAdminAccountsViewConfig();
55050
+ return /*#__PURE__*/jsxRuntime.jsx(AdminAccountsViewScreen, {
55051
+ config: accountsViewConfig
55052
+ });
55053
+ }
55054
+ return [{
55055
+ path: "",
55056
+ key: "".concat(APP_PREFIX, "_DASHBOARD"),
55057
+ exact: true,
55058
+ visible: () => true,
55059
+ component: /*#__PURE__*/jsxRuntime.jsx(DashboardWrapper, {})
55060
+ }, {
55061
+ path: "accounts",
55062
+ key: "".concat(APP_PREFIX, "_ACCOUNTS"),
55063
+ exact: true,
55064
+ visible: user => userIsAdmin(user),
55065
+ component: /*#__PURE__*/jsxRuntime.jsx(AccountsWrapper, {})
55066
+ }, {
55067
+ path: "admin-users",
55068
+ key: "".concat(APP_PREFIX, "_ADMIN_USERS"),
55069
+ exact: true,
55070
+ visible: user => userIsAdmin(user),
55071
+ component: /*#__PURE__*/jsxRuntime.jsx(UsersWrapper, {})
55072
+ }, {
55073
+ path: "accounts/:mode/:id/:group",
55074
+ key: "".concat(APP_PREFIX, "_ADMIN_VIEW"),
55075
+ exact: true,
55076
+ visible: user => userIsAdmin(user),
55077
+ component: /*#__PURE__*/jsxRuntime.jsx(AccountsViewWrapper, {})
55078
+ }];
55079
+ }
54749
55080
 
54750
55081
  const isUnderDevelopmentType = backgroundType => {
54751
55082
  const developmentTypes = ['analysis', 'table', 'field', 'globe', 'chart', 'scout'];
@@ -59654,8 +59985,15 @@ CountryFlag.propTypes = {
59654
59985
 
59655
59986
  exports.AccountTable = AccountTable;
59656
59987
  exports.ActionWidget = ActionWidget;
59988
+ exports.AddAccountModal = AddAccountModal;
59989
+ exports.AddUserModal = AddUserModal;
59990
+ exports.AddUserToAccountModal = AddUserToAccountModal;
59991
+ exports.AdminAccountsScreen = AdminAccountsScreen;
59992
+ exports.AdminAccountsViewScreen = AdminAccountsViewScreen;
59657
59993
  exports.AdminDashboard = AdminDashboard;
59658
- exports.AdminView = index;
59994
+ exports.AdminDashboardScreen = AdminDashboardScreen;
59995
+ exports.AdminUsersScreen = AdminUsersScreen;
59996
+ exports.AdminView = AdminView$1;
59659
59997
  exports.AjaxSelect = AjaxSelectMain;
59660
59998
  exports.Animated = Animated;
59661
59999
  exports.Applications = Applications;
@@ -59676,7 +60014,7 @@ exports.CustomIcon = CustomIcon;
59676
60014
  exports.DafDashboardDetails = Details;
59677
60015
  exports.DafTheme = DafTheme;
59678
60016
  exports.DashboardLayout = DashboardLayout;
59679
- exports.DataChainOfCustody = index$3;
60017
+ exports.DataChainOfCustody = index$2;
59680
60018
  exports.DataStore = DataStore;
59681
60019
  exports.DataStoreTable = DataStoreTable$1;
59682
60020
  exports.DataStoreView = DataStoreView;
@@ -59751,7 +60089,7 @@ exports.Sidenav = Sidenav;
59751
60089
  exports.SidenavMenu = SidenavMenu;
59752
60090
  exports.SimpleGlobe = SimpleGlobe;
59753
60091
  exports.StackChart = StackChart;
59754
- exports.StakeholderMappings = index$1;
60092
+ exports.StakeholderMappings = index;
59755
60093
  exports.Steps = DAFSteps;
59756
60094
  exports.StickyTable = StickyTable;
59757
60095
  exports.StoreProvider = StoreProvider;
@@ -59762,7 +60100,7 @@ exports.TableFilters = TableFilters;
59762
60100
  exports.Tabs = Tabs;
59763
60101
  exports.TabsHeader = TabsHeader;
59764
60102
  exports.TooltipIcon = TooltipIcon;
59765
- exports.TradeRelationship = index$2;
60103
+ exports.TradeRelationship = index$1;
59766
60104
  exports.UserTable = UserTable;
59767
60105
  exports.ViewForm = Content;
59768
60106
  exports.ViewFormInput = Input;
@@ -59773,4 +60111,5 @@ exports.WidgetImage = ImageWidget;
59773
60111
  exports.WidgetLoader = Loader;
59774
60112
  exports.WidgetPlaceholder = WidgetPlaceholder;
59775
60113
  exports.expandIcon = expandIcon;
60114
+ exports.getAdminRoutes = getAdminRoutes;
59776
60115
  exports.useMenu = useMenu;