@seliseblocks/genesis-os 4.4.0 → 4.4.2

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.
@@ -1,5 +1,5 @@
1
1
  import { refractor } from './chunk-FGY7QM3Y.js';
2
- import { useKeyboardShortcut, usePopoverWidth, useBlocksAppConfigStore, useTheme, useLogout, useGetMyOrganizations, useLanguageSwitcher, useGetBlocksNotificationConfig, notificationService, useLogo, useStartImpersonation, useGetProjects, useGetProject, useImpersonationStatusChecker, useStopImpersonation, useRecordClaimedTenant, useLogin, useSignUpAffordance, useSignUpRedirect, useInitiateRedirect, useGetEnvRepositories, useUpdateTenantGroup, useIcon, useDisableProject, projectService, initiateService, useGetNotifications, useMarkAsRead, useMarkAllAsRead, useDebouncedFuseFilter, useUpdateRepositories, usePrefetchRedirect } from './chunk-SAY5K2GJ.js';
2
+ import { notificationService, useKeyboardShortcut, usePopoverWidth, useBlocksAppConfigStore, useTheme, useLogout, useGetMyOrganizations, useLanguageSwitcher, useGetBlocksNotificationConfig, useLogo, useStartImpersonation, useGetProjects, useGetProject, useImpersonationStatusChecker, useStopImpersonation, useRecordClaimedTenant, useLogin, useSignUpAffordance, useSignUpRedirect, useInitiateRedirect, useGetEnvRepositories, useUpdateTenantGroup, useIcon, useDisableProject, projectService, initiateService, useGetNotifications, useMarkAsRead, useMarkAllAsRead, useDebouncedFuseFilter, useUpdateRepositories, usePrefetchRedirect } from './chunk-M3VJ7FLT.js';
3
3
  import { showErrorToast, createStorage, getForwardedToPath, debounce, formatFullDate, formatDate, deepEqual, showSuccessToast, isErrorWithErrors, getServiceBaseUrl, getServiceSwaggerUrl } from './chunk-JSXAKNHQ.js';
4
4
  import { fadeTransition, fadeInUp, staggerContainer, staggerItem, fadeInScale, subscribeToTenantClaims, holdTenant, iamClient, AUTH_ENDPOINTS, claimTenant, readCurrentOwner, TAB_ID, isTenantHeldElsewhere, isSameClaim, PROFILE_ENDPOINTS } from './chunk-SG6FH72W.js';
5
5
  import { getRuntimeEnv, HttpError } from './chunk-JUVLHPQI.js';
@@ -7040,8 +7040,24 @@ function Logo({
7040
7040
  ] });
7041
7041
  }
7042
7042
  var logicOrigin = () => getRuntimeEnv("BLOCKS_LOGIC_BASE_URL").trim().replace(/\/$/, "");
