@techlabi/kycrazy-ui-kit 0.35.0 → 0.36.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.36.0
4
+
5
+ ### Fixes
6
+
7
+ - fix camera step issues
8
+
3
9
  ## 0.35.0
4
10
 
5
11
  ### Fixes
package/dist/index.es.js CHANGED
@@ -29163,11 +29163,24 @@ class pD {
29163
29163
  default: ["name", "id", "date", "dob", "expiry", "number", "document", "issued"]
29164
29164
  };
29165
29165
  }
29166
+ async toBase64(t) {
29167
+ if (typeof window > "u")
29168
+ return (await (await import("./__vite-browser-external-l0sNRNKZ.js")).readFile(t)).toString("base64");
29169
+ if (t instanceof File)
29170
+ return new Promise((e, r) => {
29171
+ const o = new FileReader();
29172
+ o.onload = () => {
29173
+ const i = o.result.split(",")[1];
29174
+ e(i);
29175
+ }, o.onerror = r, o.readAsDataURL(t);
29176
+ });
29177
+ throw new Error("Unsupported input type for base64 conversion");
29178
+ }
29166
29179
  async validateIdCard(t, e) {
29167
29180
  let r = t;
29168
29181
  if (typeof t != "string") {
29169
- const s = await t.arrayBuffer(), c = Buffer.from(s).toString("base64");
29170
- r = `data:${t.type};base64,${c}`;
29182
+ const s = await this.toBase64(t);
29183
+ r = `data:${t.type || "image/jpeg"};base64,${s}`;
29171
29184
  }
29172
29185
  const {
29173
29186
  data: { text: o }
@@ -29204,8 +29217,8 @@ class pD {
29204
29217
  await this.loadModels();
29205
29218
  let e = t;
29206
29219
  if (typeof t != "string") {
29207
- const i = await t.arrayBuffer(), u = Buffer.from(i).toString("base64");
29208
- e = `data:${t.type};base64,${u}`;
29220
+ const i = await this.toBase64(t);
29221
+ e = `data:${t.type || "image/jpeg"};base64,${i}`;
29209
29222
  }
29210
29223
  const r = await this.fileToImage(e), o = await E9(r, new zu());
29211
29224
  return {