@eka-care/ekascribe-ts-sdk 2.0.34 → 2.0.36

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.
Files changed (2) hide show
  1. package/dist/index.mjs +12 -25
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -54372,7 +54372,7 @@ class SystemCompatibilityManager {
54372
54372
  async checkSystemInfo() {
54373
54373
  const a = COMPATIBILITY_TEST_TYPE.SYSTEM_INFO;
54374
54374
  try {
54375
- const { browser: s, version: n } = this.detectBrowser(), r = navigator.deviceMemory, c = Intl.DateTimeFormat().resolvedOptions().timeZone, u = /* @__PURE__ */ new Date(), m = u.toISOString(), y = this.validateTimezone(u, c);
54375
+ const { browser: s, version: n } = this.detectBrowser(), r = navigator.deviceMemory, c = Intl.DateTimeFormat().resolvedOptions().timeZone, m = (/* @__PURE__ */ new Date()).toISOString(), y = await this.validateTimezone();
54376
54376
  return y ? this.createTestResult(a, COMPATIBILITY_TEST_STATUS.ERROR, y, {
54377
54377
  browser: s,
54378
54378
  version: n,
@@ -54398,28 +54398,15 @@ class SystemCompatibilityManager {
54398
54398
  /**
54399
54399
  * Validate timezone against system time
54400
54400
  */
54401
- validateTimezone(a, s) {
54401
+ async validateTimezone() {
54402
54402
  try {
54403
- if (isNaN(a.getTime()))
54404
- return "Invalid system time detected";
54405
- const r = new Intl.DateTimeFormat("en-US", {
54406
- timeZone: s,
54407
- year: "numeric",
54408
- month: "2-digit",
54409
- day: "2-digit",
54410
- hour: "2-digit",
54411
- minute: "2-digit",
54412
- second: "2-digit",
54413
- hour12: !1
54414
- }).formatToParts(a), c = new Date(
54415
- parseInt(r.find((y) => y.type === "year").value),
54416
- parseInt(r.find((y) => y.type === "month").value) - 1,
54417
- parseInt(r.find((y) => y.type === "day").value),
54418
- parseInt(r.find((y) => y.type === "hour").value),
54419
- parseInt(r.find((y) => y.type === "minute").value),
54420
- parseInt(r.find((y) => y.type === "second").value)
54421
- ), u = Math.abs((a.getTime() - c.getTime()) / (1e3 * 60 * 60)), m = -a.getTimezoneOffset() / 60;
54422
- return m < -12 || m > 14 ? "System timezone offset is invalid (outside -12 to +14 range)" : u > 24 ? "System time does not match timezone configuration" : null;
54403
+ const a = Intl.DateTimeFormat().resolvedOptions().timeZone, r = (await (await fetchWrapper(
54404
+ `${GET_EKA_HOST()}/voice/sys/time?timezone=${a}`,
54405
+ {
54406
+ method: "GET"
54407
+ }
54408
+ )).json()).time, c = new Date(r), u = /* @__PURE__ */ new Date(), m = Math.abs(c.getTime() - u.getTime()), y = 600 * 1e3;
54409
+ return m > y ? `System time and server time differ by ${Math.round(m / 6e4)} minutes. Maximum allowed difference is 10 minutes.` : null;
54423
54410
  } catch {
54424
54411
  return "Failed to validate timezone against system time";
54425
54412
  }
@@ -54625,7 +54612,7 @@ class SystemCompatibilityManager {
54625
54612
  */
54626
54613
  async pingApi() {
54627
54614
  try {
54628
- return (await fetchWrapper("https://api.eka.care/voice/ping", {
54615
+ return (await fetchWrapper(`${GET_EKA_HOST()}/voice/ping`, {
54629
54616
  method: "GET"
54630
54617
  })).ok;
54631
54618
  } catch (a) {
@@ -54674,7 +54661,7 @@ class SystemCompatibilityManager {
54674
54661
  */
54675
54662
  async testS3Upload() {
54676
54663
  try {
54677
- const a = this.createDummyMp4File(), s = `${COMPATIBILITY_TEST_FOLDER}/${Date.now()}.mp4`, n = `compat-test-${Date.now()}`, r = "compat-test", c = GET_S3_BUCKET_NAME();
54664
+ const a = this.createDummyMp4File(), s = `${COMPATIBILITY_TEST_FOLDER}/sample-audio.m4a_`, n = `compat-test-${Date.now()}`, r = "compat-test", c = GET_S3_BUCKET_NAME();
54678
54665
  return this.testSharedWorker ? !!(await this.uploadViaWorker(
54679
54666
  a,
54680
54667
  s,
@@ -54731,7 +54718,7 @@ class SystemCompatibilityManager {
54731
54718
  52,
54732
54719
  49
54733
54720
  ]);
54734
- return new Blob([a], { type: "video/mp4" });
54721
+ return new Blob([a], { type: "audio/mp4" });
54735
54722
  }
54736
54723
  /**
54737
54724
  * Upload file via shared worker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "2.0.34",
3
+ "version": "2.0.36",
4
4
  "description": "EkaScribe TypeScript SDK - Modern ES2020 build",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",