@firecms/user_management 3.4.0 → 3.5.1

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.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-fast-compare"), require("@firecms/core"), require("react/jsx-runtime"), require("react-compiler-runtime"), require("@firecms/ui"), require("yup"), require("@firecms/formex"), require("date-fns"), require("date-fns/locale")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-fast-compare", "@firecms/core", "react/jsx-runtime", "react-compiler-runtime", "@firecms/ui", "yup", "@firecms/formex", "date-fns", "date-fns/locale"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.FireCMS = {}, global.React, global.equal, global.core, global.jsxRuntime, global.reactCompilerRuntime, global.ui, global.Yup, global.formex, global.dateFns, global.locales));
3
- })(this, (function(exports2, React, equal, core, jsxRuntime, reactCompilerRuntime, ui, Yup, formex, dateFns, locales) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-fast-compare"), require("@firecms/core"), require("react/jsx-runtime"), require("react-compiler-runtime"), require("@firecms/ui"), require("yup"), require("@firecms/formex"), require("date-fns")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-fast-compare", "@firecms/core", "react/jsx-runtime", "react-compiler-runtime", "@firecms/ui", "yup", "@firecms/formex", "date-fns"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.FireCMS = {}, global.React, global.equal, global.core, global.jsxRuntime, global.reactCompilerRuntime, global.ui, global.Yup, global.formex, global.dateFns));
3
+ })(this, (function(exports2, React, equal, core, jsxRuntime, reactCompilerRuntime, ui, Yup, formex, dateFns) {
4
4
  "use strict";
5
5
  function _interopNamespaceDefault(e) {
6
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -19,7 +19,6 @@
19
19
  return Object.freeze(n);
20
20
  }
21
21
  const Yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(Yup);
22
- const locales__namespace = /* @__PURE__ */ _interopNamespaceDefault(locales);
23
22
  const RESERVED_GROUPS = ["Admin"];
24
23
  const DEFAULT_PERMISSIONS = {
25
24
  read: false,
@@ -1977,14 +1976,96 @@
1977
1976
  }
1978
1977
  return t21;
1979
1978
  }
1979
+ function UserManagementPausedNotice() {
1980
+ const $ = reactCompilerRuntime.c(20);
1981
+ const {
1982
+ t
1983
+ } = core.useTranslation();
1984
+ const licenseStatus = core.useLicenseStatus();
1985
+ let t0;
1986
+ if ($[0] !== licenseStatus?.licenseState || $[1] !== t) {
1987
+ t0 = licenseStatus?.licenseState === "invalid_project" ? t("license_add_project_to_license") : licenseStatus?.licenseState === "over_quota" ? t("license_update_license") : t("license_get_license");
1988
+ $[0] = licenseStatus?.licenseState;
1989
+ $[1] = t;
1990
+ $[2] = t0;
1991
+ } else {
1992
+ t0 = $[2];
1993
+ }
1994
+ const linkLabel = t0;
1995
+ let t1;
1996
+ if ($[3] !== t) {
1997
+ t1 = t("pro_features_paused");
1998
+ $[3] = t;
1999
+ $[4] = t1;
2000
+ } else {
2001
+ t1 = $[4];
2002
+ }
2003
+ let t2;
2004
+ if ($[5] !== t1) {
2005
+ t2 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: t1 });
2006
+ $[5] = t1;
2007
+ $[6] = t2;
2008
+ } else {
2009
+ t2 = $[6];
2010
+ }
2011
+ let t3;
2012
+ if ($[7] !== t) {
2013
+ t3 = t("user_management_paused_description");
2014
+ $[7] = t;
2015
+ $[8] = t3;
2016
+ } else {
2017
+ t3 = $[8];
2018
+ }
2019
+ let t4;
2020
+ if ($[9] !== t3) {
2021
+ t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: t3 });
2022
+ $[9] = t3;
2023
+ $[10] = t4;
2024
+ } else {
2025
+ t4 = $[10];
2026
+ }
2027
+ let t5;
2028
+ if ($[11] !== licenseStatus) {
2029
+ t5 = core.getLicenseSubscribeUrl(licenseStatus);
2030
+ $[11] = licenseStatus;
2031
+ $[12] = t5;
2032
+ } else {
2033
+ t5 = $[12];
2034
+ }
2035
+ let t6;
2036
+ if ($[13] !== linkLabel || $[14] !== t5) {
2037
+ t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { component: "a", href: t5, target: "_blank", rel: "noopener noreferrer", children: linkLabel });
2038
+ $[13] = linkLabel;
2039
+ $[14] = t5;
2040
+ $[15] = t6;
2041
+ } else {
2042
+ t6 = $[15];
2043
+ }
2044
+ let t7;
2045
+ if ($[16] !== t2 || $[17] !== t4 || $[18] !== t6) {
2046
+ t7 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { className: "flex flex-col items-start px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
2047
+ t2,
2048
+ t4,
2049
+ t6
2050
+ ] });
2051
+ $[16] = t2;
2052
+ $[17] = t4;
2053
+ $[18] = t6;
2054
+ $[19] = t7;
2055
+ } else {
2056
+ t7 = $[19];
2057
+ }
2058
+ return t7;
2059
+ }
1980
2060
  const RolesView = React.memo(function RolesView2(t0) {
1981
- const $ = reactCompilerRuntime.c(25);
2061
+ const $ = reactCompilerRuntime.c(33);
1982
2062
  const {
1983
2063
  children
1984
2064
  } = t0;
1985
2065
  const {
1986
2066
  t
1987
2067
  } = core.useTranslation();
2068
+ const paused = core.isProPaused(core.useLicenseStatus());
1988
2069
  const {
1989
2070
  collections
1990
2071
  } = core.useNavigationController();
@@ -2012,94 +2093,133 @@
2012
2093
  t2 = $[1];
2013
2094
  }
2014
2095
  const handleClose = t2;
2096
+ if (paused) {
2097
+ let t32;
2098
+ if ($[2] !== t) {
2099
+ t32 = t("roles");
2100
+ $[2] = t;
2101
+ $[3] = t32;
2102
+ } else {
2103
+ t32 = $[3];
2104
+ }
2105
+ let t42;
2106
+ if ($[4] !== t32) {
2107
+ t42 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "mt-12", component: "h4", children: t32 });
2108
+ $[4] = t32;
2109
+ $[5] = t42;
2110
+ } else {
2111
+ t42 = $[5];
2112
+ }
2113
+ let t52;
2114
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2115
+ t52 = /* @__PURE__ */ jsxRuntime.jsx(UserManagementPausedNotice, {});
2116
+ $[6] = t52;
2117
+ } else {
2118
+ t52 = $[6];
2119
+ }
2120
+ let t62;
2121
+ if ($[7] !== children || $[8] !== t42) {
2122
+ t62 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2123
+ children,
2124
+ t42,
2125
+ t52
2126
+ ] });
2127
+ $[7] = children;
2128
+ $[8] = t42;
2129
+ $[9] = t62;
2130
+ } else {
2131
+ t62 = $[9];
2132
+ }
2133
+ return t62;
2134
+ }
2015
2135
  let t3;
