@rebasepro/core 0.0.1-canary.eae7889 → 0.0.1-canary.f81da60

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.
@@ -20,7 +20,7 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
20
20
  /**
21
21
  * Force filter to be applied to the table.
22
22
  */
23
- forceFilter?: FilterValues<string>;
23
+ fixedFilter?: FilterValues<string>;
24
24
  scrollRestoration?: ScrollRestorationController;
25
25
  /**
26
26
  * When set to true the filters and sort will be updated in the URL
@@ -39,7 +39,7 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
39
39
  * @param scrollRestoration
40
40
  * @param entitiesDisplayedFirst
41
41
  * @param lastDeleteTimestamp
42
- * @param forceFilterFromProps
42
+ * @param fixedFilterFromProps
43
43
  * @param updateUrl
44
44
  */
45
- export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp: _lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataTableControllerProps<M>): EntityTableController<M>;
45
+ export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp: _lastDeleteTimestamp, fixedFilter: fixedFilterFromProps, updateUrl }: DataTableControllerProps<M>): EntityTableController<M>;
@@ -19,7 +19,7 @@ export interface UseRelationSelectorProps<M extends Record<string, any> = any> {
19
19
  /**
20
20
  * Force filter to be applied to the relation search
21
21
  */
22
- forceFilter?: FilterValues<string>;
22
+ fixedFilter?: FilterValues<string>;
23
23
  /**
24
24
  * Page size for pagination
25
25
  */
@@ -49,4 +49,4 @@ export interface RelationSelectorController {
49
49
  /**
50
50
  * Hook to manage relation selection with data fetching from Rebase data source
51
51
  */
52
- export declare function useRelationSelector<M extends Record<string, any> = any>({ path, collection, forceFilter, pageSize, getLabelFromEntity, getDescriptionFromEntity, descriptionProperty }: UseRelationSelectorProps<M>): RelationSelectorController;
52
+ export declare function useRelationSelector<M extends Record<string, any> = any>({ path, collection, fixedFilter, pageSize, getLabelFromEntity, getDescriptionFromEntity, descriptionProperty }: UseRelationSelectorProps<M>): RelationSelectorController;
package/dist/index.es.js CHANGED
@@ -9,7 +9,7 @@ import { stripCollectionPath, canCreateEntity, canEditEntity, canDeleteEntity, c
9
9
  import { mergeDeep, slugify, hashString, isObject, isPlainObject, randomString } from "@rebasepro/utils";
10
10
  import { deepEqual } from "fast-equals";
11
11
  import { useTranslation as useTranslation$1, initReactI18next, I18nextProvider } from "react-i18next";
12
- import { AlertTriangleIcon, Wand2Icon, Trash2Icon, ChevronDownIcon, SettingsIcon, ChevronsLeftIcon, FolderIcon, UserIcon, TagIcon, ChevronsRightIcon, MoonIcon, SunIcon, SunMoonIcon, PlusIcon, PencilIcon, LogOutIcon, LanguagesIcon, CheckIcon, SearchIcon, XIcon, CircleUserIcon, MailIcon, ArrowLeftIcon, icons } from "lucide-react";
12
+ import { AlertTriangleIcon, Wand2Icon, Trash2Icon, ChevronDownIcon, SettingsIcon, ChevronsLeftIcon, FolderIcon, UserIcon, TagIcon, ChevronsRightIcon, MoonIcon, SunIcon, SunMoonIcon, PlusIcon, PencilIcon, LogOutIcon, LanguagesIcon, CheckIcon, CircleUserIcon, MailIcon, ArrowLeftIcon, icons } from "lucide-react";
13
13
  import i18next from "i18next";
14
14
  import Fuse from "fuse.js";
15
15
  import Compressor from "compressorjs";
@@ -581,7 +581,7 @@ const DEFAULT_PAGE_SIZE$2 = 10;
581
581
  function useRelationSelector({
582
582
  path,
583
583
  collection,
584
- forceFilter,
584
+ fixedFilter,
585
585
  pageSize = DEFAULT_PAGE_SIZE$2,
586
586
  getLabelFromEntity,
587
587
  getDescriptionFromEntity,
@@ -642,8 +642,8 @@ function useRelationSelector({
642
642
  setError(void 0);
643
643
  setLoading(true);
644
644
  const whereMap = {};
645
- if (forceFilter) {
646
- Object.entries(forceFilter).forEach(([key, value]) => {
645
+ if (fixedFilter) {
646
+ Object.entries(fixedFilter).forEach(([key, value]) => {
647
647
  if (value && Array.isArray(value)) {
648
648
  const [op, val] = value;
649
649
  const postgrestOp = op === "==" ? "eq" : op === "!=" ? "neq" : op === ">" ? "gt" : op === ">=" ? "gte" : op === "<" ? "lt" : op === "<=" ? "lte" : op === "in" ? "in" : op === "not-in" ? "nin" : op === "array-contains" ? "cs" : op === "array-contains-any" ? "csa" : "eq";
@@ -690,7 +690,7 @@ function useRelationSelector({
690
690
  };
691
691
  }
692
692
  unsubscribeRef.current = unsubscribe || null;
693
- }, [dataClient, path, forceFilter, limit, currentSearch, entityToRelationItem, cleanupSubscription, setLoading]);
693
+ }, [dataClient, path, fixedFilter, limit, currentSearch, entityToRelationItem, cleanupSubscription, setLoading]);
694
694
  const search = useCallback((searchString) => {
695
695
  if (searchTimeoutRef.current) {
696
696
  clearTimeout(searchTimeoutRef.current);
@@ -2334,7 +2334,7 @@ function hideAndExpandKeys(collection, keys) {
2334
2334
  if (key.includes(".")) {
2335
2335
  const rootKey = key.split(".")[0];
2336
2336
  const rootProperty = collection.properties[rootKey];
2337
- if (rootProperty && rootProperty.type === "map" && rootProperty.spreadChildren && rootProperty.properties) {
2337
+ if (rootProperty && rootProperty.type === "map" && rootProperty.ui?.spreadChildren && rootProperty.properties) {
2338
2338
  rootsWithExplicitChildren.add(rootKey);
2339
2339
  }
2340
2340
  }
@@ -2345,9 +2345,9 @@ function hideAndExpandKeys(collection, keys) {
2345
2345
  const property = collection.properties[key];
2346
2346
  if (property) {
2347
2347
  processedPropertyKeys.add(key);
2348
- if (property.hideFromCollection) return [null];
2349
- if (property.disabled && typeof property.disabled === "object" && property.disabled.hidden) return [null];
2350
- if (property.type === "map" && property.spreadChildren && property.properties) {
2348
+ if (property.ui?.hideFromCollection) return [null];
2349
+ if (property.ui?.disabled && typeof property.ui?.disabled === "object" && property.ui?.disabled.hidden) return [null];
2350
+ if (property.type === "map" && property.ui?.spreadChildren && property.properties) {
2351
2351
  if (rootsWithExplicitChildren.has(key)) {
2352
2352
  return [null];
2353
2353
  }
@@ -2357,7 +2357,7 @@ function hideAndExpandKeys(collection, keys) {
2357
2357
  }
2358
2358
  return [{
2359
2359
  key,
2360
- disabled: Boolean(property.disabled) || Boolean(property.readOnly)
2360
+ disabled: Boolean(property.ui?.disabled) || Boolean(property.ui?.readOnly)
2361
2361
  }];
2362
2362
  }
2363
2363
  if (key.includes(".")) {
@@ -2368,11 +2368,11 @@ function hideAndExpandKeys(collection, keys) {
2368
2368
  if (nestedProperty) {
2369
2369
  processedPropertyKeys.add(key);
2370
2370
  processedPropertyKeys.add(rootKey);
2371
- if (nestedProperty.hideFromCollection) return [null];
2372
- if (nestedProperty.disabled && typeof nestedProperty.disabled === "object" && nestedProperty.disabled.hidden) return [null];
2371
+ if (nestedProperty.ui?.hideFromCollection) return [null];
2372
+ if (nestedProperty.ui?.disabled && typeof nestedProperty.ui?.disabled === "object" && nestedProperty.ui?.disabled.hidden) return [null];
2373
2373
  return [{
2374
2374
  key,
2375
- disabled: Boolean(rootProperty.disabled) || Boolean(rootProperty.readOnly) || Boolean(nestedProperty.disabled) || Boolean(nestedProperty.readOnly)
2375
+ disabled: Boolean(rootProperty.ui?.disabled) || Boolean(rootProperty.ui?.readOnly) || Boolean(nestedProperty.ui?.disabled) || Boolean(nestedProperty.ui?.readOnly)
2376
2376
  }];
2377
2377
  }
2378
2378
  }
@@ -2400,9 +2400,9 @@ function hideAndExpandKeys(collection, keys) {
2400
2400
  if (processedPropertyKeys.has(propKey)) continue;
2401
2401
  const property = collection.properties[propKey];
2402
2402
  if (!property) continue;
2403
- if (property.hideFromCollection) continue;
2404
- if (property.disabled && typeof property.disabled === "object" && property.disabled.hidden) continue;
2405
- if (property.type === "map" && property.spreadChildren && property.properties) {
2403
+ if (property.ui?.hideFromCollection) continue;
2404
+ if (property.ui?.disabled && typeof property.ui?.disabled === "object" && property.ui?.disabled.hidden) continue;
2405
+ if (property.type === "map" && property.ui?.spreadChildren && property.properties) {
2406
2406
  const allChildConfigs = getColumnKeysForProperty(property, propKey);
2407
2407
  for (const childConfig of allChildConfigs) {
2408
2408
  if (!processedPropertyKeys.has(childConfig.key)) {
@@ -2413,7 +2413,7 @@ function hideAndExpandKeys(collection, keys) {
2413
2413
  } else {
2414
2414
  result.push({
2415
2415
  key: propKey,
2416
- disabled: Boolean(property.disabled) || Boolean(property.readOnly)
2416
+ disabled: Boolean(property.ui?.disabled) || Boolean(property.ui?.readOnly)
2417
2417
  });
2418
2418
  processedPropertyKeys.add(propKey);
2419
2419
  }
@@ -2436,12 +2436,12 @@ function getDefaultColumnKeys(collection, includeSubCollections) {
2436
2436
  return hideAndExpandKeys(collection, columnIds);
2437
2437
  }
2438
2438
  function getColumnKeysForProperty(property, key, disabled) {
2439
- if (property.type === "map" && property.spreadChildren && property.properties) {
2440
- return Object.entries(property.properties).flatMap(([childKey, childProperty]) => getColumnKeysForProperty(childProperty, `${key}.${childKey}`, disabled || Boolean(property.disabled) || Boolean(property.readOnly)));
2439
+ if (property.type === "map" && property.ui?.spreadChildren && property.properties) {
2440
+ return Object.entries(property.properties).flatMap(([childKey, childProperty]) => getColumnKeysForProperty(childProperty, `${key}.${childKey}`, disabled || Boolean(property.ui?.disabled) || Boolean(property.ui?.readOnly)));
2441
2441
  }
2442
2442
  return [{
2443
2443
  key,
2444
- disabled: disabled || Boolean(property.disabled) || Boolean(property.readOnly)
2444
+ disabled: disabled || Boolean(property.ui?.disabled) || Boolean(property.ui?.readOnly)
2445
2445
  }];
2446
2446
  }
2447
2447
  function getFormFieldKeys(collection) {
@@ -2468,17 +2468,17 @@ function useDataTableController({
2468
2468
  scrollRestoration,
2469
2469
  entitiesDisplayedFirst,
2470
2470
  lastDeleteTimestamp: _lastDeleteTimestamp,
2471
- forceFilter: forceFilterFromProps,
2471
+ fixedFilter: fixedFilterFromProps,
2472
2472
  updateUrl
2473
2473
  }) {
2474
2474
  const {
2475
- filter,
2475
+ defaultFilter,
2476
2476
  sort,
2477
- forceFilter: forceFilterFromCollection
2477
+ fixedFilter: fixedFilterFromCollection
2478
2478
  } = collection;
2479
2479
  const [popupCell, setPopupCell] = React.useState(void 0);
2480
2480
  const dataClient = useData();
2481
- const forceFilter = forceFilterFromProps ?? forceFilterFromCollection;
2481
+ const fixedFilter = fixedFilterFromProps ?? fixedFilterFromCollection;
2482
2482
  const paginationEnabled = collection.pagination === void 0 || Boolean(collection.pagination);
2483
2483
  const pageSize = typeof collection.pagination === "number" ? collection.pagination : DEFAULT_PAGE_SIZE;
2484
2484
  const [searchString, setSearchString] = React.useState();
@@ -2486,18 +2486,18 @@ function useDataTableController({
2486
2486
  return true;
2487
2487
  }, []);
2488
2488
  const sortInternal = useMemo(() => {
2489
- if (sort && forceFilter && !checkFilterCombination(forceFilter, sort)) {
2489
+ if (sort && fixedFilter && !checkFilterCombination(fixedFilter, sort)) {
2490
2490
  console.warn("Initial sort is not compatible with the force filter. Ignoring initial sort");
2491
2491
  return void 0;
2492
2492
  }
2493
2493
  return sort;
2494
- }, [sort, forceFilter]);
2494
+ }, [sort, fixedFilter]);
2495
2495
  const location = useLocation();
2496
2496
  const {
2497
2497
  filterValues: filterUrl,
2498
2498
  sortBy: sortUrl
2499
2499
  } = parseFilterAndSort(location.search);
2500
- const [filterValues_0, setFilterValues] = React.useState(forceFilter ?? (updateUrl ? filterUrl : void 0) ?? filter ?? void 0);
2500
+ const [filterValues_0, setFilterValues] = React.useState(fixedFilter ?? (updateUrl ? filterUrl : void 0) ?? defaultFilter ?? void 0);
2501
2501
  const [sortBy_0, setSortBy] = React.useState((updateUrl ? sortUrl : void 0) ?? sortInternal);
2502
2502
  const initialSearchRef = React.useRef(location.search);
2503
2503
  useEffect(() => {
@@ -2511,15 +2511,15 @@ function useDataTableController({
2511
2511
  filterValues: urlFilterValues,
2512
2512
  sortBy: urlSortBy
2513
2513
  } = parseFilterAndSort(location.search);
2514
- if (!forceFilter) {
2514
+ if (!fixedFilter) {
2515
2515
  setFilterValues(urlFilterValues);
2516
2516
  }
2517
- if (urlSortBy && forceFilter && !checkFilterCombination(forceFilter, urlSortBy)) {
2517
+ if (urlSortBy && fixedFilter && !checkFilterCombination(fixedFilter, urlSortBy)) {
2518
2518
  console.warn("URL sort is not compatible with the force filter.");
2519
2519
  } else {
2520
2520
  setSortBy(urlSortBy);
2521
2521
  }
2522
- }, [location.search, updateUrl, forceFilter, checkFilterCombination]);
2522
+ }, [location.search, updateUrl, fixedFilter, checkFilterCombination]);
2523
2523
  useUpdateUrl(filterValues_0, sortBy_0, searchString, updateUrl);
2524
2524
  const collectionScroll = scrollRestoration?.getCollectionScroll(path, filterValues_0);
2525
2525
  const initialItemCount = collectionScroll?.data.length ?? pageSize;
@@ -2553,9 +2553,9 @@ function useDataTableController({
2553
2553
  const [dataLoading, setDataLoading] = useState(false);
2554
2554
  const [dataLoadingError, setDataLoadingError] = useState();
2555
2555
  const [noMoreToLoad, setNoMoreToLoad] = useState(false);
2556
- const clearFilter = useCallback(() => setFilterValues(forceFilter ?? void 0), [forceFilter]);
2556
+ const clearFilter = useCallback(() => setFilterValues(fixedFilter ?? void 0), [fixedFilter]);
2557
2557
  const updateFilterValues = useCallback((updatedFilter) => {
2558
- if (forceFilter) {
2558
+ if (fixedFilter) {
2559
2559
  console.warn("Filter is not compatible with the force filter. Ignoring filter");
2560
2560
  return;
2561
2561
  }
@@ -2564,7 +2564,7 @@ function useDataTableController({
2564
2564
  } else {
2565
2565
  setFilterValues(updatedFilter);
2566
2566
  }
2567
- }, [forceFilter]);
2567
+ }, [fixedFilter]);
2568
2568
  useEffect(() => {
2569
2569
  setDataLoading(true);
2570
2570
  const onEntitiesUpdate = async (entities) => {
@@ -6041,14 +6041,7 @@ function UserSelectPopover({
6041
6041
  totalFilterable !== 1 ? "s" : ""
6042
6042
  ] })
6043
6043
  ] }),
6044
- /* @__PURE__ */ jsx("div", { className: cls("px-2 py-1.5 border-b shrink-0", defaultBorderMixin), children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
6045
- /* @__PURE__ */ jsx(SearchIcon, { size: "smallest", className: "absolute left-2 top-1/2 -translate-y-1/2 text-text-disabled dark:text-text-disabled-dark pointer-events-none" }),
6046
- /* @__PURE__ */ jsx("input", { ref: inputRef, type: "text", value: searchText, onChange: (e_0) => setSearchText(e_0.target.value), placeholder: "SearchIcon by name, email, or role…", className: cls("w-full pl-7 pr-7 py-1.5 text-xs rounded-md", "bg-surface-100 dark:bg-surface-950 border", defaultBorderMixin, "outline-none focus:ring-1 focus:ring-primary/40", "placeholder-text-disabled dark:placeholder-text-disabled-dark", "text-text-primary dark:text-text-primary-dark") }),
6047
- searchText && /* @__PURE__ */ jsx("button", { onClick: () => {
6048
- setSearchText("");
6049
- inputRef.current?.focus();
6050
- }, className: "absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-surface-200 dark:hover:bg-surface-700 text-text-disabled", children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.smallest }) })
6051
- ] }) }),
6044
+ /* @__PURE__ */ jsx("div", { className: cls("px-2 py-1.5 border-b shrink-0", defaultBorderMixin), children: /* @__PURE__ */ jsx(SearchBar, { inputRef, size: "smallest", placeholder: "Search by name, email, or role…", onTextSearch: (val) => setSearchText(val ?? "") }) }),
6052
6045
  /* @__PURE__ */ jsxs("div", { ref: listRef, className: "overflow-y-auto overscroll-contain", style: {
6053
6046
  maxHeight: MAX_VISIBLE_ITEMS * ITEM_HEIGHT
6054
6047
  }, children: [
@@ -6422,7 +6415,7 @@ function LoginView(t0) {
6422
6415
  const t8 = fadeIn ? "opacity-100" : "opacity-0";
6423
6416
  let t9;
6424
6417
  if ($[12] !== t8) {
6425
- t9 = cls("relative flex items-center justify-center h-screen w-screen p-4 transition-opacity duration-500 bg-white dark:bg-surface-950", t8);
6418
+ t9 = cls("relative flex items-center justify-center h-screen w-screen p-4 transition-opacity duration-500 bg-white dark:bg-surface-900", t8);
6426
6419
  $[12] = t8;
6427
6420
  $[13] = t9;
6428
6421
  } else {
@@ -6619,11 +6612,7 @@ function LoginView(t0) {
6619
6612
  mode === "buttons" && /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-3 mt-2", children: [
6620
6613
  /* @__PURE__ */ jsx(LoginButton, { disabled, text: "Sign in with email", icon: /* @__PURE__ */ jsx(MailIcon, {}), onClick: () => switchMode("login") }),
6621
6614
  hasGoogleLogin && googleClientId && /* @__PURE__ */ jsx(GoogleLoginButton, { disabled, googleClientId, authController }),
6622
- showRegistration && /* @__PURE__ */ jsx("div", { className: "mt-2 text-center", children: /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "secondary", children: [
6623
- "Don't have an account?",
6624
- " ",
6625
- /* @__PURE__ */ jsx("button", { type: "button", className: "font-semibold hover:underline cursor-pointer text-primary-600 dark:text-primary-400", onClick: () => switchMode("register"), children: "Create one" })
6626
- ] }) })
6615
+ showRegistration && /* @__PURE__ */ jsx(Button, { className: "w-full", variant: "filled", color: "primary", size: "large", onClick: () => switchMode("register"), children: "Create an account" })
6627
6616
  ] }),
6628
6617
  mode === "login" && /* @__PURE__ */ jsx(LoginForm, { authController, registrationMode: false, onClose: () => switchMode("buttons"), onForgotPassword: hasPasswordReset ? () => switchMode("forgot") : void 0, noUserComponent, disableSignupScreen, switchToRegister: showRegistration ? () => switchMode("register") : void 0 }),
6629
6618
  mode === "register" && /* @__PURE__ */ jsx(LoginForm, { authController, registrationMode: true, onClose: () => switchMode("buttons"), onForgotPassword: hasPasswordReset ? () => switchMode("forgot") : void 0, noUserComponent, disableSignupScreen, switchToLogin: () => switchMode("login") }),
@@ -6739,42 +6728,56 @@ function LoginButton(t0) {
6739
6728
  }
6740
6729
  return t4;
6741
6730
  }
6731
+ const GoogleIcon = () => {
6732
+ const $ = c(1);
6733
+ let t0;
6734
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6735
+ t0 = /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "20", height: "20", children: [
6736
+ /* @__PURE__ */ jsx("path", { fill: "#4285F4", d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }),
6737
+ /* @__PURE__ */ jsx("path", { fill: "#34A853", d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }),
6738
+ /* @__PURE__ */ jsx("path", { fill: "#FBBC05", d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }),
6739
+ /* @__PURE__ */ jsx("path", { fill: "#EA4335", d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })
6740
+ ] });
6741
+ $[0] = t0;
6742
+ } else {
6743
+ t0 = $[0];
6744
+ }
6745
+ return t0;
6746
+ };
6742
6747
  function GoogleLoginButton(t0) {
6743
- const $ = c(7);
6748
+ const $ = c(10);
6744
6749
  const {
6745
6750
  disabled,
6746
6751
  googleClientId,
6747
6752
  authController
6748
6753
  } = t0;
6754
+ const tokenClientRef = useRef(null);
6749
6755
  let t1;
6750
6756
  if ($[0] !== authController.googleLogin || $[1] !== googleClientId) {
6751
- t1 = async () => {
6757
+ t1 = () => {
6752
6758
  if (!authController.googleLogin) {
6753
6759
  return;
6754
6760
  }
6755
- try {
6756
- const google = window.google;
6757
- if (!google) {
6758
- console.error("Google Sign-In not loaded");
6759
- return;
6760
- }
6761
- google.accounts.id.initialize({
6762
- client_id: googleClientId,
6763
- callback: async (response) => {
6764
- ;
6765
- try {
6766
- await authController.googleLogin(response.credential);
6767
- } catch (t32) {
6768
- const err_0 = t32;
6769
- console.error("Google login error:", err_0);
6770
- }
6771
- }
6772
- });
6773
- google.accounts.id.prompt();
6774
- } catch (t22) {
6775
- const err = t22;
6776
- console.error("Google login error:", err);
6761
+ const google = window.google;
6762
+ if (!google || tokenClientRef.current) {
6763
+ return;
6777
6764
  }
6765
+ tokenClientRef.current = google.accounts.oauth2.initTokenClient({
6766
+ client_id: googleClientId,
6767
+ scope: "openid email profile",
6768
+ callback: async (response) => {
6769
+ if (response.error || !response.access_token) {
6770
+ console.error("Google login error:", response.error);
6771
+ return;
6772
+ }
6773
+ try {
6774
+ await authController.googleLogin(response.access_token, "accessToken");
6775
+ } catch (t22) {
6776
+ const err = t22;
6777
+ console.error("Google login error:", err);
6778
+ }
6779
+ }
6780
+ });
6778
6781
  };
6779
6782
  $[0] = authController.googleLogin;
6780
6783
  $[1] = googleClientId;
@@ -6782,32 +6785,46 @@ function GoogleLoginButton(t0) {
6782
6785
  } else {
6783
6786
  t1 = $[2];
6784
6787
  }
6785
- const handleGoogleLogin = t1;
6786
6788
  let t2;
6787
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6788
- t2 = /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center w-full gap-3 py-1", children: [
6789
- /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "20", height: "20", children: [
6790
- /* @__PURE__ */ jsx("path", { fill: "#4285F4", d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }),
6791
- /* @__PURE__ */ jsx("path", { fill: "#34A853", d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }),
6792
- /* @__PURE__ */ jsx("path", { fill: "#FBBC05", d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }),
6793
- /* @__PURE__ */ jsx("path", { fill: "#EA4335", d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })
6794
- ] }),
6795
- /* @__PURE__ */ jsx(Typography, { variant: "button", children: "Continue with Google" })
6796
- ] });
6797
- $[3] = t2;
6789
+ if ($[3] !== authController || $[4] !== googleClientId) {
6790
+ t2 = [googleClientId, authController];
6791
+ $[3] = authController;
6792
+ $[4] = googleClientId;
6793
+ $[5] = t2;
6798
6794
  } else {
6799
- t2 = $[3];
6795
+ t2 = $[5];
6800
6796
  }
6797
+ useEffect(t1, t2);
6801
6798
  let t3;
6802
- if ($[4] !== disabled || $[5] !== handleGoogleLogin) {
6803
- t3 = /* @__PURE__ */ jsx(Button, { disabled, className: "w-full", variant: "outlined", size: "large", onClick: handleGoogleLogin, children: t2 });
6804
- $[4] = disabled;
6805
- $[5] = handleGoogleLogin;
6799
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6800
+ t3 = () => {
6801
+ if (!tokenClientRef.current) {
6802
+ console.error("Google Sign-In not loaded");
6803
+ return;
6804
+ }
6805
+ tokenClientRef.current.requestAccessToken();
6806
+ };
6806
6807
  $[6] = t3;
6807
6808
  } else {
6808
6809
  t3 = $[6];
6809
6810
  }
6810
- return t3;
6811
+ const handleClick = t3;
6812
+ let t4;
6813
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6814
+ t4 = /* @__PURE__ */ jsx(GoogleIcon, {});
6815
+ $[7] = t4;
6816
+ } else {
6817
+ t4 = $[7];
6818
+ }
6819
+ let t5;
6820
+ if ($[8] !== disabled) {
6821
+ t5 = /* @__PURE__ */ jsx(LoginButton, { disabled, text: "Sign in with Google", icon: t4, onClick: handleClick });
6822
+ $[8] = disabled;
6823
+ $[9] = t5;
6824
+ } else {
6825
+ t5 = $[9];
6826
+ }
6827
+ return t5;
6811
6828
  }
6812
6829
  function LoginForm(t0) {
6813
6830
  const $ = c(67);
@@ -7025,7 +7042,7 @@ function LoginForm(t0) {
7025
7042
  const t22 = authController.authLoading || !email || !password;
7026
7043
  let t23;
7027
7044
  if ($[45] !== authController.authLoading || $[46] !== buttonLabel || $[47] !== t22) {
7028
- t23 = /* @__PURE__ */ jsx(LoadingButton, { type: "submit", variant: "filled", className: "w-full mt-1", size: "large", loading: authController.authLoading, disabled: t22, children: buttonLabel });
7045
+ t23 = /* @__PURE__ */ jsx(LoadingButton, { type: "submit", variant: "filled", color: "primary", className: "w-full mt-1", size: "large", loading: authController.authLoading, disabled: t22, children: buttonLabel });
7029
7046
  $[45] = authController.authLoading;
7030
7047
  $[46] = buttonLabel;
7031
7048
  $[47] = t22;
@@ -7791,6 +7808,10 @@ const en = {
7791
7808
  reset_password: "Reset Password",
7792
7809
  reset_password_success: "Password reset successfully",
7793
7810
  reset_password_confirmation: "Are you sure you want to reset this user's password?",
7811
+ /** Permission-denied empty states */
7812
+ no_permission_to_view_users: "You don't have permission to view users",
7813
+ no_permission_to_view_roles: "You don't have permission to view roles",
7814
+ no_permission_description: "Contact an administrator if you need access to this section.",
7794
7815
  error_resetting_password: "Error resetting password",
7795
7816
  /** Editor table-bubble */
7796
7817
  add_row_before: "Add row before",
@@ -8335,6 +8356,9 @@ const es = {
8335
8356
  delete_user_confirmation: "¿Estás seguro de que quieres eliminar a este usuario?",
8336
8357
  create_your_users_and_roles: "Crea tus usuarios y roles",
8337
8358
  no_users_or_roles_defined: "No tienes usuarios ni roles. Puedes crear los roles por defecto y añadirte a ti mismo como administrador.",
8359
+ no_permission_to_view_users: "No tienes permisos para ver los usuarios",
8360
+ no_permission_to_view_roles: "No tienes permisos para ver los roles",
8361
+ no_permission_description: "Contacta a un administrador si necesitas acceso a esta sección.",
8338
8362
  save_before_changing_schema: "Debes guardar el documento antes de cambiar el esquema",
8339
8363
  edit_schema_for_this_form: "Editar esquema para este formulario",
8340
8364
  no_permissions_to_edit_collection: "No tienes permisos para editar esta colección",
@@ -9179,6 +9203,9 @@ const de = {
9179
9203
  delete_user_confirmation: "Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?",
9180
9204
  create_your_users_and_roles: "Erstellen Sie Ihre Benutzer und Rollen",
9181
9205
  no_users_or_roles_defined: "Sie haben keine Benutzer oder Rollen definiert. Sie können Standardrollen erstellen und den aktuellen Benutzer als Administrator hinzufügen.",
9206
+ no_permission_to_view_users: "Sie haben keine Berechtigung, Benutzer anzuzeigen",
9207
+ no_permission_to_view_roles: "Sie haben keine Berechtigung, Rollen anzuzeigen",
9208
+ no_permission_description: "Wenden Sie sich an einen Administrator, wenn Sie Zugang zu diesem Bereich benötigen.",
9182
9209
  save_before_changing_schema: "Sie müssen das Dokument speichern, bevor Sie das Schema ändern können",
9183
9210
  edit_schema_for_this_form: "Schema für dieses Formular bearbeiten",
9184
9211
  no_permissions_to_edit_collection: "Sie haben keine Berechtigung, diese Sammlung zu bearbeiten",
@@ -10020,6 +10047,9 @@ const fr = {
10020
10047
  delete_user_confirmation: "Êtes-vous sûr de vouloir supprimer cet utilisateur ?",
10021
10048
  create_your_users_and_roles: "Créez vos utilisateurs et rôles",
10022
10049
  no_users_or_roles_defined: "Vous n'avez défini aucun utilisateur ni rôle. Vous pouvez créer les rôles par défaut et ajouter l'utilisateur actuel en tant qu'administrateur.",
10050
+ no_permission_to_view_users: "Vous n'avez pas la permission de voir les utilisateurs",
10051
+ no_permission_to_view_roles: "Vous n'avez pas la permission de voir les rôles",
10052
+ no_permission_description: "Contactez un administrateur si vous avez besoin d'accéder à cette section.",
10023
10053
  save_before_changing_schema: "Vous devez enregistrer le document avant de modifier le schéma",
10024
10054
  edit_schema_for_this_form: "Modifier le schéma de ce formulaire",
10025
10055
  no_permissions_to_edit_collection: "Vous n'avez pas l'autorisation de modifier cette collection",
@@ -10861,6 +10891,9 @@ const it = {
10861
10891
  delete_user_confirmation: "Sei sicuro di voler eliminare questo utente?",
10862
10892
  create_your_users_and_roles: "Crea i tuoi utenti e ruoli",
10863
10893
  no_users_or_roles_defined: "Non hai definito né utenti né ruoli. Puoi creare ruoli predefiniti e aggiungere l'utente corrente come amministratore.",
10894
+ no_permission_to_view_users: "Non hai i permessi per visualizzare gli utenti",
10895
+ no_permission_to_view_roles: "Non hai i permessi per visualizzare i ruoli",
10896
+ no_permission_description: "Contatta un amministratore se hai bisogno di accedere a questa sezione.",
10864
10897
  save_before_changing_schema: "Devi salvare il documento prima di modificare lo schema",
10865
10898
  edit_schema_for_this_form: "Modifica lo schema per questo modulo",
10866
10899
  no_permissions_to_edit_collection: "Non hai i permessi per modificare questa collezione",
@@ -11702,6 +11735,9 @@ const hi = {
11702
11735
  delete_user_confirmation: "क्या आप वाकई इस उपयोगकर्ता को हटाना चाहते हैं?",
11703
11736
  create_your_users_and_roles: "अपने उपयोगकर्ता और भूमिकाएँ बनाएँ",
11704
11737
  no_users_or_roles_defined: "आपके पास कोई उपयोगकर्ता या भूमिका परिभाषित नहीं है। आप डिफ़ॉल्ट भूमिकाएँ बना सकते हैं और वर्तमान उपयोगकर्ता को एडमिन के रूप में जोड़ सकते हैं।",
11738
+ no_permission_to_view_users: "आपको उपयोगकर्ताओं को देखने की अनुमति नहीं है",
11739
+ no_permission_to_view_roles: "आपको भूमिकाओं को देखने की अनुमति नहीं है",
11740
+ no_permission_description: "यदि आपको इस अनुभाग तक पहुँच की आवश्यकता है तो किसी व्यवस्थापक से संपर्क करें।",
11705
11741
  save_before_changing_schema: "स्कीमा बदलने से पहले आपको दस्तावेज़ सहेजना होगा",
11706
11742
  edit_schema_for_this_form: "इस फॉर्म के लिए स्कीमा संपादित करें",
11707
11743
  no_permissions_to_edit_collection: "आपके पास इस संग्रह को संपादित करने की अनुमति नहीं है",
@@ -12543,6 +12579,9 @@ const pt = {
12543
12579
  delete_user_confirmation: "Tem a certeza de que quer eliminar este utilizador?",
12544
12580
  create_your_users_and_roles: "Crie os seus utilizadores e funções",
12545
12581
  no_users_or_roles_defined: "Não tem utilizadores ou funções definidas. Pode criar funções predefinidas e adicionar o utilizador atual como administrador.",
12582
+ no_permission_to_view_users: "Não tem permissão para ver os utilizadores",
12583
+ no_permission_to_view_roles: "Não tem permissão para ver as funções",
12584
+ no_permission_description: "Contacte um administrador se precisar de acesso a esta secção.",
12546
12585
  save_before_changing_schema: "Precisa de guardar o documento antes de alterar o esquema",
12547
12586
  edit_schema_for_this_form: "Editar esquema para este formulário",
12548
12587
  no_permissions_to_edit_collection: "Não tem permissões para editar esta coleção",
@@ -14279,7 +14318,7 @@ function getEntityTitlePropertyKey(collection, propertyConfigs) {
14279
14318
  const property = collection.properties[key];
14280
14319
  if (!isPropertyBuilder(property)) {
14281
14320
  const prop = property;
14282
- if (prop.type === "string" && !prop.multiline && !prop.markdown && !prop.storage && !prop.isId) {
14321
+ if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
14283
14322
  return key;
14284
14323
  }
14285
14324
  }
@@ -14476,7 +14515,8 @@ const NOOP_COLLECTION_REGISTRY = {
14476
14515
  getCollection: () => void 0,
14477
14516
  getRawCollection: () => void 0,
14478
14517
  getParentReferencesFromPath: () => [],
14479
- getParentCollectionIds: () => [],
14518
+ getParentCollectionSlugs: () => [],
14519
+ getParentEntityIds: () => [],
14480
14520
  convertIdsToPaths: () => [],
14481
14521
  initialised: false
14482
14522
  };