@linktr.ee/messaging-react 3.15.1-rc-1784866707 → 3.15.1
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/{Card-BZ5QF2gm.cjs → Card-BPPe6RVF.cjs} +2 -2
- package/dist/{Card-BZ5QF2gm.cjs.map → Card-BPPe6RVF.cjs.map} +1 -1
- package/dist/{Card-DldMwIcO.js → Card-opmIFszT.js} +2 -2
- package/dist/{Card-DldMwIcO.js.map → Card-opmIFszT.js.map} +1 -1
- package/dist/{index-BOThiuy9.js → index-BdRJRNr3.js} +158 -161
- package/dist/index-BdRJRNr3.js.map +1 -0
- package/dist/{index-stv1fd7v.cjs → index-ftxF5ams.cjs} +2 -2
- package/dist/index-ftxF5ams.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/CustomMessageInput/CustomMessageInput.test.tsx +47 -6
- package/src/components/CustomMessageInput/index.tsx +11 -11
- package/dist/index-BOThiuy9.js.map +0 -1
- package/dist/index-stv1fd7v.cjs.map +0 -1
- package/src/utils/isIOS.test.ts +0 -54
- package/src/utils/isIOS.ts +0 -19
package/src/utils/isIOS.test.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
-
|
|
3
|
-
import { isIOS } from './isIOS'
|
|
4
|
-
|
|
5
|
-
const mockNavigator = (overrides: Partial<Navigator>) => {
|
|
6
|
-
vi.stubGlobal('navigator', { ...navigator, ...overrides })
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
describe('isIOS', () => {
|
|
10
|
-
afterEach(() => {
|
|
11
|
-
vi.unstubAllGlobals()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('detects iPhone user agents', () => {
|
|
15
|
-
mockNavigator({
|
|
16
|
-
userAgent:
|
|
17
|
-
'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15',
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
expect(isIOS()).toBe(true)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('detects iPadOS, which reports as MacIntel but exposes touch points', () => {
|
|
24
|
-
mockNavigator({
|
|
25
|
-
userAgent:
|
|
26
|
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15',
|
|
27
|
-
platform: 'MacIntel',
|
|
28
|
-
maxTouchPoints: 5,
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
expect(isIOS()).toBe(true)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('does not flag a real Mac (no touch points)', () => {
|
|
35
|
-
mockNavigator({
|
|
36
|
-
userAgent:
|
|
37
|
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15',
|
|
38
|
-
platform: 'MacIntel',
|
|
39
|
-
maxTouchPoints: 0,
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
expect(isIOS()).toBe(false)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('does not flag Android', () => {
|
|
46
|
-
mockNavigator({
|
|
47
|
-
userAgent: 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36',
|
|
48
|
-
platform: 'Linux armv81',
|
|
49
|
-
maxTouchPoints: 5,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
expect(isIOS()).toBe(false)
|
|
53
|
-
})
|
|
54
|
-
})
|
package/src/utils/isIOS.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* True on iOS (including iPadOS, which reports as `MacIntel` but exposes
|
|
3
|
-
* touch points a real Mac never does). WebKit only opens the on-screen
|
|
4
|
-
* keyboard for a `focus()` call made inside a genuine user gesture — an
|
|
5
|
-
* `autoFocus`/programmatic focus on mount briefly flashes focus (enough to
|
|
6
|
-
* trip a host's focus-driven viewport resize) before WebKit revokes it, so
|
|
7
|
-
* callers use this to skip autofocusing the composer on iOS and let the
|
|
8
|
-
* user's first tap focus it instead.
|
|
9
|
-
*/
|
|
10
|
-
export function isIOS(): boolean {
|
|
11
|
-
if (typeof navigator === 'undefined') {
|
|
12
|
-
return false
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
|
|
17
|
-
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)
|
|
18
|
-
)
|
|
19
|
-
}
|