@swan-admin/swan-ai-measurements 1.1.16 → 1.1.18

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.
@@ -1,23 +1,51 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1
+ var __awaiter =
2
+ (this && this.__awaiter) ||
3
+ function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P
6
+ ? value
7
+ : new P(function (resolve) {
8
+ resolve(value);
9
+ });
10
+ }
3
11
  return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ function fulfilled(value) {
13
+ try {
14
+ step(generator.next(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+ function step(result) {
27
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
28
+ }
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
30
  });
9
- };
10
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
31
+ };
32
+ var __classPrivateFieldSet =
33
+ (this && this.__classPrivateFieldSet) ||
34
+ function (receiver, state, value, kind, f) {
11
35
  if (kind === "m") throw new TypeError("Private method is not writable");
12
36
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
14
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15
- };
16
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
37
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
38
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
39
+ return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
40
+ };
41
+ var __classPrivateFieldGet =
42
+ (this && this.__classPrivateFieldGet) ||
43
+ function (receiver, state, kind, f) {
17
44
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
45
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
46
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
47
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
- };
48
+ };
21
49
  var _FileUpload_uppyIns, _FileUpload_accessKey, _FileUpload_stagingUrl;
22
50
  import axios from "axios";
23
51
  import { REQUIRED_MESSAGE, REQUIRED_MESSAGE_FOR_META_DATA, FILE_UPLOAD_ENDPOINT, APP_AUTH_BASE_URL } from "./constants.js";
@@ -25,147 +53,155 @@ import { addScanType, checkMetaDataValue, checkParameters, fetchData, getFileChu
25
53
  import Uppy from "@uppy/core";
26
54
  import AwsS3Multipart from "@uppy/aws-s3-multipart";
27
55
  class FileUpload {
28
- constructor(accessKey, stagingUrl = false) {
29
- _FileUpload_uppyIns.set(this, void 0);
30
- _FileUpload_accessKey.set(this, void 0);
31
- _FileUpload_stagingUrl.set(this, void 0);
32
- __classPrivateFieldSet(this, _FileUpload_accessKey, accessKey, "f");
33
- __classPrivateFieldSet(this, _FileUpload_stagingUrl, stagingUrl, "f");
34
- }
35
- uploadFileFrontend(_a) {
36
- return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
37
- if (!checkParameters(file, arrayMetaData, scanId)) {
38
- throw new Error(REQUIRED_MESSAGE);
39
- }
40
- if (!checkMetaDataValue(arrayMetaData)) {
41
- throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
42
- }
43
- arrayMetaData = addScanType(arrayMetaData, scanId);
44
- return new Promise((resolve, reject) => {
45
- if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
46
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
47
- }
48
- __classPrivateFieldSet(this, _FileUpload_uppyIns, new Uppy({ autoProceed: true }), "f");
49
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").use(AwsS3Multipart, {
50
- limit: 10,
51
- retryDelays: [0, 1000, 3000, 5000],
52
- companionUrl: getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f") }),
53
- getChunkSize: () => 5 * 1024 * 1024,
54
- createMultipartUpload: (file) => {
55
- const objectKey = `${scanId}.${file.extension}`;
56
- return fetchData({
57
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
58
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
59
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
60
- body: {
61
- objectKey,
62
- contentType: file.type,
63
- objectMetadata: arrayMetaData,
64
- },
65
- });
66
- },
67
- completeMultipartUpload: (file, { uploadId, key, parts }) => fetchData({
68
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
69
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
70
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
71
- body: {
72
- uploadId,
73
- objectKey: key,
74
- parts,
75
- originalFileName: file.name,
76
- },
77
- }),
78
- signPart: (file, partData) => fetchData({
79
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
80
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
81
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
82
- body: {
83
- objectKey: partData.key,
84
- uploadId: partData.uploadId,
85
- partNumber: partData.partNumber,
86
- },
87
- }),
88
- });
89
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").addFile({
90
- source: "manual",
91
- name: file.name,
92
- type: file.type,
93
- data: file,
94
- });
95
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-error", (file, error, response) => {
96
- reject(error);
97
- });
98
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-success", () => {
99
- resolve({ message: "file uploaded successfully" });
100
- });
101
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("complete", (result) => {
102
- if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
103
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
104
- }
105
- });
56
+ constructor(accessKey, stagingUrl = false) {
57
+ _FileUpload_uppyIns.set(this, void 0);
58
+ _FileUpload_accessKey.set(this, void 0);
59
+ _FileUpload_stagingUrl.set(this, void 0);
60
+ __classPrivateFieldSet(this, _FileUpload_accessKey, accessKey, "f");
61
+ __classPrivateFieldSet(this, _FileUpload_stagingUrl, stagingUrl, "f");
62
+ }
63
+ uploadFileFrontend(_a) {
64
+ return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
65
+ if (!checkParameters(file, arrayMetaData, scanId)) {
66
+ throw new Error(REQUIRED_MESSAGE);
67
+ }
68
+ if (!checkMetaDataValue(arrayMetaData)) {
69
+ throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
70
+ }
71
+ arrayMetaData = addScanType(arrayMetaData, scanId);
72
+ return new Promise((resolve, reject) => {
73
+ if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
74
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
75
+ }
76
+ __classPrivateFieldSet(this, _FileUpload_uppyIns, new Uppy({ autoProceed: true }), "f");
77
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").use(AwsS3Multipart, {
78
+ limit: 10,
79
+ retryDelays: [0, 1000, 3000, 5000],
80
+ companionUrl: getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f") }),
81
+ getChunkSize: () => 5 * 1024 * 1024,
82
+ createMultipartUpload: (file) => {
83
+ const objectKey = `${scanId}.${file.extension}`;
84
+ return fetchData({
85
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
86
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
87
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
88
+ body: {
89
+ objectKey,
90
+ contentType: file.type,
91
+ objectMetadata: arrayMetaData,
92
+ },
106
93
  });
94
+ },
95
+ completeMultipartUpload: (file, { uploadId, key, parts }) =>
96
+ fetchData({
97
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
98
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
99
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
100
+ body: {
101
+ uploadId,
102
+ objectKey: key,
103
+ parts,
104
+ originalFileName: file.name,
105
+ },
106
+ }),
107
+ signPart: (file, partData) =>
108
+ fetchData({
109
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
110
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
111
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
112
+ body: {
113
+ objectKey: partData.key,
114
+ uploadId: partData.uploadId,
115
+ partNumber: partData.partNumber,
116
+ },
117
+ }),
107
118
  });
