@tellescope/react-components 1.193.0 → 1.195.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/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +20 -8
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/state.d.ts.map +1 -1
- package/lib/cjs/state.js +6 -0
- package/lib/cjs/state.js.map +1 -1
- package/lib/cjs/table.d.ts.map +1 -1
- package/lib/cjs/table.js +3 -2
- package/lib/cjs/table.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +20 -8
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/state.d.ts.map +1 -1
- package/lib/esm/state.js +6 -0
- package/lib/esm/state.js.map +1 -1
- package/lib/esm/table.d.ts.map +1 -1
- package/lib/esm/table.js +3 -2
- package/lib/esm/table.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/inputs.tsx +17 -4
- package/src/state.tsx +7 -0
- package/src/table.tsx +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.195.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@reduxjs/toolkit": "^1.6.2",
|
|
48
48
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
49
49
|
"@stripe/stripe-js": "^1.52.1",
|
|
50
|
-
"@tellescope/constants": "^1.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
54
|
-
"@tellescope/types-utilities": "^1.
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
56
|
-
"@tellescope/validation": "^1.
|
|
50
|
+
"@tellescope/constants": "^1.195.0",
|
|
51
|
+
"@tellescope/sdk": "^1.195.0",
|
|
52
|
+
"@tellescope/types-client": "^1.195.0",
|
|
53
|
+
"@tellescope/types-models": "^1.195.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.195.0",
|
|
55
|
+
"@tellescope/utilities": "^1.195.0",
|
|
56
|
+
"@tellescope/validation": "^1.195.0",
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
58
58
|
"@typescript-eslint/parser": "^4.33.0",
|
|
59
59
|
"css-to-react-native": "^3.0.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
85
85
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "eb4dad9ab2bd06dd6993a6c0c55b9f0b61ee12b3",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -1516,14 +1516,14 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1516
1516
|
(
|
|
1517
1517
|
value?.includes(c)
|
|
1518
1518
|
? (
|
|
1519
|
-
radio
|
|
1519
|
+
(radio || field.options?.radioChoices?.includes(c))
|
|
1520
1520
|
? []
|
|
1521
1521
|
: value.filter(v => v !== c)
|
|
1522
1522
|
)
|
|
1523
1523
|
: (
|
|
1524
|
-
radio
|
|
1524
|
+
(radio || field.options?.radioChoices?.includes(c))
|
|
1525
1525
|
? [c]
|
|
1526
|
-
: [...(value ?? []), c]
|
|
1526
|
+
: [...(value ?? []).filter(x => !field.options?.radioChoices?.includes(x)), c]
|
|
1527
1527
|
)
|
|
1528
1528
|
),
|
|
1529
1529
|
field.id,
|
|
@@ -1589,6 +1589,7 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1589
1589
|
const [stripePromise, setStripePromise] = useState<ReturnType<typeof loadStripe>>()
|
|
1590
1590
|
const [, { findById: findProduct }] = useProducts({ dontFetch: true })
|
|
1591
1591
|
const [answertext, setAnswertext] = useState('')
|
|
1592
|
+
const [error, setError] = useState('')
|
|
1592
1593
|
|
|
1593
1594
|
const fetchRef = useRef(false)
|
|
1594
1595
|
useEffect(() => {
|
|
@@ -1607,7 +1608,12 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1607
1608
|
setBusinessName(businessName)
|
|
1608
1609
|
setCustomerId(customerId)
|
|
1609
1610
|
})
|
|
1610
|
-
.catch(
|
|
1611
|
+
.catch((e: any) => {
|
|
1612
|
+
console.error(e)
|
|
1613
|
+
if (typeof e?.message === 'string') {
|
|
1614
|
+
setError(e.message)
|
|
1615
|
+
}
|
|
1616
|
+
})
|
|
1611
1617
|
}, [session, value, field.id])
|
|
1612
1618
|
|
|
1613
1619
|
const cost = (
|
|
@@ -1615,6 +1621,13 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
|
|
|
1615
1621
|
.reduce((t, p) => t + (p?.cost?.amount || 0), 0)
|
|
1616
1622
|
)
|
|
1617
1623
|
|
|
1624
|
+
if (error) {
|
|
1625
|
+
return (
|
|
1626
|
+
<Typography color="error">
|
|
1627
|
+
{error}
|
|
1628
|
+
</Typography>
|
|
1629
|
+
)
|
|
1630
|
+
}
|
|
1618
1631
|
if (value) {
|
|
1619
1632
|
return (
|
|
1620
1633
|
<Grid container alignItems="center" wrap="nowrap">
|
package/src/state.tsx
CHANGED
|
@@ -543,6 +543,7 @@ export const lastDataSync = { current : { numResults: 0, at: new Date(0), from:
|
|
|
543
543
|
export const useDataSync____internal = () => {
|
|
544
544
|
const session = useSession()
|
|
545
545
|
const lastFetch = React.useRef(new Date())
|
|
546
|
+
const lastError = React.useRef(0)
|
|
546
547
|
const loadTimings = React.useRef({ } as { [index: string]: number })
|
|
547
548
|
const loaded = React.useRef({ } as { [K in string]?: ClientModelForName[keyof ClientModelForName][] })
|
|
548
549
|
const deleted = React.useRef({ } as { [K in string]?: string[] })
|
|
@@ -596,6 +597,11 @@ export const useDataSync____internal = () => {
|
|
|
596
597
|
return
|
|
597
598
|
}
|
|
598
599
|
|
|
600
|
+
// 5 second delay when hitting errors intead of immediate retry
|
|
601
|
+
if (lastError.current > Date.now() - 1000 * 5) {
|
|
602
|
+
return
|
|
603
|
+
}
|
|
604
|
+
|
|
599
605
|
// ensure we don't miss updates due to latency
|
|
600
606
|
const from = new Date(lastFetch.current.getTime() - 3000) // large leeway could result in same data being fetched twice, but helps ensure nothing is dropped
|
|
601
607
|
lastFetch.current = new Date() // update before syncing, not after it returns
|
|
@@ -631,6 +637,7 @@ export const useDataSync____internal = () => {
|
|
|
631
637
|
.catch(err => {
|
|
632
638
|
console.error('Sync error', err)
|
|
633
639
|
lastFetch.current = from // don't skip this interval yet
|
|
640
|
+
lastError.current = Date.now()
|
|
634
641
|
})
|
|
635
642
|
}, 1000)
|
|
636
643
|
|
package/src/table.tsx
CHANGED
|
@@ -105,6 +105,8 @@ type LocalFilter = {
|
|
|
105
105
|
valuesQualifier?: ListQueryQualifier,
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
const COLUMN_RESIZE_HANDLE_WIDTH = 3
|
|
109
|
+
|
|
108
110
|
// export type SortType = 'infer'
|
|
109
111
|
export type Sorting = {
|
|
110
112
|
field: string,
|
|
@@ -358,7 +360,7 @@ export const TableHeader = <T extends Item>({
|
|
|
358
360
|
}}
|
|
359
361
|
>
|
|
360
362
|
<div style={{
|
|
361
|
-
width:
|
|
363
|
+
width: COLUMN_RESIZE_HANDLE_WIDTH, marginLeft: -COLUMN_RESIZE_HANDLE_WIDTH,
|
|
362
364
|
height: '30px',
|
|
363
365
|
backgroundColor: '#22222266',
|
|
364
366
|
cursor: 'col-resize',
|
|
@@ -457,7 +459,7 @@ export const TableRow = <T extends Item>({
|
|
|
457
459
|
/>
|
|
458
460
|
</Flex>
|
|
459
461
|
}
|
|
460
|
-
<Flex flex={1} wrap="nowrap">
|
|
462
|
+
<Flex flex={1} wrap="nowrap" style={{ overflow: 'hidden'}}>
|
|
461
463
|
{fields.map(({ key, width, textAlign='left', render, hidden, style }, i) => hidden ? null : (
|
|
462
464
|
<Flex key={key} flex={width !== undefined ? 0 : 1} style={{
|
|
463
465
|
alignItems: 'center',
|