@swan-admin/swan-ai-measurements 1.0.35 → 1.0.37
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 +10 -10
- package/custom.js +2 -2
- package/fileUpload.js +13 -9
- package/index.js +8 -8
- package/measurement.js +34 -34
- package/package.json +1 -1
- package/poseDetection.js +13 -13
- package/tryOn.js +30 -30
package/auth.js
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
REQUIRED_MESSAGE,
|
|
8
8
|
} from "./constants.js";
|
|
9
9
|
import { checkParameters } from "./utils.js";
|
|
10
|
-
let socketRef;
|
|
11
10
|
|
|
12
11
|
class Auth {
|
|
13
|
-
|
|
12
|
+
#accessKey;
|
|
13
|
+
#socketRef;
|
|
14
14
|
constructor(key) {
|
|
15
|
-
|
|
15
|
+
this.#accessKey = key;
|
|
16
16
|
}
|
|
17
17
|
registerUser({ email, appVerifyUrl, gender, height, username }) {
|
|
18
18
|
if (checkParameters(email, appVerifyUrl) === false) {
|
|
@@ -62,29 +62,29 @@ class Auth {
|
|
|
62
62
|
if (checkParameters(email, scanId) === false) {
|
|
63
63
|
throw new Error(REQUIRED_MESSAGE);
|
|
64
64
|
}
|
|
65
|
-
socketRef?.close?.();
|
|
65
|
+
this.#socketRef?.close?.();
|
|
66
66
|
|
|
67
|
-
socketRef = new WebSocket(`${APP_AUTH_WEBSOCKET_URL}${API_ENDPOINTS.AUTH}`);
|
|
67
|
+
this.#socketRef = new WebSocket(`${APP_AUTH_WEBSOCKET_URL}${API_ENDPOINTS.AUTH}`);
|
|
68
68
|
const detailObj = {
|
|
69
69
|
email,
|
|
70
70
|
scanId,
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
socketRef.onopen = () => {
|
|
74
|
-
socketRef.send(JSON.stringify(detailObj));
|
|
73
|
+
this.#socketRef.onopen = () => {
|
|
74
|
+
this.#socketRef.send(JSON.stringify(detailObj));
|
|
75
75
|
onOpen?.();
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
socketRef.onmessage = (event) => {
|
|
78
|
+
this.#socketRef.onmessage = (event) => {
|
|
79
79
|
const data = JSON.parse(event.data);
|
|
80
80
|
onSuccess?.(data);
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
socketRef.onclose = () => {
|
|
83
|
+
this.#socketRef.onclose = () => {
|
|
84
84
|
onClose?.();
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
socketRef.onerror = (event) => {
|
|
87
|
+
this.#socketRef.onerror = (event) => {
|
|
88
88
|
onError?.(event);
|
|
89
89
|
};
|
|
90
90
|
};
|
package/custom.js
CHANGED
|
@@ -2,9 +2,9 @@ import axios from "axios";
|
|
|
2
2
|
import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE } from "./constants.js";
|
|
3
3
|
|
|
4
4
|
export default class Custom {
|
|
5
|
-
|
|
5
|
+
#accessKey;
|
|
6
6
|
constructor(key) {
|
|
7
|
-
|
|
7
|
+
this.#accessKey = key;
|
|
8
8
|
}
|
|
9
9
|
getCustomCustomerConfig = (store_url) => {
|
|
10
10
|
if (!store_url) {
|
package/fileUpload.js
CHANGED
|
@@ -4,17 +4,21 @@ import { FILE_UPLOAD_KEY, REQUIRED_MESSAGE, UPPY_FILE_UPLOAD_ENDPOINT } from "./
|
|
|
4
4
|
import { checkParameters, fetchData } from "./utils.js";
|
|
5
5
|
|
|
6
6
|
export default class FileUpload {
|
|
7
|
-
|
|
7
|
+
#accessKey;
|
|
8
|
+
#uppyIns;
|
|
8
9
|
constructor(key) {
|
|
9
|
-
|
|
10
|
+
this.#accessKey = key;
|
|
10
11
|
}
|
|
11
12
|
uploadFile({ file, objMetaData, scanId }) {
|
|
12
13
|
if (checkParameters(file, objMetaData, scanId) === false) {
|
|
13
14
|
throw new Error(REQUIRED_MESSAGE);
|
|
14
15
|
}
|
|
15
16
|
return new Promise((resolve, reject) => {
|
|
17
|
+
if (this.#uppyIns) {
|
|
18
|
+
this.#uppyIns.close();
|
|
19
|
+
}
|
|
16
20
|
const uppyIns = new Uppy({ autoProceed: true });
|
|
17
|
-
uppyIns.use(AwsS3Multipart, {
|
|
21
|
+
this.#uppyIns.use(AwsS3Multipart, {
|
|
18
22
|
limit: 10,
|
|
19
23
|
retryDelays: [0, 1000, 3000, 5000],
|
|
20
24
|
getChunkSize: () => 5 * 1024 * 1024,
|
|
@@ -65,22 +69,22 @@ export default class FileUpload {
|
|
|
65
69
|
}),
|
|
66
70
|
});
|
|
67
71
|
|
|
68
|
-
uppyIns.addFile({
|
|
72
|
+
this.#uppyIns.addFile({
|
|
69
73
|
source: "manual",
|
|
70
74
|
name: file.name,
|
|
71
75
|
type: file.type,
|
|
72
76
|
data: file,
|
|
73
77
|
});
|
|
74
78
|
|
|
75
|
-
uppyIns.on("upload-error", (file, error, response) => {
|
|
79
|
+
this.#uppyIns.on("upload-error", (file, error, response) => {
|
|
76
80
|
reject(error);
|
|
77
81
|
});
|
|
78
|
-
uppyIns.on("upload-success", () => {
|
|
82
|
+
this.#uppyIns.on("upload-success", () => {
|
|
79
83
|
resolve({ message: "file uploaded successfully" });
|
|
80
84
|
});
|
|
81
|
-
uppyIns.on("complete", (result) => {
|
|
82
|
-
if (uppyIns) {
|
|
83
|
-
uppyIns.close();
|
|
85
|
+
this.#uppyIns.on("complete", (result) => {
|
|
86
|
+
if (this.#uppyIns) {
|
|
87
|
+
this.#uppyIns.close();
|
|
84
88
|
}
|
|
85
89
|
});
|
|
86
90
|
});
|
package/index.js
CHANGED
|
@@ -5,23 +5,23 @@ import Measurement from "./measurement.js";
|
|
|
5
5
|
import PoseDetection from "./poseDetection.js";
|
|
6
6
|
import TryOn from "./tryOn.js";
|
|
7
7
|
export default class Swan {
|
|
8
|
-
|
|
8
|
+
#accessKey;
|
|
9
9
|
constructor(key) {
|
|
10
10
|
if (key !== 9876543210) {
|
|
11
11
|
throw new Error("wrong access key");
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
this.#accessKey = key;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
auth = new Auth(
|
|
16
|
+
auth = new Auth(this.#accessKey);
|
|
17
17
|
|
|
18
|
-
custom = new Custom(
|
|
18
|
+
custom = new Custom(this.#accessKey);
|
|
19
19
|
|
|
20
|
-
fileUpload = new FileUpload(
|
|
20
|
+
fileUpload = new FileUpload(this.#accessKey);
|
|
21
21
|
|
|
22
|
-
measurement = new Measurement(
|
|
22
|
+
measurement = new Measurement(this.#accessKey);
|
|
23
23
|
|
|
24
|
-
poseDetection = new PoseDetection(
|
|
24
|
+
poseDetection = new PoseDetection(this.#accessKey);
|
|
25
25
|
|
|
26
|
-
tryOn = new TryOn(
|
|
26
|
+
tryOn = new TryOn(this.#accessKey);
|
|
27
27
|
}
|
package/measurement.js
CHANGED
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
import { checkParameters } from "./utils.js";
|
|
11
11
|
|
|
12
12
|
export default class Measurement {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
#accessKey;
|
|
14
|
+
#tryOnSocketRef = null;
|
|
15
|
+
#measurementSocketRef = null;
|
|
16
|
+
#timerPollingRef = null;
|
|
17
|
+
#timerWaitingRef = null;
|
|
18
18
|
constructor(key) {
|
|
19
|
-
|
|
19
|
+
this.#accessKey = key;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
getMeasurementStatus(scanId) {
|
|
@@ -41,16 +41,16 @@ export default class Measurement {
|
|
|
41
41
|
if (checkParameters(shopDomain, scanId, productName) === false) {
|
|
42
42
|
throw new Error(REQUIRED_MESSAGE);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
this.#tryOnSocketRef?.close();
|
|
45
45
|
|
|
46
46
|
const url = `${APP_TRY_ON_WEBSOCKET_URL}/develop?store_url=${shopDomain}&product_name=${productName}&scan_id=${scanId}`;
|
|
47
|
-
|
|
47
|
+
this.#tryOnSocketRef = new WebSocket(url);
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
this.#tryOnSocketRef.onopen = () => {
|
|
50
50
|
onOpen?.();
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
this.#tryOnSocketRef.onmessage = (event) => {
|
|
54
54
|
const data = JSON.parse(event.data);
|
|
55
55
|
if (data?.tryOnProcessStatus === "available") {
|
|
56
56
|
onSuccess?.(data);
|
|
@@ -59,44 +59,44 @@ export default class Measurement {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
this.#tryOnSocketRef.onclose = () => {
|
|
63
63
|
onClose?.();
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
this.#tryOnSocketRef.onerror = (event) => {
|
|
67
67
|
onError?.(event);
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
#getMeasurementsCheck = async (onSuccess, onError, scanId) => {
|
|
72
72
|
try {
|
|
73
73
|
const res = await this.getMeasurementStatus(scanId);
|
|
74
74
|
if (res?.data && res?.data?.[0]?.isMeasured === true) {
|
|
75
75
|
onSuccess?.(res?.data);
|
|
76
|
-
clearInterval(
|
|
76
|
+
clearInterval(this.#timerPollingRef);
|
|
77
77
|
}
|
|
78
78
|
} catch (e) {
|
|
79
|
-
clearInterval(
|
|
79
|
+
clearInterval(this.#timerPollingRef);
|
|
80
80
|
onError?.(e);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
clearInterval(
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
#handlePolling(onSuccess, onError) {
|
|
85
|
+
clearInterval(this.#timerPollingRef);
|
|
86
|
+
this.#timerPollingRef = setInterval(() => {
|
|
87
|
+
this.#getMeasurementsCheck(onSuccess, onError);
|
|
88
88
|
}, 5000);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
clearTimeout(
|
|
91
|
+
#disconnectSocket = () => {
|
|
92
|
+
this.#measurementSocketRef?.close();
|
|
93
|
+
clearTimeout(this.#timerWaitingRef);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
#handleTimeOut = (onSuccess, onError) => {
|
|
97
|
+
this.#timerWaitingRef = setTimeout(() => {
|
|
98
|
+
this.#handlePolling(onSuccess, onError);
|
|
99
|
+
this.#disconnectSocket();
|
|
100
100
|
}, 2 * 60000);
|
|
101
101
|
};
|
|
102
102
|
|
|
@@ -104,30 +104,30 @@ export default class Measurement {
|
|
|
104
104
|
if (!scanId) {
|
|
105
105
|
throw new Error(REQUIRED_MESSAGE);
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
this.#disconnectSocket();
|
|
108
108
|
const url = `${APP_RECOMMENDATION_WEBSOCKET_URL}?scanId=${scanId}`;
|
|
109
|
-
|
|
109
|
+
this.#measurementSocketRef = new WebSocket(url);
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
this.#measurementSocketRef.onopen = () => {
|
|
112
112
|
onOpen?.();
|
|
113
|
-
|
|
113
|
+
this.#handleTimeOut(onSuccess, onError);
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
this.#measurementSocketRef.onmessage = (event) => {
|
|
117
117
|
const data = JSON.parse(event.data);
|
|
118
118
|
if (data?.code === 200 && data?.scanStatus === "success") {
|
|
119
119
|
onSuccess?.(data);
|
|
120
120
|
} else {
|
|
121
121
|
onError?.(data);
|
|
122
122
|
}
|
|
123
|
-
clearTimeout(
|
|
123
|
+
clearTimeout(this.#timerWaitingRef);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
this.#measurementSocketRef.onclose = () => {
|
|
127
127
|
onClose?.();
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
this.#measurementSocketRef.onerror = (event) => {
|
|
131
131
|
onError?.(event);
|
|
132
132
|
};
|
|
133
133
|
};
|
package/package.json
CHANGED
package/poseDetection.js
CHANGED
|
@@ -2,45 +2,45 @@ import { APP_POSE_DETECTION_WEbSOCKET_URL } from "./constants.js";
|
|
|
2
2
|
import { io } from "socket.io-client";
|
|
3
3
|
|
|
4
4
|
export default class PoseDetection {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
#socketRef = null;
|
|
6
|
+
#accessKey;
|
|
7
7
|
constructor(key) {
|
|
8
|
-
|
|
8
|
+
this.#accessKey = key;
|
|
9
9
|
}
|
|
10
10
|
connect() {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
resolve(
|
|
12
|
+
this.#socketRef = io.connect(APP_POSE_DETECTION_WEbSOCKET_URL);
|
|
13
|
+
this.#socketRef?.on("connect", () => {
|
|
14
|
+
resolve(this.#socketRef.id); // "G5p5..."
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
this.#socketRef?.on("connect_error", (err) => reject(err));
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
videoEmit({ image, scanId }) {
|
|
21
|
-
if (!
|
|
21
|
+
if (!this.#socketRef) {
|
|
22
22
|
throw new Error("socket is not connected");
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
this.#socketRef.emit("video", {
|
|
25
25
|
image,
|
|
26
26
|
user_unique_key: scanId,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
disconnect() {
|
|
31
|
-
|
|
31
|
+
this.#socketRef?.disconnect?.();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
poseStatus(callBack) {
|
|
35
|
-
if (!
|
|
35
|
+
if (!this.#socketRef) {
|
|
36
36
|
throw new Error("socket is not connected");
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
this.#socketRef.on("pose_status", (data) => {
|
|
39
39
|
callBack?.(data);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
connected() {
|
|
44
|
-
return !!
|
|
44
|
+
return !!this.#socketRef?.connected;
|
|
45
45
|
}
|
|
46
46
|
}
|
package/tryOn.js
CHANGED
|
@@ -3,11 +3,11 @@ import { API_ENDPOINTS, APP_AUTH_BASE_URL, APP_AUTH_WEBSOCKET_URL, REQUIRED_MESS
|
|
|
3
3
|
import { checkParameters } from "./utils.js";
|
|
4
4
|
|
|
5
5
|
class TryOn {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
#accessKey = null;
|
|
7
|
+
#tryOnSocketRef = null;
|
|
8
|
+
#timerWaitingRef = null;
|
|
9
9
|
constructor(accessKey) {
|
|
10
|
-
|
|
10
|
+
this.#accessKey = accessKey;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
uploadFile(files, userId) {
|
|
@@ -20,9 +20,9 @@ class TryOn {
|
|
|
20
20
|
if (files?.[1]) {
|
|
21
21
|
payload.userImages.push(files?.[1]?.name);
|
|
22
22
|
}
|
|
23
|
-
const signedUrlRes = await
|
|
23
|
+
const signedUrlRes = await this.#getSignedUrl(payload);
|
|
24
24
|
for (const file of files) {
|
|
25
|
-
await
|
|
25
|
+
await this.#s3Upload(signedUrlRes?.data?.uploadUrls?.[file.name]?.url, file);
|
|
26
26
|
}
|
|
27
27
|
resolve("uploaded successfully!");
|
|
28
28
|
} catch (error) {
|
|
@@ -31,7 +31,7 @@ class TryOn {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
#getSignedUrl(payload) {
|
|
35
35
|
return axios.post(`${APP_AUTH_BASE_URL}${API_ENDPOINTS.TRY_ON_IMAGE_UPLOAD}`, payload, {
|
|
36
36
|
headers: {
|
|
37
37
|
"Content-Type": "application/json",
|
|
@@ -39,7 +39,7 @@ class TryOn {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
#s3Upload(url, file) {
|
|
43
43
|
return axios.put(url, file, {
|
|
44
44
|
headers: {
|
|
45
45
|
"Content-Type": file.type,
|
|
@@ -55,15 +55,15 @@ class TryOn {
|
|
|
55
55
|
return axios.delete(`${APP_AUTH_BASE_URL}${API_ENDPOINTS.TRY_ON_IMAGE_URLS}?userId=${userId}&file=${name}`);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
clearTimeout(
|
|
58
|
+
#disconnectSocket = () => {
|
|
59
|
+
this.#tryOnSocketRef?.close();
|
|
60
|
+
clearTimeout(this.#timerWaitingRef);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
#handleTimeOut = ({ onSuccess, onError, shopDomain, userId, productName }) => {
|
|
64
|
+
this.#timerWaitingRef = setTimeout(() => {
|
|
65
|
+
this.#handleGetTryOnResult({ shopDomain, userId, productName, onSuccess, onError });
|
|
66
|
+
this.#disconnectSocket();
|
|
67
67
|
}, 78000);
|
|
68
68
|
};
|
|
69
69
|
|
|
@@ -71,33 +71,33 @@ class TryOn {
|
|
|
71
71
|
if (checkParameters(shopDomain, userId, productName) === false) {
|
|
72
72
|
throw new Error(REQUIRED_MESSAGE);
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
this.#disconnectSocket();
|
|
75
75
|
const url = `${APP_AUTH_WEBSOCKET_URL}${API_ENDPOINTS.TRY_ON}/?store_url=${shopDomain}&product_name=${productName}&scan_id=${userId}`;
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
this.#tryOnSocketRef = new WebSocket(url);
|
|
77
|
+
this.#tryOnSocketRef.onopen = async () => {
|
|
78
78
|
onOpen?.();
|
|
79
|
-
|
|
79
|
+
this.#handleTimeOut({ onSuccess, onError, shopDomain, userId, productName });
|
|
80
80
|
try {
|
|
81
81
|
await this.handleForLatestImage({ shopDomain, userId, productName });
|
|
82
82
|
} catch (error) {
|
|
83
83
|
onError?.(error);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
this.#tryOnSocketRef.onmessage = (event) => {
|
|
87
87
|
const data = JSON.parse(event.data);
|
|
88
88
|
if (data?.status === "success") {
|
|
89
|
-
|
|
89
|
+
this.#handleGetTryOnResult({ shopDomain, userId, productName, onError, onSuccess });
|
|
90
90
|
} else {
|
|
91
91
|
onError?.(data);
|
|
92
92
|
}
|
|
93
|
-
clearTimeout(
|
|
93
|
+
clearTimeout(this.#tryOnSocketRef);
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
this.#tryOnSocketRef.onclose = () => {
|
|
96
96
|
onClose?.();
|
|
97
97
|
};
|
|
98
|
-
|
|
98
|
+
this.#tryOnSocketRef.onerror = (event) => {
|
|
99
99
|
onError?.(event);
|
|
100
|
-
clearTimeout(
|
|
100
|
+
clearTimeout(this.#tryOnSocketRef);
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
103
|
|
|
@@ -107,23 +107,23 @@ class TryOn {
|
|
|
107
107
|
}
|
|
108
108
|
return new Promise(async (resolve, reject) => {
|
|
109
109
|
try {
|
|
110
|
-
const url = `${APP_AUTH_BASE_URL}${API_ENDPOINTS.TRY_ON}/?scan_id=${
|
|
110
|
+
const url = `${APP_AUTH_BASE_URL}${API_ENDPOINTS.TRY_ON}/?scan_id=${userId}&store_url=${shopDomain}&product_name=${productName}`;
|
|
111
111
|
const res = await axios.post(url);
|
|
112
112
|
if (res?.data?.tryOnProcessStatus === "failed") {
|
|
113
|
-
|
|
113
|
+
this.#disconnectSocket();
|
|
114
114
|
reject(res?.data);
|
|
115
115
|
} else {
|
|
116
116
|
resolve(res?.data);
|
|
117
117
|
}
|
|
118
118
|
} catch (error) {
|
|
119
119
|
onError?.(error);
|
|
120
|
-
|
|
120
|
+
this.#disconnectSocket();
|
|
121
121
|
reject(error);
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
#handleGetTryOnResult = async ({ onSuccess, onError, shopDomain, userId, productName }) => {
|
|
127
127
|
try {
|
|
128
128
|
const data = await this.getTryOnResult({ shopDomain, userId, productName });
|
|
129
129
|
onSuccess?.(data?.data);
|
|
@@ -132,7 +132,7 @@ class TryOn {
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
getTryOnResult =
|
|
135
|
+
getTryOnResult = ({ userId, shopDomain, productName }) => {
|
|
136
136
|
if (checkParameters(shopDomain, userId, productName) === false) {
|
|
137
137
|
throw new Error(REQUIRED_MESSAGE);
|
|
138
138
|
}
|