108
- }
109
- uploadFile(_a) {
110
- return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
111
- if (!checkParameters(file, arrayMetaData, scanId)) {
112
- throw new Error(REQUIRED_MESSAGE);
113
- }
114
- if (!checkMetaDataValue(arrayMetaData)) {
115
- throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
116
- }
117
- arrayMetaData = addScanType(arrayMetaData, scanId);
118
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
119
- var _b;
120
- try {
121
- const res = yield fetchData({
122
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
123
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
124
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
125
- body: {
126
- objectKey: file.name,
127
- contentType: file.type,
128
- objectMetadata: arrayMetaData,
129
- },
130
- throwError: true,
131
- });
132
- const totalChunks = getFileChunks(file);
133
- const parts = [];
134
- for (let i = 0; i < totalChunks.length; i++) {
135
- const data = yield fetchData({
136
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
137
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
138
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
139
- body: {
140
- objectKey: res === null || res === void 0 ? void 0 : res.key,
141
- uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
142
- partNumber: i + 1,
143
- },
144
- throwError: true,
145
- });
146
- const val = yield axios.put(data === null || data === void 0 ? void 0 : data.url, totalChunks[i], { headers: { "Content-Type": file.type, "X-Api-Key": __classPrivateFieldGet(this, _FileUpload_accessKey, "f") } });
147
- parts.push({ PartNumber: i + 1, ETag: (_b = val === null || val === void 0 ? void 0 : val.headers) === null || _b === void 0 ? void 0 : _b.etag });
148
- }
149
- const completeValue = yield fetchData({
150
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
151
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
152
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
153
- body: {
154
- uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
155
- objectKey: res === null || res === void 0 ? void 0 : res.key,
156
- parts,
157
- originalFileName: file.name,
158
- },
159
- throwError: true,
160
- });
161
- resolve({ message: "successfully uploaded", data: completeValue });
162
- }
163
- catch (error) {
164
- reject(error);
165
- }
166
- }));
119
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").addFile({
120
+ source: "manual",
121
+ name: file.name,
122
+ type: file.type,
123
+ data: file,
167
124
  });
