@swan-admin/swan-ai-measurements 1.1.61 → 1.1.63
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/dist/esm/tryOn.js +1 -1
- package/dist/tryOn.js +1 -1
- package/package.json +1 -1
- package/src/measurement.ts +1 -4
- package/src/tryOn.ts +1 -15
package/dist/esm/tryOn.js
CHANGED
|
@@ -180,7 +180,7 @@ class TryOn {
|
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
handleTryOnSubmit({ userEmail, shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
|
|
183
|
-
if (checkParameters(shopDomain, userEmail, products
|
|
183
|
+
if (checkParameters(shopDomain, userEmail, products) === false) {
|
|
184
184
|
throw new Error(REQUIRED_MESSAGE);
|
|
185
185
|
}
|
|
186
186
|
// if (!selectedUserImages.length) {
|
package/dist/tryOn.js
CHANGED
|
@@ -155,7 +155,7 @@ class TryOn {
|
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
handleTryOnSubmit({ userEmail, shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
|
|
158
|
-
if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, products
|
|
158
|
+
if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, products) === false) {
|
|
159
159
|
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
160
160
|
}
|
|
161
161
|
// if (!selectedUserImages.length) {
|
package/package.json
CHANGED
package/src/measurement.ts
CHANGED
|
@@ -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;
|
|
@@ -154,7 +151,7 @@ class Measurement {
|
|
|
154
151
|
} else {
|
|
155
152
|
onError?.(data);
|
|
156
153
|
}
|
|
157
|
-
if (this.#timerWaitingRef) {
|
|
154
|
+
if (this.#timerWaitingRef && data?.code === 200 && data?.scanStatus === "success" && data?.resultType === "final" ) {
|
|
158
155
|
clearTimeout(this.#timerWaitingRef);
|
|
159
156
|
}
|
|
160
157
|
};
|
package/src/tryOn.ts
CHANGED
|
@@ -221,12 +221,9 @@ class TryOn {
|
|
|
221
221
|
openTryonId,
|
|
222
222
|
selectedProductImageUrl
|
|
223
223
|
}: HandleForLatestImageParams): Promise<AxiosResponse<any>> {
|
|
224
|
-
if (checkParameters(shopDomain, userEmail, products
|
|
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 },
|