@abpjs/ui 0.2.0-next.17 → 0.2.0-next.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0-next.19
4
+
5
+ A prerelease under npm's `next` tag.
6
+
7
+ - guard: `guardPages(options)`, the five `SettingsPage` entries (accounts, groups, directories, sign-up, anonymous
8
+ access) on a base path, each drawing its list or item from the catch-all's path; `directories: false` for a server
9
+ with Guard's directories off. Sign-up reads its directories from its settings (AbpGuard 0.8.3; `/directories` before
10
+ it), and `directoriesPage` drops the hint about a page the host doesn't have. No Delete on the system groups
11
+ (`isSystemGroup`). A merge's `?into=` is read so the server and the browser render it alike.
12
+
13
+ ## 0.2.0-next.18
14
+
15
+ A prerelease under npm's `next` tag.
16
+
17
+ - `AbpProvider`'s `useServerInsertedHTML`: a framework's hook for HTML in the page's head while it streams (Next's).
18
+ With it, Emotion's styles go to the head on the server (`EmotionRegistry`), so the first render hydrates without a
19
+ mismatch where Chakra's global styles met next-themes' script. Without it, nothing changes. `@emotion/cache` is a
20
+ dependency.
21
+ - `AbpLabelsInput`, what `AbpProvider`'s `labels` takes: any label, and any of a group's (`queryList`,
22
+ `translations`, `picker`), the rest the defaults, so a group the package adds needs nothing from a host that doesn't
23
+ use it.
24
+
3
25
  ## 0.2.0-next.17
4
26
 
5
27
  A prerelease under npm's `next` tag.
package/dist/guard.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { ListSource } from '@abpjs/ui';
3
+ import { ListSource, SettingsPage, AbpHost } from '@abpjs/ui';
4
4
 
