@sawport/react-sdk 1.0.11-alpha.0 → 1.0.11-alpha.2

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.js CHANGED
@@ -67909,7 +67909,7 @@ const immerImpl = (initializer) => (set2, get2, store) => {
67909
67909
  return initializer(store.setState, get2, store);
67910
67910
  };
67911
67911
  const immer = immerImpl;
67912
- const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false, "VITE_API_URL": "http://localhost:5000/api/v1/", "VITE_BASE_URL": "http://localhost:5000", "VITE_PROJECT_ID": "dc956202-5374-4256-985e-a492fcd26992" };
67912
+ const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false, "VITE_API_URL": "http://localhost:5000/api/v1/", "VITE_BASE_URL": "http://localhost:5000", "VITE_PROJECT_ID": "f10f2526-e079-4815-b28b-621447cc0b9f" };
67913
67913
  const trackedConnections = /* @__PURE__ */ new Map();
67914
67914
  const getTrackedConnectionState = (name) => {
67915
67915
  const api2 = trackedConnections.get(name);
@@ -103622,6 +103622,7 @@ const viewCompany = (id2, params) => api("companies/" + id2, params);
103622
103622
  const user = (id2, params) => api(`agents/${id2}`, params);
103623
103623
  const viewUser = (id2, params) => api(`users/${id2}`, params);
103624
103624
  const viewCustomer = (id2, params) => api(`customers/${id2}`, params);
103625
+ const compareImage = (params, config) => api(`customers/image/compare`, params, "post", config);
103625
103626
  function WidgetOnlineHeader({ company }) {
103626
103627
  const { setIsWidgetLaunched } = useChatStore();
103627
103628
  const minimize = () => setIsWidgetLaunched(false);
@@ -110261,7 +110262,7 @@ const FaceCam = memo(({ className = "", scan, onReady, ref: ref2 }) => {
110261
110262
  ) })
110262
110263
  ] }) });
110263
110264
  });
110264
- const FacePoseDetector = ({ onProceed, onCancel }) => {
110265
+ const FacePoseDetector = ({ onProceed, onCancel, accountNumber, bvn }) => {
110265
110266
  const [capturedImage, setCapturedImage] = useState$1(void 0);
110266
110267
  const [{ ready, status, progress, result }, setState] = useState({
110267
110268
  progress: 0,
@@ -110283,7 +110284,9 @@ const FacePoseDetector = ({ onProceed, onCancel }) => {
110283
110284
  const formData = new FormData();
110284
110285
  const image = base64ToFile(capturedImage, "image.png");
110285
110286
  formData.append("image", image);
110286
- const { data: data2 } = await axios.post("https://face-match.sawport.com/search-face", formData, {
110287
+ formData.append("accountNumber", accountNumber);
110288
+ formData.append("bvn", bvn);
110289
+ const { data: data2 } = await compareImage(formData, {
110287
110290
  headers: {
110288
110291
  "Content-Type": "multipart/form-data"
110289
110292
  },
@@ -110408,11 +110411,21 @@ const FacePoseDetector = ({ onProceed, onCancel }) => {
110408
110411
  };
110409
110412
  const FacePoseDetector$1 = memo(FacePoseDetector);
110410
110413
  const FaceRecognition = memo(({ onCancel, onProceed }) => {
110414
+ var _a, _b;
110411
110415
  const [{ ready }, setState] = useState({ ready: false });
110412
110416
  const ref2 = useRef$1(null);
110413
110417
  const onReady = useCallback(() => setState({ ready: true }), [setState]);
110414
110418
  const cancel = useCallback(() => onCancel(), [onCancel]);
110415
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col justify-center items-center h-full p-1", children: ready ? /* @__PURE__ */ jsxRuntimeExports.jsx(Detect, { onProceed, onCancel }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
110419
+ const user2 = useUserStore((state) => state.user);
110420
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col justify-center items-center h-full p-1", children: ready ? /* @__PURE__ */ jsxRuntimeExports.jsx(
110421
+ Detect,
110422
+ {
110423
+ onProceed,
110424
+ onCancel,
110425
+ bvn: (_a = user2 == null ? void 0 : user2.credentials) == null ? void 0 : _a.bvn,
110426
+ accountNumber: (_b = user2 == null ? void 0 : user2.credentials) == null ? void 0 : _b.account
110427
+ }
110428
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
110416
110429
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-medium mb-6 text-2xl", children: "Facial Recognition" }),
110417
110430
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { backgroundColor: "rgba(228,228,228, 0.24)" }, className: "p-4 rounded-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { backgroundColor: "rgba(68,76,167, 0.25)" }, className: "p-4 rounded-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaceCam, { className: "rounded-full h-36 w-36", ref: ref2 }) }) }),
110418
110431
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center px-10 text-xs mt-6", children: [
@@ -110425,10 +110438,18 @@ const FaceRecognition = memo(({ onCancel, onProceed }) => {
110425
110438
  ] })
110426
110439
  ] }) });
110427
110440
  });
110428
- const Detect = memo(({ onProceed, onCancel }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-[#00000040] rounded-lg flex flex-col items-center p-4 text-center", children: [
110441
+ const Detect = memo(({ onProceed, onCancel, bvn, accountNumber }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-[#00000040] rounded-lg flex flex-col items-center p-4 text-center", children: [
110429
110442
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-medium text-xl", children: "Position Face in the Frame" }),
110430
110443
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "px-8 text-xs mb-6 text-gray-700", children: "Please look into the camera and hold still" }),
110431
- /* @__PURE__ */ jsxRuntimeExports.jsx(FacePoseDetector$1, { onProceed, onCancel })
110444
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
110445
+ FacePoseDetector$1,
110446
+ {
110447
+ onProceed,
110448
+ onCancel,
110449
+ bvn,
110450
+ accountNumber
110451
+ }
110452
+ )
110432
110453
  ] }));
110433
110454
  const updateConversation = (id2, params) => api("conversations/" + id2, params, "put");
110434
110455
  class WidgetDomEvent {