2016
- if ($[2] !== t) {
2136
+ if ($[10] !== t) {
2017
2137
  t3 = t("roles");
2018
- $[2] = t;
2019
- $[3] = t3;
2138
+ $[10] = t;
2139
+ $[11] = t3;
2020
2140
  } else {
2021
- t3 = $[3];
2141
+ t3 = $[11];
2022
2142
  }
2023
2143
  let t4;
2024
- if ($[4] !== t3) {
2144
+ if ($[12] !== t3) {
2025
2145
  t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t3 });
2026
- $[4] = t3;
2027
- $[5] = t4;
2146
+ $[12] = t3;
2147
+ $[13] = t4;
2028
2148
  } else {
2029
- t4 = $[5];
2149
+ t4 = $[13];
2030
2150
  }
2031
2151
  let t5;
2032
2152
  let t6;
2033
- if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2153
+ if ($[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2034
2154
  t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2035
2155
  t6 = () => setDialogOpen(true);
2036
- $[6] = t5;
2037
- $[7] = t6;
2156
+ $[14] = t5;
2157
+ $[15] = t6;
2038
2158
  } else {
2039
- t5 = $[6];
2040
- t6 = $[7];
2159
+ t5 = $[14];
2160
+ t6 = $[15];
2041
2161
  }
2042
2162
  let t7;
2043
- if ($[8] !== t) {
2163
+ if ($[16] !== t) {
2044
2164
  t7 = t("add_role");
2045
- $[8] = t;
2046
- $[9] = t7;
2165
+ $[16] = t;
2166
+ $[17] = t7;
2047
2167
  } else {
2048
- t7 = $[9];
2168
+ t7 = $[17];
2049
2169
  }
2050
2170
  let t8;
2051
- if ($[10] !== t7) {
2171
+ if ($[18] !== t7) {
2052
2172
  t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: t5, onClick: t6, children: t7 });
2053
- $[10] = t7;
2054
- $[11] = t8;
2173
+ $[18] = t7;
2174
+ $[19] = t8;
2055
2175
  } else {
2056
- t8 = $[11];
2176
+ t8 = $[19];
2057
2177
  }
2058
2178
  let t9;
2059
- if ($[12] !== t4 || $[13] !== t8) {
2179
+ if ($[20] !== t4 || $[21] !== t8) {
2060
2180
  t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2061
2181
  t4,
2062
2182
  t8
2063
2183
  ] });