7043
+ var RETRY_DELAYS_MS = [2e3, 5e3, 15e3, 3e4];
7044
+ var STEADY_RETRY_MS = 6e4;
7045
+ var isLoggedOut = (error) => error?.status === 401;
7046
+ var hasHttpStatus = (error) => typeof error?.status === "number";
7047
+ var refreshLoginCall = async (probe) => {
7048
+ try {
7049
+ await probe;
7050
+ } catch (error) {
7051
+ if (isLoggedOut(error) || !hasHttpStatus(error)) throw error;
7052
+ }
7053
+ };
7043
7054
  var NotificationListenerService = class {
7044
7055
  connection;
7056
+ // True from connect() until disconnect(): the app wants the hub up.
7057
+ wanted = false;
7058
+ attempt = 0;
7059
+ timer;
7060
+ inFlight;
7045
7061
  constructor() {
7046
7062
  this.connection = new HubConnectionBuilder().withUrl(
7047
7063
  `${logicOrigin()}/api/NotificationHub?x-blocks-key=${getRuntimeEnv("BLOCKS_X_BLOCKS_KEY")}`,
@@ -7049,17 +7065,72 @@ var NotificationListenerService = class {
7049
7065
  transport: HttpTransportType.WebSockets
7050
7066
  }
7051
7067
  ).withAutomaticReconnect().build();
7068
+ this.connection.onclose(() => {
7069
+ if (this.wanted) this.recover(true);
7070
+ });
7052
7071
  }
7053
7072
  async connect() {
7054
- if (this.connection.state === "Disconnected") {
7055
- await this.connection.start();
7073
+ if (!this.wanted) {
7074
+ this.wanted = true;
7075
+ this.attempt = 0;
7076
+ globalThis.addEventListener("online", this.onWake);
7077
+ document.addEventListener("visibilitychange", this.onVisibility);
7056
7078
  }
7079
+ if (this.timer === void 0) await this.recover(false);
7057
7080
  }
7058
7081
  async disconnect() {
7082
+ this.wanted = false;
7083
+ this.stopWatching();
7059
7084
  if (this.connection.state !== "Disconnected") {
7060
7085
  await this.connection.stop();
7061
7086
  }
7062
7087
  }
7088
+ onWake = () => {
7089
+ if (this.wanted) this.recover(true);
7090
+ };
7091
+ onVisibility = () => {
7092
+ if (document.visibilityState === "visible") this.onWake();
7093
+ };
7094
+ stopWatching() {
7095
+ clearTimeout(this.timer);
7096
+ this.timer = void 0;
7097
+ globalThis.removeEventListener("online", this.onWake);
7098
+ document.removeEventListener("visibilitychange", this.onVisibility);
7099
+ }
7100
+ // Never two starts at once: callers share the run that is already going.
7101
+ recover(refreshLogin) {
7102
+ this.inFlight ??= this.tryStart(refreshLogin).finally(() => {
7103
+ this.inFlight = void 0;
7104
+ });
7105
+ return this.inFlight;
7106
+ }
7107
+ async tryStart(refreshLogin) {
7108
+ clearTimeout(this.timer);
7109
+ this.timer = void 0;
7110
+ if (!this.wanted || this.connection.state !== "Disconnected") return;
7111
+ if (refreshLogin && navigator.onLine === false) return;
7112
+ try {
7113
+ if (refreshLogin)
7114
+ await refreshLoginCall(notificationService.getNotifications(1, 1));
7115
+ if (!this.wanted) return;
7116
+ await this.connection.start();
7117
+ this.attempt = 0;
7118
+ if (!this.wanted) await this.connection.stop();
7119
+ } catch (error) {
7120
+ if (!this.wanted) return;
7121
+ if (isLoggedOut(error)) {
7122
+ this.wanted = false;
7123
+ this.stopWatching();
7124
+ return;
7125
+ }
7126
+ this.scheduleRetry();
7127
+ }
7128
+ }
7129
+ scheduleRetry() {
7130
+ const delay = RETRY_DELAYS_MS[this.attempt] ?? STEADY_RETRY_MS;
7131
+ this.attempt += 1;
7132
+ this.timer = setTimeout(() => this.recover(true), delay);
7133
+ }
7063
7134
  };
7064
7135
  var notificationListenerService = new NotificationListenerService();
7065
7136
 
@@ -10519,8 +10590,8 @@ var SelfProjectLoading = ({ viewMode }) => {
10519
10590
  ) });
10520
10591
  };
10521
10592
  var SelfProject = ({ canCreateProject = false }) => {
10522
- const { data, isLoading, isFetching } = useGetProjects({ enabled: true });
10523
- const isPending = isLoading || isFetching;
10593
+ const { data, isLoading } = useGetProjects({ enabled: true });
10594
+ const isPending = isLoading;
10524
10595
  const projectGroups = data || [];
10525
10596
  const {
10526
10597
  availableEnvironmentOptions,
@@ -10640,6 +10711,16 @@ var ConsolePage = ({ canCreateProject = false }) => {
10640
10711
  ] })
10641
10712
  ] });
10642
10713
  };
