@tallyui/components 3.9.1 → 3.10.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 +3 -1
- package/dist/index.js +4 -3
- package/package.json +9 -9
- package/src/customer/customer-picker.tsx +4 -2
- package/src/sale/orders-list.tsx +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -802,8 +802,10 @@ interface CustomerPickerProps {
|
|
|
802
802
|
/** Debounce before a search, ms. */
|
|
803
803
|
debounceMs?: number;
|
|
804
804
|
className?: string;
|
|
805
|
+
/** testID of the search field, for e2e tests. Default `customer-picker-search`. */
|
|
806
|
+
testID?: string;
|
|
805
807
|
}
|
|
806
|
-
declare function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs, className }: CustomerPickerProps): react_jsx_runtime.JSX.Element;
|
|
808
|
+
declare function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs, className, testID }: CustomerPickerProps): react_jsx_runtime.JSX.Element;
|
|
807
809
|
|
|
808
810
|
interface PaymentMethodCardProps extends Omit<PressableProps, 'children'> {
|
|
809
811
|
label: string;
|
package/dist/index.js
CHANGED
|
@@ -2611,7 +2611,7 @@ import { cn as cn61 } from "@tallyui/theme";
|
|
|
2611
2611
|
import { jsx as jsx64, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2612
2612
|
var EMAIL_MAX = 254;
|
|
2613
2613
|
var EMAIL_SHAPE = /^[^\s@\u0000]+@[^\s@\u0000]+\.[^\s@\u0000]+$/u;
|
|
2614
|
-
function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs = 250, className }) {
|
|
2614
|
+
function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs = 250, className, testID = "customer-picker-search" }) {
|
|
2615
2615
|
const [query, setQuery] = useState8("");
|
|
2616
2616
|
const [customers, setCustomers] = useState8([]);
|
|
2617
2617
|
const [error, setError] = useState8(null);
|
|
@@ -2686,6 +2686,7 @@ function CustomerPicker({ search, create, selected, onSelect, onError, online, d
|
|
|
2686
2686
|
TextInput7,
|
|
2687
2687
|
{
|
|
2688
2688
|
accessibilityLabel: "Search customers",
|
|
2689
|
+
testID,
|
|
2689
2690
|
value: query,
|
|
2690
2691
|
onChangeText: setQuery,
|
|
2691
2692
|
editable: online,
|
|
@@ -5203,7 +5204,7 @@ function SyncStatus({ state, registerState, pluginName = "the POS plugin", pullN
|
|
|
5203
5204
|
import { useEffect as useEffect8, useRef as useRef8, useState as useState24 } from "react";
|
|
5204
5205
|
import { Pressable as Pressable34, ScrollView as ScrollView13, Text as Text43, View as View65 } from "react-native";
|
|
5205
5206
|
import { formatMoney as formatMoney17, knownWarnings } from "@tallyui/core";
|
|
5206
|
-
import { needsAttention } from "@tallyui/pos";
|
|
5207
|
+
import { isRequeueable, needsAttention } from "@tallyui/pos";
|
|
5207
5208
|
import { jsx as jsx100, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
5208
5209
|
var STATUS_LABEL = { pending: "Waiting to sync", applied: "Synced", rejected: "Not accepted" };
|
|
5209
5210
|
var FIGURE_LABELS = /* @__PURE__ */ new Map([["subtotalMinor", "Subtotal"], ["taxMinor", "Tax"], ["discountMinor", "Discount"]]);
|
|
@@ -5301,7 +5302,7 @@ function OrdersList({ orders, onRetry, formatDate = defaultFormatDate2, footer,
|
|
|
5301
5302
|
order.syncStatus === "rejected" ? /* @__PURE__ */ jsx100(Text43, { className: "text-destructive", children: refusalSentence(order.error?.code) }) : null,
|
|
5302
5303
|
order.lateSessionId !== void 0 ? /* @__PURE__ */ jsx100(Text43, { className: "text-foreground", children: "Taken after the register closed. It is not in that register's closure." }) : null,
|
|
5303
5304
|
order.localWarnings?.map((warning, index) => /* @__PURE__ */ jsx100(Text43, { className: "text-foreground", children: warning.code === "customer_omitted" ? `The customer's ${warning.field} couldn't be sent to the store, so the order isn't linked to them.` : "The terminal's payment reference couldn't be kept; the payment is recorded without it." }, index)),
|
|
5304
|
-
section.title === "Needs attention" && order.syncStatus === "rejected" && order.error?.code
|
|
5305
|
+
section.title === "Needs attention" && order.syncStatus === "rejected" && isRequeueable(order.error?.code) ? /* @__PURE__ */ jsx100(Pressable34, { accessibilityRole: "button", disabled: retryingIds.has(order.id), onPress: async () => {
|
|
5305
5306
|
if (retrying.current.has(order.id)) return;
|
|
5306
5307
|
retrying.current.add(order.id);
|
|
5307
5308
|
setRetryingIds(new Set(retrying.current));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tallyui/components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Universal POS UI components for Tally UI",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
"directory": "packages/components"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@tallyui/core": "^3.
|
|
32
|
-
"@tallyui/primitives": "^3.
|
|
33
|
-
"@tallyui/theme": "^3.
|
|
31
|
+
"@tallyui/core": "^3.10.0",
|
|
32
|
+
"@tallyui/primitives": "^3.10.0",
|
|
33
|
+
"@tallyui/theme": "^3.10.0",
|
|
34
34
|
"react": ">=18",
|
|
35
35
|
"react-native": ">=0.74",
|
|
36
36
|
"react-native-svg": ">=15"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"class-variance-authority": "^0.7.1",
|
|
40
|
-
"@tallyui/pos": "3.
|
|
40
|
+
"@tallyui/pos": "3.10.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@tallyui/connector-medusa": "3.
|
|
44
|
-
"@tallyui/connector-vendure": "3.
|
|
45
|
-
"@tallyui/connector-woocommerce": "3.
|
|
46
|
-
"@tallyui/mock-api": "3.
|
|
43
|
+
"@tallyui/connector-medusa": "3.10.0",
|
|
44
|
+
"@tallyui/connector-vendure": "3.10.0",
|
|
45
|
+
"@tallyui/connector-woocommerce": "3.10.0",
|
|
46
|
+
"@tallyui/mock-api": "3.10.0",
|
|
47
47
|
"@types/react": ">=18",
|
|
48
48
|
"react": "^19.2.4",
|
|
49
49
|
"react-native-svg": "15.12.1",
|
|
@@ -20,6 +20,8 @@ export interface CustomerPickerProps {
|
|
|
20
20
|
/** Debounce before a search, ms. */
|
|
21
21
|
debounceMs?: number;
|
|
22
22
|
className?: string;
|
|
23
|
+
/** testID of the search field, for e2e tests. Default `customer-picker-search`. */
|
|
24
|
+
testID?: string;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
/** `@tallyui/core/server`'s `payloadBoundErrors` bound on `customer.email`, in UTF-16 code units. */
|
|
@@ -27,7 +29,7 @@ const EMAIL_MAX = 254;
|
|
|
27
29
|
/** A simple shape, not RFC 5322: one `@`, a non-empty local part, a domain with text either side of a dot, no whitespace or NUL. */
|
|
28
30
|
const EMAIL_SHAPE = /^[^\s@\u0000]+@[^\s@\u0000]+\.[^\s@\u0000]+$/u;
|
|
29
31
|
|
|
30
|
-
export function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs = 250, className }: CustomerPickerProps) {
|
|
32
|
+
export function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs = 250, className, testID = 'customer-picker-search' }: CustomerPickerProps) {
|
|
31
33
|
const [query, setQuery] = useState('');
|
|
32
34
|
const [customers, setCustomers] = useState<Customer[]>([]);
|
|
33
35
|
const [error, setError] = useState<string | null>(null);
|
|
@@ -96,7 +98,7 @@ export function CustomerPicker({ search, create, selected, onSelect, onError, on
|
|
|
96
98
|
<Pressable accessibilityRole="button" className="items-center rounded-lg border border-border px-4 py-3" onPress={() => onSelect(null)}><Text className="text-sm font-semibold text-foreground">Remove customer</Text></Pressable>
|
|
97
99
|
</View>}
|
|
98
100
|
<Text className="text-xs font-medium text-muted-foreground">Search customers</Text>
|
|
99
|
-
<TextInput accessibilityLabel="Search customers" value={query} onChangeText={setQuery} editable={online}
|
|
101
|
+
<TextInput accessibilityLabel="Search customers" testID={testID} value={query} onChangeText={setQuery} editable={online}
|
|
100
102
|
className="rounded-lg border border-border bg-card px-3 py-2 text-sm text-foreground"
|
|
101
103
|
placeholderTextColorClassName="accent-muted-foreground" placeholder="Name or email" />
|
|
102
104
|
{!online && <Text className="text-sm text-muted-foreground">Connect to search or add customers.</Text>}
|
package/src/sale/orders-list.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef, useState, type ReactNode } from 'react';
|
|
2
2
|
import { Pressable, ScrollView, Text, View } from 'react-native';
|
|
3
3
|
import { formatMoney, knownWarnings } from '@tallyui/core';
|
|
4
|
-
import { needsAttention, type OutboxState, type PosOrder } from '@tallyui/pos';
|
|
4
|
+
import { isRequeueable, needsAttention, type OutboxState, type PosOrder } from '@tallyui/pos';
|
|
5
5
|
import { orderReference } from './order-reference';
|
|
6
6
|
import { sinceText } from './since-text';
|
|
7
7
|
|
|
@@ -115,8 +115,8 @@ export function OrdersList({ orders, onRetry, formatDate = defaultFormatDate, fo
|
|
|
115
115
|
? `The customer's ${warning.field} couldn't be sent to the store, so the order isn't linked to them.`
|
|
116
116
|
: "The terminal's payment reference couldn't be kept; the payment is recorded without it."}
|
|
117
117
|
</Text>)}
|
|
118
|
-
{/*
|
|
119
|
-
{section.title === 'Needs attention' && order.syncStatus === 'rejected' && order.error?.code
|
|
118
|
+
{/* Retry is offered only for a code the outbox resends (isRequeueable). */}
|
|
119
|
+
{section.title === 'Needs attention' && order.syncStatus === 'rejected' && isRequeueable(order.error?.code)
|
|
120
120
|
? <Pressable accessibilityRole="button" disabled={retryingIds.has(order.id)} onPress={async () => {
|
|
121
121
|
if (retrying.current.has(order.id)) return;
|
|
122
122
|
retrying.current.add(order.id);
|