2064
- $[12] = t4;
2065
- $[13] = t8;
2066
- $[14] = t9;
2184
+ $[20] = t4;
2185
+ $[21] = t8;
2186
+ $[22] = t9;
2067
2187
  } else {
2068
- t9 = $[14];
2188
+ t9 = $[22];
2069
2189
  }
2070
2190
  let t10;
2071
- if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2191
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2072
2192
  t10 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
2073
- $[15] = t10;
2193
+ $[23] = t10;
2074
2194
  } else {
2075
- t10 = $[15];
2195
+ t10 = $[23];
2076
2196
  }
2077
2197
  const t11 = selectedRole?.id ?? "new";
2078
2198
  let t12;
2079
- if ($[16] !== collections || $[17] !== dialogOpen || $[18] !== selectedRole || $[19] !== t11) {
2199
+ if ($[24] !== collections || $[25] !== dialogOpen || $[26] !== selectedRole || $[27] !== t11) {
2080
2200
  t12 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t11);
2081
- $[16] = collections;
2082
- $[17] = dialogOpen;
2083
- $[18] = selectedRole;
2084
- $[19] = t11;
2085
- $[20] = t12;
2201
+ $[24] = collections;
2202
+ $[25] = dialogOpen;
2203
+ $[26] = selectedRole;
2204
+ $[27] = t11;
2205
+ $[28] = t12;
2086
2206
  } else {
2087
- t12 = $[20];
2207
+ t12 = $[28];
2088
2208
  }
2089
2209
  let t13;
2090
- if ($[21] !== children || $[22] !== t12 || $[23] !== t9) {
2210
+ if ($[29] !== children || $[30] !== t12 || $[31] !== t9) {
2091
2211
  t13 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2092
2212
  children,
2093
2213
  t9,
2094
2214
  t10,
2095
2215
  t12
2096
2216
  ] });
2097
- $[21] = children;
2098
- $[22] = t12;
2099
- $[23] = t9;
2100
- $[24] = t13;
2217
+ $[29] = children;
2218
+ $[30] = t12;
2219
+ $[31] = t9;
2220
+ $[32] = t13;
2101
2221
  } else {
2102
- t13 = $[24];
2222
+ t13 = $[32];
2103
2223
  }
2104
2224
  return t13;
2105
2225
  });
