@swan-admin/swan-ai-measurements 1.1.62 → 1.1.64

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.62",
3
+ "version": "1.1.64",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -2,9 +2,6 @@ import axios, { AxiosResponse } from "axios";
2
2
  import { API_ENDPOINTS, APP_AUTH_BASE_URL, APP_BASE_WEBSOCKET_URL, REQUIRED_MESSAGE } from "./constants.js";
3
3
  import { checkParameters, getUrl } from "./utils.js";
4
4
 
5
-
6
-
7
-
8
5
  interface MeasurementRecommendation {
9
6
  shopDomain: string;
10
7
  scanId: string;
@@ -152,9 +149,12 @@ class Measurement {
152
149
  if (data?.code === 200 && data?.scanStatus === "success") {
153
150
  onSuccess?.(data);
154
151
  } else {
152
+ if (this.#timerWaitingRef){
153
+ clearTimeout(this.#timerWaitingRef);
154
+ }
155
155
  onError?.(data);
156
156
  }
157
- if (this.#timerWaitingRef) {
157
+ if (this.#timerWaitingRef && data?.code === 200 && data?.scanStatus === "success" && data?.resultType === "final" ) {
158
158
  clearTimeout(this.#timerWaitingRef);
159
159
  }
160
160
  };
package/src/tryOn.ts CHANGED
@@ -224,9 +224,6 @@ class TryOn {
224
224
  if (checkParameters(shopDomain, userEmail, products) === false) {
225
225
  throw new Error(REQUIRED_MESSAGE);
226
226
  }
227
- // if (!selectedUserImages.length) {
228
- // throw new Error("No user images found!");
229
- // }
230
227
  if (!isValidEmail(userEmail.trim())) {
231
228
  throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
232
229
  }
@@ -269,17 +266,6 @@ class TryOn {
269
266
  if (checkParameters(tryonId) === false) {
270
267
  throw new Error(REQUIRED_MESSAGE);
271
268
  }
272
-
273
- // if (!isValidEmail(userEmail.trim())) {
274
- // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
275
- // }
276
-
277
- // const payload = {
278
- // products,
279
- // userEmail,
280
- // customerStoreUrl: shopDomain,
281
- // };
282
-
283
269
  const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON_RESULT_IMAGE_DOWNLOAD}/${tryonId}`;
284
270
  return axios.post(url, null,{
285
271
  headers: { "X-Api-Key": this.#accessKey },