168
- }
125
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-error", (file, error, response) => {
126
+ reject(error);
127
+ });
128
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-success", () => {
129
+ resolve({ message: "file uploaded successfully" });
130
+ });
131
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("complete", (result) => {
132
+ if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
133
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
134
+ }
135
+ });
136
+ });
137
+ });
138
+ }
139
+ uploadFile(_a) {
140
+ return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
141
+ if (!checkParameters(file, arrayMetaData, scanId)) {
142
+ throw new Error(REQUIRED_MESSAGE);
143
+ }
144
+ if (!checkMetaDataValue(arrayMetaData)) {
145
+ throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
146
+ }
147
+ arrayMetaData = addScanType(arrayMetaData, scanId);
148
+ return new Promise((resolve, reject) =>
149
+ __awaiter(this, void 0, void 0, function* () {
150
+ var _b;
151
+ try {
152
+ const res = yield fetchData({
153
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
154
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
155
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
156
+ body: {
157
+ objectKey: file.name,
158
+ contentType: file.type,
159
+ objectMetadata: arrayMetaData,
160
+ },
161
+ throwError: true,
162
+ });
163
+ const totalChunks = getFileChunks(file);
164
+ const parts = [];
165
+ for (let i = 0; i < totalChunks.length; i++) {
166
+ const data = yield fetchData({
167
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
168
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
169
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
170
+ body: {
171
+ objectKey: res === null || res === void 0 ? void 0 : res.key,
172
+ uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
173
+ partNumber: i + 1,
174
+ },
175
+ throwError: true,
176
+ });
177
+ const val = yield axios.put(data === null || data === void 0 ? void 0 : data.url, totalChunks[i], {
178
+ headers: { "Content-Type": file.type, "X-Api-Key": __classPrivateFieldGet(this, _FileUpload_accessKey, "f") },
179
+ });
180
+ parts.push({
181
+ PartNumber: i + 1,
182
+ ETag: (_b = val === null || val === void 0 ? void 0 : val.headers) === null || _b === void 0 ? void 0 : _b.etag,
183
+ });
184
+ }
185
+ const completeValue = yield fetchData({
186
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
187
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
188
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
189
+ body: {
190
+ uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
191
+ objectKey: res === null || res === void 0 ? void 0 : res.key,
192
+ parts,
193
+ originalFileName: file.name,
194
+ },
195
+ throwError: true,
196
+ });
197
+ resolve({ message: "successfully uploaded", data: completeValue });
198
+ } catch (error) {
199
+ reject(error);
200
+ }
201
+ })
202
+ );
203
+ });
204
+ }
169
205
  }
170
- _FileUpload_uppyIns = new WeakMap(), _FileUpload_accessKey = new WeakMap(), _FileUpload_stagingUrl = new WeakMap();
206
+ (_FileUpload_uppyIns = new WeakMap()), (_FileUpload_accessKey = new WeakMap()), (_FileUpload_stagingUrl = new WeakMap());
171
207
  export default FileUpload;
@@ -89,7 +89,7 @@ class Measurement {
89
89
  }
90
90
  setTimeout(() => {
91
91
  __classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_disconnectSocket).call(this);
92
- const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: __classPrivateFieldGet(this, _Measurement_stagingUrl, "f") })}/${API_ENDPOINTS.SCANNING}?scanId=${scanId}`;
92
+ const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: __classPrivateFieldGet(this, _Measurement_stagingUrl, "f") })}${API_ENDPOINTS.SCANNING}?scanId=${scanId}`;
93
93
  __classPrivateFieldSet(this, _Measurement_measurementSocketRef, new WebSocket(url), "f");