@@ -2592,7 +2712,7 @@
2592
2712
  const authController = core.useAuthController();
2593
2713
  const snackbarController = core.useSnackbarController();
2594
2714
  const customizationController = core.useCustomizationController();
2595
- const dateUtilsLocale = customizationController?.locale ? locales__namespace[customizationController?.locale] : void 0;
2715
+ const dateUtilsLocale = core.useDateFnsLocale(customizationController?.locale);
2596
2716
  const dateFormat = customizationController?.dateTimeFormat ?? core.defaultDateFormat;
2597
2717
  const [userToBeDeleted, setUserToBeDeleted] = React.useState(void 0);
2598
2718
  const [deleteInProgress, setDeleteInProgress] = React.useState(false);
@@ -2887,13 +3007,14 @@
2887
3007
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2888
3008
  }
2889
3009
  const UsersView = function UsersView2(t0) {
2890
- const $ = reactCompilerRuntime.c(24);
3010
+ const $ = reactCompilerRuntime.c(32);
2891
3011
  const {
2892
3012
  children
2893
3013
  } = t0;
2894
3014
  const {
2895
3015
  t
2896
3016
  } = core.useTranslation();
3017
+ const paused = core.isProPaused(core.useLicenseStatus());
2897
3018
  const [dialogOpen, setDialogOpen] = React.useState(false);
2898
3019
  const [selectedUser, setSelectedUser] = React.useState();
2899
3020
  const [newFormKey, setNewFormKey] = React.useState(0);
@@ -2932,89 +3053,128 @@
2932
3053
  t3 = $[2];
2933
3054
  }
2934
3055
  const handleAddUser = t3;
3056
+ if (paused) {
3057
+ let t42;
3058
+ if ($[3] !== t) {
3059
+ t42 = t("users");
3060
+ $[3] = t;
3061
+ $[4] = t42;
3062
+ } else {
3063
+ t42 = $[4];
3064
+ }
3065
+ let t52;
3066
+ if ($[5] !== t42) {
3067
+ t52 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "mt-12", component: "h4", children: t42 });
3068
+ $[5] = t42;
3069
+ $[6] = t52;
3070
+ } else {
3071
+ t52 = $[6];
3072
+ }
3073
+ let t62;
3074
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3075
+ t62 = /* @__PURE__ */ jsxRuntime.jsx(UserManagementPausedNotice, {});
3076
+ $[7] = t62;
3077
+ } else {
3078
+ t62 = $[7];
3079
+ }
3080
+ let t72;
3081
+ if ($[8] !== children || $[9] !== t52) {
3082
+ t72 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
3083
+ children,
3084
+ t52,
3085
+ t62
3086
+ ] });
3087
+ $[8] = children;
3088
+ $[9] = t52;
3089
+ $[10] = t72;
3090
+ } else {
3091
+ t72 = $[10];
3092
+ }
3093
+ return t72;
3094
+ }
2935
3095
  let t4;
2936
- if ($[3] !== t) {
3096
+ if ($[11] !== t) {
2937
3097
  t4 = t("users");
2938
- $[3] = t;
2939
- $[4] = t4;
3098
+ $[11] = t;
3099
+ $[12] = t4;
2940
3100
  } else {
2941
- t4 = $[4];
3101
+ t4 = $[12];
2942
3102
  }
2943
3103
  let t5;
2944
- if ($[5] !== t4) {
3104
+ if ($[13] !== t4) {
2945
3105
  t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: t4 });
2946
- $[5] = t4;
2947
- $[6] = t5;
3106
+ $[13] = t4;
3107
+ $[14] = t5;
2948
3108
  } else {
2949
- t5 = $[6];
3109
+ t5 = $[14];
2950
3110
  }
2951
3111
  let t6;
2952
- if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3112
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2953
3113
  t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2954
- $[7] = t6;
3114
+ $[15] = t6;
2955
3115
  } else {
2956
- t6 = $[7];
3116
+ t6 = $[15];
2957
3117
  }
