@lessly/ui 0.16.1 → 0.18.0
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.d.ts +159 -3
- package/dist/index.js +756 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1262,13 +1262,24 @@ interface CreateProductWindowProduct {
|
|
|
1262
1262
|
type CreateProductSubmit = {
|
|
1263
1263
|
name: string;
|
|
1264
1264
|
organizationId: string;
|
|
1265
|
-
}
|
|
1265
|
+
}
|
|
1266
|
+
/** @deprecated Emitted only by the deprecated create-new-org mode — see
|
|
1267
|
+
* `CreateProductWindowProps.selectedOrgId`. Use `OrganizationCreateScreen` instead. */
|
|
1268
|
+
| {
|
|
1266
1269
|
name: string;
|
|
1267
1270
|
organizationName: string;
|
|
1268
1271
|
};
|
|
1269
1272
|
interface CreateProductWindowProps {
|
|
1270
1273
|
organizations: CreateProductWindowOrganization[];
|
|
1271
|
-
/**
|
|
1274
|
+
/**
|
|
1275
|
+
* null => create-new-org mode.
|
|
1276
|
+
*
|
|
1277
|
+
* @deprecated The create-new-org mode is deprecated. Organization creation now goes
|
|
1278
|
+
* through `OrganizationCreateScreen`, which collects the legal details the API needs
|
|
1279
|
+
* (legal name, country of incorporation, beneficial owners) — this window only ever
|
|
1280
|
+
* sends a bare `organizationName`. Pass a real org id and let the onboarding screens
|
|
1281
|
+
* handle the org-first flow. Selecting an existing org here is unaffected.
|
|
1282
|
+
*/
|
|
1272
1283
|
selectedOrgId: string | null;
|
|
1273
1284
|
/** products of the selected org */
|
|
1274
1285
|
products: CreateProductWindowProduct[];
|
|
@@ -1280,6 +1291,13 @@ interface CreateProductWindowProps {
|
|
|
1280
1291
|
onEnterProduct: (product: CreateProductWindowProduct) => void;
|
|
1281
1292
|
onSubmit: (data: CreateProductSubmit) => void;
|
|
1282
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* The legacy first-run window: pick an organization and name a product, in one panel.
|
|
1296
|
+
*
|
|
1297
|
+
* Still supported for picking an existing organization. Its **create-new-org mode**
|
|
1298
|
+
* (`selectedOrgId: null`, or an empty `organizations` list) is deprecated — org creation
|
|
1299
|
+
* now goes through `OrganizationCreateScreen`, followed by `ProductCreateScreen`.
|
|
1300
|
+
*/
|
|
1283
1301
|
declare function CreateProductWindow({ organizations, selectedOrgId, products, productsLoading, submitting, error, onOrganizationChange, onEnterProduct, onSubmit, }: CreateProductWindowProps): React$1.JSX.Element;
|
|
1284
1302
|
|
|
1285
1303
|
/** FYI / Important / Critical — the one severity vocabulary. */
|
|
@@ -1477,4 +1495,142 @@ interface NotificationToasterProps {
|
|
|
1477
1495
|
}
|
|
1478
1496
|
declare const NotificationToaster: React$1.ForwardRefExoticComponent<NotificationToasterProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1479
1497
|
|
|
1480
|
-
|
|
1498
|
+
/**
|
|
1499
|
+
* ISO 3166-1 alpha-2 countries, English names, sorted by name. Platform APIs that take a country
|
|
1500
|
+
* on an organization validate it as an alpha-2 code and upper-case it, so this list is the
|
|
1501
|
+
* client-side mirror of what such an endpoint accepts — an option outside it would be rejected.
|
|
1502
|
+
* Generated from the ISO 3166-1 code list with `Intl.DisplayNames('en', { type: 'region' })`.
|
|
1503
|
+
*/
|
|
1504
|
+
declare const COUNTRY_OPTIONS: SelectOption[];
|
|
1505
|
+
|
|
1506
|
+
/** One beneficial owner, in the shape the organization API takes it. */
|
|
1507
|
+
interface BeneficialOwnerPayload {
|
|
1508
|
+
name: string;
|
|
1509
|
+
country: string;
|
|
1510
|
+
share_pct: number;
|
|
1511
|
+
}
|
|
1512
|
+
/** The submit payload — snake_case, exactly as the organization-creation endpoint takes it. */
|
|
1513
|
+
interface OrganizationOnboardingPayload {
|
|
1514
|
+
name: string;
|
|
1515
|
+
legal_name?: string;
|
|
1516
|
+
owner_name?: string;
|
|
1517
|
+
country_of_incorporation?: string;
|
|
1518
|
+
residency_country?: string;
|
|
1519
|
+
beneficial_owners: BeneficialOwnerPayload[];
|
|
1520
|
+
/** Only present when no listed owner holds a controlling share. */
|
|
1521
|
+
ownership_confirmed?: boolean;
|
|
1522
|
+
}
|
|
1523
|
+
interface OrganizationOnboardingDefaults {
|
|
1524
|
+
name?: string;
|
|
1525
|
+
legal_name?: string;
|
|
1526
|
+
owner_name?: string;
|
|
1527
|
+
country_of_incorporation?: string;
|
|
1528
|
+
residency_country?: string;
|
|
1529
|
+
beneficial_owners?: BeneficialOwnerPayload[];
|
|
1530
|
+
}
|
|
1531
|
+
interface OrganizationOnboardingFormProps {
|
|
1532
|
+
/** Makes the country of incorporation — and the ownership confirmation, where it is shown —
|
|
1533
|
+
* mandatory. Mirrors the server-side requirement the consumer is configured for. */
|
|
1534
|
+
requireSanctionsFields: boolean;
|
|
1535
|
+
onSubmit: (payload: OrganizationOnboardingPayload) => void;
|
|
1536
|
+
defaultValues?: OrganizationOnboardingDefaults;
|
|
1537
|
+
/** Disables the submit button and swaps its label while the caller's request is in flight. */
|
|
1538
|
+
submitting?: boolean;
|
|
1539
|
+
serverError?: string | null;
|
|
1540
|
+
/** Field-level messages returned alongside a server error. */
|
|
1541
|
+
violations?: string[];
|
|
1542
|
+
/** Defaults to the built-in ISO 3166-1 alpha-2 list. */
|
|
1543
|
+
countries?: SelectOption[];
|
|
1544
|
+
submitLabel?: string;
|
|
1545
|
+
/** Renders a Cancel button when provided. */
|
|
1546
|
+
onCancel?: () => void;
|
|
1547
|
+
className?: string;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* The organization-creation form: name plus the extra details some jurisdictions require of a
|
|
1551
|
+
* new organization. Presentational and self-contained — it never calls an API and never
|
|
1552
|
+
* navigates; the caller wraps it in its own dialog and handles the outcome of `onSubmit`.
|
|
1553
|
+
*/
|
|
1554
|
+
declare function OrganizationOnboardingForm({ requireSanctionsFields, onSubmit, defaultValues, submitting, serverError, violations, countries, submitLabel, onCancel, className, }: OrganizationOnboardingFormProps): React$1.JSX.Element;
|
|
1555
|
+
|
|
1556
|
+
interface OrganizationCreateScreenProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'title' | 'onSubmit'> {
|
|
1557
|
+
/** Makes the country of incorporation — and the ownership confirmation, where it is
|
|
1558
|
+
* shown — mandatory. Mirrors the server-side requirement the consumer runs under. */
|
|
1559
|
+
requireSanctionsFields: boolean;
|
|
1560
|
+
onSubmit: (payload: OrganizationOnboardingPayload) => void;
|
|
1561
|
+
defaultValues?: OrganizationOnboardingDefaults;
|
|
1562
|
+
/** Disables the submit button and swaps its label while the caller's request is in flight. */
|
|
1563
|
+
submitting?: boolean;
|
|
1564
|
+
serverError?: string | null;
|
|
1565
|
+
/** Field-level messages returned alongside a server error. */
|
|
1566
|
+
violations?: string[];
|
|
1567
|
+
/** Defaults to the built-in ISO 3166-1 alpha-2 list. */
|
|
1568
|
+
countries?: SelectOption[];
|
|
1569
|
+
submitLabel?: string;
|
|
1570
|
+
/** Renders a Cancel button in the form when provided. */
|
|
1571
|
+
onCancel?: () => void;
|
|
1572
|
+
/** Brand mark above the headline. */
|
|
1573
|
+
logo?: React$1.ReactNode;
|
|
1574
|
+
/** Rendered top-right. Defaults to the kit's own `ThemeToggle`; pass your own node to
|
|
1575
|
+
* replace it, or `null` to drop it. */
|
|
1576
|
+
themeToggle?: React$1.ReactNode;
|
|
1577
|
+
title?: React$1.ReactNode;
|
|
1578
|
+
description?: React$1.ReactNode;
|
|
1579
|
+
/** Muted footer signature. Pass `null` to hide. */
|
|
1580
|
+
footer?: React$1.ReactNode;
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Full-page first step of the org-first onboarding flow: the screen a user lands on when
|
|
1584
|
+
* they have no organization yet. It is the screen wrapper around
|
|
1585
|
+
* `OrganizationOnboardingForm` — presentational and self-contained, it never calls an API
|
|
1586
|
+
* and never navigates; the caller handles the outcome of `onSubmit`.
|
|
1587
|
+
*/
|
|
1588
|
+
declare function OrganizationCreateScreen({ requireSanctionsFields, onSubmit, defaultValues, submitting, serverError, violations, countries, submitLabel, onCancel, logo, themeToggle, title, description, footer, ...props }: OrganizationCreateScreenProps): React$1.JSX.Element;
|
|
1589
|
+
|
|
1590
|
+
/** One product already living in the target organization. */
|
|
1591
|
+
interface ProductCreateScreenProduct {
|
|
1592
|
+
id: string;
|
|
1593
|
+
name: string;
|
|
1594
|
+
slug?: string;
|
|
1595
|
+
}
|
|
1596
|
+
/** The submit payload. The organization is implied — the screen only ever creates inside
|
|
1597
|
+
* the organization it was given. */
|
|
1598
|
+
interface ProductCreateScreenSubmit {
|
|
1599
|
+
name: string;
|
|
1600
|
+
}
|
|
1601
|
+
interface ProductCreateScreenProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'title' | 'onSubmit'> {
|
|
1602
|
+
/** The organization the new product lands in. Shown so the user can see where they are. */
|
|
1603
|
+
organizationName: string;
|
|
1604
|
+
onSubmit: (data: ProductCreateScreenSubmit) => void;
|
|
1605
|
+
defaultName?: string;
|
|
1606
|
+
/** Disables the submit button and swaps its label while the caller's request is in flight. */
|
|
1607
|
+
submitting?: boolean;
|
|
1608
|
+
serverError?: string | null;
|
|
1609
|
+
/** Products the organization already has. Omit (or pass an empty list) to hide the
|
|
1610
|
+
* "Your products" section entirely. */
|
|
1611
|
+
existingProducts?: ProductCreateScreenProduct[];
|
|
1612
|
+
/** Makes each existing product a button. Without it the list is read-only. */
|
|
1613
|
+
onOpenProduct?: (product: ProductCreateScreenProduct) => void;
|
|
1614
|
+
/** Heading above the existing-products list. */
|
|
1615
|
+
existingProductsLabel?: React$1.ReactNode;
|
|
1616
|
+
submitLabel?: React$1.ReactNode;
|
|
1617
|
+
/** Renders a Cancel button when provided. */
|
|
1618
|
+
onCancel?: () => void;
|
|
1619
|
+
/** Brand mark above the headline. */
|
|
1620
|
+
logo?: React$1.ReactNode;
|
|
1621
|
+
/** Rendered top-right. Defaults to the kit's own `ThemeToggle`; pass your own node to
|
|
1622
|
+
* replace it, or `null` to drop it. */
|
|
1623
|
+
themeToggle?: React$1.ReactNode;
|
|
1624
|
+
title?: React$1.ReactNode;
|
|
1625
|
+
description?: React$1.ReactNode;
|
|
1626
|
+
/** Muted footer signature. Pass `null` to hide. */
|
|
1627
|
+
footer?: React$1.ReactNode;
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Full-page second step of the org-first onboarding flow: create the first product inside
|
|
1631
|
+
* an organization that already exists. Presentational and self-contained — it never calls
|
|
1632
|
+
* an API and never navigates; the caller handles the outcome of `onSubmit`.
|
|
1633
|
+
*/
|
|
1634
|
+
declare function ProductCreateScreen({ organizationName, onSubmit, defaultName, submitting, serverError, existingProducts, onOpenProduct, existingProductsLabel, submitLabel, onCancel, logo, themeToggle, title, description, footer, ...props }: ProductCreateScreenProps): React$1.JSX.Element;
|
|
1635
|
+
|
|
1636
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppShell, type AppShellProps, AppSidebar, type AppSidebarProps, AspectRatio, AuthenticatedLayout, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, type BeneficialOwnerPayload, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, COUNTRY_OPTIONS, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, type CarouselContextProps, CarouselItem, CarouselNext, type CarouselOptions, type CarouselPlugin, CarouselPrevious, type CarouselProps, Checkbox, Code, CodeBlock, type CodeBlockProps, type CodeLang, type CodeProps, Col, type ColProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, type ConfirmDialogProps, type ConnectionAuth, ConnectionCard, type ConnectionCardProps, type ConnectionScope, type ConnectionStatus, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, type CopyButtonProps, type CreateProductSubmit, CreateProductWindow, type CreateProductWindowOrganization, type CreateProductWindowProduct, type CreateProductWindowProps, DatePicker, type DatePickerProps, type DeltaDirection, type DeltaTone, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DocsLink, type DocsLinkProps, 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, EmptyState, type EmptyStateProps, ExtensionIcon, type ExtensionIconProps, ExtensionLink, type ExtensionLinkProps, type ExtensionLinkUiMode, FeedbackButton, type FeedbackButtonLabels, type FeedbackButtonProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Grid, GridOverlay, type GridOverlayProps, type GridProps, HoverCard, HoverCardContent, HoverCardTrigger, InlineError, type InlineErrorProps, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, MenuDivider, MenuPopup, type MenuPopupProps, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, type NavItem, type NavLinkComponent, NavRow, type NavRowProps, type NavRowVariant, NavSectionLabel, type NavSectionLabelProps, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, type NotifClass, type NotificationAction, NotificationBell, type NotificationBellProps, NotificationCenter, type NotificationCenterProps, type NotificationClass, type NotificationDeepLink, type NotificationItem, type NotificationMute, type NotificationPreferences, type NotificationProduct, NotificationSettings, type NotificationSettingsProps, type NotificationSeverity, type NotificationSubscription, type NotificationThreshold, NotificationToast, type NotificationToastDwell, type NotificationToastProps, NotificationToaster, type NotificationToasterPosition, type NotificationToasterProps, OrgProductSwitcher, type OrgProductSwitcherAction, type OrgProductSwitcherItem, type OrgProductSwitcherProps, OrganizationCreateScreen, type OrganizationCreateScreenProps, type OrganizationOnboardingDefaults, OrganizationOnboardingForm, type OrganizationOnboardingFormProps, type OrganizationOnboardingPayload, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, type PaginationLinkProps, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductCreateScreen, type ProductCreateScreenProduct, type ProductCreateScreenProps, type ProductCreateScreenSubmit, Progress, RadioGroup, RadioGroupItem, RequestRow, type RequestRowProps, type RequestState, type RequestSurface, type ResolvedTheme, type Responsive, ScrollArea, ScrollBar, SectionIntro, type SectionIntroProps, SegmentChip, type SegmentChipProps, Select, type SelectOption, type SelectProps, Separator, type Severity, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarBackHeader, type SidebarBackHeaderProps, SidebarNav, SidebarNavLink, type SidebarNavLinkProps, type SidebarNavProps, SidebarProductHeader, type SidebarProductHeaderProps, SignInScreen, type SignInScreenProps, type SignInScreenState, Skeleton, Slider, StatCard, type StatCardProps, StatusDot, type StatusDotProps, Switch, type SwitchProps, TOAST_DWELL, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, type Theme, ThemeToggle, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseSidebarOptions, type UseSidebarResult, UserMenu, type UserMenuItem, type UserMenuProps, type UserMenuUser, alertVariants, badgeVariants, buttonVariants, cn, formatRelativeAge, isKnownExtensionIcon, isNotificationSettled, navigationMenuTriggerStyle, segmentChipVariants, severityBadgeVariant, severityLabels, statusDotVariants, toggleVariants, useCarousel, useFormField, useIsMobile, useSidebar, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -5092,6 +5092,758 @@ var NotificationToaster = React65.forwardRef(
|
|
|
5092
5092
|
}
|
|
5093
5093
|
);
|
|
5094
5094
|
NotificationToaster.displayName = "NotificationToaster";
|
|
5095
|
+
|
|
5096
|
+
// src/lib/countries.ts
|
|
5097
|
+
var COUNTRY_OPTIONS = [
|
|
5098
|
+
{ value: "AF", label: "Afghanistan" },
|
|
5099
|
+
{ value: "AX", label: "\xC5land Islands" },
|
|
5100
|
+
{ value: "AL", label: "Albania" },
|
|
5101
|
+
{ value: "DZ", label: "Algeria" },
|
|
5102
|
+
{ value: "AS", label: "American Samoa" },
|
|
5103
|
+
{ value: "AD", label: "Andorra" },
|
|
5104
|
+
{ value: "AO", label: "Angola" },
|
|
5105
|
+
{ value: "AI", label: "Anguilla" },
|
|
5106
|
+
{ value: "AQ", label: "Antarctica" },
|
|
5107
|
+
{ value: "AG", label: "Antigua & Barbuda" },
|
|
5108
|
+
{ value: "AR", label: "Argentina" },
|
|
5109
|
+
{ value: "AM", label: "Armenia" },
|
|
5110
|
+
{ value: "AW", label: "Aruba" },
|
|
5111
|
+
{ value: "AU", label: "Australia" },
|
|
5112
|
+
{ value: "AT", label: "Austria" },
|
|
5113
|
+
{ value: "AZ", label: "Azerbaijan" },
|
|
5114
|
+
{ value: "BS", label: "Bahamas" },
|
|
5115
|
+
{ value: "BH", label: "Bahrain" },
|
|
5116
|
+
{ value: "BD", label: "Bangladesh" },
|
|
5117
|
+
{ value: "BB", label: "Barbados" },
|
|
5118
|
+
{ value: "BY", label: "Belarus" },
|
|
5119
|
+
{ value: "BE", label: "Belgium" },
|
|
5120
|
+
{ value: "BZ", label: "Belize" },
|
|
5121
|
+
{ value: "BJ", label: "Benin" },
|
|
5122
|
+
{ value: "BM", label: "Bermuda" },
|
|
5123
|
+
{ value: "BT", label: "Bhutan" },
|
|
5124
|
+
{ value: "BO", label: "Bolivia" },
|
|
5125
|
+
{ value: "BA", label: "Bosnia & Herzegovina" },
|
|
5126
|
+
{ value: "BW", label: "Botswana" },
|
|
5127
|
+
{ value: "BV", label: "Bouvet Island" },
|
|
5128
|
+
{ value: "BR", label: "Brazil" },
|
|
5129
|
+
{ value: "IO", label: "British Indian Ocean Territory" },
|
|
5130
|
+
{ value: "VG", label: "British Virgin Islands" },
|
|
5131
|
+
{ value: "BN", label: "Brunei" },
|
|
5132
|
+
{ value: "BG", label: "Bulgaria" },
|
|
5133
|
+
{ value: "BF", label: "Burkina Faso" },
|
|
5134
|
+
{ value: "BI", label: "Burundi" },
|
|
5135
|
+
{ value: "KH", label: "Cambodia" },
|
|
5136
|
+
{ value: "CM", label: "Cameroon" },
|
|
5137
|
+
{ value: "CA", label: "Canada" },
|
|
5138
|
+
{ value: "CV", label: "Cape Verde" },
|
|
5139
|
+
{ value: "BQ", label: "Caribbean Netherlands" },
|
|
5140
|
+
{ value: "KY", label: "Cayman Islands" },
|
|
5141
|
+
{ value: "CF", label: "Central African Republic" },
|
|
5142
|
+
{ value: "TD", label: "Chad" },
|
|
5143
|
+
{ value: "CL", label: "Chile" },
|
|
5144
|
+
{ value: "CN", label: "China" },
|
|
5145
|
+
{ value: "CX", label: "Christmas Island" },
|
|
5146
|
+
{ value: "CC", label: "Cocos (Keeling) Islands" },
|
|
5147
|
+
{ value: "CO", label: "Colombia" },
|
|
5148
|
+
{ value: "KM", label: "Comoros" },
|
|
5149
|
+
{ value: "CG", label: "Congo - Brazzaville" },
|
|
5150
|
+
{ value: "CD", label: "Congo - Kinshasa" },
|
|
5151
|
+
{ value: "CK", label: "Cook Islands" },
|
|
5152
|
+
{ value: "CR", label: "Costa Rica" },
|
|
5153
|
+
{ value: "CI", label: "C\xF4te d\u2019Ivoire" },
|
|
5154
|
+
{ value: "HR", label: "Croatia" },
|
|
5155
|
+
{ value: "CU", label: "Cuba" },
|
|
5156
|
+
{ value: "CW", label: "Cura\xE7ao" },
|
|
5157
|
+
{ value: "CY", label: "Cyprus" },
|
|
5158
|
+
{ value: "CZ", label: "Czechia" },
|
|
5159
|
+
{ value: "DK", label: "Denmark" },
|
|
5160
|
+
{ value: "DJ", label: "Djibouti" },
|
|
5161
|
+
{ value: "DM", label: "Dominica" },
|
|
5162
|
+
{ value: "DO", label: "Dominican Republic" },
|
|
5163
|
+
{ value: "EC", label: "Ecuador" },
|
|
5164
|
+
{ value: "EG", label: "Egypt" },
|
|
5165
|
+
{ value: "SV", label: "El Salvador" },
|
|
5166
|
+
{ value: "GQ", label: "Equatorial Guinea" },
|
|
5167
|
+
{ value: "ER", label: "Eritrea" },
|
|
5168
|
+
{ value: "EE", label: "Estonia" },
|
|
5169
|
+
{ value: "SZ", label: "Eswatini" },
|
|
5170
|
+
{ value: "ET", label: "Ethiopia" },
|
|
5171
|
+
{ value: "FK", label: "Falkland Islands" },
|
|
5172
|
+
{ value: "FO", label: "Faroe Islands" },
|
|
5173
|
+
{ value: "FJ", label: "Fiji" },
|
|
5174
|
+
{ value: "FI", label: "Finland" },
|
|
5175
|
+
{ value: "FR", label: "France" },
|
|
5176
|
+
{ value: "GF", label: "French Guiana" },
|
|
5177
|
+
{ value: "PF", label: "French Polynesia" },
|
|
5178
|
+
{ value: "TF", label: "French Southern Territories" },
|
|
5179
|
+
{ value: "GA", label: "Gabon" },
|
|
5180
|
+
{ value: "GM", label: "Gambia" },
|
|
5181
|
+
{ value: "GE", label: "Georgia" },
|
|
5182
|
+
{ value: "DE", label: "Germany" },
|
|
5183
|
+
{ value: "GH", label: "Ghana" },
|
|
5184
|
+
{ value: "GI", label: "Gibraltar" },
|
|
5185
|
+
{ value: "GR", label: "Greece" },
|
|
5186
|
+
{ value: "GL", label: "Greenland" },
|
|
5187
|
+
{ value: "GD", label: "Grenada" },
|
|
5188
|
+
{ value: "GP", label: "Guadeloupe" },
|
|
5189
|
+
{ value: "GU", label: "Guam" },
|
|
5190
|
+
{ value: "GT", label: "Guatemala" },
|
|
5191
|
+
{ value: "GG", label: "Guernsey" },
|
|
5192
|
+
{ value: "GN", label: "Guinea" },
|
|
5193
|
+
{ value: "GW", label: "Guinea-Bissau" },
|
|
5194
|
+
{ value: "GY", label: "Guyana" },
|
|
5195
|
+
{ value: "HT", label: "Haiti" },
|
|
5196
|
+
{ value: "HM", label: "Heard & McDonald Islands" },
|
|
5197
|
+
{ value: "HN", label: "Honduras" },
|
|
5198
|
+
{ value: "HK", label: "Hong Kong SAR China" },
|
|
5199
|
+
{ value: "HU", label: "Hungary" },
|
|
5200
|
+
{ value: "IS", label: "Iceland" },
|
|
5201
|
+
{ value: "IN", label: "India" },
|
|
5202
|
+
{ value: "ID", label: "Indonesia" },
|
|
5203
|
+
{ value: "IR", label: "Iran" },
|
|
5204
|
+
{ value: "IQ", label: "Iraq" },
|
|
5205
|
+
{ value: "IE", label: "Ireland" },
|
|
5206
|
+
{ value: "IM", label: "Isle of Man" },
|
|
5207
|
+
{ value: "IL", label: "Israel" },
|
|
5208
|
+
{ value: "IT", label: "Italy" },
|
|
5209
|
+
{ value: "JM", label: "Jamaica" },
|
|
5210
|
+
{ value: "JP", label: "Japan" },
|
|
5211
|
+
{ value: "JE", label: "Jersey" },
|
|
5212
|
+
{ value: "JO", label: "Jordan" },
|
|
5213
|
+
{ value: "KZ", label: "Kazakhstan" },
|
|
5214
|
+
{ value: "KE", label: "Kenya" },
|
|
5215
|
+
{ value: "KI", label: "Kiribati" },
|
|
5216
|
+
{ value: "KW", label: "Kuwait" },
|
|
5217
|
+
{ value: "KG", label: "Kyrgyzstan" },
|
|
5218
|
+
{ value: "LA", label: "Laos" },
|
|
5219
|
+
{ value: "LV", label: "Latvia" },
|
|
5220
|
+
{ value: "LB", label: "Lebanon" },
|
|
5221
|
+
{ value: "LS", label: "Lesotho" },
|
|
5222
|
+
{ value: "LR", label: "Liberia" },
|
|
5223
|
+
{ value: "LY", label: "Libya" },
|
|
5224
|
+
{ value: "LI", label: "Liechtenstein" },
|
|
5225
|
+
{ value: "LT", label: "Lithuania" },
|
|
5226
|
+
{ value: "LU", label: "Luxembourg" },
|
|
5227
|
+
{ value: "MO", label: "Macao SAR China" },
|
|
5228
|
+
{ value: "MG", label: "Madagascar" },
|
|
5229
|
+
{ value: "MW", label: "Malawi" },
|
|
5230
|
+
{ value: "MY", label: "Malaysia" },
|
|
5231
|
+
{ value: "MV", label: "Maldives" },
|
|
5232
|
+
{ value: "ML", label: "Mali" },
|
|
5233
|
+
{ value: "MT", label: "Malta" },
|
|
5234
|
+
{ value: "MH", label: "Marshall Islands" },
|
|
5235
|
+
{ value: "MQ", label: "Martinique" },
|
|
5236
|
+
{ value: "MR", label: "Mauritania" },
|
|
5237
|
+
{ value: "MU", label: "Mauritius" },
|
|
5238
|
+
{ value: "YT", label: "Mayotte" },
|
|
5239
|
+
{ value: "MX", label: "Mexico" },
|
|
5240
|
+
{ value: "FM", label: "Micronesia" },
|
|
5241
|
+
{ value: "MD", label: "Moldova" },
|
|
5242
|
+
{ value: "MC", label: "Monaco" },
|
|
5243
|
+
{ value: "MN", label: "Mongolia" },
|
|
5244
|
+
{ value: "ME", label: "Montenegro" },
|
|
5245
|
+
{ value: "MS", label: "Montserrat" },
|
|
5246
|
+
{ value: "MA", label: "Morocco" },
|
|
5247
|
+
{ value: "MZ", label: "Mozambique" },
|
|
5248
|
+
{ value: "MM", label: "Myanmar (Burma)" },
|
|
5249
|
+
{ value: "NA", label: "Namibia" },
|
|
5250
|
+
{ value: "NR", label: "Nauru" },
|
|
5251
|
+
{ value: "NP", label: "Nepal" },
|
|
5252
|
+
{ value: "NL", label: "Netherlands" },
|
|
5253
|
+
{ value: "NC", label: "New Caledonia" },
|
|
5254
|
+
{ value: "NZ", label: "New Zealand" },
|
|
5255
|
+
{ value: "NI", label: "Nicaragua" },
|
|
5256
|
+
{ value: "NE", label: "Niger" },
|
|
5257
|
+
{ value: "NG", label: "Nigeria" },
|
|
5258
|
+
{ value: "NU", label: "Niue" },
|
|
5259
|
+
{ value: "NF", label: "Norfolk Island" },
|
|
5260
|
+
{ value: "KP", label: "North Korea" },
|
|
5261
|
+
{ value: "MK", label: "North Macedonia" },
|
|
5262
|
+
{ value: "MP", label: "Northern Mariana Islands" },
|
|
5263
|
+
{ value: "NO", label: "Norway" },
|
|
5264
|
+
{ value: "OM", label: "Oman" },
|
|
5265
|
+
{ value: "PK", label: "Pakistan" },
|
|
5266
|
+
{ value: "PW", label: "Palau" },
|
|
5267
|
+
{ value: "PS", label: "Palestinian Territories" },
|
|
5268
|
+
{ value: "PA", label: "Panama" },
|
|
5269
|
+
{ value: "PG", label: "Papua New Guinea" },
|
|
5270
|
+
{ value: "PY", label: "Paraguay" },
|
|
5271
|
+
{ value: "PE", label: "Peru" },
|
|
5272
|
+
{ value: "PH", label: "Philippines" },
|
|
5273
|
+
{ value: "PN", label: "Pitcairn Islands" },
|
|
5274
|
+
{ value: "PL", label: "Poland" },
|
|
5275
|
+
{ value: "PT", label: "Portugal" },
|
|
5276
|
+
{ value: "PR", label: "Puerto Rico" },
|
|
5277
|
+
{ value: "QA", label: "Qatar" },
|
|
5278
|
+
{ value: "RE", label: "R\xE9union" },
|
|
5279
|
+
{ value: "RO", label: "Romania" },
|
|
5280
|
+
{ value: "RU", label: "Russia" },
|
|
5281
|
+
{ value: "RW", label: "Rwanda" },
|
|
5282
|
+
{ value: "WS", label: "Samoa" },
|
|
5283
|
+
{ value: "SM", label: "San Marino" },
|
|
5284
|
+
{ value: "ST", label: "S\xE3o Tom\xE9 & Pr\xEDncipe" },
|
|
5285
|
+
{ value: "SA", label: "Saudi Arabia" },
|
|
5286
|
+
{ value: "SN", label: "Senegal" },
|
|
5287
|
+
{ value: "RS", label: "Serbia" },
|
|
5288
|
+
{ value: "SC", label: "Seychelles" },
|
|
5289
|
+
{ value: "SL", label: "Sierra Leone" },
|
|
5290
|
+
{ value: "SG", label: "Singapore" },
|
|
5291
|
+
{ value: "SX", label: "Sint Maarten" },
|
|
5292
|
+
{ value: "SK", label: "Slovakia" },
|
|
5293
|
+
{ value: "SI", label: "Slovenia" },
|
|
5294
|
+
{ value: "SB", label: "Solomon Islands" },
|
|
5295
|
+
{ value: "SO", label: "Somalia" },
|
|
5296
|
+
{ value: "ZA", label: "South Africa" },
|
|
5297
|
+
{ value: "GS", label: "South Georgia & South Sandwich Islands" },
|
|
5298
|
+
{ value: "KR", label: "South Korea" },
|
|
5299
|
+
{ value: "SS", label: "South Sudan" },
|
|
5300
|
+
{ value: "ES", label: "Spain" },
|
|
5301
|
+
{ value: "LK", label: "Sri Lanka" },
|
|
5302
|
+
{ value: "BL", label: "St. Barth\xE9lemy" },
|
|
5303
|
+
{ value: "SH", label: "St. Helena" },
|
|
5304
|
+
{ value: "KN", label: "St. Kitts & Nevis" },
|
|
5305
|
+
{ value: "LC", label: "St. Lucia" },
|
|
5306
|
+
{ value: "MF", label: "St. Martin" },
|
|
5307
|
+
{ value: "PM", label: "St. Pierre & Miquelon" },
|
|
5308
|
+
{ value: "VC", label: "St. Vincent & Grenadines" },
|
|
5309
|
+
{ value: "SD", label: "Sudan" },
|
|
5310
|
+
{ value: "SR", label: "Suriname" },
|
|
5311
|
+
{ value: "SJ", label: "Svalbard & Jan Mayen" },
|
|
5312
|
+
{ value: "SE", label: "Sweden" },
|
|
5313
|
+
{ value: "CH", label: "Switzerland" },
|
|
5314
|
+
{ value: "SY", label: "Syria" },
|
|
5315
|
+
{ value: "TW", label: "Taiwan" },
|
|
5316
|
+
{ value: "TJ", label: "Tajikistan" },
|
|
5317
|
+
{ value: "TZ", label: "Tanzania" },
|
|
5318
|
+
{ value: "TH", label: "Thailand" },
|
|
5319
|
+
{ value: "TL", label: "Timor-Leste" },
|
|
5320
|
+
{ value: "TG", label: "Togo" },
|
|
5321
|
+
{ value: "TK", label: "Tokelau" },
|
|
5322
|
+
{ value: "TO", label: "Tonga" },
|
|
5323
|
+
{ value: "TT", label: "Trinidad & Tobago" },
|
|
5324
|
+
{ value: "TN", label: "Tunisia" },
|
|
5325
|
+
{ value: "TR", label: "T\xFCrkiye" },
|
|
5326
|
+
{ value: "TM", label: "Turkmenistan" },
|
|
5327
|
+
{ value: "TC", label: "Turks & Caicos Islands" },
|
|
5328
|
+
{ value: "TV", label: "Tuvalu" },
|
|
5329
|
+
{ value: "UM", label: "U.S. Outlying Islands" },
|
|
5330
|
+
{ value: "VI", label: "U.S. Virgin Islands" },
|
|
5331
|
+
{ value: "UG", label: "Uganda" },
|
|
5332
|
+
{ value: "UA", label: "Ukraine" },
|
|
5333
|
+
{ value: "AE", label: "United Arab Emirates" },
|
|
5334
|
+
{ value: "GB", label: "United Kingdom" },
|
|
5335
|
+
{ value: "US", label: "United States" },
|
|
5336
|
+
{ value: "UY", label: "Uruguay" },
|
|
5337
|
+
{ value: "UZ", label: "Uzbekistan" },
|
|
5338
|
+
{ value: "VU", label: "Vanuatu" },
|
|
5339
|
+
{ value: "VA", label: "Vatican City" },
|
|
5340
|
+
{ value: "VE", label: "Venezuela" },
|
|
5341
|
+
{ value: "VN", label: "Vietnam" },
|
|
5342
|
+
{ value: "WF", label: "Wallis & Futuna" },
|
|
5343
|
+
{ value: "EH", label: "Western Sahara" },
|
|
5344
|
+
{ value: "YE", label: "Yemen" },
|
|
5345
|
+
{ value: "ZM", label: "Zambia" },
|
|
5346
|
+
{ value: "ZW", label: "Zimbabwe" }
|
|
5347
|
+
];
|
|
5348
|
+
|
|
5349
|
+
// src/components/organization-onboarding-form.tsx
|
|
5350
|
+
import * as React66 from "react";
|
|
5351
|
+
import { jsx as jsx79, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5352
|
+
var CONTROLLER_SHARE_PCT = 50;
|
|
5353
|
+
var MAX_BENEFICIAL_OWNERS = 50;
|
|
5354
|
+
function parseShare(raw) {
|
|
5355
|
+
if (!/^\d{1,3}$/.test(raw.trim())) return null;
|
|
5356
|
+
const n = Number(raw);
|
|
5357
|
+
return n >= 0 && n <= 100 ? n : null;
|
|
5358
|
+
}
|
|
5359
|
+
function isRowBlank(row) {
|
|
5360
|
+
return row.name.trim() === "" && row.country === "" && row.share.trim() === "";
|
|
5361
|
+
}
|
|
5362
|
+
function initialRows(owners) {
|
|
5363
|
+
return (owners ?? []).map((owner, i) => ({
|
|
5364
|
+
key: i + 1,
|
|
5365
|
+
name: owner.name,
|
|
5366
|
+
country: owner.country,
|
|
5367
|
+
share: String(owner.share_pct)
|
|
5368
|
+
}));
|
|
5369
|
+
}
|
|
5370
|
+
function OrganizationOnboardingForm({
|
|
5371
|
+
requireSanctionsFields,
|
|
5372
|
+
onSubmit,
|
|
5373
|
+
defaultValues,
|
|
5374
|
+
submitting,
|
|
5375
|
+
serverError,
|
|
5376
|
+
violations,
|
|
5377
|
+
countries = COUNTRY_OPTIONS,
|
|
5378
|
+
submitLabel = "Create",
|
|
5379
|
+
onCancel,
|
|
5380
|
+
className
|
|
5381
|
+
}) {
|
|
5382
|
+
const [name, setName] = React66.useState(defaultValues?.name ?? "");
|
|
5383
|
+
const [legalName, setLegalName] = React66.useState(defaultValues?.legal_name ?? "");
|
|
5384
|
+
const [ownerName, setOwnerName] = React66.useState(defaultValues?.owner_name ?? "");
|
|
5385
|
+
const [countryOfIncorporation, setCountryOfIncorporation] = React66.useState(
|
|
5386
|
+
defaultValues?.country_of_incorporation ?? ""
|
|
5387
|
+
);
|
|
5388
|
+
const [residencyCountry, setResidencyCountry] = React66.useState(
|
|
5389
|
+
defaultValues?.residency_country ?? ""
|
|
5390
|
+
);
|
|
5391
|
+
const [owners, setOwners] = React66.useState(
|
|
5392
|
+
() => initialRows(defaultValues?.beneficial_owners)
|
|
5393
|
+
);
|
|
5394
|
+
const [ownershipConfirmed, setOwnershipConfirmed] = React66.useState(false);
|
|
5395
|
+
const nextKeyRef = React66.useRef(owners.length);
|
|
5396
|
+
const submittingRef = React66.useRef(false);
|
|
5397
|
+
const trimmed = name.trim();
|
|
5398
|
+
const filledOwners = owners.filter((row) => !isRowBlank(row));
|
|
5399
|
+
const ownerShares = filledOwners.map((row) => parseShare(row.share));
|
|
5400
|
+
const ownersValid = filledOwners.every(
|
|
5401
|
+
(row, i) => row.name.trim() !== "" && row.country !== "" && ownerShares[i] !== null
|
|
5402
|
+
);
|
|
5403
|
+
const shareSum = ownerShares.reduce((sum, share) => sum + (share ?? 0), 0);
|
|
5404
|
+
const hasController = ownerShares.some(
|
|
5405
|
+
(share) => share !== null && share >= CONTROLLER_SHARE_PCT
|
|
5406
|
+
);
|
|
5407
|
+
const needsOwnershipConfirmation = !hasController;
|
|
5408
|
+
const missingCountry = requireSanctionsFields && countryOfIncorporation === "";
|
|
5409
|
+
const missingConfirmation = requireSanctionsFields && needsOwnershipConfirmation && !ownershipConfirmed;
|
|
5410
|
+
const canSubmit = trimmed !== "" && ownersValid && !missingCountry && !missingConfirmation && !submitting;
|
|
5411
|
+
const addOwner = () => {
|
|
5412
|
+
if (owners.length >= MAX_BENEFICIAL_OWNERS) return;
|
|
5413
|
+
nextKeyRef.current += 1;
|
|
5414
|
+
setOwners((prev) => [
|
|
5415
|
+
...prev,
|
|
5416
|
+
{ key: nextKeyRef.current, name: "", country: "", share: "" }
|
|
5417
|
+
]);
|
|
5418
|
+
};
|
|
5419
|
+
const removeOwner = (key) => setOwners((prev) => prev.filter((row) => row.key !== key));
|
|
5420
|
+
const patchOwner = (key, patch) => setOwners((prev) => prev.map((row) => row.key === key ? { ...row, ...patch } : row));
|
|
5421
|
+
const handleSubmit = (event) => {
|
|
5422
|
+
event.preventDefault();
|
|
5423
|
+
if (!canSubmit || submittingRef.current) return;
|
|
5424
|
+
submittingRef.current = true;
|
|
5425
|
+
const beneficialOwners = filledOwners.map((row, i) => ({
|
|
5426
|
+
name: row.name,
|
|
5427
|
+
country: row.country,
|
|
5428
|
+
share_pct: ownerShares[i] ?? 0
|
|
5429
|
+
}));
|
|
5430
|
+
onSubmit({
|
|
5431
|
+
name: trimmed,
|
|
5432
|
+
...legalName.trim() !== "" ? { legal_name: legalName.trim() } : {},
|
|
5433
|
+
...ownerName.trim() !== "" ? { owner_name: ownerName.trim() } : {},
|
|
5434
|
+
...countryOfIncorporation !== "" ? { country_of_incorporation: countryOfIncorporation } : {},
|
|
5435
|
+
...residencyCountry !== "" ? { residency_country: residencyCountry } : {},
|
|
5436
|
+
beneficial_owners: beneficialOwners,
|
|
5437
|
+
// Only meaningful — and only collected — when the list shows no controlling owner.
|
|
5438
|
+
...needsOwnershipConfirmation ? { ownership_confirmed: ownershipConfirmed } : {}
|
|
5439
|
+
});
|
|
5440
|
+
};
|
|
5441
|
+
React66.useEffect(() => {
|
|
5442
|
+
submittingRef.current = false;
|
|
5443
|
+
}, [
|
|
5444
|
+
name,
|
|
5445
|
+
legalName,
|
|
5446
|
+
ownerName,
|
|
5447
|
+
countryOfIncorporation,
|
|
5448
|
+
residencyCountry,
|
|
5449
|
+
owners,
|
|
5450
|
+
ownershipConfirmed,
|
|
5451
|
+
submitting,
|
|
5452
|
+
serverError
|
|
5453
|
+
]);
|
|
5454
|
+
const countryField = (params) => /* @__PURE__ */ jsxs45("div", { className: "space-y-1.5", children: [
|
|
5455
|
+
/* @__PURE__ */ jsxs45(Label2, { htmlFor: params.id, children: [
|
|
5456
|
+
params.label,
|
|
5457
|
+
params.required && /* @__PURE__ */ jsx79("span", { className: "text-text-danger", children: " *" })
|
|
5458
|
+
] }),
|
|
5459
|
+
/* @__PURE__ */ jsx79(
|
|
5460
|
+
Select,
|
|
5461
|
+
{
|
|
5462
|
+
id: params.id,
|
|
5463
|
+
"data-testid": params.id,
|
|
5464
|
+
value: params.value,
|
|
5465
|
+
onValueChange: params.onChange,
|
|
5466
|
+
options: countries,
|
|
5467
|
+
placeholder: "Select a country\u2026",
|
|
5468
|
+
optionTestId: (value) => `${params.id}-option-${value}`
|
|
5469
|
+
}
|
|
5470
|
+
)
|
|
5471
|
+
] });
|
|
5472
|
+
return /* @__PURE__ */ jsxs45("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
|
|
5473
|
+
/* @__PURE__ */ jsxs45("div", { className: "space-y-1.5", children: [
|
|
5474
|
+
/* @__PURE__ */ jsx79(Label2, { htmlFor: "create-org-name", children: "Organization name" }),
|
|
5475
|
+
/* @__PURE__ */ jsx79(
|
|
5476
|
+
Input,
|
|
5477
|
+
{
|
|
5478
|
+
id: "create-org-name",
|
|
5479
|
+
"data-testid": "create-org-input",
|
|
5480
|
+
value: name,
|
|
5481
|
+
onChange: (event) => setName(event.target.value),
|
|
5482
|
+
placeholder: "Acme Inc"
|
|
5483
|
+
}
|
|
5484
|
+
)
|
|
5485
|
+
] }),
|
|
5486
|
+
/* @__PURE__ */ jsxs45("div", { className: "space-y-1.5", children: [
|
|
5487
|
+
/* @__PURE__ */ jsx79(Label2, { htmlFor: "create-org-legal-name", children: "Legal name" }),
|
|
5488
|
+
/* @__PURE__ */ jsx79(
|
|
5489
|
+
Input,
|
|
5490
|
+
{
|
|
5491
|
+
id: "create-org-legal-name",
|
|
5492
|
+
"data-testid": "create-org-legal-name",
|
|
5493
|
+
value: legalName,
|
|
5494
|
+
onChange: (event) => setLegalName(event.target.value),
|
|
5495
|
+
placeholder: "Acme O\xDC"
|
|
5496
|
+
}
|
|
5497
|
+
)
|
|
5498
|
+
] }),
|
|
5499
|
+
/* @__PURE__ */ jsxs45("div", { className: "space-y-1.5", children: [
|
|
5500
|
+
/* @__PURE__ */ jsx79(Label2, { htmlFor: "create-org-owner-name", children: "Owner name" }),
|
|
5501
|
+
/* @__PURE__ */ jsx79(
|
|
5502
|
+
Input,
|
|
5503
|
+
{
|
|
5504
|
+
id: "create-org-owner-name",
|
|
5505
|
+
"data-testid": "create-org-owner-name",
|
|
5506
|
+
value: ownerName,
|
|
5507
|
+
onChange: (event) => setOwnerName(event.target.value),
|
|
5508
|
+
placeholder: "Jane Doe"
|
|
5509
|
+
}
|
|
5510
|
+
)
|
|
5511
|
+
] }),
|
|
5512
|
+
countryField({
|
|
5513
|
+
id: "create-org-country",
|
|
5514
|
+
label: "Country of incorporation",
|
|
5515
|
+
value: countryOfIncorporation,
|
|
5516
|
+
onChange: setCountryOfIncorporation,
|
|
5517
|
+
required: requireSanctionsFields
|
|
5518
|
+
}),
|
|
5519
|
+
countryField({
|
|
5520
|
+
id: "create-org-residency",
|
|
5521
|
+
label: "Country of residency",
|
|
5522
|
+
value: residencyCountry,
|
|
5523
|
+
onChange: setResidencyCountry,
|
|
5524
|
+
required: false
|
|
5525
|
+
}),
|
|
5526
|
+
/* @__PURE__ */ jsxs45("div", { className: "space-y-2", children: [
|
|
5527
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between", children: [
|
|
5528
|
+
/* @__PURE__ */ jsx79(Label2, { children: "Beneficial owners" }),
|
|
5529
|
+
/* @__PURE__ */ jsx79(
|
|
5530
|
+
Button,
|
|
5531
|
+
{
|
|
5532
|
+
type: "button",
|
|
5533
|
+
variant: "outline",
|
|
5534
|
+
size: "sm",
|
|
5535
|
+
"data-testid": "add-beneficial-owner",
|
|
5536
|
+
disabled: owners.length >= MAX_BENEFICIAL_OWNERS,
|
|
5537
|
+
onClick: addOwner,
|
|
5538
|
+
children: "Add owner"
|
|
5539
|
+
}
|
|
5540
|
+
)
|
|
5541
|
+
] }),
|
|
5542
|
+
owners.length === 0 && /* @__PURE__ */ jsx79("p", { className: "text-xs text-text-tertiary", children: "List the natural persons who ultimately own or control the organization." }),
|
|
5543
|
+
owners.map((row) => /* @__PURE__ */ jsxs45(
|
|
5544
|
+
"div",
|
|
5545
|
+
{
|
|
5546
|
+
"data-testid": `beneficial-owner-row-${row.key}`,
|
|
5547
|
+
className: "flex items-end gap-2",
|
|
5548
|
+
children: [
|
|
5549
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex-1 space-y-1", children: [
|
|
5550
|
+
/* @__PURE__ */ jsx79(Label2, { htmlFor: `bo-name-${row.key}`, className: "text-xs", children: "Name" }),
|
|
5551
|
+
/* @__PURE__ */ jsx79(
|
|
5552
|
+
Input,
|
|
5553
|
+
{
|
|
5554
|
+
id: `bo-name-${row.key}`,
|
|
5555
|
+
"data-testid": `bo-name-${row.key}`,
|
|
5556
|
+
value: row.name,
|
|
5557
|
+
onChange: (event) => patchOwner(row.key, { name: event.target.value })
|
|
5558
|
+
}
|
|
5559
|
+
)
|
|
5560
|
+
] }),
|
|
5561
|
+
/* @__PURE__ */ jsxs45("div", { className: "w-40 space-y-1", children: [
|
|
5562
|
+
/* @__PURE__ */ jsx79(Label2, { htmlFor: `bo-country-${row.key}`, className: "text-xs", children: "Country" }),
|
|
5563
|
+
/* @__PURE__ */ jsx79(
|
|
5564
|
+
Select,
|
|
5565
|
+
{
|
|
5566
|
+
id: `bo-country-${row.key}`,
|
|
5567
|
+
"data-testid": `bo-country-${row.key}`,
|
|
5568
|
+
value: row.country,
|
|
5569
|
+
onValueChange: (value) => patchOwner(row.key, { country: value }),
|
|
5570
|
+
options: countries,
|
|
5571
|
+
placeholder: "Country\u2026",
|
|
5572
|
+
optionTestId: (value) => `bo-country-${row.key}-option-${value}`
|
|
5573
|
+
}
|
|
5574
|
+
)
|
|
5575
|
+
] }),
|
|
5576
|
+
/* @__PURE__ */ jsxs45("div", { className: "w-24 space-y-1", children: [
|
|
5577
|
+
/* @__PURE__ */ jsx79(Label2, { htmlFor: `bo-share-${row.key}`, className: "text-xs", children: "Share %" }),
|
|
5578
|
+
/* @__PURE__ */ jsx79(
|
|
5579
|
+
Input,
|
|
5580
|
+
{
|
|
5581
|
+
id: `bo-share-${row.key}`,
|
|
5582
|
+
"data-testid": `bo-share-${row.key}`,
|
|
5583
|
+
inputMode: "numeric",
|
|
5584
|
+
value: row.share,
|
|
5585
|
+
onChange: (event) => patchOwner(row.key, { share: event.target.value })
|
|
5586
|
+
}
|
|
5587
|
+
)
|
|
5588
|
+
] }),
|
|
5589
|
+
/* @__PURE__ */ jsx79(
|
|
5590
|
+
Button,
|
|
5591
|
+
{
|
|
5592
|
+
type: "button",
|
|
5593
|
+
variant: "outline",
|
|
5594
|
+
size: "sm",
|
|
5595
|
+
"data-testid": `remove-beneficial-owner-${row.key}`,
|
|
5596
|
+
onClick: () => removeOwner(row.key),
|
|
5597
|
+
children: "Remove"
|
|
5598
|
+
}
|
|
5599
|
+
)
|
|
5600
|
+
]
|
|
5601
|
+
},
|
|
5602
|
+
row.key
|
|
5603
|
+
)),
|
|
5604
|
+
!ownersValid && /* @__PURE__ */ jsx79("p", { "data-testid": "beneficial-owners-error", className: "text-xs text-text-danger", children: "Every owner needs a name, a country and a share between 0 and 100." }),
|
|
5605
|
+
shareSum > 100 && /* @__PURE__ */ jsxs45("p", { "data-testid": "beneficial-owners-sum-warning", className: "text-xs text-text-warning", children: [
|
|
5606
|
+
"The listed shares add up to ",
|
|
5607
|
+
shareSum,
|
|
5608
|
+
"%, which is more than 100%."
|
|
5609
|
+
] })
|
|
5610
|
+
] }),
|
|
5611
|
+
needsOwnershipConfirmation && /* @__PURE__ */ jsxs45("div", { className: "flex items-start gap-2", children: [
|
|
5612
|
+
/* @__PURE__ */ jsx79(
|
|
5613
|
+
Checkbox,
|
|
5614
|
+
{
|
|
5615
|
+
id: "create-org-ownership-confirmed",
|
|
5616
|
+
"data-testid": "create-org-ownership-confirmed",
|
|
5617
|
+
checked: ownershipConfirmed,
|
|
5618
|
+
onCheckedChange: (value) => setOwnershipConfirmed(value === true)
|
|
5619
|
+
}
|
|
5620
|
+
),
|
|
5621
|
+
/* @__PURE__ */ jsxs45(
|
|
5622
|
+
Label2,
|
|
5623
|
+
{
|
|
5624
|
+
htmlFor: "create-org-ownership-confirmed",
|
|
5625
|
+
className: "text-xs font-normal leading-snug",
|
|
5626
|
+
children: [
|
|
5627
|
+
"I confirm the ownership structure above is complete and correct",
|
|
5628
|
+
requireSanctionsFields && /* @__PURE__ */ jsx79("span", { className: "text-text-danger", children: " *" })
|
|
5629
|
+
]
|
|
5630
|
+
}
|
|
5631
|
+
)
|
|
5632
|
+
] }),
|
|
5633
|
+
(serverError || violations && violations.length > 0) && /* @__PURE__ */ jsxs45(InlineError, { children: [
|
|
5634
|
+
serverError,
|
|
5635
|
+
violations && violations.length > 0 && /* @__PURE__ */ jsx79("ul", { "data-testid": "create-org-violations", className: "mt-1 list-disc pl-4", children: violations.map((violation) => /* @__PURE__ */ jsx79("li", { children: violation }, violation)) })
|
|
5636
|
+
] }),
|
|
5637
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex justify-end gap-2", children: [
|
|
5638
|
+
onCancel && /* @__PURE__ */ jsx79(Button, { type: "button", variant: "outline", onClick: onCancel, children: "Cancel" }),
|
|
5639
|
+
/* @__PURE__ */ jsx79(Button, { type: "submit", "data-testid": "submit-create-org", disabled: !canSubmit, children: submitting ? "Creating\u2026" : submitLabel })
|
|
5640
|
+
] })
|
|
5641
|
+
] });
|
|
5642
|
+
}
|
|
5643
|
+
|
|
5644
|
+
// src/components/onboarding-screen-shell.tsx
|
|
5645
|
+
import { jsx as jsx80, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5646
|
+
var GLOW_BG2 = "radial-gradient(560px 320px at 28% 16%, var(--auth-glow-a), transparent 68%),radial-gradient(520px 340px at 78% 90%, var(--auth-glow-b), transparent 66%),var(--bg-sunken)";
|
|
5647
|
+
var CARD_WIDTH = {
|
|
5648
|
+
md: "max-w-[440px]",
|
|
5649
|
+
lg: "max-w-[560px]"
|
|
5650
|
+
};
|
|
5651
|
+
function OnboardingScreenShell({
|
|
5652
|
+
logo,
|
|
5653
|
+
themeToggle = /* @__PURE__ */ jsx80(ThemeToggle, {}),
|
|
5654
|
+
title,
|
|
5655
|
+
description,
|
|
5656
|
+
footer = "Supercharged by Lessly",
|
|
5657
|
+
width = "md",
|
|
5658
|
+
children,
|
|
5659
|
+
className,
|
|
5660
|
+
...props
|
|
5661
|
+
}) {
|
|
5662
|
+
return /* @__PURE__ */ jsxs46(
|
|
5663
|
+
"div",
|
|
5664
|
+
{
|
|
5665
|
+
className: cn(
|
|
5666
|
+
"relative flex min-h-screen w-full flex-col items-center justify-center overflow-hidden px-6 py-12 text-text-primary",
|
|
5667
|
+
className
|
|
5668
|
+
),
|
|
5669
|
+
style: { background: GLOW_BG2 },
|
|
5670
|
+
...props,
|
|
5671
|
+
children: [
|
|
5672
|
+
themeToggle && /* @__PURE__ */ jsx80("div", { className: "absolute right-6 top-6", children: themeToggle }),
|
|
5673
|
+
/* @__PURE__ */ jsxs46("div", { className: cn("w-full", CARD_WIDTH[width]), children: [
|
|
5674
|
+
/* @__PURE__ */ jsxs46("div", { className: "mb-[26px] text-center", children: [
|
|
5675
|
+
logo && /* @__PURE__ */ jsx80("div", { className: "mb-[20px] text-[24px] font-bold leading-none tracking-[-0.02em] text-text-primary", children: logo }),
|
|
5676
|
+
/* @__PURE__ */ jsx80("h1", { className: "mb-[8px] text-[22px] font-semibold leading-[1.25] tracking-[-0.015em] text-text-primary", children: title }),
|
|
5677
|
+
description && /* @__PURE__ */ jsx80("p", { className: "mx-auto max-w-[380px] text-[13.5px] leading-[1.5] text-text-secondary", children: description })
|
|
5678
|
+
] }),
|
|
5679
|
+
/* @__PURE__ */ jsx80(
|
|
5680
|
+
"div",
|
|
5681
|
+
{
|
|
5682
|
+
className: "rounded-2xl bg-bg-surface px-[30px] pb-[28px] pt-[28px]",
|
|
5683
|
+
style: {
|
|
5684
|
+
border: "1px solid var(--auth-card-border)",
|
|
5685
|
+
boxShadow: "var(--auth-card-shadow)"
|
|
5686
|
+
},
|
|
5687
|
+
children
|
|
5688
|
+
}
|
|
5689
|
+
),
|
|
5690
|
+
footer != null && /* @__PURE__ */ jsx80("div", { className: "mt-[24px] text-center text-[11px] tracking-[0.005em] text-text-tertiary", children: footer })
|
|
5691
|
+
] })
|
|
5692
|
+
]
|
|
5693
|
+
}
|
|
5694
|
+
);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
// src/components/organization-create-screen.tsx
|
|
5698
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
5699
|
+
function OrganizationCreateScreen({
|
|
5700
|
+
requireSanctionsFields,
|
|
5701
|
+
onSubmit,
|
|
5702
|
+
defaultValues,
|
|
5703
|
+
submitting,
|
|
5704
|
+
serverError,
|
|
5705
|
+
violations,
|
|
5706
|
+
countries,
|
|
5707
|
+
submitLabel,
|
|
5708
|
+
onCancel,
|
|
5709
|
+
logo,
|
|
5710
|
+
themeToggle,
|
|
5711
|
+
title = "Create your organization",
|
|
5712
|
+
description = "An organization is the home for your team and products",
|
|
5713
|
+
footer,
|
|
5714
|
+
...props
|
|
5715
|
+
}) {
|
|
5716
|
+
return /* @__PURE__ */ jsx81(
|
|
5717
|
+
OnboardingScreenShell,
|
|
5718
|
+
{
|
|
5719
|
+
logo,
|
|
5720
|
+
themeToggle,
|
|
5721
|
+
title,
|
|
5722
|
+
description,
|
|
5723
|
+
footer,
|
|
5724
|
+
width: "lg",
|
|
5725
|
+
...props,
|
|
5726
|
+
children: /* @__PURE__ */ jsx81(
|
|
5727
|
+
OrganizationOnboardingForm,
|
|
5728
|
+
{
|
|
5729
|
+
requireSanctionsFields,
|
|
5730
|
+
onSubmit,
|
|
5731
|
+
defaultValues,
|
|
5732
|
+
submitting,
|
|
5733
|
+
serverError,
|
|
5734
|
+
violations,
|
|
5735
|
+
countries,
|
|
5736
|
+
submitLabel,
|
|
5737
|
+
onCancel
|
|
5738
|
+
}
|
|
5739
|
+
)
|
|
5740
|
+
}
|
|
5741
|
+
);
|
|
5742
|
+
}
|
|
5743
|
+
|
|
5744
|
+
// src/components/product-create-screen.tsx
|
|
5745
|
+
import * as React67 from "react";
|
|
5746
|
+
import { jsx as jsx82, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5747
|
+
var productRow = "flex w-full items-center justify-between rounded-md border border-border-default bg-bg-primary px-3 py-2 text-left text-sm text-text-primary";
|
|
5748
|
+
function ProductCreateScreen({
|
|
5749
|
+
organizationName,
|
|
5750
|
+
onSubmit,
|
|
5751
|
+
defaultName = "",
|
|
5752
|
+
submitting,
|
|
5753
|
+
serverError,
|
|
5754
|
+
existingProducts,
|
|
5755
|
+
onOpenProduct,
|
|
5756
|
+
existingProductsLabel = "Your products",
|
|
5757
|
+
submitLabel = "Create product",
|
|
5758
|
+
onCancel,
|
|
5759
|
+
logo,
|
|
5760
|
+
themeToggle,
|
|
5761
|
+
title = "Create your product",
|
|
5762
|
+
description = "A product is where your data, extensions and team access live",
|
|
5763
|
+
footer,
|
|
5764
|
+
...props
|
|
5765
|
+
}) {
|
|
5766
|
+
const [name, setName] = React67.useState(defaultName);
|
|
5767
|
+
const submittingRef = React67.useRef(false);
|
|
5768
|
+
const trimmed = name.trim();
|
|
5769
|
+
const canSubmit = trimmed !== "" && !submitting;
|
|
5770
|
+
React67.useEffect(() => {
|
|
5771
|
+
submittingRef.current = false;
|
|
5772
|
+
}, [name, submitting, serverError]);
|
|
5773
|
+
const handleSubmit = (event) => {
|
|
5774
|
+
event.preventDefault();
|
|
5775
|
+
if (!canSubmit || submittingRef.current) return;
|
|
5776
|
+
submittingRef.current = true;
|
|
5777
|
+
onSubmit({ name: trimmed });
|
|
5778
|
+
};
|
|
5779
|
+
const products = existingProducts ?? [];
|
|
5780
|
+
return /* @__PURE__ */ jsxs47(
|
|
5781
|
+
OnboardingScreenShell,
|
|
5782
|
+
{
|
|
5783
|
+
logo,
|
|
5784
|
+
themeToggle,
|
|
5785
|
+
title,
|
|
5786
|
+
description,
|
|
5787
|
+
footer,
|
|
5788
|
+
...props,
|
|
5789
|
+
children: [
|
|
5790
|
+
/* @__PURE__ */ jsxs47("form", { onSubmit: handleSubmit, className: "space-y-4", noValidate: true, children: [
|
|
5791
|
+
/* @__PURE__ */ jsxs47("div", { className: "space-y-1.5", children: [
|
|
5792
|
+
/* @__PURE__ */ jsx82("span", { className: "text-sm font-medium leading-none text-text-primary", children: "Organization" }),
|
|
5793
|
+
/* @__PURE__ */ jsx82(
|
|
5794
|
+
"p",
|
|
5795
|
+
{
|
|
5796
|
+
"data-testid": "create-product-organization",
|
|
5797
|
+
className: "truncate rounded-md border border-border-default bg-bg-secondary px-3 py-2 text-sm text-text-secondary",
|
|
5798
|
+
children: organizationName
|
|
5799
|
+
}
|
|
5800
|
+
)
|
|
5801
|
+
] }),
|
|
5802
|
+
/* @__PURE__ */ jsxs47("div", { className: "space-y-1.5", children: [
|
|
5803
|
+
/* @__PURE__ */ jsx82(Label2, { htmlFor: "create-product-name", children: "Product name" }),
|
|
5804
|
+
/* @__PURE__ */ jsx82(
|
|
5805
|
+
Input,
|
|
5806
|
+
{
|
|
5807
|
+
id: "create-product-name",
|
|
5808
|
+
"data-testid": "create-product-input",
|
|
5809
|
+
value: name,
|
|
5810
|
+
onChange: (event) => setName(event.target.value),
|
|
5811
|
+
placeholder: "My product"
|
|
5812
|
+
}
|
|
5813
|
+
)
|
|
5814
|
+
] }),
|
|
5815
|
+
serverError && /* @__PURE__ */ jsx82(InlineError, { children: serverError }),
|
|
5816
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex justify-end gap-2", children: [
|
|
5817
|
+
onCancel && /* @__PURE__ */ jsx82(Button, { type: "button", variant: "outline", onClick: onCancel, children: "Cancel" }),
|
|
5818
|
+
/* @__PURE__ */ jsx82(Button, { type: "submit", "data-testid": "submit-create-product", disabled: !canSubmit, children: submitting ? "Creating\u2026" : submitLabel })
|
|
5819
|
+
] })
|
|
5820
|
+
] }),
|
|
5821
|
+
products.length > 0 && /* @__PURE__ */ jsxs47("div", { "data-testid": "existing-products", className: "mt-6 space-y-2 border-t border-border-default pt-5", children: [
|
|
5822
|
+
/* @__PURE__ */ jsx82(Label2, { children: existingProductsLabel }),
|
|
5823
|
+
/* @__PURE__ */ jsx82("ul", { className: "flex flex-col gap-1", children: products.map((product) => /* @__PURE__ */ jsx82("li", { children: onOpenProduct ? /* @__PURE__ */ jsxs47(
|
|
5824
|
+
"button",
|
|
5825
|
+
{
|
|
5826
|
+
type: "button",
|
|
5827
|
+
"data-testid": `existing-product-${product.id}`,
|
|
5828
|
+
onClick: () => onOpenProduct(product),
|
|
5829
|
+
className: cn(
|
|
5830
|
+
productRow,
|
|
5831
|
+
"hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus"
|
|
5832
|
+
),
|
|
5833
|
+
children: [
|
|
5834
|
+
/* @__PURE__ */ jsx82("span", { className: "truncate", children: product.name }),
|
|
5835
|
+
product.slug && /* @__PURE__ */ jsx82("span", { className: "ml-2 truncate text-text-tertiary", children: product.slug })
|
|
5836
|
+
]
|
|
5837
|
+
}
|
|
5838
|
+
) : /* @__PURE__ */ jsxs47("div", { className: productRow, children: [
|
|
5839
|
+
/* @__PURE__ */ jsx82("span", { className: "truncate", children: product.name }),
|
|
5840
|
+
product.slug && /* @__PURE__ */ jsx82("span", { className: "ml-2 truncate text-text-tertiary", children: product.slug })
|
|
5841
|
+
] }) }, product.id)) })
|
|
5842
|
+
] })
|
|
5843
|
+
]
|
|
5844
|
+
}
|
|
5845
|
+
);
|
|
5846
|
+
}
|
|
5095
5847
|
export {
|
|
5096
5848
|
Accordion,
|
|
5097
5849
|
AccordionContent,
|
|
@@ -5127,6 +5879,7 @@ export {
|
|
|
5127
5879
|
BreadcrumbPage,
|
|
5128
5880
|
BreadcrumbSeparator,
|
|
5129
5881
|
Button,
|
|
5882
|
+
COUNTRY_OPTIONS,
|
|
5130
5883
|
Calendar,
|
|
5131
5884
|
Card,
|
|
5132
5885
|
CardContent,
|
|
@@ -5268,6 +6021,8 @@ export {
|
|
|
5268
6021
|
NotificationToast,
|
|
5269
6022
|
NotificationToaster,
|
|
5270
6023
|
OrgProductSwitcher,
|
|
6024
|
+
OrganizationCreateScreen,
|
|
6025
|
+
OrganizationOnboardingForm,
|
|
5271
6026
|
Pagination,
|
|
5272
6027
|
PaginationContent,
|
|
5273
6028
|
PaginationEllipsis,
|
|
@@ -5279,6 +6034,7 @@ export {
|
|
|
5279
6034
|
PopoverAnchor,
|
|
5280
6035
|
PopoverContent,
|
|
5281
6036
|
PopoverTrigger,
|
|
6037
|
+
ProductCreateScreen,
|
|
5282
6038
|
Progress,
|
|
5283
6039
|
RadioGroup2 as RadioGroup,
|
|
5284
6040
|
RadioGroupItem,
|