@opexa/portal-components 0.0.968 → 0.0.970

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.
@@ -142,7 +142,10 @@ export function useCamera(options = {}) {
142
142
  canvas.toBlob((blob) => {
143
143
  if (!blob) {
144
144
  resolve(null);
145
- return;
145
+ return setError({
146
+ name: 'CameraError',
147
+ message: 'Failed to snap photo',
148
+ });
146
149
  }
147
150
  const url = URL.createObjectURL(blob);
148
151
  const file = new File([blob], `${crypto.randomUUID()}.jpeg`, {
@@ -168,6 +171,7 @@ export function useCamera(options = {}) {
168
171
  const reopen = useCallback(async () => {
169
172
  setSnapping(false);
170
173
  setLoading(true);
174
+ setData(null);
171
175
  await close();
172
176
  await sleep();
173
177
  await open();
@@ -160,7 +160,7 @@ function TransactionPassword() {
160
160
  confirmPassword: '',
161
161
  },
162
162
  });
163
- return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Transaction password" }), _jsx("p", { className: "text-sm text-text-tertiary-600", children: "The transaction password secures and confirms your wallet withdrawals." })] }), profileCompletion?.transactionPassword ? (_jsx(ark.svg, { asChild: true, className: "size-6 text-text-success-primary", children: _jsx(CheckVerified02Icon, {}) })) : (_jsxs("div", { className: "flex items-center gap-1 rounded-sm border border-[#93370d] bg-[#4e1d09] px-sm py-xs", children: [_jsx(AlertCircleIcon, { className: "h-5 w-5 text-[#FEC84B]" }), _jsx("span", { className: "m-0 text-nowrap text-[#FEC84B] text-xs", children: "Not Set" })] }))] }), !profileCompletion?.transactionPassword && (_jsx(AlertWarning, { title: "Please set your transaction password. This is required when making withdrawals and helps secure your account.", className: "my-3" })), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
163
+ return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Withdrawal password" }), _jsx("p", { className: "text-sm text-text-tertiary-600", children: "The withdrawal password secures and confirms your wallet withdrawals." })] }), profileCompletion?.transactionPassword ? (_jsx(ark.svg, { asChild: true, className: "size-6 text-text-success-primary", children: _jsx(CheckVerified02Icon, {}) })) : (_jsxs("div", { className: "flex items-center gap-1 rounded-sm border border-[#93370d] bg-[#4e1d09] px-sm py-xs", children: [_jsx(AlertCircleIcon, { className: "h-5 w-5 text-[#FEC84B]" }), _jsx("span", { className: "m-0 text-nowrap text-[#FEC84B] text-xs", children: "Not Set" })] }))] }), !profileCompletion?.transactionPassword && (_jsx(AlertWarning, { title: "Please set your withdrawal password. This is required when making withdrawals and helps secure your account.", className: "my-3" })), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
164
164
  updateAccountMutation.mutate({
165
165
  transactionPassword: data.password,
166
166
  });
@@ -1,6 +1,6 @@
1
1
  import { useFieldContext } from '@ark-ui/react';
2
2
  import { FaceDetector, FilesetResolver } from '@mediapipe/tasks-vision';
3
- import { useRef, useState } from 'react';
3
+ import { useEffect, useRef, useState } from 'react';
4
4
  import invariant from 'tiny-invariant';
5
5
  import { useInterval } from 'usehooks-ts';
6
6
  import { useCamera } from '../../../client/hooks/useCamera.js';
@@ -111,13 +111,14 @@ export function useSelfieImageField(props) {
111
111
  if (open) {
112
112
  camera.open();
113
113
  }
114
- else {
115
- setFaceFound(false);
116
- camera.close();
117
- }
118
114
  },
119
115
  });
120
116
  const [faceFound, setFaceFound] = useState(false);
117
+ // Reset faceFound when camera is reset or reopened
118
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Reset faceFound on state change
119
+ useEffect(() => {
120
+ setFaceFound(false);
121
+ }, [camera.loading, camera.data]);
121
122
  useInterval(async () => {
122
123
  if (!camera.videoRef.current || !guideRef.current) {
123
124
  return setFaceFound(false);
@@ -197,14 +198,13 @@ async function getVideoFaceDetector() {
197
198
  return __video_face_detector_promise__;
198
199
  __video_face_detector_promise__ = (async () => {
199
200
  try {
200
- const vision = await getVision();
201
+ const vision = await FilesetResolver.forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm');
201
202
  const detector = await FaceDetector.createFromOptions(vision, {
202
- runningMode: 'VIDEO',
203
- minDetectionConfidence: 0.5,
204
203
  baseOptions: {
205
- delegate: 'GPU',
206
204
  modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite',
205
+ delegate: 'GPU',
207
206
  },
207
+ runningMode: 'VIDEO',
208
208
  });
209
209
  __video_face_detector__ = detector;
210
210
  return detector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.968",
3
+ "version": "0.0.970",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",