@opexa/portal-components 0.0.1025 → 0.0.1027

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.
@@ -206,7 +206,7 @@ export function NameAndPasswordSignIn() {
206
206
  globalStore.disclaimer.setOpen(true);
207
207
  }
208
208
  else {
209
- globalStore.signIn.setOpen(!globalStore.signIn.open);
209
+ // globalStore.signIn.setOpen(!globalStore.signIn.open);
210
210
  console.error('Failed to create token');
211
211
  }
212
212
  }
@@ -9,6 +9,7 @@ import { useDisclosure } from '../../../client/hooks/useDisclosure.js';
9
9
  import { useFileQuery } from '../../../client/hooks/useFileQuery.js';
10
10
  import { useUploadPrivateImageFileMutation } from '../../../client/hooks/useUploadPrivateImageFileMutation.js';
11
11
  import { toaster } from '../../../client/utils/toaster.js';
12
+ import { isIPhone13Series } from '../../../utils/isIOS.js';
12
13
  export function useSelfieImageField(props) {
13
14
  const field = useFieldContext();
14
15
  const [value, setValue] = useControllableState({
@@ -115,6 +116,7 @@ export function useSelfieImageField(props) {
115
116
  });
116
117
  const [faceFound, setFaceFound] = useState(false);
117
118
  const [detectorReady, setDetectorReady] = useState(false);
119
+ const isIos = isIPhone13Series();
118
120
  // Preload detector when disclosure opens
119
121
  useEffect(() => {
120
122
  if (disclosure.open) {
@@ -123,7 +125,7 @@ export function useSelfieImageField(props) {
123
125
  .then(() => setDetectorReady(true))
124
126
  .catch((e) => {
125
127
  console.error('Failed to load face detector:', e);
126
- setDetectorReady(false);
128
+ setDetectorReady(true);
127
129
  });
128
130
  }
129
131
  }, [disclosure.open]);
@@ -133,6 +135,11 @@ export function useSelfieImageField(props) {
133
135
  setFaceFound(false);
134
136
  }, [camera.loading, camera.data]);
135
137
  useInterval(async () => {
138
+ if (isIos) {
139
+ setFaceFound(true);
140
+ setDetectorReady(true);
141
+ return;
142
+ }
136
143
  if (!camera.videoRef.current || !guideRef.current) {
137
144
  return setFaceFound(false);
138
145
  }
@@ -0,0 +1,5 @@
1
+ export declare function isiOSDevice(): boolean;
2
+ /**
3
+ * Detects if the device is likely an iPhone 13 based on screen resolution.
4
+ */
5
+ export declare function isIPhone13Series(): boolean;
@@ -0,0 +1,26 @@
1
+ export function isiOSDevice() {
2
+ return ([
3
+ 'iPad Simulator',
4
+ 'iPhone Simulator',
5
+ 'iPod Simulator',
6
+ 'iPad',
7
+ 'iPhone',
8
+ 'iPod',
9
+ ].includes(navigator.platform) ||
10
+ // iPad on iOS 13 detection
11
+ (navigator.userAgent.includes('Mac') && 'ontouchend' in document));
12
+ }
13
+ /**
14
+ * Detects if the device is likely an iPhone 13 based on screen resolution.
15
+ */
16
+ export function isIPhone13Series() {
17
+ if (typeof window === 'undefined')
18
+ return false;
19
+ const width = Math.min(window.screen.width, window.screen.height);
20
+ const height = Math.max(window.screen.width, window.screen.height);
21
+ const dpr = window.devicePixelRatio;
22
+ // iPhone 13 / 13 Pro
23
+ if (width === 390 && height === 844 && dpr === 3)
24
+ return true;
25
+ return false;
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1025",
3
+ "version": "0.0.1027",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",