@tallyui/components 4.1.0 → 4.2.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 CHANGED
@@ -911,8 +911,12 @@ interface ProductTableProps extends Omit<ViewProps, 'children'> {
911
911
  /** With renderExpanded and showThumbnail, a product with more than one variant has its thumbnail toggle its
912
912
  * expanded block: a button labelled "Show variations" with aria-expanded. A press calls this, never onSelect. */
913
913
  onToggleExpand?: (doc: ProductTableRowDoc) => void;
914
- /** The block drawn under an expanded row (e.g. its variant rows), indented by the thumbnail column. */
914
+ /** The block drawn under an expanded row (e.g. its variant rows), indented by the thumbnail column when it shows. */
915
915
  renderExpanded?: (doc: ProductTableRowDoc) => ReactNode;
916
+ /** v2's "{count} variations" button under the first cell's content, with a chevron and aria-expanded, on a product
917
+ * with more than one variant. A press calls onToggleExpand, never onSelect; needs onToggleExpand and renderExpanded,
918
+ * and makes such rows expandable without showThumbnail. Default false. */
919
+ variationsButton?: boolean;
916
920
  /** With no items, draw the header and skeleton rows instead of emptyState, as WCPOS v2's DataTableSkeleton. */
917
921
  loading?: boolean;
918
922
  className?: string;
@@ -923,7 +927,7 @@ declare function defaultProductColumns(traits: ProductTraits, context?: TraitCon
923
927
  declare function useDefaultProductColumns(options?: {
924
928
  currencySymbol?: string;
925
929
  }): ProductTableColumn[];
926
- declare function ProductTable({ items, columns, sort, defaultSort, onSortChange, sortItems, onSelect, searchSlot, filterSlot, emptyState, showUnsellable, currencySymbol, showThumbnail, showAddButton, cartQuantity, isExpanded, onToggleExpand, renderExpanded, loading, className, ...viewProps }: ProductTableProps): JSX.Element;
930
+ declare function ProductTable({ items, columns, sort, defaultSort, onSortChange, sortItems, onSelect, searchSlot, filterSlot, emptyState, showUnsellable, currencySymbol, showThumbnail, showAddButton, cartQuantity, isExpanded, onToggleExpand, renderExpanded, variationsButton, loading, className, ...viewProps }: ProductTableProps): JSX.Element;
927
931
 
928
932
  /**
929
933
  * WCPOS v2's Products screen read columns: image, product (with its variation count), stock with the Manage switch,
@@ -963,6 +967,8 @@ declare function CategoryNav({ categories, selectedId, onSelect, orientation, cl
963
967
  interface VariantOption {
964
968
  name: string;
965
969
  values: string[];
970
+ /** Values in this group that no variant takes with the other current picks; drawn dimmed, still pressable. */
971
+ dimmed?: string[];
966
972
  }
967
973
  interface ProductVariantPickerProps extends Omit<ViewProps, 'children'> {
968
974
  options: VariantOption[];
@@ -2635,6 +2641,16 @@ declare function Cart({ sale, taxLabel, canEditPrice, onPriceChange, quickDiscou
2635
2641
  /** The empty cart's line. Default: v2's "Tap a product to start a sale". */
2636
2642
  emptyText?: string;
2637
2643
  }): react_jsx_runtime.JSX.Element;
2644
+ /** WCPOS v2's `− n of unpaid +` stepper (tender/unit-stepper.tsx), the one Cart's `picker` draws in each pickable line's
2645
+ * quantity cell, with what the picked units add under it. An app cart built on CartPanel and CartLine passes it as
2646
+ * CartLine's `quantitySlot` (with `picking`), with the same `picker` object Cart takes. */
2647
+ declare function PickStepper({ picker, id, name, unpaid, currency }: {
2648
+ picker: NonNullable<Parameters<typeof Cart>[0]['picker']>;
2649
+ id: string;
2650
+ name: string;
2651
+ unpaid: number;
2652
+ currency: string;
2653
+ }): react_jsx_runtime.JSX.Element;
2638
2654
 
2639
2655
  interface OrderNoteSheetProps {
2640
2656
  /** The note as it stands; the sheet edits it live, as v2's autosaved field does. */
@@ -2828,7 +2844,10 @@ interface ChargeFormProps {
2828
2844
  taxClass?: string;
2829
2845
  percent?: number;
2830
2846
  amountIncludesTax?: boolean;
2847
+ sku?: string;
2831
2848
  };
2849
+ /** On the custom kind, shows v2's "+ SKU" add-row after the tax rows; pressing it shows the SKU field. */
2850
+ sku?: boolean;
2832
2851
  /** Shows the amount-unit toggle (currency symbol or %) on the fee kind, as v2's AmountUnitToggle. */
2833
2852
  allowPercent?: boolean;
2834
2853
  /** The store's tax mode. Given, the fee and shipping kinds show the "Amount Includes Tax" switch (not on a percent fee), which starts at this
@@ -2842,11 +2861,12 @@ interface ChargeFormProps {
2842
2861
  taxClass?: string;
2843
2862
  percent?: number;
2844
2863
  amountIncludesTax?: boolean;
2864
+ sku?: string;
2845
2865
  }) => string | null;
2846
2866
  onClose: () => void;
2847
2867
  }
2848
2868
  /** `onApply` returns a refusal to show inline, or null once applied. */
2849
- declare function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore, shippingNoTax, kind: fixedKind, initial, allowPercent, pricesIncludeTax, onApply, onClose }: ChargeFormProps): react_jsx_runtime.JSX.Element;
2869
+ declare function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore, shippingNoTax, kind: fixedKind, initial, sku, allowPercent, pricesIncludeTax, onApply, onClose }: ChargeFormProps): react_jsx_runtime.JSX.Element;
2850
2870
 
2851
2871
  type ProductFilterChip = 'inStock' | 'featured' | 'onSale' | 'category' | 'tag' | 'brand';
2852
2872
  type TermChip = 'category' | 'tag' | 'brand';
