@swan-admin/swan-ai-measurements 1.0.34 → 1.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.
package/auth.js CHANGED
@@ -64,7 +64,7 @@ class Auth {
64
64
  }
65
65
  socketRef?.close?.();
66
66
 
67
- socketRef = new WebSocket(APP_AUTH_WEBSOCKET_URL);
67
+ socketRef = new WebSocket(`${APP_AUTH_WEBSOCKET_URL}${API_ENDPOINTS.AUTH}`);
68
68
  const detailObj = {
69
69
  email,
70
70
  scanId,
package/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const FILE_UPLOAD_KEY = "7a8ccc86249849be911b0d7dbc20290e";
2
2
  export const APP_BASE_URL = "https://fitview-server-staging.ft2a64raup4pg.us-east-1.cs.amazonlightsail.com";
3
3
  export const APP_AUTH_BASE_URL = "https://staging.api.getswan.co";
4
- export const APP_AUTH_WEBSOCKET_URL = "wss://staging.wsnotify.api.getswan.co/auth";
4
+ export const APP_AUTH_WEBSOCKET_URL = "wss://staging.wsnotify.api.getswan.co";
5
5
  export const APP_TRY_ON_WEBSOCKET_URL = "wss://bucbzczxjk.execute-api.ap-south-1.amazonaws.com";
6
6
  export const APP_RECOMMENDATION_WEBSOCKET_URL = "wss://staging.wsnotify.api.getswan.co/scanning";
7
7
  export const APP_POSE_DETECTION_WEbSOCKET_URL =
@@ -27,6 +27,7 @@ export const API_ENDPOINTS = {
27
27
  TRY_ON_IMAGE_URLS: "/tryon/user-image-urls",
28
28
  TRY_ON_RESULT_IMAGE_DOWNLOAD: "/tryon/result-image-urls/download",
29
29
  TRY_ON: "/tryon",
30
+ AUTH: "/auth",
30
31
  };
31
32
 
32
33
  export const REQUIRED_MESSAGE = "Please verify required parameters";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/tryOn.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import axios from "axios";
2
- import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE } from "./constants.js";
2
+ import { API_ENDPOINTS, APP_AUTH_BASE_URL, APP_AUTH_WEBSOCKET_URL, REQUIRED_MESSAGE } from "./constants.js";
3
3
  import { checkParameters } from "./utils.js";
4
4
 
5
5
  class TryOn {
@@ -72,6 +72,7 @@ class TryOn {
72
72
  throw new Error(REQUIRED_MESSAGE);
73
73
  }
74
74
  TryOn.disconnectSocket();
75
+ const url = `${APP_AUTH_WEBSOCKET_URL}${API_ENDPOINTS.TRY_ON}/?store_url=${shopDomain}&product_name=${productName}&scan_id=${userId}`;
75
76
  TryOn.tryOnSocketRef = new WebSocket(url);
76
77
  TryOn.tryOnSocketRef.onopen = async () => {
77
78
  onOpen?.();
@@ -106,7 +107,7 @@ class TryOn {
106
107
  }
107
108
  return new Promise(async (resolve, reject) => {
108
109
  try {
109
- const url = `${APP_AUTH_BASE_URL}${API_ENDPOINTS.TRY_ON}/?scan_id=${id}&store_url=${shopDomain}&product_name=${productName}`;
110
+ const url = `${APP_AUTH_BASE_URL}${API_ENDPOINTS.TRY_ON}/?scan_id=${userId}&store_url=${shopDomain}&product_name=${productName}`;
110
111
  const res = await axios.post(url);
111
112
  if (res?.data?.tryOnProcessStatus === "failed") {
112
113
  TryOn.disconnectSocket();