5
5
  interface components {
6
6
  schemas: {
@@ -426,6 +426,7 @@ interface components {
426
426
  names?: {
427
427
  [key: string]: string;
428
428
  };
429
+ system?: boolean;
429
430
  };
430
431
  GroupMemberDto: {
431
432
  memberType: string;
@@ -1053,6 +1054,11 @@ interface components {
1053
1054
  SessionTicketInput: {
1054
1055
  ticket: null | string;
1055
1056
  };
1057
+ SignUpDirectoryDto: {
1058
+ /** Format: uuid */
1059
+ id: string;
1060
+ name: string;
1061
+ };
1056
1062
  SignUpInfoDto: {
1057
1063
  enabled: boolean;
1058
1064
  emailDomains: string[];
@@ -1071,6 +1077,7 @@ interface components {
1071
1077
  directoryId: null | string;
1072
1078
  directoryName: null | string;
1073
1079
  emailDomains: string[];
1080
+ directories?: components["schemas"]["SignUpDirectoryDto"][];
1074
1081
  };
1075
1082
  SignUpSettingsInput: {
1076
1083
  enabled: boolean;
@@ -1175,6 +1182,7 @@ type AppEnrolmentDto = Schemas['AppEnrolmentDto'];
1175
1182
  type SecondFactorSenderDto = Schemas['SecondFactorSenderDto'];
1176
1183
  type SignUpSettingsDto = Schemas['SignUpSettingsDto'];
1177
1184
  type SignUpSettingsInput = Schemas['SignUpSettingsInput'];
1185
+ type SignUpDirectoryDto = Schemas['SignUpDirectoryDto'];
1178
1186
  type AnonymousGrantDto = Schemas['AnonymousGrantDto'];
1179
1187
  type AccountPage = Schemas['PagedResultDtoOfAccountDto'];
1180
1188
  type GroupPage = Schemas['PagedResultDtoOfGroupDto'];
@@ -1357,6 +1365,8 @@ declare function DuplicatesPanel({ routes }: {
1357
1365
  routes?: GuardRoutes;
1358
1366
  }): react.JSX.Element | null;
1359
1367
 
1368
+ /** Whether a group is AbpGuard's own: the group says so (AbpGuard.HttpApi 0.8.3); the known ids before. Goes to `system` alone once 0.8.3 is the minimum. */
1369
+ declare function isSystemGroup(group: GroupDto): boolean;
1360
1370
  interface GroupScreenProps {
1361
1371
  id: string;
1362
1372
  routes?: GuardRoutes;
@@ -1436,7 +1446,10 @@ declare function MergesPanel({ accountId, merges, onChange, routes }: MergesPane
1436
1446
  interface MergeScreenProps {
1437
1447
  /** The account to merge into another. */
1438
1448
  id: string;
1439
- /** The account to merge it into, when the link names one (the duplicates list's): picked already. */
1449
+ /**
1450
+ * The account to merge it into, when the link names one (the duplicates list's): picked already. It may come after the
1451
+ * first render (a host reading the address in the browser only); it's picked then, unless the person picked someone.
1452
+ */
1440
1453
  into?: string | null;
1441
1454
  routes?: GuardRoutes;
1442
1455
  }
@@ -1468,6 +1481,27 @@ declare function MySecondFactorsPanel({ setUpNow, onSetUpChosen, onChange }: MyS
1468
1481
  */
1469
1482
  declare function useWrittenName(): (name: string, names?: Record<string, string> | null) => string;
1470
1483
 
1484
+ type GuardPageKey = 'accounts' | 'groups' | 'directories' | 'signup' | 'anonymous';
1485
+ /**
1486
+ * The area's settings pages for a host to file under its sections: `guard.accounts`, `guard.groups`,
1487
+ * `guard.directories`, `guard.signup` and `guard.anonymous`, under `base` (`/admin` by default: `/admin/accounts`…).
1488
+ * Each is drawn by the host's catch-all route with the path after its address: a list, then one item
1489
+ * (`/admin/accounts/{id}`, `/admin/accounts/{id}/merge`, `/admin/groups/{id}`, `/admin/directories/{id}`), so the links
1490
+ * between them are `guardRoutes(base)`'s. Who sees them is the host's `guard.site.admin` when `host` is given;
1491
+ * `directories: false` (AbpGuard's Directories feature off) leaves the directories page out and sign-up's hint about
1492
+ * it. The titles are the area's English words unless given; the server checks every call anyway.
1493
+ */
1494
+ declare function guardPages(options: {
1495
+ section: string;
1496
+ base?: string;
1497
+ weight?: number;
1498
+ titles?: Partial<Record<GuardPageKey, string>>;
1499
+ about?: Partial<Record<GuardPageKey, string>>;
1500
+ directories?: boolean;
1501
+ visible?: SettingsPage['visible'];
1502
+ host?: Pick<AbpHost, 'can'>;
1503
+ }): SettingsPage[];
1504
+
1471
1505
  /** The authenticator app's base32 key in groups of four, easier to type into an app. */
1472
1506
  declare function groupedKey(secret: string): string;
1473
1507
  /**
@@ -1503,12 +1537,21 @@ declare function RecoveryCodes({ codes, onSaved, savedLabel }: {
1503
1537
  savedLabel?: string;
1504
1538
  }): react.JSX.Element;
1505
1539
 
1540
+ interface SignUpScreenProps {
1541
+ /**
1542
+ * Whether the host shows AbpGuard's Directories page (its Directories feature on), so the hint may point to it for
1543
+ * adding an internal directory; true by default.
1544
+ */
1545
+ directoriesPage?: boolean;
1546
+ }
1506
1547
  /**
1507
1548
  * Sign-up, for site admins: off by default. On, people create their own accounts in the internal directory chosen
1508
1549
  * here, optionally only with an email in some domains; an account is active once its email is confirmed. Which places
1509
- * they may use is a grant like any other, to that directory's "everyone" group.
1550
+ * they may use is a grant like any other, to that directory's "everyone" group. The directories to choose from come
1551
+ * with the settings (AbpGuard.HttpApi 0.8.3), so the page works with the Directories feature off; from an older
1552
+ * server, from the directories' list.
1510
1553
  */
1511
- declare function SignUpScreen(): react.JSX.Element;
1554
+ declare function SignUpScreen({ directoriesPage }?: SignUpScreenProps): react.JSX.Element;
1512
1555
 
1513
1556
  /** What AbpGuard says of a person's strong factor (`me.strongFactor`): whether they have one, and by when they must. */
1514
1557
  interface StrongFactorState {
@@ -1562,4 +1605,4 @@ declare function useGuardNs(namespace: string): GuardText;
1562
1605
  */
1563
1606
  declare function withParts(text: string, parts: Record<string, ReactNode>): ReactNode;
1564
1607
 
1565
- export { type AccountAction, type AccountCanDto, type AccountDetailDto, type AccountDto, type AccountEmailsDto, AccountEmailsPanel, type AccountEmailsPanelProps, type AccountMergeDto, type AccountNameDto, AccountNameEditor, type AccountNameEditorProps, type AccountPage, AccountScreen, type AccountScreenProps, AccountSecondFactorPanel, type AccountSecondFactorPanelProps, type AccountStatus, AccountStatusPill, type AccountSummaryDto, AccountsScreen, type AccountsScreenProps, type AnonymousGrantDto, AnonymousScreen, type AppEnrolmentDto, AppSetup, type AppSetupProps, CodeInput, type ConnectionTestResult, CountList, CreateAccountPanel, CreateGroupPanel, DirectoriesScreen, type DirectoryDto, DirectoryForm, type DirectoryFormProps, type DirectoryInput, DirectoryScreen, type DirectorySettingDefinition, type DirectoryTypeDto, DirectoryWarnings, type DuplicateDto, DuplicatesPanel, type EffectiveGroupDto, type EffectiveMemberDto, FlagPill, type GroupDetailDto, type GroupDto, type GroupMemberDto, type GroupPage, GroupScreen, type GroupScreenProps, GroupTree, type GroupTreeProps, GroupTwoFactorPanel, GroupsScreen, type GroupsScreenProps, type GuardRoutes, type GuardText, type GuardTypes, type IdentityDto, type MergeCountDto, type MergePreviewDto, MergeScreen, type MergeScreenProps, MergesPanel, type MergesPanelProps, type MySecondFactorsDto, MySecondFactorsPanel, type MySecondFactorsPanelProps, PassFail, type PluginState, PluginStatePill, RecoveryCodes, type SecondFactorDto, type SecondFactorSenderDto, SignUpScreen, type SignUpSettingsDto, type SignUpSettingsInput, StrongFactorBanner, type StrongFactorState, SyncResultPill, type SyncRunDto, SyncStatus, TWO_FACTOR_MODES, type TestLoginResult, type TestLoginStepName, groupedKey, guardRoutes, num, useAccountCan, useCountLabel, useGuardNs, useGuardTexts, usePartLabel, useSenderName, useWrittenName, withParts };
1608
+ export { type AccountAction, type AccountCanDto, type AccountDetailDto, type AccountDto, type AccountEmailsDto, AccountEmailsPanel, type AccountEmailsPanelProps, type AccountMergeDto, type AccountNameDto, AccountNameEditor, type AccountNameEditorProps, type AccountPage, AccountScreen, type AccountScreenProps, AccountSecondFactorPanel, type AccountSecondFactorPanelProps, type AccountStatus, AccountStatusPill, type AccountSummaryDto, AccountsScreen, type AccountsScreenProps, type AnonymousGrantDto, AnonymousScreen, type AppEnrolmentDto, AppSetup, type AppSetupProps, CodeInput, type ConnectionTestResult, CountList, CreateAccountPanel, CreateGroupPanel, DirectoriesScreen, type DirectoryDto, DirectoryForm, type DirectoryFormProps, type DirectoryInput, DirectoryScreen, type DirectorySettingDefinition, type DirectoryTypeDto, DirectoryWarnings, type DuplicateDto, DuplicatesPanel, type EffectiveGroupDto, type EffectiveMemberDto, FlagPill, type GroupDetailDto, type GroupDto, type GroupMemberDto, type GroupPage, GroupScreen, type GroupScreenProps, GroupTree, type GroupTreeProps, GroupTwoFactorPanel, GroupsScreen, type GroupsScreenProps, type GuardPageKey, type GuardRoutes, type GuardText, type GuardTypes, type IdentityDto, type MergeCountDto, type MergePreviewDto, MergeScreen, type MergeScreenProps, MergesPanel, type MergesPanelProps, type MySecondFactorsDto, MySecondFactorsPanel, type MySecondFactorsPanelProps, PassFail, type PluginState, PluginStatePill, RecoveryCodes, type SecondFactorDto, type SecondFactorSenderDto, type SignUpDirectoryDto, SignUpScreen, type SignUpScreenProps, type SignUpSettingsDto, type SignUpSettingsInput, StrongFactorBanner, type StrongFactorState, SyncResultPill, type SyncRunDto, SyncStatus, TWO_FACTOR_MODES, type TestLoginResult, type TestLoginStepName, groupedKey, guardPages, guardRoutes, isSystemGroup, num, useAccountCan, useCountLabel, useGuardNs, useGuardTexts, usePartLabel, useSenderName, useWrittenName, withParts };
package/dist/guard.js CHANGED
@@ -205,6 +205,7 @@ var ar_default = {
205
205
  "signUpSettings.enabled": "\u064A\u0645\u0643\u0646 \u0644\u0644\u0646\u0627\u0633 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",
206
206
  "signUpSettings.directory": "\u0627\u0644\u062F\u0644\u064A\u0644",
207
207
  "signUpSettings.directoryHint": "\u062A\u064F\u0646\u0634\u0623 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u062F\u0644\u064A\u0644 \u0627\u0644\u062F\u0627\u062E\u0644\u064A. \u0623\u0636\u0641 \u062F\u0644\u064A\u0644\u064B\u0627 \u0645\u062B\u0644 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0645\u0646 \u0627\u0644\u0623\u062F\u0644\u0629.",
208
+ "signUpSettings.directoryHintPlain": "\u062A\u064F\u0646\u0634\u0623 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u062F\u0644\u064A\u0644 \u0627\u0644\u062F\u0627\u062E\u0644\u064A.",
208
209
  "signUpSettings.chooseDirectory": "\u0627\u062E\u062A\u0631 \u062F\u0644\u064A\u0644\u064B\u0627",
209
210
  "signUpSettings.domains": "\u0646\u0637\u0627\u0642\u0627\u062A \u0627\u0644\u0628\u0631\u064A\u062F",
210
211
  "signUpSettings.domainsHint": "\u0644\u0627 \u064A\u0633\u062C\u0644 \u0625\u0644\u0627 \u0623\u0635\u062D\u0627\u0628 \u0647\u0630\u0647 \u0627\u0644\u0646\u0637\u0627\u0642\u0627\u062A\u061B \u0627\u0644\u0641\u0627\u0631\u063A \u064A\u0642\u0628\u0644 \u0623\u064A\u064B\u0627 \u0645\u0646\u0647\u0627. \u0627\u0641\u0635\u0644 \u0628\u064A\u0646\u0647\u0627 \u0628\u0641\u0648\u0627\u0635\u0644.",
@@ -629,6 +630,7 @@ var en_default = {
629
630
  "signUpSettings.enabled": "People may sign up",
630
631
  "signUpSettings.directory": "Directory",
631
632
  "signUpSettings.directoryHint": "Sign-ups are created in this internal directory. Add one such as Customers under Directories.",
633
+ "signUpSettings.directoryHintPlain": "Sign-ups are created in this internal directory.",
632
634
  "signUpSettings.chooseDirectory": "Choose a directory",
633
635
  "signUpSettings.domains": "Email domains",
634
636
  "signUpSettings.domainsHint": "Only these domains may sign up; empty takes any. Separate them with commas.",
@@ -2406,6 +2408,10 @@ function GroupTwoFactorPanel({ group, onSaved }) {
2406
2408
 
2407
2409
  // src/areas/guard/GroupScreen.tsx
2408
2410
  import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
2411
+ var SYSTEM_GROUPS = ["00000000-0000-0000-0000-00000000a001", "00000000-0000-0000-0000-00000000a002"];
2412
+ function isSystemGroup(group) {
2413
+ return group.system ?? SYSTEM_GROUPS.includes(group.id);
2414
+ }
2409
2415
  function GroupScreen({ id, routes = guardRoutes() }) {
2410
2416
  const t = useGuardNs("groupDetail");
2411
2417
  const tg = useGuardNs("groups");
@@ -2505,7 +2511,7 @@ function GroupScreen({ id, routes = guardRoutes() }) {
2505
2511
  !group ? /* @__PURE__ */ jsx15(StatusPill9, {}) : group.writable ? /* @__PURE__ */ jsx15(StatusPill9, { tone: "success", children: t("writable") }) : /* @__PURE__ */ jsx15(StatusPill9, { children: tg("readOnly") }),
2506
2512
  group && group.twoFactor && group.twoFactor !== "off" && /* @__PURE__ */ jsx15(StatusPill9, { tone: "accent", "data-testid": "group-two-factor-pill", children: tf("pill", { mode: tf(`modes.${group.twoFactor}`) }) })
2507
2513
  ] }),
2508
- actions: (!group || group.isLocal && !group.computed) && /* @__PURE__ */ jsx15(Button10, { danger: true, onClick: deleteGroup, disabled: action.busy, children: t("delete") })
2514
+ actions: (!group || group.isLocal && !group.computed && !isSystemGroup(group)) && /* @__PURE__ */ jsx15(Button10, { danger: true, onClick: deleteGroup, disabled: action.busy, children: t("delete") })
2509
2515
  }
2510
2516
  ),
2511
2517
  /* @__PURE__ */ jsxs15(Stack11, { gap: "section", children: [
@@ -2897,7 +2903,7 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
2897
2903
  }
2898
2904
 
2899
2905
  // src/areas/guard/MergeScreen.tsx
2900
- import { useEffect as useEffect2, useState as useState11 } from "react";
2906
+ import { useEffect as useEffect2, useRef, useState as useState11 } from "react";
2901
2907
  import { HStack as HStack15, Input as Input7, SimpleGrid as SimpleGrid4, Stack as Stack13, Text as Text16 } from "@chakra-ui/react";
2902
2908
  import {
2903
2909
  boneWidth,
@@ -2930,16 +2936,23 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
2930
2936
  const request = useAreaRequest14("guard");
2931
2937
  const source = useApiQuery10("guard", `/accounts/${id}`);
2932
2938
  const [survivor, setSurvivor] = useState11(null);
2939
+ const pickedByHand = useRef(false);
2933
2940
  const [preview, setPreview] = useState11(null);
2934
2941
  const [confirm, setConfirm] = useState11("");
2935
2942
  const loading = useApiAction9();
2936
2943
  const merging = useApiAction9();
2937
2944
  useEffect2(() => {
2938
2945
  if (!into) return;
2946
+ let live = true;
2939
2947
  request(`/accounts/${into}`).then(
2940
- (d) => setSurvivor(d.account),
2948
+ (d) => {
2949
+ if (live && !pickedByHand.current) setSurvivor(d.account);
2950
+ },
2941
2951
  () => void 0
2942
2952
  );
2953
+ return () => {
2954
+ live = false;
2955
+ };
2943
2956
  }, [into, request]);
2944
2957
  useEffect2(() => {
2945
2958
  setPreview(null);
@@ -2986,7 +2999,10 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
2986
2999
  {
2987
3000
  "aria-label": t("survivor"),
2988
3001
  value: survivor,
2989
- onChange: setSurvivor,
3002
+ onChange: (picked) => {
3003
+ pickedByHand.current = true;
3004
+ setSurvivor(picked);
3005
+ },
2990
3006
  search,
2991
3007
  known: [],
2992
3008
  getId: (a) => a.id,
@@ -3454,17 +3470,21 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
3454
3470
  ] });
3455
3471
  }
3456
3472
 
3473
+ // src/areas/guard/pages.tsx
3474
+ import { useSyncExternalStore } from "react";
3475
+
3457
3476
  // src/areas/guard/SignUpScreen.tsx
3458
3477
  import { useEffect as useEffect5, useState as useState14 } from "react";
3459
3478
  import { HStack as HStack18, Input as Input10, Stack as Stack16 } from "@chakra-ui/react";
3460
3479
  import { Button as Button15, Field as Field9, InlineAlert as InlineAlert16, notify as notify12, PageHeader as PageHeader9, Panel as Panel15, SelectField as SelectField4, SwitchField, useApiAction as useApiAction10, useApiQuery as useApiQuery12, useAreaRequest as useAreaRequest16 } from "@abpjs/ui";
3461
3480
  import { splitList as splitList3 } from "@abpjs/ui/rules";
3462
3481
  import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
3463
- function SignUpScreen() {
3482
+ function SignUpScreen({ directoriesPage = true } = {}) {
3464
3483
  const t = useGuardNs("signUpSettings");
3465
3484
  const request = useAreaRequest16("guard");
3466
3485
  const settings = useApiQuery12("guard", "/signup/settings");
3467
- const directories = useApiQuery12("guard", "/directories");
3486
+ const older = settings.data != null && settings.data.directories == null;
3487
+ const directories = useApiQuery12("guard", older ? "/directories" : null);
3468
3488
  const action = useApiAction10();
3469
3489
  const [form, setForm] = useState14({ enabled: false, directoryId: "", domains: "" });
3470
3490
  useEffect5(() => {
@@ -3472,7 +3492,9 @@ function SignUpScreen() {
3472
3492
  if (s) setForm({ enabled: s.enabled, directoryId: s.directoryId ?? "", domains: s.emailDomains.join(", ") });
3473
3493
  }, [settings.data]);
3474
3494
  if (settings.error) return /* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: settings.error });
3475
- const internal = (directories.data ?? []).filter((d) => d.type === "internal");
3495
+ const listed = settings.data?.directories ?? (directories.data ?? []).filter((d) => d.type === "internal").map((d) => ({ id: d.id, name: d.name }));
3496
+ const current = settings.data?.directoryId;
3497
+ const internal = current && !listed.some((d) => d.id === current) && settings.data?.directoryName ? [...listed, { id: current, name: settings.data.directoryName }] : listed;
3476
3498
  const chosen = internal.find((d) => d.id === form.directoryId);
3477
3499
  async function save() {
3478
3500
  const saved = await action.run(
@@ -3490,7 +3512,7 @@ function SignUpScreen() {
3490
3512
  /* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
3491
3513
  /* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(Stack16, { gap: "field", maxW: "2xl", children: [
3492
3514
  /* @__PURE__ */ jsx20(SwitchField, { label: t("enabled"), checked: form.enabled, onCheckedChange: (c) => setForm({ ...form, enabled: c }) }),
3493
- /* @__PURE__ */ jsx20(Field9, { label: t("directory"), helperText: t("directoryHint"), children: /* @__PURE__ */ jsx20(
3515
+ /* @__PURE__ */ jsx20(Field9, { label: t("directory"), helperText: directoriesPage ? t("directoryHint") : t("directoryHintPlain"), children: /* @__PURE__ */ jsx20(
3494
3516
  SelectField4,
3495
3517
  {
3496
3518
  value: form.directoryId,
@@ -3506,18 +3528,64 @@ function SignUpScreen() {
3506
3528
  ] });
3507
3529
  }
3508
3530
 
3531
+ // src/areas/guard/pages.tsx
3532
+ import { jsx as jsx21 } from "react/jsx-runtime";
3533
+ function subscribe(changed) {
3534
+ window.addEventListener("popstate", changed);
3535
+ return () => window.removeEventListener("popstate", changed);
3536
+ }
3537
+ function MergePage({ id, routes }) {
3538
+ const into = useSyncExternalStore(
3539
+ subscribe,
3540
+ () => new URLSearchParams(window.location.search).get("into"),
3541
+ () => null
3542
+ );
3543
+ return /* @__PURE__ */ jsx21(MergeScreen, { id, into, routes });
3544
+ }
3545
+ function guardPages(options) {
3546
+ const base = (options.base ?? "/admin").replace(/\/$/, "");
3547
+ const routes = guardRoutes(base);
3548
+ const directories = options.directories ?? true;
3549
+ const visible = options.visible ?? (options.host?.can ? () => options.host.can("guard.site.admin") : void 0);
3550
+ const weight = options.weight ?? 100;
3551
+ const page = (key, at, component) => ({
3552
+ id: `guard.${key}`,
3553
+ section: options.section,
3554
+ weight: weight + at,
3555
+ title: options.titles?.[key] ?? en_default[`nav.${key}`],
3556
+ href: `${base}/${key}`,
3557
+ about: options.about?.[key],
3558
+ plugin: "guard",
3559
+ visible,
3560
+ component
3561
+ });
3562
+ const pages = [
3563
+ page(
3564
+ "accounts",
3565
+ 0,
3566
+ ({ path }) => !path[0] ? /* @__PURE__ */ jsx21(AccountsScreen, { routes }) : path[1] === "merge" ? /* @__PURE__ */ jsx21(MergePage, { id: path[0], routes }) : /* @__PURE__ */ jsx21(AccountScreen, { id: path[0], routes })
3567
+ ),
3568
+ page("groups", 1, ({ path }) => path[0] ? /* @__PURE__ */ jsx21(GroupScreen, { id: path[0], routes }) : /* @__PURE__ */ jsx21(GroupsScreen, { routes }))
3569
+ ];
3570
+ if (directories) {
3571
+ pages.push(page("directories", 2, ({ path }) => path[0] ? /* @__PURE__ */ jsx21(DirectoryScreen, { id: path[0], routes }) : /* @__PURE__ */ jsx21(DirectoriesScreen, { routes })));
3572
+ }
3573
+ pages.push(page("signup", 3, () => /* @__PURE__ */ jsx21(SignUpScreen, { directoriesPage: directories })), page("anonymous", 4, () => /* @__PURE__ */ jsx21(AnonymousScreen, {})));
3574
+ return pages;
3575
+ }
3576
+
3509
3577
  // src/areas/guard/StrongFactorBanner.tsx
3510
3578
  import { Box as Box5 } from "@chakra-ui/react";
3511
3579
  import { AppLink as AppLink11, InlineAlert as InlineAlert17, useFormatters as useFormatters10 } from "@abpjs/ui";
3512
- import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
3580
+ import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
3513
3581
  function StrongFactorBanner({ strongFactor, setUpHref }) {
3514
3582
  const t = useGuardTexts();
3515
3583
  const fmt = useFormatters10();
3516
3584
  if (!strongFactor || strongFactor.has || !strongFactor.requiredBy) return null;
3517
- return /* @__PURE__ */ jsx21(Box5, { mb: "section", "data-testid": "strong-factor-banner", children: /* @__PURE__ */ jsxs21(InlineAlert17, { tone: strongFactor.overdue ? "danger" : "warning", title: t("secondFactor.required.title"), children: [
3585
+ return /* @__PURE__ */ jsx22(Box5, { mb: "section", "data-testid": "strong-factor-banner", children: /* @__PURE__ */ jsxs21(InlineAlert17, { tone: strongFactor.overdue ? "danger" : "warning", title: t("secondFactor.required.title"), children: [
3518
3586
  t(strongFactor.overdue ? "secondFactor.required.overdue" : "secondFactor.required.by", { date: fmt.dateTime(strongFactor.requiredBy) }),
3519
3587
  " ",
3520
- /* @__PURE__ */ jsx21(AppLink11, { href: setUpHref, children: t("secondFactor.required.setUp") })
3588
+ /* @__PURE__ */ jsx22(AppLink11, { href: setUpHref, children: t("secondFactor.required.setUp") })
3521
3589
  ] }) });
3522
3590
  }
3523
3591
  export {
@@ -3555,7 +3623,9 @@ export {
3555
3623
  SyncStatus,
3556
3624
  TWO_FACTOR_MODES,
3557
3625
  groupedKey,
3626
+ guardPages,
3558
3627
  guardRoutes,
3628
+ isSystemGroup,
3559
3629
  num,
3560
3630
  useAccountCan,
3561
3631
  useCountLabel,