@@ -2985,11 +3005,13 @@ declare function Catalogue<Doc>({ products, traits, currency, onSelect, statusTe
2985
3005
  /** v2's table row extras in table view: thumbnail leads the row, addButton ends it with the + (> for a product
2986
3006
  * with variants) that does what a row press does. With expand and thumbnail, a product with more than one variant
2987
3007
  * has its thumbnail show or hide its variants as rows under it: option chips, price, stock and a + that adds that
2988
- * variant as the list chooser does. Default: none. */
3008
+ * variant as the list chooser does; variationsButton adds v2's '{count} variations' button under the name, which shows
3009
+ * or hides the variants as expand does; it needs expand. Default: none. */
2989
3010
  tableRow?: {
2990
3011
  thumbnail?: boolean;
2991
3012
  addButton?: boolean;
2992
3013
  expand?: boolean;
3014
+ variationsButton?: boolean;
2993
3015
  };
2994
3016
  /** v2's rows between the chips and the products (its ListColumn `rows`): notices such as "Price check only until
2995
3017
  * the register is open.", rendered under the header and above the grid, table or category tiles. Default none. */
@@ -3092,7 +3114,7 @@ interface ReceiptSheetEmail {
3092
3114
  offline?: boolean;
3093
3115
  /** Draws "Save email to the customer" (default off). */
3094
3116
  saveToCustomer?: boolean;
3095
- /** Sends or queues the receipt. Returns a refusal to show, or null once sent or queued; the form then closes. */
3117
+ /** Sends or queues the receipt. Returns a refusal to show, or null once sent or queued; the form then shows "Email sent", or "Receipt email queued" when offline. */
3096
3118
  onSend: (input: {
3097
3119
  address: string;
3098
3120
  saveToCustomer: boolean;
@@ -3135,6 +3157,17 @@ interface ReceiptSheetProps {
3135
3157
  /** The preview. */
3136
3158
  children: ReactNode;
3137
3159
  }
3160
+ interface ReceiptEmailFormProps {
3161
+ email: ReceiptSheetEmail;
3162
+ /** Called once after `onSend` returns null, with true when `email.offline` was set (queued). */
3163
+ onDone?: (queued: boolean) => void;
3164
+ }
3165
+ /**
3166
+ * v2's email.tsx (MIT, WCPOS) inline, the form ReceiptSheet draws: "Email Address" prefilled from `defaultAddress`,
3167
+ * the save switch (off), the offline notice and Send. After `onSend` returns null it shows "Email sent" or
3168
+ * "Receipt email queued" in its own place and calls `onDone`. Remount it (for example with a new `key`) to send again.
3169
+ */
3170
+ declare function ReceiptEmailForm({ email, onDone }: ReceiptEmailFormProps): JSX.Element;
3138
3171
  declare function ReceiptSheet({ open, onOpenChange, title, templates, templateId, onTemplateChange, printerLabel, printers, printerId, autoPrinterName, onPrinterChange, onPrint, printing, printed, onEmail, email, onDownloadPdf, downloadingPdf, children }: ReceiptSheetProps): JSX.Element;
3139
3172
 
3140
3173
  /** The order reference a visitor sees on the receipt and in Orders (front desk ruling, 2026-10-06): the finalized
@@ -3613,4 +3646,4 @@ declare function I18nProvider({ locale, resources, children }: I18nProviderProps
3613
3646
  /** The components' `t`, read from the nearest `I18nProvider`, else English. Interpolation is `{name}`. */
3614
3647
  declare function useT(): TFunction;
3615
3648
 
3616
- export { APPROVAL_REQUIRED_TEXT, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityHeartbeatIcon, type AddedToCartEvent, AddedToCartToast, type AddedToCartToastProps, AddressEditor, type AddressEditorProps, type AddressEditorValue, AddressFields, type AddressFieldsProps, AlertCircleIcon, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTriangleIcon, AppShell, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, BarcodeScanningSettings, type BarcodeScanningSettingsProps, type BarcodeScanningValues, Button, type ButtonProps, Calendar, type CalendarProps, CameraScanButton, type CameraScanButtonProps, CameraScannerPanel, type CameraScannerPanelProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cart, type CartAction, CartBar, CartColumnHeads, type CartColumnHeadsProps, type CartColumnId, type CartColumnSettings, CartColumnsForm, type CartColumnsFormProps, CartFoot, type CartFootAction, type CartFootProps, CartLine, CartLineActions, type CartLineActionsProps, type CartLineProps, CartNoteInput, type CartNoteInputProps, CartPanel, type CartPanelProps, CartTotal, type CartTotalProps, CashCountInput, type CashCountInputProps, CashRegisterIcon, CashTendered, type CashTenderedProps, CashierSheet, type CashierSheetCashier, type CashierSheetDrawer, type CashierSheetHandTo, type CashierSheetPlace, type CashierSheetProps, Catalogue, CatalogueSettingsForm, type CatalogueSettingsFormProps, type Catalogues, type CategoryItem, CategoryNav, type CategoryNavProps, CategoryTile, type CategoryTileProps, ChangeDisplay, type ChangeDisplayProps, ChargeForm, type ChargeFormProps, ChartLineIcon, CheckIcon, Checkbox, CheckoutLayout, type CheckoutLayoutProps, ChevronDownIcon, ChevronRightIcon, type ChipItem, ClosureSheet, type ClosureSheetProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, ConfirmDialog, type ConfirmDialogProps, type ConnectionStatus, ConnectivityToast, type ConnectivityToastProps, ConnectorStatus, type ConnectorStatusProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CustomerCard, type CustomerCardProps, CustomerDisplayPairing, type CustomerDisplayPairingProps, CustomerDisplayScreen, CustomerDisplaySettings, type CustomerDisplaySettingsProps, CustomerDropdown, type CustomerDropdownProps, CustomerEditor, type CustomerEditorProps, CustomerForm, type CustomerFormProps, type CustomerFormValues, CustomerOrderHistory, type CustomerOrderHistoryProps, CustomerPicker, type CustomerPickerProps, CustomerSelect, type CustomerSelectProps, CustomersList, type CustomersListProps, DEFAULT_PRODUCT_FILTERS, DIGIT_ROWS, DateRangeMenu, type DateRangeMenuProps, type Denomination, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscountBadge, type DiscountBadgeProps, DiscountChips, type DiscountCoupon, DiscountForm, DiscountIcon, DisplaySettings, type DisplaySettingsProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FLASH_DURATION_MS, FilterChip, FilterChipGroup, type FilterChipGroupProps, type FilterChipProps, type FilterOption, FontProvider, type FontProviderProps, type FontState, type FontStatus, GiftIcon, type GridDay, GripIcon, HStack, type HStackProps, HandoverSlip, type HandoverSlipProps, HoverCard, HoverCardContent, HoverCardTrigger, I18nProvider, type I18nProviderProps, Icon, IconButton, type IconButtonProps, type IconProps, InCartBadge, type InCartBadgeProps, InfoCircleIcon, Input, InputField, InputRoot, type InputRootProps, InputSlot, Keypad, type KeypadKey, type KeypadProps, Label, type LabelProps, LinePopover, type LinePopoverProps, ListRow, type ListRowProps, type ListRowSize, LiveTabScreen, type LiveTabScreenProps, type LiveTabScreenState, Loader, type LoaderProps, MessageQuestionIcon, type Month, MovementSheet, type MovementSheetProps, NavDrawer, type NavDrawerProps, NavRail, type NavRailProps, Notice, type NoticeAction, type NoticeProps, OpenRegisterCard, type OpenRegisterCardProps, OpenSaleTabs, type OpenSaleTabsProps, OrderCard, type OrderCardProps, OrderDetail, type OrderDetailLineItem, type OrderDetailProps, type OrderDetailTaxLine, OrderFilterBar, type OrderFilterBarProps, type OrderFilterOption, type OrderHistoryRow, OrderList, type OrderListProps, OrderNoteSheet, type OrderNoteSheetProps, type OrderStatus, OrderStatusBadge, type OrderStatusBadgeProps, OrderSummary, OrderSummaryLine, type OrderSummaryLineProps, type OrderSummaryPayment, type OrderSummaryProps, OrderSyncNotices, type OrderSyncNoticesProps, OrdersList, POSLayout, type POSLayoutProps, PRODUCT_FILTER_CHIPS, ParkedSales, type ParkedSalesProps, type PaymentMethod, PaymentMethodCard, type PaymentMethodCardProps, type PaymentMethodKind, PaymentSelector, type PaymentSelectorMethod, type PaymentSelectorProps, PlusIcon, Popover, PopoverContent, PopoverTrigger, PriceForm, PrinterForm, type PrinterFormDraft, type PrinterFormProps, PrinterIcon, PrintingSettings, type PrintingSettingsProps, ProductCard, type ProductCardProps, ProductFilterBar, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters, ProductGrid, type ProductGridProps, ProductImage, type ProductImageProps, ProductList, type ProductListProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, ProductStockBadge, type ProductStockBadgeProps, ProductTable, type ProductTableColumn, type ProductTableProps, type ProductTermFilter, ProductTitle, type ProductTitleProps, ProductVariantPicker, type ProductVariantPickerProps, Progress, type ProgressProps, QuantityStepper, type QuantityStepperProps, RadioGroup, RadioGroupItem, Receipt, ReceiptIcon, type ReceiptItem, ReceiptPreview, type ReceiptPreviewProps, ReceiptSheet, type ReceiptSheetEmail, type ReceiptSheetProps, type ReceiptSheetTemplate, RefundForm, type RefundFormProps, type RefundFormValue, RefundModal, type RefundModalProps, RegisterBar, type RegisterBarPill, type RegisterBarProps, RegisterColumn, type RegisterColumnProps, RegisterCount, type RegisterCountProps, RegisterOpenClose, type RegisterOpenCloseProps, RegisterPanel, type RegisterPanelProps, RegisterPicker, type RegisterPickerProps, type RegisterPickerRegister, RegisterSummary, type RegisterSummaryProps, SCANNER_DEFAULT_HEIGHT, SCANNER_MAX_HEIGHT, SCANNER_MIN_HEIGHT, SKELETON_MAX_ROWS, type SalesCardId, SalesCardPanel, type SalesCardPanelProps, SalesCards, type SalesCardsProps, type SalesFilters, SalesFiltersBar, type SalesFiltersBarProps, SalesHero, type SalesHeroProps, type SalesOption, type SalesPanelId, SalesRoom, type SalesRoomProps, ScaleProvider, type ScaleProviderProps, type ScaleScopeProps, type ScaleState, ScanIcon, ScannerViewfinder, SearchIcon, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, SettingsGroup, type SettingsGroupProps, SettingsIcon, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, type ShellNavItem, ShippingAddressFields, type ShippingAddressFieldsProps, ShoppingCartIcon, Skeleton, type SkeletonProps, Slider, type SliderProps, SplitTender, StatusBadge, type StatusBadgeProps, StoreSettingsChoiceScreen, type StoreSettingsChoiceScreenProps, type SvgIconProps, Switch, SwitchConfirm, type SwitchConfirmProps, SyncStatus, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TaxBasedOn, type TaxBasedOnProps, TaxCalculationSettings, type TaxCalculationSettingsProps, Tender, TenderPane, type TenderPaneProps, type TenderPicker, Text, type TextProps, Textarea, type TextareaProps, Toast, ToastClose, ToastDescription, type ToastProps, ToastTitle, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, ToneDisc, type ToneDiscProps, type Tone as ToneDiscTone, Tooltip, TooltipContent, TooltipTrigger, type TransactionSummary, UserIcon, UsersIcon, VStack, type VStackProps, type VariantOption, VariationPicker, type VariationPickerProps, ViewToggle, type ViewToggleProps, type ViewfinderProps, type WeekDay, XIcon, addMonths, avatarInitials, avatarVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, cartColumnIds, compareDays, createSvgIcon, defaultProductColumns, describeRegisterBarPill, discountLabel, formatStockSyncTime, hstackVariants, iconButtonVariants, iconVariants, injectPrintStyle, loaderVariants, monthGrid, monthOf, orderReference, parseDiscount, parsePrice, pickFigure, pressRangeDay, productsScreenColumns, skeletonCount, statusDotVariants, syncStatusQuiet, tenderLabel, textVariants, toastVariants, toggleTextVariants, toggleVariants, useDefaultProductColumns, useFontType, useInputContext, usePointer, useProductsScreenColumns, useScale, useT, useTender, vstackVariants };
3649
+ export { APPROVAL_REQUIRED_TEXT, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityHeartbeatIcon, type AddedToCartEvent, AddedToCartToast, type AddedToCartToastProps, AddressEditor, type AddressEditorProps, type AddressEditorValue, AddressFields, type AddressFieldsProps, AlertCircleIcon, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTriangleIcon, AppShell, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, BarcodeScanningSettings, type BarcodeScanningSettingsProps, type BarcodeScanningValues, Button, type ButtonProps, Calendar, type CalendarProps, CameraScanButton, type CameraScanButtonProps, CameraScannerPanel, type CameraScannerPanelProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cart, type CartAction, CartBar, CartColumnHeads, type CartColumnHeadsProps, type CartColumnId, type CartColumnSettings, CartColumnsForm, type CartColumnsFormProps, CartFoot, type CartFootAction, type CartFootProps, CartLine, CartLineActions, type CartLineActionsProps, type CartLineProps, CartNoteInput, type CartNoteInputProps, CartPanel, type CartPanelProps, CartTotal, type CartTotalProps, CashCountInput, type CashCountInputProps, CashRegisterIcon, CashTendered, type CashTenderedProps, CashierSheet, type CashierSheetCashier, type CashierSheetDrawer, type CashierSheetHandTo, type CashierSheetPlace, type CashierSheetProps, Catalogue, CatalogueSettingsForm, type CatalogueSettingsFormProps, type Catalogues, type CategoryItem, CategoryNav, type CategoryNavProps, CategoryTile, type CategoryTileProps, ChangeDisplay, type ChangeDisplayProps, ChargeForm, type ChargeFormProps, ChartLineIcon, CheckIcon, Checkbox, CheckoutLayout, type CheckoutLayoutProps, ChevronDownIcon, ChevronRightIcon, type ChipItem, ClosureSheet, type ClosureSheetProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, ConfirmDialog, type ConfirmDialogProps, type ConnectionStatus, ConnectivityToast, type ConnectivityToastProps, ConnectorStatus, type ConnectorStatusProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CustomerCard, type CustomerCardProps, CustomerDisplayPairing, type CustomerDisplayPairingProps, CustomerDisplayScreen, CustomerDisplaySettings, type CustomerDisplaySettingsProps, CustomerDropdown, type CustomerDropdownProps, CustomerEditor, type CustomerEditorProps, CustomerForm, type CustomerFormProps, type CustomerFormValues, CustomerOrderHistory, type CustomerOrderHistoryProps, CustomerPicker, type CustomerPickerProps, CustomerSelect, type CustomerSelectProps, CustomersList, type CustomersListProps, DEFAULT_PRODUCT_FILTERS, DIGIT_ROWS, DateRangeMenu, type DateRangeMenuProps, type Denomination, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscountBadge, type DiscountBadgeProps, DiscountChips, type DiscountCoupon, DiscountForm, DiscountIcon, DisplaySettings, type DisplaySettingsProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FLASH_DURATION_MS, FilterChip, FilterChipGroup, type FilterChipGroupProps, type FilterChipProps, type FilterOption, FontProvider, type FontProviderProps, type FontState, type FontStatus, GiftIcon, type GridDay, GripIcon, HStack, type HStackProps, HandoverSlip, type HandoverSlipProps, HoverCard, HoverCardContent, HoverCardTrigger, I18nProvider, type I18nProviderProps, Icon, IconButton, type IconButtonProps, type IconProps, InCartBadge, type InCartBadgeProps, InfoCircleIcon, Input, InputField, InputRoot, type InputRootProps, InputSlot, Keypad, type KeypadKey, type KeypadProps, Label, type LabelProps, LinePopover, type LinePopoverProps, ListRow, type ListRowProps, type ListRowSize, LiveTabScreen, type LiveTabScreenProps, type LiveTabScreenState, Loader, type LoaderProps, MessageQuestionIcon, type Month, MovementSheet, type MovementSheetProps, NavDrawer, type NavDrawerProps, NavRail, type NavRailProps, Notice, type NoticeAction, type NoticeProps, OpenRegisterCard, type OpenRegisterCardProps, OpenSaleTabs, type OpenSaleTabsProps, OrderCard, type OrderCardProps, OrderDetail, type OrderDetailLineItem, type OrderDetailProps, type OrderDetailTaxLine, OrderFilterBar, type OrderFilterBarProps, type OrderFilterOption, type OrderHistoryRow, OrderList, type OrderListProps, OrderNoteSheet, type OrderNoteSheetProps, type OrderStatus, OrderStatusBadge, type OrderStatusBadgeProps, OrderSummary, OrderSummaryLine, type OrderSummaryLineProps, type OrderSummaryPayment, type OrderSummaryProps, OrderSyncNotices, type OrderSyncNoticesProps, OrdersList, POSLayout, type POSLayoutProps, PRODUCT_FILTER_CHIPS, ParkedSales, type ParkedSalesProps, type PaymentMethod, PaymentMethodCard, type PaymentMethodCardProps, type PaymentMethodKind, PaymentSelector, type PaymentSelectorMethod, type PaymentSelectorProps, PickStepper, PlusIcon, Popover, PopoverContent, PopoverTrigger, PriceForm, PrinterForm, type PrinterFormDraft, type PrinterFormProps, PrinterIcon, PrintingSettings, type PrintingSettingsProps, ProductCard, type ProductCardProps, ProductFilterBar, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters, ProductGrid, type ProductGridProps, ProductImage, type ProductImageProps, ProductList, type ProductListProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, ProductStockBadge, type ProductStockBadgeProps, ProductTable, type ProductTableColumn, type ProductTableProps, type ProductTermFilter, ProductTitle, type ProductTitleProps, ProductVariantPicker, type ProductVariantPickerProps, Progress, type ProgressProps, QuantityStepper, type QuantityStepperProps, RadioGroup, RadioGroupItem, Receipt, ReceiptEmailForm, type ReceiptEmailFormProps, ReceiptIcon, type ReceiptItem, ReceiptPreview, type ReceiptPreviewProps, ReceiptSheet, type ReceiptSheetEmail, type ReceiptSheetProps, type ReceiptSheetTemplate, RefundForm, type RefundFormProps, type RefundFormValue, RefundModal, type RefundModalProps, RegisterBar, type RegisterBarPill, type RegisterBarProps, RegisterColumn, type RegisterColumnProps, RegisterCount, type RegisterCountProps, RegisterOpenClose, type RegisterOpenCloseProps, RegisterPanel, type RegisterPanelProps, RegisterPicker, type RegisterPickerProps, type RegisterPickerRegister, RegisterSummary, type RegisterSummaryProps, SCANNER_DEFAULT_HEIGHT, SCANNER_MAX_HEIGHT, SCANNER_MIN_HEIGHT, SKELETON_MAX_ROWS, type SalesCardId, SalesCardPanel, type SalesCardPanelProps, SalesCards, type SalesCardsProps, type SalesFilters, SalesFiltersBar, type SalesFiltersBarProps, SalesHero, type SalesHeroProps, type SalesOption, type SalesPanelId, SalesRoom, type SalesRoomProps, ScaleProvider, type ScaleProviderProps, type ScaleScopeProps, type ScaleState, ScanIcon, ScannerViewfinder, SearchIcon, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, SettingsGroup, type SettingsGroupProps, SettingsIcon, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, type ShellNavItem, ShippingAddressFields, type ShippingAddressFieldsProps, ShoppingCartIcon, Skeleton, type SkeletonProps, Slider, type SliderProps, SplitTender, StatusBadge, type StatusBadgeProps, StoreSettingsChoiceScreen, type StoreSettingsChoiceScreenProps, type SvgIconProps, Switch, SwitchConfirm, type SwitchConfirmProps, SyncStatus, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TaxBasedOn, type TaxBasedOnProps, TaxCalculationSettings, type TaxCalculationSettingsProps, Tender, TenderPane, type TenderPaneProps, type TenderPicker, Text, type TextProps, Textarea, type TextareaProps, Toast, ToastClose, ToastDescription, type ToastProps, ToastTitle, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, ToneDisc, type ToneDiscProps, type Tone as ToneDiscTone, Tooltip, TooltipContent, TooltipTrigger, type TransactionSummary, UserIcon, UsersIcon, VStack, type VStackProps, type VariantOption, VariationPicker, type VariationPickerProps, ViewToggle, type ViewToggleProps, type ViewfinderProps, type WeekDay, XIcon, addMonths, avatarInitials, avatarVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, cartColumnIds, compareDays, createSvgIcon, defaultProductColumns, describeRegisterBarPill, discountLabel, formatStockSyncTime, hstackVariants, iconButtonVariants, iconVariants, injectPrintStyle, loaderVariants, monthGrid, monthOf, orderReference, parseDiscount, parsePrice, pickFigure, pressRangeDay, productsScreenColumns, skeletonCount, statusDotVariants, syncStatusQuiet, tenderLabel, textVariants, toastVariants, toggleTextVariants, toggleVariants, useDefaultProductColumns, useFontType, useInputContext, usePointer, useProductsScreenColumns, useScale, useT, useTender, vstackVariants };
package/dist/index.js CHANGED
@@ -2928,6 +2928,7 @@ function ProductTable({
2928
2928
  isExpanded,
2929
2929
  onToggleExpand,
2930
2930
  renderExpanded,
2931
+ variationsButton = false,
2931
2932
  loading = false,
2932
2933
  className,
2933
2934
  ...viewProps
@@ -3003,7 +3004,8 @@ function ProductTable({
3003
3004
  const key = String(item.id ?? index);
3004
3005
  const variations = addButton && traits !== void 0 && traits.getVariantCount(item) > 1;
3005
3006
  const count2 = addButton && !variations ? cartQuantity?.(item) ?? 0 : 0;
3006
- const expandable = thumbnail && onToggleExpand !== void 0 && renderExpanded !== void 0 && traits.getVariantCount(item) > 1;
3007
+ const variantCount = traits?.getVariantCount(item) ?? 0;
3008
+ const expandable = (thumbnail || variationsButton) && onToggleExpand !== void 0 && renderExpanded !== void 0 && variantCount > 1;
3007
3009
  const expanded = expandable && (isExpanded?.(item) ?? false);
3008
3010
  const row2 = /* @__PURE__ */ jsxs31(TableRow, { testID: onSelect ? void 0 : "product-row-" + key, children: [
3009
3011
  thumbnail ? /* @__PURE__ */ jsx82(TableCell, { style: { width: thumb + CELL_PAD_X }, className: "flex-none px-3 py-1.5", children: expandable ? /* @__PURE__ */ jsx82(
@@ -3020,12 +3022,31 @@ function ProductTable({
3020
3022
  children: /* @__PURE__ */ jsx82(ProductImage, { doc: item, size: thumb, showPlaceholder: true, className: "rounded-md" })
3021
3023
  }
3022
3024
  ) : /* @__PURE__ */ jsx82(ProductImage, { doc: item, size: thumb, showPlaceholder: true, className: "rounded-md" }) }) : null,
3023
- resolvedColumns.map((column) => /* @__PURE__ */ jsx82(
3025
+ resolvedColumns.map((column, cell) => /* @__PURE__ */ jsxs31(
3024
3026
  TableCell,
3025
3027
  {
3026
3028
  style: { flex: column.flex ?? 1 },
3027
3029
  className: cn53("px-3 py-1.5", column.align && ALIGN[column.align]),
3028
- children: column.render(item)
3030
+ children: [
3031
+ column.render(item),
3032
+ cell === 0 && expandable && variationsButton ? /* @__PURE__ */ jsxs31(
3033
+ Pressable11,
3034
+ {
3035
+ accessibilityRole: "button",
3036
+ "aria-expanded": expanded,
3037
+ testID: "product-row-variations-" + key,
3038
+ className: "mt-0.5 self-start flex-row items-center gap-1",
3039
+ onPress: (event) => {
3040
+ event.stopPropagation?.();
3041
+ onToggleExpand(item);
3042
+ },
3043
+ children: [
3044
+ /* @__PURE__ */ jsx82(View30, { className: "text-muted-foreground", children: expanded ? /* @__PURE__ */ jsx82(ChevronDownIcon, { size: 14 }) : /* @__PURE__ */ jsx82(ChevronRightIcon, { size: 14 }) }),
3045
+ /* @__PURE__ */ jsx82(Text, { className: "text-xs text-muted-foreground", children: `${variantCount} variations` })
3046
+ ]
3047
+ }
3048
+ ) : null
3049
+ ]
3029
3050
  },
3030
3051
  column.id
3031
3052
  )),
@@ -3052,7 +3073,7 @@ function ProductTable({
3052
3073
  View30,
3053
3074
  {
3054
3075
  testID: "product-row-expanded-" + key,
3055
- style: { paddingLeft: thumb + CELL_PAD_X },
3076
+ style: { paddingLeft: thumbnail ? thumb + CELL_PAD_X : 0 },
3056
3077
  className: "border-b border-border",
3057
3078
  children: renderExpanded(item)
3058
3079
  }
@@ -3250,10 +3271,12 @@ function ProductVariantPicker({
3250
3271
  return /* @__PURE__ */ jsx86(
3251
3272
  Pressable13,
3252
3273
  {
3274
+ testID: `variant-option-${option.name}-${value}`,
3253
3275
  onPress: () => handleSelect(option.name, value),
3254
3276
  className: cn56(
3255
3277
  "rounded-lg border px-3 py-1.5",
3256
- active ? "border-primary bg-primary/10" : "border-border bg-card"
3278
+ active ? "border-primary bg-primary/10" : "border-border bg-card",
3279
+ option.dimmed?.includes(value) && "opacity-50"
3257
3280
  ),
3258
3281
  children: /* @__PURE__ */ jsx86(
3259
3282
  Text15,
@@ -3781,6 +3804,7 @@ var components_default = {
3781
3804
  "pos_checkout.no_payments_yet": "No payments yet",
3782
3805
  "pos_checkout.paid": "Paid",
3783
3806
  "pos_checkout.paid_in_full": "Paid in full",
3807
+ "pos_checkout.paid_in_full_at": "Paid in full \xB7 {time}",
3784
3808
  "pos_checkout.paid_of_total": "{paid} of {total} paid",
3785
3809
  "pos_checkout.part_payment_left": "Part payment \xB7 {left} left after this",
3786
3810
  "pos_checkout.pick_amount_due": "This payment is {amount} for the picked items",
@@ -9796,6 +9820,7 @@ import { normalizeMoneyText as normalizeMoneyText5, useCurrencySymbol as useCurr
9796
9820
  import { Fragment as Fragment36, jsx as jsx169, jsxs as jsxs106 } from "react/jsx-runtime";
9797
9821
  var NAME_LABEL_ID = "charge-form-name-label";
9798
9822
  var AMOUNT_LABEL_ID4 = "charge-form-amount-label";
9823
+ var SKU_LABEL_ID = "charge-form-sku-label";
9799
9824
  var button3 = "rounded-md border border-border px-3 py-2 min-h-11 items-center justify-center";
9800
9825
  var DEFAULT_NAME = { fee: "Fee", shipping: "Shipping", custom: "Product" };
9801
9826
  function ChargeForm({
@@ -9806,6 +9831,7 @@ function ChargeForm({
9806
9831
  shippingNoTax,
9807
9832
  kind: fixedKind,
9808
9833
  initial,
9834
+ sku,
9809
9835
  allowPercent,
9810
9836
  pricesIncludeTax,
9811
9837
  onApply,
@@ -9823,7 +9849,10 @@ function ChargeForm({
9823
9849
  const [noTax, setNoTax] = useState48(initial?.taxStatus === "none");
9824
9850
  const [includesTax, setIncludesTax] = useState48(initial?.amountIncludesTax ?? pricesIncludeTax ?? false);
9825
9851
  const [taxClass, setTaxClass] = useState48(initial?.taxClass ?? "");
9852
+ const [skuText, setSkuText] = useState48(initial?.sku ?? "");
9853
+ const [skuOpen, setSkuOpen] = useState48(Boolean(initial?.sku));
9826
9854
  const [error, setError] = useState48(null);
9855
+ const showSku = Boolean(sku) && kind === "custom";
9827
9856
  const storeShipping = kind === "shipping" && shippingTaxFromStore;
9828
9857
  const showNoTax = storeShipping ? shippingNoTax : lineTax?.none;
9829
9858
  const showUnit = Boolean(allowPercent) && kind === "fee";
@@ -9841,7 +9870,8 @@ function ChargeForm({
9841
9870
  taxStatus: showNoTax ? noTax ? "none" : void 0 : initial?.taxStatus === "none" ? "none" : void 0,
9842
9871
  taxClass: !storeShipping && lineTax?.classes && taxClasses?.length ? taxClass || void 0 : initial?.taxClass,
9843
9872
  ...percentMode ? { percent: parsed } : !showUnit && initial?.percent !== void 0 ? { percent: initial.percent } : {},
9844
- ...percentMode ? {} : showIncludesTax ? includesTax !== pricesIncludeTax ? { amountIncludesTax: includesTax } : {} : initial?.amountIncludesTax !== void 0 ? { amountIncludesTax: initial.amountIncludesTax } : {}
9873
+ ...percentMode ? {} : showIncludesTax ? includesTax !== pricesIncludeTax ? { amountIncludesTax: includesTax } : {} : initial?.amountIncludesTax !== void 0 ? { amountIncludesTax: initial.amountIncludesTax } : {},
9874
+ ...showSku ? skuText.trim() ? { sku: skuText.trim() } : {} : initial?.sku ? { sku: initial.sku } : {}
9845
9875
  });
9846
9876
  setError(refused);
9847
9877
  if (refused === null) onClose();
@@ -9936,6 +9966,29 @@ function ChargeForm({
9936
9966
  },
9937
9967
  option.id
9938
9968
  )) }) : null }),
9969
+ showSku ? skuOpen ? /* @__PURE__ */ jsxs106(Fragment36, { children: [
9970
+ /* @__PURE__ */ jsx169(Label, { nativeID: SKU_LABEL_ID, children: t("common.sku") }),
9971
+ /* @__PURE__ */ jsx169(
9972
+ TextInput11,
9973
+ {
9974
+ testID: "charge-form-sku-input",
9975
+ accessibilityLabelledBy: SKU_LABEL_ID,
9976
+ accessibilityLabel: t("common.sku"),
9977
+ value: skuText,
9978
+ onChangeText: setSkuText,
9979
+ className: "min-w-0 rounded-md border border-border bg-background px-3 py-2 text-foreground"
9980
+ }
9981
+ )
9982
+ ] }) : /* @__PURE__ */ jsx169(
9983
+ Pressable44,
9984
+ {
9985
+ testID: "charge-form-add-sku",
9986
+ accessibilityRole: "button",
9987
+ onPress: () => setSkuOpen(true),
9988
+ className: `${button3} bg-card self-start`,
9989
+ children: /* @__PURE__ */ jsx169(Text44, { className: "text-foreground", children: `+ ${t("common.sku")}` })
9990
+ }
9991
+ ) : null,
9939
9992
  error ? /* @__PURE__ */ jsx169(Text44, { accessibilityRole: "alert", className: "text-destructive", children: error }) : null,
9940
9993
  /* @__PURE__ */ jsxs106(View102, { className: "flex-row gap-2", children: [
9941
9994
  /* @__PURE__ */ jsx169(Pressable44, { accessibilityRole: "button", onPress: apply, className: `${button3} bg-primary`, children: /* @__PURE__ */ jsx169(Text44, { className: "font-semibold text-primary-foreground", children: t(initial ? "common.save" : "common.add_to_cart") }) }),
@@ -10208,6 +10261,14 @@ function tenderOf(descriptor) {
10208
10261
  return { method, ...descriptor.id !== method ? { methodId: descriptor.id } : {} };
10209
10262
  }
10210
10263
 
10264
+ // src/sale/since-text.ts
10265
+ function shortTime(t) {
10266
+ return new Date(t).toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
10267
+ }
10268
+ function sinceText(clock2) {
10269
+ return clock2.firstFailedAt === void 0 ? "about " + shortTime(clock2.since) : shortTime(clock2.firstFailedAt);
10270
+ }
10271
+
10211
10272
  // src/sale/tender-ledger.tsx
10212
10273
  import { Fragment as Fragment37, jsx as jsx172, jsxs as jsxs109 } from "react/jsx-runtime";
10213
10274
  var STATUS_LABEL = {
@@ -10235,6 +10296,8 @@ function TenderLedger({ sale, methods, closing = false, confirmVoid = false }) {
10235
10296
  const money = (minor) => formatMoney2({ amount: minor, currency: order.currency }) ?? "";
10236
10297
  const balance = order.balanceDueMinor;
10237
10298
  const settled = order.payments.some(countsTowardPaid);
10299
+ const paidAt = order.payments.filter(countsTowardPaid).at(-1)?.takenAt;
10300
+ const paidInFull = paidAt ? t("pos_checkout.paid_in_full_at", { time: shortTime(paidAt) }) : t("pos_checkout.paid_in_full");
10238
10301
  const firstPending = order.payments.find((leg) => legStatus(leg) === "pending");
10239
10302
  const askedLeg = order.payments.find((leg) => leg.id === asking);
10240
10303
  const asked = askedLeg && descriptorOf(askedLeg);
@@ -10251,6 +10314,7 @@ function TenderLedger({ sale, methods, closing = false, confirmVoid = false }) {
10251
10314
  /* @__PURE__ */ jsx172(Text46, { testID: `tender-leg-${leg.id}-status`, className: cn112("text-sm font-semibold", STATUS_TONE[status]), children: voided ? t("pos_checkout.cancelled") : t(STATUS_LABEL[status]) })
10252
10315
  ] }),
10253
10316
  leg.reference ? /* @__PURE__ */ jsx172(Text46, { className: "text-sm text-muted-foreground", children: leg.reference }) : null,
10317
+ leg.takenAt ? /* @__PURE__ */ jsx172(Text46, { testID: `tender-leg-${leg.id}-time`, className: "text-sm text-muted-foreground", children: shortTime(leg.takenAt) }) : null,
10254
10318
  leg === firstPending ? /* @__PURE__ */ jsx172(Text46, { className: "text-sm text-muted-foreground", children: t("pos_checkout.next_leg") }) : null,
10255
10319
  descriptor && canVoidLeg(leg, descriptor) && !heldTillLeg(order, leg) ? /* @__PURE__ */ jsx172(
10256
10320
  Pressable46,
@@ -10265,7 +10329,7 @@ function TenderLedger({ sale, methods, closing = false, confirmVoid = false }) {
10265
10329
  ) : null
10266
10330
  ] }, leg.id);
10267
10331
  }),
10268
- !closing && balance === 0 && settled ? /* @__PURE__ */ jsx172(Text46, { className: "text-sm text-success", children: t("pos_checkout.paid_in_full") }) : null,
10332
+ !closing && balance === 0 && settled ? /* @__PURE__ */ jsx172(Text46, { className: "text-sm text-success", children: paidInFull }) : null,
10269
10333
  confirmVoid ? /* @__PURE__ */ jsx172(
10270
10334
  ConfirmDialog,
10271
10335
  {
@@ -10295,7 +10359,7 @@ function TenderLedger({ sale, methods, closing = false, confirmVoid = false }) {
10295
10359
  /* @__PURE__ */ jsxs109(View104, { testID: "tender-ledger-totals", className: "gap-1.5", children: [
10296
10360
  row2(t("common.total"), order.totalMinor),
10297
10361
  row2(t("pos_checkout.paid"), order.paidMinor),
10298
- /* @__PURE__ */ jsx172(View104, { testID: "tender-ledger-lead", className: "mt-1.5 flex-row justify-between border-t border-border pt-2", children: balance === 0 && settled ? /* @__PURE__ */ jsx172(Text46, { className: "font-semibold text-success", children: t("pos_checkout.paid_in_full") }) : /* @__PURE__ */ jsxs109(Fragment37, { children: [
10362
+ /* @__PURE__ */ jsx172(View104, { testID: "tender-ledger-lead", className: "mt-1.5 flex-row justify-between border-t border-border pt-2", children: balance === 0 && settled ? /* @__PURE__ */ jsx172(Text46, { className: "font-semibold text-success", children: paidInFull }) : /* @__PURE__ */ jsxs109(Fragment37, { children: [
10299
10363
  /* @__PURE__ */ jsx172(Text46, { className: "font-semibold text-foreground", children: t("pos_checkout.remaining") }),
10300
10364
  /* @__PURE__ */ jsx172(Text46, { testID: "tender-ledger-remaining", className: "font-semibold text-foreground", children: money(order.balanceDueMinor) })
10301
10365
  ] }) })
@@ -11757,6 +11821,7 @@ function Catalogue({
11757
11821
  return next;
11758
11822
  }) : void 0,
11759
11823
  renderExpanded: tableRow?.expand ? variantRows : void 0,
11824
+ variationsButton: tableRow?.variationsButton,
11760
11825
  cartQuantity: (doc) => quantities.get(traits.getId(doc)) ?? 0
11761
11826
  }
11762
11827
  ) : drillEntries.length > 0 ? /* @__PURE__ */ jsxs119(LevelWrap, { level: true, onBack: () => setDrillId(null), children: [
@@ -12153,11 +12218,17 @@ function PrinterValue({ printers, printerId, autoPrinterName, onPrinterChange })
12153
12218
  ] });
12154
12219
  }
12155
12220
  var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+$/;
12156
- function EmailForm({ email, onDone }) {
12221
+ var SEND_FAILED = "Could not send the receipt.";
12222
+ function EmailSentLine({ queued }) {
12223
+ const t = useT();
12224
+ return /* @__PURE__ */ jsx186(Text, { testID: "receipt-email-sent", className: "py-2 text-sm text-foreground", children: t(queued ? "receipt.email_queued" : "receipt.email_sent") });
12225
+ }
12226
+ function ReceiptEmailForm({ email, onDone }) {
12157
12227
  const [text, setText] = useState54(email.defaultAddress ?? "");
12158
12228
  const [save, setSave] = useState54(false);
12159
12229
  const [error, setError] = useState54(null);
12160
12230
  const [sending, setSending] = useState54(false);
12231
+ const [sent, setSent] = useState54(null);
12161
12232
  const send = async () => {
12162
12233
  if (sending) return;
12163
12234
  const address = text.trim();
@@ -12172,12 +12243,14 @@ function EmailForm({ email, onDone }) {
12172
12243
  refusal = await result;
12173
12244
  }
12174
12245
  } catch (cause) {
12175
- refusal = cause instanceof Error ? cause.message : "Could not send the receipt.";
12246
+ refusal = cause instanceof Error ? cause.message : SEND_FAILED;
12176
12247
  }
12177
12248
  setSending(false);
12178
- if (refusal === null) onDone(Boolean(email.offline));
12179
- else setError(refusal);
12249
+ if (refusal !== null) return setError(refusal || SEND_FAILED);
12250
+ setSent(email.offline ? "queued" : "sent");
12251
+ onDone?.(Boolean(email.offline));
12180
12252
  };
12253
+ if (sent) return /* @__PURE__ */ jsx186(EmailSentLine, { queued: sent === "queued" });
12181
12254
  return /* @__PURE__ */ jsxs122(View114, { testID: "receipt-email-form", className: "gap-2 py-2", children: [
12182
12255
  /* @__PURE__ */ jsx186(Text, { className: "text-sm font-medium text-foreground", children: "Email Address" }),
12183
12256
  /* @__PURE__ */ jsx186(Input, { children: /* @__PURE__ */ jsx186(
@@ -12232,7 +12305,6 @@ function ReceiptSheet({
12232
12305
  downloadingPdf = false,
12233
12306
  children
12234
12307
  }) {
12235
- const t = useT();
12236
12308
  const [sent, setSent] = useState54(null);
12237
12309
  const [emailOpen, setEmailOpen] = useState54(false);
12238
12310
  if (!open && (emailOpen || sent)) {
@@ -12250,11 +12322,11 @@ function ReceiptSheet({
12250
12322
  /* @__PURE__ */ jsx186(SheetRow, { testID: "print-sheet-printer", label: "Printer", children: printers && printers.length > 0 ? /* @__PURE__ */ jsx186(PrinterValue, { printers, printerId, autoPrinterName, onPrinterChange }) : /* @__PURE__ */ jsx186(Text, { className: "text-sm text-foreground", children: printerLabel }) })
12251
12323
  ] }),
12252
12324
  /* @__PURE__ */ jsx186(ScrollView22, { className: "flex-1", contentContainerClassName: "pb-2", children }),
12253
- email && emailOpen ? /* @__PURE__ */ jsx186(EmailForm, { email, onDone: (queued) => {
12325
+ email && emailOpen ? /* @__PURE__ */ jsx186(ReceiptEmailForm, { email, onDone: (queued) => {
12254
12326
  setEmailOpen(false);
12255
12327
  setSent(queued ? "queued" : "sent");
12256
12328
  } }) : null,
12257
- email && sent ? /* @__PURE__ */ jsx186(Text, { testID: "receipt-email-sent", className: "py-2 text-sm text-foreground", children: t(sent === "queued" ? "receipt.email_queued" : "receipt.email_sent") }) : null,
12329
+ email && sent ? /* @__PURE__ */ jsx186(EmailSentLine, { queued: sent === "queued" }) : null,
12258
12330
  /* @__PURE__ */ jsxs122(DialogFooter, { bordered: true, className: "gap-2", testID: "receipt-footer", children: [
12259
12331
  /* @__PURE__ */ jsx186(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx186(Button, { variant: "outline", testID: "receipt-close-button", children: /* @__PURE__ */ jsx186(Text, { children: "Close" }) }) }),
12260
12332
  onEmailPress ? /* @__PURE__ */ jsx186(Button, { variant: "outline", testID: "receipt-email-button", onPress: onEmailPress, children: /* @__PURE__ */ jsx186(Text, { children: "Email Receipt" }) }) : null,
@@ -12292,14 +12364,6 @@ function ReceiptSheet({
12292
12364
  // src/sale/sync-status.tsx
12293
12365
  import { useEffect as useEffect23, useRef as useRef25, useState as useState55 } from "react";
12294
12366
  import { AccessibilityInfo as AccessibilityInfo4, Platform as Platform21, Text as Text56, View as View115 } from "react-native";
12295
-
12296
- // src/sale/since-text.ts
12297
- function sinceText(clock2) {
12298
- const time = (t) => new Date(t).toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
12299
- return clock2.firstFailedAt === void 0 ? "about " + time(clock2.since) : time(clock2.firstFailedAt);
12300
- }
12301
-
12302
- // src/sale/sync-status.tsx
12303
12367
  import { Fragment as Fragment47, jsx as jsx187, jsxs as jsxs123 } from "react/jsx-runtime";
12304
12368
  var PULL_NOTICE_TEXT = {
12305
12369
  unauthorized: {
@@ -12340,6 +12404,7 @@ var REFUSED = (n, waiting) => n === 1 ? `1 sale needs attention${waiting} \xB7 T
12340
12404
  var REFUSED_DETAIL = "Refused sales stay on this till under Needs attention, each with what to do next.";
12341
12405
  var SALES_REFUSED = "The online store refused the last send. This till will try again with the next sale, or when the app is reopened.";
12342
12406
  var TILL_UPDATES_REFUSED = "The online store refused the last send. This till will try again with the next till update, or when the app is reopened.";
12407
+ var STORE_VERSION_UNKNOWN = "The online store didn't say which POS plugin version it runs.";
12343
12408
  var count = (n, noun) => `${n} ${noun}${n === 1 ? "" : "s"}`;
12344
12409
  function useAnnounceOnIos(...texts) {
12345
12410
  const announced = useRef25(texts);
@@ -12386,6 +12451,7 @@ function SyncStatus({ state, registerState, pluginName = "the POS plugin", pullN
12386
12451
  ] }) : null,
12387
12452
  /* @__PURE__ */ jsx187(Text56, { accessibilityLabel: spoken, accessibilityLiveRegion: "polite", className: "px-4 py-2 text-xs text-muted-foreground", children: spoken }),
12388
12453
  doing ? /* @__PURE__ */ jsx187(Text56, { className: "px-4 pb-2 text-xs text-muted-foreground", children: doing }) : null,
12454
+ doing && outbox.lastRetryReason === "store_version_unknown" ? /* @__PURE__ */ jsx187(Text56, { className: "px-4 pb-2 text-xs text-muted-foreground", children: STORE_VERSION_UNKNOWN }) : null,
12389
12455
  refused ? /* @__PURE__ */ jsx187(Text56, { className: "px-4 pb-2 text-xs text-muted-foreground", children: REFUSED_DETAIL }) : null,
12390
12456
  oneDetail && notice ? /* @__PURE__ */ jsx187(Text56, { className: "px-4 pb-2 text-xs text-muted-foreground", children: notice.detail }) : backendMissing ? /* @__PURE__ */ jsx187(Text56, { className: "px-4 pb-2 text-xs text-muted-foreground", children: BACKEND_MISSING_DETAIL.replace("{pluginName}", () => pluginName).replace("{lastTime}", () => upToDate ? " the last time it checked" : "") }) : null
12391
12457
  ] });
@@ -14294,6 +14360,7 @@ export {
14294
14360
  ParkedSales,
14295
14361
  PaymentMethodCard,
14296
14362
  PaymentSelector,
14363
+ PickStepper,
14297
14364
  PlusIcon,
14298
14365
  Popover,
14299
14366
  PopoverContent,
@@ -14318,6 +14385,7 @@ export {
14318
14385
  RadioGroup,
14319
14386
  RadioGroupItem,
14320
14387
  Receipt,
14388
+ ReceiptEmailForm,
14321
14389
  ReceiptIcon,
14322
14390
  ReceiptPreview,
14323
14391
  ReceiptSheet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tallyui/components",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "type": "module",
5
5
  "description": "Universal POS UI components for Tally UI",
6
6
  "main": "./dist/index.js",
@@ -28,9 +28,9 @@
28
28
  "directory": "packages/components"
29
29
  },
30
30
  "peerDependencies": {
31
- "@tallyui/core": "^4.1.0",
32
- "@tallyui/primitives": "^4.1.0",
33
- "@tallyui/theme": "^4.1.0",
31
+ "@tallyui/core": "^4.2.0",
32
+ "@tallyui/primitives": "^4.2.0",
33
+ "@tallyui/theme": "^4.2.0",
34
34
  "react": ">=18",
35
35
  "react-native": ">=0.74",
36
36
  "react-native-svg": ">=15"
@@ -39,13 +39,13 @@
39
39
  "class-variance-authority": "^0.7.1",
40
40
  "i18next": "^26.7.1",
41
41
  "react-i18next": "^17.1.12",
42
- "@tallyui/pos": "4.1.0"
42
+ "@tallyui/pos": "4.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@tallyui/connector-medusa": "4.1.0",
46
- "@tallyui/connector-vendure": "4.1.0",
47
- "@tallyui/connector-woocommerce": "4.1.0",
48
- "@tallyui/mock-api": "4.1.0",
45
+ "@tallyui/connector-medusa": "4.2.0",
46
+ "@tallyui/connector-vendure": "4.2.0",
47
+ "@tallyui/connector-woocommerce": "4.2.0",
48
+ "@tallyui/mock-api": "4.2.0",
49
49
  "@types/react": ">=18",
50
50
  "react": "^19.2.4",
51
51
  "react-native-svg": "15.12.1",
@@ -77,6 +77,7 @@
77
77
  "pos_checkout.no_payments_yet": "No payments yet",
78
78
  "pos_checkout.paid": "Paid",
79
79
  "pos_checkout.paid_in_full": "Paid in full",
80
+ "pos_checkout.paid_in_full_at": "Paid in full · {time}",
80
81
  "pos_checkout.paid_of_total": "{paid} of {total} paid",
81
82
  "pos_checkout.part_payment_left": "Part payment · {left} left after this",
82
83
  "pos_checkout.pick_amount_due": "This payment is {amount} for the picked items",
package/src/index.ts CHANGED
@@ -248,11 +248,11 @@ export { TaxBasedOn, type TaxBasedOnProps } from './tax';
248
248
 
249
249
  // Sale components
250
250
  export {
251
- Cart, CartBar, Tender, SplitTender, TenderPane, type TenderPaneProps, DiscountForm, DiscountChips, parseDiscount, discountLabel,
251
+ Cart, PickStepper, CartBar, Tender, SplitTender, TenderPane, type TenderPaneProps, DiscountForm, DiscountChips, parseDiscount, discountLabel,
252
252
  PriceForm, parsePrice, LinePopover, type LinePopoverProps,
253
253
  ChargeForm, type ChargeFormProps,
254
254
  OrderNoteSheet, type OrderNoteSheetProps,
255
- Catalogue, CatalogueSettingsForm, type CatalogueSettingsFormProps, formatStockSyncTime, Receipt, ReceiptSheet, type ReceiptSheetProps, type ReceiptSheetEmail, type ReceiptSheetTemplate, injectPrintStyle, SyncStatus, syncStatusQuiet, OrdersList, OrderSyncNotices, type OrderSyncNoticesProps, type OrderHistoryRow, orderReference,
255
+ Catalogue, CatalogueSettingsForm, type CatalogueSettingsFormProps, formatStockSyncTime, Receipt, ReceiptSheet, ReceiptEmailForm, type ReceiptEmailFormProps, type ReceiptSheetProps, type ReceiptSheetEmail, type ReceiptSheetTemplate, injectPrintStyle, SyncStatus, syncStatusQuiet, OrdersList, OrderSyncNotices, type OrderSyncNoticesProps, type OrderHistoryRow, orderReference,
256
256
  ParkedSales, type ParkedSalesProps, OpenSaleTabs, type OpenSaleTabsProps, CustomerDisplayScreen,
257
257
  CustomerDisplayPairing, type CustomerDisplayPairingProps,
258
258
  ProductFilterBar, DEFAULT_PRODUCT_FILTERS, PRODUCT_FILTER_CHIPS, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters, type ProductTermFilter, type FilterOption,
@@ -4,7 +4,7 @@ import { useProductTraits, useTraitContext, useStockOverlaid, type ProductTraits
4
4
  import { productSortValue, sortProducts, type ProductSort, type ProductSortValue } from '@tallyui/pos';
5
5
  import { cn } from '@tallyui/theme';
6
6
  import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, Text, VStack, IconButton, PlusIcon, ChevronRightIcon,
7
- Skeleton, skeletonCount } from '../ui';
7
+ ChevronDownIcon, Skeleton, skeletonCount } from '../ui';
8
8
  import { MinTargetBand } from '../scale/min-target';
9
9
  import { usePointer } from '../scale/use-pointer';
10
10
  import { ProductImage } from './product-image';
@@ -88,8 +88,12 @@ export interface ProductTableProps extends Omit<ViewProps, 'children'> {
88
88
  /** With renderExpanded and showThumbnail, a product with more than one variant has its thumbnail toggle its
89
89
  * expanded block: a button labelled "Show variations" with aria-expanded. A press calls this, never onSelect. */
90
90
  onToggleExpand?: (doc: ProductTableRowDoc) => void;
91
- /** The block drawn under an expanded row (e.g. its variant rows), indented by the thumbnail column. */
91
+ /** The block drawn under an expanded row (e.g. its variant rows), indented by the thumbnail column when it shows. */
92
92
  renderExpanded?: (doc: ProductTableRowDoc) => ReactNode;
93
+ /** v2's "{count} variations" button under the first cell's content, with a chevron and aria-expanded, on a product
94
+ * with more than one variant. A press calls onToggleExpand, never onSelect; needs onToggleExpand and renderExpanded,
95
+ * and makes such rows expandable without showThumbnail. Default false. */
96
+ variationsButton?: boolean;
93
97
  /** With no items, draw the header and skeleton rows instead of emptyState, as WCPOS v2's DataTableSkeleton. */
94
98
  loading?: boolean;
95
99
  className?: string;
@@ -121,7 +125,7 @@ export function useDefaultProductColumns(options?: { currencySymbol?: string }):
121
125
  export function ProductTable({
122
126
  items, columns, sort, defaultSort = null, onSortChange, sortItems = true, onSelect,
123
127
  searchSlot, filterSlot, emptyState, showUnsellable = false, currencySymbol, showThumbnail = false,
124
- showAddButton = false, cartQuantity, isExpanded, onToggleExpand, renderExpanded, loading = false, className, ...viewProps
128
+ showAddButton = false, cartQuantity, isExpanded, onToggleExpand, renderExpanded, variationsButton = false, loading = false, className, ...viewProps
125
129
  }: ProductTableProps): JSX.Element {
126
130
  // Without a ConnectorProvider, custom columns can render without traits.
127
131
  let traits: ReturnType<typeof useProductTraits> | undefined;
@@ -190,7 +194,8 @@ export function ProductTable({
190
194
  const key = String(item.id ?? index);
191
195
  const variations = addButton && traits !== undefined && traits.getVariantCount(item) > 1;
192
196
  const count = addButton && !variations ? cartQuantity?.(item) ?? 0 : 0;
193
- const expandable = thumbnail && onToggleExpand !== undefined && renderExpanded !== undefined && traits!.getVariantCount(item) > 1;
197
+ const variantCount = traits?.getVariantCount(item) ?? 0;
198
+ const expandable = (thumbnail || variationsButton) && onToggleExpand !== undefined && renderExpanded !== undefined && variantCount > 1;
194
199
  const expanded = expandable && (isExpanded?.(item) ?? false);
195
200
  const row = (
196
201
  <TableRow testID={onSelect ? undefined : 'product-row-' + key}>
@@ -199,9 +204,15 @@ export function ProductTable({
199
204
  testID={'product-row-expand-' + key} onPress={(event) => { event.stopPropagation?.(); onToggleExpand!(item); }}>
200
205
  <ProductImage doc={item} size={thumb} showPlaceholder className="rounded-md" /></Pressable> :
201
206
  <ProductImage doc={item} size={thumb} showPlaceholder className="rounded-md" />}</TableCell> : null}
202
- {resolvedColumns.map((column) => (
207
+ {resolvedColumns.map((column, cell) => (
203
208
  <TableCell key={column.id} style={{ flex: column.flex ?? 1 }}
204
- className={cn('px-3 py-1.5', column.align && ALIGN[column.align])}>{column.render(item)}</TableCell>
209
+ className={cn('px-3 py-1.5', column.align && ALIGN[column.align])}>{column.render(item)}
210
+ {cell === 0 && expandable && variationsButton ? <Pressable accessibilityRole="button" aria-expanded={expanded}
211
+ testID={'product-row-variations-' + key} className="mt-0.5 self-start flex-row items-center gap-1"
212
+ onPress={(event) => { event.stopPropagation?.(); onToggleExpand!(item); }}>
213
+ <View className="text-muted-foreground">{expanded ? <ChevronDownIcon size={14} /> : <ChevronRightIcon size={14} />}</View>
214
+ <Text className="text-xs text-muted-foreground">{`${variantCount} variations`}</Text>
215
+ </Pressable> : null}</TableCell>
205
216
  ))}
206
217
  {addButton ? (
207
218
  <TableCell style={{ width: ACTION_WIDTH }} className="flex-none items-center justify-center px-0 py-1.5">
@@ -222,7 +233,7 @@ export function ProductTable({
222
233
  {row}
223
234
  </Pressable>
224
235
  ) : row}
225
- {expanded ? <View testID={'product-row-expanded-' + key} style={{ paddingLeft: thumb + CELL_PAD_X }}
236
+ {expanded ? <View testID={'product-row-expanded-' + key} style={{ paddingLeft: thumbnail ? thumb + CELL_PAD_X : 0 }}
226
237
  className="border-b border-border">{renderExpanded!(item)}</View> : null}
227
238
  </>;
228
239
  }}
@@ -5,6 +5,8 @@ import { cn } from '@tallyui/theme';
5
5
  export interface VariantOption {
6
6
  name: string;
7
7
  values: string[];
8
+ /** Values in this group that no variant takes with the other current picks; drawn dimmed, still pressable. */
9
+ dimmed?: string[];
8
10
  }
9
11
 
10
12
  export interface ProductVariantPickerProps extends Omit<ViewProps, 'children'> {
@@ -36,10 +38,12 @@ export function ProductVariantPicker({
36
38
  return (
37
39
  <Pressable
38
40
  key={value}
41
+ testID={`variant-option-${option.name}-${value}`}
39
42
  onPress={() => handleSelect(option.name, value)}
40
43
  className={cn(
41
44
  'rounded-lg border px-3 py-1.5',
42
45
  active ? 'border-primary bg-primary/10' : 'border-border bg-card',
46
+ option.dimmed?.includes(value) && 'opacity-50',
43
47
  )}
44
48
  >
45
49
  <Text
package/src/sale/cart.tsx CHANGED
@@ -255,8 +255,10 @@ export function Cart({ sale, taxLabel = (ratePpm: number) => `Tax ${ratePpm / 10
255
255
  /** A fee or shipping row on the picker's read-only bill: the row alone, no Edit or Remove strip. */
256
256
  const ReadOnlyStrip = ({ children }: Parameters<typeof CartLineStrip>[0]) => <>{children((content) => content)}</>;
257
257
 
258
- /** Cart's `picker` stepper, v2's `− n of unpaid +` (tender/unit-stepper.tsx), with what the picked units add under it. */
259
- function PickStepper({ picker, id, name, unpaid, currency }: { picker: NonNullable<Parameters<typeof Cart>[0]['picker']>;
258
+ /** WCPOS v2's `− n of unpaid +` stepper (tender/unit-stepper.tsx), the one Cart's `picker` draws in each pickable line's
259
+ * quantity cell, with what the picked units add under it. An app cart built on CartPanel and CartLine passes it as
260
+ * CartLine's `quantitySlot` (with `picking`), with the same `picker` object Cart takes. */
261
+ export function PickStepper({ picker, id, name, unpaid, currency }: { picker: NonNullable<Parameters<typeof Cart>[0]['picker']>;
260
262
  id: string; name: string; unpaid: number; currency: string }) {
261
263
  const t = useT();
262
264
  const formatMoney = useFormatMoney();
@@ -167,8 +167,9 @@ export function Catalogue<Doc>({ products, traits, currency, onSelect, statusTex
167
167
  /** v2's table row extras in table view: thumbnail leads the row, addButton ends it with the + (> for a product
168
168
  * with variants) that does what a row press does. With expand and thumbnail, a product with more than one variant
169
169
  * has its thumbnail show or hide its variants as rows under it: option chips, price, stock and a + that adds that
170
- * variant as the list chooser does. Default: none. */
171
- tableRow?: { thumbnail?: boolean; addButton?: boolean; expand?: boolean };
170
+ * variant as the list chooser does; variationsButton adds v2's '{count} variations' button under the name, which shows
171
+ * or hides the variants as expand does; it needs expand. Default: none. */
172
+ tableRow?: { thumbnail?: boolean; addButton?: boolean; expand?: boolean; variationsButton?: boolean };
172
173
  /** v2's rows between the chips and the products (its ListColumn `rows`): notices such as "Price check only until
173
174
  * the register is open.", rendered under the header and above the grid, table or category tiles. Default none. */
174
175
  rowsSlot?: ReactNode;
@@ -534,7 +535,7 @@ export function Catalogue<Doc>({ products, traits, currency, onSelect, statusTex
534
535
  if (next.has(key)) next.delete(key); else next.add(key);
535
536
  return next;
536
537
  }) : undefined}
537
- renderExpanded={tableRow?.expand ? variantRows : undefined}
538
+ renderExpanded={tableRow?.expand ? variantRows : undefined} variationsButton={tableRow?.variationsButton}
538
539
  cartQuantity={(doc) => quantities.get(traits.getId(doc)) ?? 0} />
539
540
  ) : drillEntries.length > 0 ? <LevelWrap level onBack={() => setDrillId(null)}>
540
541
  {/* v2 drill-in.tsx:44-68: "Products › name" above the variant tiles; at phone width the Breadcrumb drops the separator. */}
@@ -18,19 +18,24 @@ export interface ChargeFormProps {
18
18
  * Add Miscellaneous Product entries); absent, the form opens on Fee with the row. */
19
19
  kind?: 'fee' | 'shipping' | 'custom';
20
20
  /** Given, the form edits that charge: prefilled, titled `Edit <name>` as v2's record dialog. */
21
- initial?: { name: string; amountMinor: number; taxStatus?: 'taxable' | 'none'; taxClass?: string; percent?: number; amountIncludesTax?: boolean };
21
+ initial?: { name: string; amountMinor: number; taxStatus?: 'taxable' | 'none'; taxClass?: string; percent?: number; amountIncludesTax?: boolean;
22
+ sku?: string };
23
+ /** On the custom kind, shows v2's "+ SKU" add-row after the tax rows; pressing it shows the SKU field. */
24
+ sku?: boolean;
22
25
  /** Shows the amount-unit toggle (currency symbol or %) on the fee kind, as v2's AmountUnitToggle. */
23
26
  allowPercent?: boolean;
24
27
  /** The store's tax mode. Given, the fee and shipping kinds show the "Amount Includes Tax" switch (not on a percent fee), which starts at this
25
28
  * value (Desk Q4: default = store tax mode, ADR-075). */
26
29
  pricesIncludeTax?: boolean;
27
30
  onApply: (charge: { kind: 'fee' | 'shipping' | 'custom'; name: string; amountMinor: number;
28
- taxStatus?: 'none'; taxClass?: string; percent?: number; amountIncludesTax?: boolean }) => string | null;
31
+ taxStatus?: 'none'; taxClass?: string; percent?: number; amountIncludesTax?: boolean;
32
+ sku?: string }) => string | null;
29
33
  onClose: () => void;
30
34
  }
31
35
 
32
36
  const NAME_LABEL_ID = 'charge-form-name-label';
33
37
  const AMOUNT_LABEL_ID = 'charge-form-amount-label';
38
+ const SKU_LABEL_ID = 'charge-form-sku-label';
34
39
 
35
40
  const button = 'rounded-md border border-border px-3 py-2 min-h-11 items-center justify-center';
36
41
  /** A blank name takes v2's default for the kind: add-fee.tsx:71 (`pos_cart.fee`), add-shipping.tsx:73
@@ -38,7 +43,7 @@ const button = 'rounded-md border border-border px-3 py-2 min-h-11 items-center
38
43
  const DEFAULT_NAME: Record<'fee' | 'shipping' | 'custom', string> = { fee: 'Fee', shipping: 'Shipping', custom: 'Product' };
39
44
 
40
45
  /** `onApply` returns a refusal to show inline, or null once applied. */
41
- export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore, shippingNoTax, kind: fixedKind, initial, allowPercent,
46
+ export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore, shippingNoTax, kind: fixedKind, initial, sku, allowPercent,
42
47
  pricesIncludeTax, onApply, onClose }: ChargeFormProps) {
43
48
  const currencySymbol = useCurrencySymbol();
44
49
  const format = useMoneyFormat();
@@ -54,7 +59,10 @@ export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore
54
59
  const [noTax, setNoTax] = useState(initial?.taxStatus === 'none');
55
60
  const [includesTax, setIncludesTax] = useState(initial?.amountIncludesTax ?? pricesIncludeTax ?? false);
56
61
  const [taxClass, setTaxClass] = useState(initial?.taxClass ?? '');
62
+ const [skuText, setSkuText] = useState(initial?.sku ?? '');
63
+ const [skuOpen, setSkuOpen] = useState(Boolean(initial?.sku));
57
64
  const [error, setError] = useState<string | null>(null);
65
+ const showSku = Boolean(sku) && kind === 'custom';
58
66
  const storeShipping = kind === 'shipping' && shippingTaxFromStore;
59
67
  const showNoTax = storeShipping ? shippingNoTax : lineTax?.none;
60
68
  const showUnit = Boolean(allowPercent) && kind === 'fee';
@@ -81,6 +89,7 @@ export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore
81
89
  ...(percentMode ? { percent: parsed } : !showUnit && initial?.percent !== undefined ? { percent: initial.percent } : {}),
82
90
  ...(percentMode ? {} : showIncludesTax ? includesTax !== pricesIncludeTax ? { amountIncludesTax: includesTax } : {}
83
91
  : initial?.amountIncludesTax !== undefined ? { amountIncludesTax: initial.amountIncludesTax } : {}),
92
+ ...(showSku ? skuText.trim() ? { sku: skuText.trim() } : {} : initial?.sku ? { sku: initial.sku } : {}),
84
93
  });
85
94
  setError(refused);
86
95
  if (refused === null) onClose();
@@ -130,6 +139,15 @@ export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore
130
139
  </Pressable>)}
131
140
  </View> : null}
132
141
  </>}
142
+ {/* v2's "+ SKU" add-row (add-misc-product.tsx) on the custom item. */}
143
+ {showSku ? skuOpen ? <>
144
+ <Label nativeID={SKU_LABEL_ID}>{t('common.sku')}</Label>
145
+ <TextInput testID="charge-form-sku-input" accessibilityLabelledBy={SKU_LABEL_ID} accessibilityLabel={t('common.sku')}
146
+ value={skuText} onChangeText={setSkuText}
147
+ className="min-w-0 rounded-md border border-border bg-background px-3 py-2 text-foreground" />
148
+ </> : <Pressable testID="charge-form-add-sku" accessibilityRole="button" onPress={() => setSkuOpen(true)}
149
+ className={`${button} bg-card self-start`}>
150
+ <Text className="text-foreground">{`+ ${t('common.sku')}`}</Text></Pressable> : null}
133
151
  {error ? <Text accessibilityRole="alert" className="text-destructive">{error}</Text> : null}
134
152
  <View className="flex-row gap-2">
135
153
  <Pressable accessibilityRole="button" onPress={apply} className={`${button} bg-primary`}>
package/src/sale/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Cart } from './cart';
1
+ export { Cart, PickStepper } from './cart';
2
2
  export { OrderNoteSheet, type OrderNoteSheetProps } from './order-note-sheet';
3
3
  export { CartBar } from './cart-bar';
4
4
  export { Tender, SplitTender } from './tender';
@@ -10,7 +10,7 @@ export { ChargeForm, type ChargeFormProps } from './charge-form';
10
10
  export { Catalogue, formatStockSyncTime } from './catalogue';
11
11
  export { CatalogueSettingsForm, type CatalogueSettingsFormProps } from './catalogue-settings-form';
12
12
  export { Receipt } from './receipt';
13
- export { ReceiptSheet, type ReceiptSheetEmail, type ReceiptSheetProps, type ReceiptSheetTemplate } from './receipt-sheet';
13
+ export { ReceiptEmailForm, type ReceiptEmailFormProps, ReceiptSheet, type ReceiptSheetEmail, type ReceiptSheetProps, type ReceiptSheetTemplate } from './receipt-sheet';
14
14
  export { orderReference } from './order-reference';
15
15
  export { injectPrintStyle } from './print-style';
16
16
  export { SyncStatus, syncStatusQuiet } from './sync-status';
@@ -32,7 +32,7 @@ export interface ReceiptSheetEmail {
32
32
  offline?: boolean;
33
33
  /** Draws "Save email to the customer" (default off). */
34
34
  saveToCustomer?: boolean;
35
- /** Sends or queues the receipt. Returns a refusal to show, or null once sent or queued; the form then closes. */
35
+ /** Sends or queues the receipt. Returns a refusal to show, or null once sent or queued; the form then shows "Email sent", or "Receipt email queued" when offline. */
36
36
  onSend: (input: { address: string; saveToCustomer: boolean }) => Promise<string | null> | string | null;
37
37
  }
38
38
 
@@ -135,13 +135,31 @@ function PrinterValue({ printers, printerId, autoPrinterName, onPrinterChange }:
135
135
  }
136
136
 
137
137
  const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+$/;
138
+ const SEND_FAILED = 'Could not send the receipt.';
138
139
 
139
- /** v2's email.tsx (MIT, WCPOS) inline: it mounts fresh on each open, so it starts from defaultAddress, switch off, no error. */
140
- function EmailForm({ email, onDone }: { email: ReceiptSheetEmail; onDone: (queued: boolean) => void }) {
140
+ /** The sent/queued line, drawn by ReceiptEmailForm after a send and by ReceiptSheet in the form's place. */
141
+ function EmailSentLine({ queued }: { queued: boolean }) {
142
+ const t = useT();
143
+ return <Text testID="receipt-email-sent" className="py-2 text-sm text-foreground">{t(queued ? 'receipt.email_queued' : 'receipt.email_sent')}</Text>;
144
+ }
145
+
146
+ export interface ReceiptEmailFormProps {
147
+ email: ReceiptSheetEmail;
148
+ /** Called once after `onSend` returns null, with true when `email.offline` was set (queued). */
149
+ onDone?: (queued: boolean) => void;
150
+ }
151
+
152
+ /**
153
+ * v2's email.tsx (MIT, WCPOS) inline, the form ReceiptSheet draws: "Email Address" prefilled from `defaultAddress`,
154
+ * the save switch (off), the offline notice and Send. After `onSend` returns null it shows "Email sent" or
155
+ * "Receipt email queued" in its own place and calls `onDone`. Remount it (for example with a new `key`) to send again.
156
+ */
157
+ export function ReceiptEmailForm({ email, onDone }: ReceiptEmailFormProps): JSX.Element {
141
158
  const [text, setText] = useState(email.defaultAddress ?? '');
142
159
  const [save, setSave] = useState(false);
143
160
  const [error, setError] = useState<string | null>(null);
144
161
  const [sending, setSending] = useState(false);
162
+ const [sent, setSent] = useState<'sent' | 'queued' | null>(null);
145
163
  const send = async () => {
146
164
  if (sending) return;
147
165
  const address = text.trim();
@@ -153,11 +171,14 @@ function EmailForm({ email, onDone }: { email: ReceiptSheetEmail; onDone: (queue
153
171
  if (typeof result === 'string' || result === null) refusal = result;
154
172
  else { setSending(true); refusal = await result; }
155
173
  } catch (cause) {
156
- refusal = cause instanceof Error ? cause.message : 'Could not send the receipt.';
174
+ refusal = cause instanceof Error ? cause.message : SEND_FAILED;
157
175
  }
158
176
  setSending(false);
159
- if (refusal === null) onDone(Boolean(email.offline)); else setError(refusal);
177
+ if (refusal !== null) return setError(refusal || SEND_FAILED);
178
+ setSent(email.offline ? 'queued' : 'sent');
179
+ onDone?.(Boolean(email.offline));
160
180
  };
181
+ if (sent) return <EmailSentLine queued={sent === 'queued'} />;
161
182
  return (
162
183
  <View testID="receipt-email-form" className="gap-2 py-2">
163
184
  <Text className="text-sm font-medium text-foreground">Email Address</Text>
@@ -186,7 +207,6 @@ function EmailForm({ email, onDone }: { email: ReceiptSheetEmail; onDone: (queue
186
207
  export function ReceiptSheet({ open, onOpenChange, title = 'Receipt', templates, templateId, onTemplateChange,
187
208
  printerLabel = 'Browser print dialog', printers, printerId, autoPrinterName, onPrinterChange,
188
209
  onPrint, printing = false, printed = false, onEmail, email, onDownloadPdf, downloadingPdf = false, children }: ReceiptSheetProps): JSX.Element {
189
- const t = useT();
190
210
  const [sent, setSent] = useState<'sent' | 'queued' | null>(null);
191
211
  const [emailOpen, setEmailOpen] = useState(false);
192
212
  // Closing the sheet closes the form too, so it opens fresh next time.
@@ -214,8 +234,8 @@ export function ReceiptSheet({ open, onOpenChange, title = 'Receipt', templates,
214
234
  </View>
215
235
  {/* v2 draws its own WebView preview with zoom and loading states; here the app's preview is the child. */}
216
236
  <ScrollView className="flex-1" contentContainerClassName="pb-2">{children}</ScrollView>
217
- {email && emailOpen ? <EmailForm email={email} onDone={(queued) => { setEmailOpen(false); setSent(queued ? 'queued' : 'sent'); }} /> : null}
218
- {email && sent ? <Text testID="receipt-email-sent" className="py-2 text-sm text-foreground">{t(sent === 'queued' ? 'receipt.email_queued' : 'receipt.email_sent')}</Text> : null}
237
+ {email && emailOpen ? <ReceiptEmailForm email={email} onDone={(queued) => { setEmailOpen(false); setSent(queued ? 'queued' : 'sent'); }} /> : null}
238
+ {email && sent ? <EmailSentLine queued={sent === 'queued'} /> : null}
219
239
  {/* v2's footer also has Sync order, which TallyUI does not have. `email` draws v2's form above, and the app sends. Download PDF is drawn when `onDownloadPdf` is given. */}
220
240
  <DialogFooter bordered className="gap-2" testID="receipt-footer">
221
241
  <DialogClose asChild>
@@ -1,7 +1,10 @@
1
+ // The device's own 12/24-hour format, with no forced leading zero on the hour.
2
+ export function shortTime(t: number | string): string {
3
+ return new Date(t).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
4
+ }
5
+
1
6
  // The time a stuck line names: the real first failure when this run has one, else "about" the virtual since (after a restart
2
7
  // firstFailedAt is gone; see OutboxState.stuck).
3
8
  export function sinceText(clock: { since: number; firstFailedAt?: number }): string {
4
- // The device's own 12/24-hour format, with no forced leading zero on the hour.
5
- const time = (t: number) => new Date(t).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
6
- return clock.firstFailedAt === undefined ? 'about ' + time(clock.since) : time(clock.firstFailedAt);
9
+ return clock.firstFailedAt === undefined ? 'about ' + shortTime(clock.since) : shortTime(clock.firstFailedAt);
7
10
  }
@@ -71,6 +71,8 @@ const REFUSED_DETAIL = 'Refused sales stay on this till under Needs attention, e
71
71
  // on reopen and both sentences name a reopen.
72
72
  const SALES_REFUSED = 'The online store refused the last send. This till will try again with the next sale, or when the app is reopened.';
73
73
  const TILL_UPDATES_REFUSED = 'The online store refused the last send. This till will try again with the next till update, or when the app is reopened.';
74
+ // The line below the sending or retrying line while the shown outbox's lastRetryReason is store_version_unknown.
75
+ const STORE_VERSION_UNKNOWN = "The online store didn't say which POS plugin version it runs.";
74
76
 
75
77
  const count = (n: number, noun: string) => `${n} ${noun}${n === 1 ? '' : 's'}`;
76
78
  // iOS has no live region (accessibilityLiveRegion is Android-only), so there each text is announced when it changes: never on
@@ -147,6 +149,8 @@ export function SyncStatus({ state, registerState, pluginName = 'the POS plugin'
147
149
  {oneDetail ? null : <Text className="px-4 pb-2 text-xs text-muted-foreground">{notice.detail}</Text>}
148
150
  </> : null}<Text accessibilityLabel={spoken} accessibilityLiveRegion="polite" className="px-4 py-2 text-xs text-muted-foreground">{spoken}</Text>
149
151
  {doing ? <Text className="px-4 pb-2 text-xs text-muted-foreground">{doing}</Text> : null}
152
+ {doing && outbox.lastRetryReason === 'store_version_unknown'
153
+ ? <Text className="px-4 pb-2 text-xs text-muted-foreground">{STORE_VERSION_UNKNOWN}</Text> : null}
150
154
  {refused ? <Text className="px-4 pb-2 text-xs text-muted-foreground">{REFUSED_DETAIL}</Text> : null}
151
155
  {oneDetail && notice ? <Text className="px-4 pb-2 text-xs text-muted-foreground">{notice.detail}</Text>
152
156
  : backendMissing ? <Text className="px-4 pb-2 text-xs text-muted-foreground">
@@ -12,6 +12,7 @@ import { useT } from '../i18n';
12
12
  import { ConfirmDialog } from '../ui/confirm-dialog';
13
13
  import { heldTillLeg } from './held-leg';
14
14
  import { offeredMethods } from './offered-methods';
15
+ import { shortTime } from './since-text';
15
16
 
16
17
  /** v2 labels.ts statusLabel, as catalogue keys. */
17
18
  const STATUS_LABEL: Record<PaymentLegStatus, string> = {
@@ -39,6 +40,9 @@ export function TenderLedger({ sale, methods, closing = false, confirmVoid = fal
39
40
  const money = (minor: number) => formatMoney({ amount: minor, currency: order.currency }) ?? '';
40
41
  const balance = order.balanceDueMinor;
41
42
  const settled = order.payments.some(countsTowardPaid);
43
+ /** v2's paid_in_full_at: the time of the last settled leg (settled.at(-1)); plain Paid in full when it has none. */
44
+ const paidAt = order.payments.filter(countsTowardPaid).at(-1)?.takenAt;
45
+ const paidInFull = paidAt ? t('pos_checkout.paid_in_full_at', { time: shortTime(paidAt) }) : t('pos_checkout.paid_in_full');
42
46
  const firstPending = order.payments.find((leg) => legStatus(leg) === 'pending');
43
47
  const askedLeg = order.payments.find((leg) => leg.id === asking);
44
48
  const asked = askedLeg && descriptorOf(askedLeg);
@@ -59,6 +63,7 @@ export function TenderLedger({ sale, methods, closing = false, confirmVoid = fal
59
63
  <Text testID={`tender-leg-${leg.id}-status`} className={cn('text-sm font-semibold', STATUS_TONE[status])}>{voided ? t('pos_checkout.cancelled') : t(STATUS_LABEL[status])}</Text>
60
64
  </View>
61
65
  {leg.reference ? <Text className="text-sm text-muted-foreground">{leg.reference}</Text> : null}
66
+ {leg.takenAt ? <Text testID={`tender-leg-${leg.id}-time`} className="text-sm text-muted-foreground">{shortTime(leg.takenAt)}</Text> : null}
62
67
  {leg === firstPending ? <Text className="text-sm text-muted-foreground">{t('pos_checkout.next_leg')}</Text> : null}
63
68
  {descriptor && canVoidLeg(leg, descriptor) && !heldTillLeg(order, leg) ? <Pressable testID={`tender-leg-${leg.id}-void`} accessibilityRole="button" accessibilityLabel={t('pos_checkout.cancel_payment')}
64
69
  onPress={() => (confirmVoid ? setAsking(leg.id) : sale.voidTender(leg.id))} className="self-start min-h-11 justify-center px-2">
@@ -66,7 +71,7 @@ export function TenderLedger({ sale, methods, closing = false, confirmVoid = fal
66
71
  </Pressable> : null}
67
72
  </View>;
68
73
  })}
69
- {!closing && balance === 0 && settled ? <Text className="text-sm text-success">{t('pos_checkout.paid_in_full')}</Text> : null}
74
+ {!closing && balance === 0 && settled ? <Text className="text-sm text-success">{paidInFull}</Text> : null}
70
75
  {confirmVoid ? <ConfirmDialog testID="tender-leg-void-dialog" tone="destructive" title={t('pos_checkout.cancel_payment_question')} description={question}
71
76
  confirmLabel={t('pos_checkout.cancel_payment')} open={asking !== null} onOpenChange={(open) => { if (!open) setAsking(null); }}
72
77
  onConfirm={() => { if (asking) sale.voidTender(asking); }} /> : null}
@@ -83,7 +88,7 @@ export function TenderLedger({ sale, methods, closing = false, confirmVoid = fal
83
88
  {row(t('common.total'), order.totalMinor)}
84
89
  {row(t('pos_checkout.paid'), order.paidMinor)}
85
90
  <View testID="tender-ledger-lead" className="mt-1.5 flex-row justify-between border-t border-border pt-2">
86
- {balance === 0 && settled ? <Text className="font-semibold text-success">{t('pos_checkout.paid_in_full')}</Text> : <>
91
+ {balance === 0 && settled ? <Text className="font-semibold text-success">{paidInFull}</Text> : <>
87
92
  <Text className="font-semibold text-foreground">{t('pos_checkout.remaining')}</Text>
88
93
  <Text testID="tender-ledger-remaining" className="font-semibold text-foreground">{money(order.balanceDueMinor)}</Text>
89
94
  </>}