2958
3118
  let t7;
2959
- if ($[8] !== t) {
3119
+ if ($[16] !== t) {
2960
3120
  t7 = t("add_user");
2961
- $[8] = t;
2962
- $[9] = t7;
3121
+ $[16] = t;
3122
+ $[17] = t7;
2963
3123
  } else {
2964
- t7 = $[9];
3124
+ t7 = $[17];
2965
3125
  }
2966
3126
  let t8;
2967
- if ($[10] !== t7) {
3127
+ if ($[18] !== t7) {
2968
3128
  t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: t6, onClick: handleAddUser, children: t7 });
2969
- $[10] = t7;
2970
- $[11] = t8;
3129
+ $[18] = t7;
3130
+ $[19] = t8;
2971
3131
  } else {
2972
- t8 = $[11];
3132
+ t8 = $[19];
2973
3133
  }
2974
3134
  let t9;
2975
- if ($[12] !== t5 || $[13] !== t8) {
3135
+ if ($[20] !== t5 || $[21] !== t8) {
2976
3136
  t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2977
3137
  t5,
2978
3138
  t8
2979
3139
  ] });
2980
- $[12] = t5;
2981
- $[13] = t8;
2982
- $[14] = t9;
3140
+ $[20] = t5;
3141
+ $[21] = t8;
3142
+ $[22] = t9;
2983
3143
  } else {
2984
- t9 = $[14];
3144
+ t9 = $[22];
2985
3145
  }
2986
3146
  let t10;
2987
- if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3147
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2988
3148
  t10 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2989
- $[15] = t10;
3149
+ $[23] = t10;
2990
3150
  } else {
2991
- t10 = $[15];
3151
+ t10 = $[23];
2992
3152
  }
2993
3153
  const t11 = selectedUser?.uid ?? `new-${newFormKey}`;
2994
3154
  let t12;
2995
- if ($[16] !== dialogOpen || $[17] !== selectedUser || $[18] !== t11) {
3155
+ if ($[24] !== dialogOpen || $[25] !== selectedUser || $[26] !== t11) {
2996
3156
  t12 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t11);
2997
- $[16] = dialogOpen;
2998
- $[17] = selectedUser;
2999
- $[18] = t11;
3000
- $[19] = t12;
3157
+ $[24] = dialogOpen;
3158
+ $[25] = selectedUser;
3159
+ $[26] = t11;
3160
+ $[27] = t12;
3001
3161
  } else {
3002
- t12 = $[19];
3162
+ t12 = $[27];
3003
3163
  }
3004
3164
  let t13;
3005
- if ($[20] !== children || $[21] !== t12 || $[22] !== t9) {
3165
+ if ($[28] !== children || $[29] !== t12 || $[30] !== t9) {
3006
3166
  t13 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
3007
3167
  children,
3008
3168
  t9,
3009
3169
  t10,
3010
3170
  t12
3011
3171
  ] });
3012
- $[20] = children;
3013
- $[21] = t12;
3014
- $[22] = t9;
3015
- $[23] = t13;
3172
+ $[28] = children;
3173
+ $[29] = t12;
3174
+ $[30] = t9;
3175
+ $[31] = t13;
3016
3176
  } else {
3017
- t13 = $[23];
3177
+ t13 = $[31];
3018
3178
  }
3019
3179
  return t13;
3020
3180
  };
@@ -3102,6 +3262,10 @@
3102
3262
  const {
3103
3263
  t
3104
3264
  } = core.useTranslation();
3265
+ const licenseStatus = core.useLicenseStatus();
3266
+ if (core.isProPaused(licenseStatus)) {
3267
+ return null;
3268
+ }
3105
3269
  let t1;
3106
3270
  if ($[0] !== noRoles || $[1] !== noUsers || $[2] !== t) {
3107
3271
  t1 = noUsers && noRoles ? t("create_default_roles_and_add_admin") : noUsers ? t("add_current_user_as_admin") : noRoles ? t("create_default_roles") : void 0;