94
94
  __classPrivateFieldGet(this, _Measurement_measurementSocketRef, "f").onopen = () => {
95
95
  onOpen === null || onOpen === void 0 ? void 0 : onOpen();
package/dist/esm/tryOn.js CHANGED
@@ -40,7 +40,7 @@ class TryOn {
40
40
  __classPrivateFieldSet(this, _TryOn_timerWaitingRef, setTimeout(() => {
41
41
  __classPrivateFieldGet(this, _TryOn_handleGetTryOnResult, "f").call(this, { shopDomain, userId, productName, onSuccess, onError });
42
42
  __classPrivateFieldGet(this, _TryOn_disconnectSocket, "f").call(this);
43
- }, 120000), "f");
43
+ }, 138000), "f");
44
44
  });
45
45
  this.handleTryOnWebSocket = ({ shopDomain, userId, productName, onError, onSuccess, onClose, onOpen }) => {
46
46
  if (checkParameters(shopDomain, userId, productName) === false) {
@@ -62,7 +62,7 @@ class TryOn {
62
62
  __classPrivateFieldGet(this, _TryOn_tryOnSocketRef, "f").onmessage = (event) => {
63
63
  const data = JSON.parse(event.data);
64
64
  if ((data === null || data === void 0 ? void 0 : data.status) === "success") {
65
- __classPrivateFieldGet(this, _TryOn_handleGetTryOnResult, "f").call(this, { shopDomain, userId, productName, onError, onSuccess });
65
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
66
66
  }
67
67
  else {
68
68
  onError === null || onError === void 0 ? void 0 : onError(data);
@@ -125,7 +125,7 @@ class Measurement {
125
125
  }
126
126
  setTimeout(() => {
127
127
  this.#disconnectSocket();
128
- const url = `${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}/${constants_js_1.API_ENDPOINTS.SCANNING}?scanId=${scanId}`;
128
+ const url = `${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.SCANNING}?scanId=${scanId}`;
129
129
  this.#measurementSocketRef = new WebSocket(url);
130
130
  this.#measurementSocketRef.onopen = () => {
131
131
  onOpen?.();
package/dist/tryOn.js CHANGED
@@ -75,7 +75,7 @@ class TryOn {
75
75
  this.#timerWaitingRef = setTimeout(() => {
76
76
  this.#handleGetTryOnResult({ shopDomain, userId, productName, onSuccess, onError });
77
77
  this.#disconnectSocket();
78
- }, 120000);
78
+ }, 138000);
79
79
  };
80
80
  handleTryOnWebSocket = ({ shopDomain, userId, productName, onError, onSuccess, onClose, onOpen }) => {
81
81
  if ((0, utils_js_1.checkParameters)(shopDomain, userId, productName) === false) {
@@ -97,7 +97,7 @@ class TryOn {
97
97
  this.#tryOnSocketRef.onmessage = (event) => {
98
98
  const data = JSON.parse(event.data);
99
99
  if (data?.status === "success") {
100
- this.#handleGetTryOnResult({ shopDomain, userId, productName, onError, onSuccess });
100
+ onSuccess?.(data);
101
101
  }
102
102
  else {
103
103
  onError?.(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -176,7 +176,7 @@ class Measurement {
176
176
 
177
177
  setTimeout(() => {
178
178
  this.#disconnectSocket();
179
- const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}/${API_ENDPOINTS.SCANNING}?scanId=${scanId}`;
179
+ const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.SCANNING}?scanId=${scanId}`;
180
180
  this.#measurementSocketRef = new WebSocket(url);
181
181
  this.#measurementSocketRef.onopen = () => {
182
182
  onOpen?.();
package/src/tryOn.ts CHANGED
@@ -125,7 +125,7 @@ class TryOn {
125
125
  this.#timerWaitingRef = setTimeout(() => {
126
126
  this.#handleGetTryOnResult({ shopDomain, userId, productName, onSuccess, onError });
127
127
  this.#disconnectSocket();
128
- }, 120000);
128
+ }, 138000);
129
129
  };
130
130
 
131
131
  handleTryOnWebSocket = ({ shopDomain, userId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams): void => {
@@ -149,7 +149,7 @@ class TryOn {
149
149
  this.#tryOnSocketRef.onmessage = (event) => {
150
150
  const data = JSON.parse(event.data);
151
151
  if (data?.status === "success") {
152
- this.#handleGetTryOnResult({ shopDomain, userId, productName, onError, onSuccess });
152
+ onSuccess?.(data);
153
153
  } else {
154
154
  onError?.(data);
155
155
  }