10714
+ var toSafeAppPath = (value) => {
10715
+ if (!value || !value.startsWith("/")) return null;
10716
+ try {
10717
+ const target = new URL(value, window.location.origin);
10718
+ if (target.origin !== window.location.origin) return null;
10719
+ return target.href;
10720
+ } catch {
10721
+ return null;
10722
+ }
10723
+ };
10643
10724
  var CallbackPage = ({ defaultRedirectUrl }) => {
10644
10725
  const [searchParams] = useSearchParams();
10645
10726
  const hasProcessed = useRef(false);
@@ -10655,7 +10736,7 @@ var CallbackPage = ({ defaultRedirectUrl }) => {
10655
10736
  const idpBaseUrl = window.process?.env.userBaseUrl;
10656
10737
  const callbackUrl = new URL(`${idpBaseUrl}/api/idp/callback`);
10657
10738
  const tenantId = window.process?.env.BLOCKS_X_BLOCKS_KEY;
10658
- const appRedirectUrl = forwardTo || defaultRedirectUrl || "/";
10739
+ const appRedirectUrl = toSafeAppPath(forwardTo) || defaultRedirectUrl || "/";
10659
10740
  if (code) callbackUrl.searchParams.set("code", code);
10660
10741
  if (state) callbackUrl.searchParams.set("state", state);
10661
10742
  if (error) callbackUrl.searchParams.set("error", error);
@@ -11509,6 +11590,7 @@ var EditProjectForm = ({
11509
11590
  description: "Project name updated successfully"
11510
11591
  });
11511
11592
  queryClient.invalidateQueries({ queryKey: ["identifier", "project"] });
11593
+ queryClient.invalidateQueries({ queryKey: ["identifier", "projects"] });
11512
11594
  form.reset();
11513
11595
  onAfterSubmit();
11514
11596
  } else {
@@ -13427,5 +13509,5 @@ var TablePagination2 = React8.forwardRef(
13427
13509
  TablePagination2.displayName = "TablePagination";
13428
13510
 
13429
13511
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppLoadingSpinner, AppSwitcher, ArchiveProject, AspectRatio, AuthLayout, AuthResolver, Avatar, AvatarFallback, AvatarImage, BackToConsoleNavigator, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CallbackPage, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmationModal, ConsoleHeader, ConsoleLayout, ConsolePage, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyToClipboardButton, CopyableSnippet, DEFAULT_KANBAN_COLUMNS, DashboardHeader, DashboardLayout, DashboardOverview, DashboardRoute, DashboardSectionCard, DataTable, DataTableHeaderCell, DateRangePicker, DesktopMenuItem, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditProject, EditProjectDialog, EditProjectForm, EnvironmentCard, EnvironmentList, ErrorBoundary, ErrorDisplay, ErrorDisplayWithCard, FileInput, FileUploader, FileUploaderContent, FileUploaderItem, FilterControls, FilterToolBarMobileView, FilterToolbar, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, ImpersonationChecker, ImpersonationSynchronizer, ImpersonationTerminator, ImportFileModalContent, InfiniteScroll, InfiniteScroller, InfoTooltip, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, KanbanBoard, KanbanBoardColumn, KanbanBoardContainer, KanbanTaskCard, Label, LanguageSelector, LoadingButton, LoginPage, Logo, MaskedText, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MobileMenuItem, MultiSelect, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Notification, OidcLayout, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfilePage, Progress, ProjectActions, ProjectCardLoadingSkeleton, ProjectDetail, ProjectList2 as ProjectList, ProjectListRowLoadingSkeleton, ProjectOverview, ProjectRepoList, ProtectedGuard, PublicGuard, PublicLayout, RadioGroup4 as RadioGroup, RadioGroupItem, RenderAlternatively, RenderConditionally, ResizableHandle, ResizablePanel, ResizablePanelGroup, RightSidePanel, RightSidePanelBody, RightSidePanelClose, RightSidePanelDescription, RightSidePanelFooter, RightSidePanelHeader, RightSidePanelProvider, RightSidePanelTitle, RightSidePanelTrigger, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectedEnvironment, SelectedProject, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarCollapsedTooltip, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDesktop, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarMobileView, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableLoadingSkeleton, TablePagination2 as TablePagination, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitcher, Timeline, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserDropdownMenu, WizardHorizontalTrackBar, WizardStepContent, WizardStepIndicator, WizardStepViewport, WizardStepperProvider, WizardVerticalTrackBar, badgeVariants, buttonVariants, editProjectFormDefaultValues, editProjectFormSchema, filteredAppSwitcherData, hasDraggableData, kanbanKeyboardCoordinateGetter, navigationMenuTriggerStyle, paginationQueryParsers, sidebarCollapsedTooltipClass, sortQueryParsers, spinnerVariants, toggleVariants, useFileUpload, useFormField, useNotificationSocket, useOidcContext, usePaginationQueryParams, useRightSidePanel, useSortQueryParams, useWizardStepper };
13430
- //# sourceMappingURL=chunk-SWHGCT72.js.map
13431
- //# sourceMappingURL=chunk-SWHGCT72.js.map
13512
+ //# sourceMappingURL=chunk-QH7AVUL7.js.map
13513
+ //# sourceMappingURL=chunk-QH7AVUL7.js.map