@swan-admin/swan-ai-measurements 1.1.51 → 1.1.52
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.d.ts +3 -1
- package/dist/esm/tryOn.js +4 -4
- package/dist/tryOn.d.ts +3 -1
- package/dist/tryOn.js +5 -3
- package/package.json +1 -1
- package/src/tryOn.ts +8 -2
package/dist/esm/tryOn.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ interface HandleForLatestImageParams {
|
|
|
31
31
|
selectedUserImages: string[];
|
|
32
32
|
requestSource?: string;
|
|
33
33
|
callbackUrl?: string;
|
|
34
|
+
openTryonId?: string;
|
|
35
|
+
selectedProductImageUrl?: string;
|
|
34
36
|
}
|
|
35
37
|
interface GetTryOnResultParams {
|
|
36
38
|
shopDomain: string;
|
|
@@ -44,7 +46,7 @@ declare class TryOn {
|
|
|
44
46
|
getUploadedFiles(userEmail: string): Promise<AxiosResponse<any>>;
|
|
45
47
|
deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
|
|
46
48
|
handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
|
|
47
|
-
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
|
|
49
|
+
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
|
|
48
50
|
getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
|
|
49
51
|
getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
|
|
50
52
|
getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
|
package/dist/esm/tryOn.js
CHANGED
|
@@ -63,7 +63,7 @@ class TryOn {
|
|
|
63
63
|
data = JSON.parse(event.data);
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
66
|
-
console.log(data, error, "
|
|
66
|
+
console.log(data, error, "not correct format for data");
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
if ((data === null || data === void 0 ? void 0 : data.status) === "success") {
|
|
@@ -182,7 +182,7 @@ class TryOn {
|
|
|
182
182
|
data: payload,
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, }) {
|
|
185
|
+
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
|
|
186
186
|
if (checkParameters(shopDomain, userEmail, productName, selectedUserImages) === false) {
|
|
187
187
|
throw new Error(REQUIRED_MESSAGE);
|
|
188
188
|
}
|
|
@@ -192,8 +192,8 @@ class TryOn {
|
|
|
192
192
|
if (!isValidEmail(userEmail.trim())) {
|
|
193
193
|
throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
|
|
194
194
|
}
|
|
195
|
-
const payload = Object.assign(Object.assign({ productName,
|
|
196
|
-
userEmail, customerStoreUrl: shopDomain, selectedUserImages }, (requestSource !== undefined && requestSource !== null && { requestSource })), (callbackUrl !== undefined && callbackUrl !== null && { callbackUrl }));
|
|
195
|
+
const payload = Object.assign(Object.assign(Object.assign(Object.assign({ productName,
|
|
196
|
+
userEmail, customerStoreUrl: shopDomain, selectedUserImages }, (requestSource !== undefined && requestSource !== null && { requestSource })), (callbackUrl !== undefined && callbackUrl !== null && { callbackUrl })), (openTryonId !== undefined && openTryonId !== null && { openTryonId })), (selectedProductImageUrl !== undefined && selectedProductImageUrl !== null && { selectedProductImageUrl }));
|
|
197
197
|
const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON}`;
|
|
198
198
|
return axios.post(url, payload, {
|
|
199
199
|
headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
|
package/dist/tryOn.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ interface HandleForLatestImageParams {
|
|
|
31
31
|
selectedUserImages: string[];
|
|
32
32
|
requestSource?: string;
|
|
33
33
|
callbackUrl?: string;
|
|
34
|
+
openTryonId?: string;
|
|
35
|
+
selectedProductImageUrl?: string;
|
|
34
36
|
}
|
|
35
37
|
interface GetTryOnResultParams {
|
|
36
38
|
shopDomain: string;
|
|
@@ -44,7 +46,7 @@ declare class TryOn {
|
|
|
44
46
|
getUploadedFiles(userEmail: string): Promise<AxiosResponse<any>>;
|
|
45
47
|
deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
|
|
46
48
|
handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
|
|
47
|
-
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
|
|
49
|
+
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
|
|
48
50
|
getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
|
|
49
51
|
getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
|
|
50
52
|
getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
|
package/dist/tryOn.js
CHANGED
|
@@ -130,7 +130,7 @@ class TryOn {
|
|
|
130
130
|
data = JSON.parse(event.data);
|
|
131
131
|
}
|
|
132
132
|
catch (error) {
|
|
133
|
-
console.log(data, error, "
|
|
133
|
+
console.log(data, error, "not correct format for data");
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
if (data?.status === "success") {
|
|
@@ -157,7 +157,7 @@ class TryOn {
|
|
|
157
157
|
console.log("no connection made for websocket");
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
-
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, }) {
|
|
160
|
+
handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
|
|
161
161
|
if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, productName, selectedUserImages) === false) {
|
|
162
162
|
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
163
163
|
}
|
|
@@ -173,7 +173,9 @@ class TryOn {
|
|
|
173
173
|
customerStoreUrl: shopDomain,
|
|
174
174
|
selectedUserImages,
|
|
175
175
|
...(requestSource !== undefined && requestSource !== null && { requestSource }),
|
|
176
|
-
...(callbackUrl !== undefined && callbackUrl !== null && { callbackUrl })
|
|
176
|
+
...(callbackUrl !== undefined && callbackUrl !== null && { callbackUrl }),
|
|
177
|
+
...(openTryonId !== undefined && openTryonId !== null && { openTryonId }),
|
|
178
|
+
...(selectedProductImageUrl !== undefined && selectedProductImageUrl !== null && { selectedProductImageUrl })
|
|
177
179
|
};
|
|
178
180
|
const url = `${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.TRY_ON}`;
|
|
179
181
|
return axios_1.default.post(url, payload, {
|
package/package.json
CHANGED
package/src/tryOn.ts
CHANGED
|
@@ -35,6 +35,8 @@ interface HandleForLatestImageParams {
|
|
|
35
35
|
selectedUserImages:string[];
|
|
36
36
|
requestSource?: string;
|
|
37
37
|
callbackUrl?: string;
|
|
38
|
+
openTryonId?:string;
|
|
39
|
+
selectedProductImageUrl?:string
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
interface HandleTimeOutParams {
|
|
@@ -184,7 +186,7 @@ class TryOn {
|
|
|
184
186
|
try {
|
|
185
187
|
data = JSON.parse(event.data);
|
|
186
188
|
} catch (error) {
|
|
187
|
-
console.log(data, error, "
|
|
189
|
+
console.log(data, error, "not correct format for data");
|
|
188
190
|
return;
|
|
189
191
|
}
|
|
190
192
|
if (data?.status === "success") {
|
|
@@ -219,6 +221,8 @@ class TryOn {
|
|
|
219
221
|
selectedUserImages,
|
|
220
222
|
requestSource,
|
|
221
223
|
callbackUrl,
|
|
224
|
+
openTryonId,
|
|
225
|
+
selectedProductImageUrl
|
|
222
226
|
}: HandleForLatestImageParams): Promise<AxiosResponse<any>> {
|
|
223
227
|
if (checkParameters(shopDomain, userEmail, productName,selectedUserImages) === false) {
|
|
224
228
|
throw new Error(REQUIRED_MESSAGE);
|
|
@@ -235,7 +239,9 @@ class TryOn {
|
|
|
235
239
|
customerStoreUrl: shopDomain,
|
|
236
240
|
selectedUserImages,
|
|
237
241
|
...(requestSource!==undefined && requestSource!==null &&{requestSource}),
|
|
238
|
-
...(callbackUrl!==undefined && callbackUrl!==null &&{callbackUrl})
|
|
242
|
+
...(callbackUrl!==undefined && callbackUrl!==null &&{callbackUrl}),
|
|
243
|
+
...(openTryonId!==undefined && openTryonId!==null &&{openTryonId}),
|
|
244
|
+
...(selectedProductImageUrl!==undefined && selectedProductImageUrl!==null &&{selectedProductImageUrl})
|
|
239
245
|
};
|
|
240
246
|
const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON}`;
|
|
241
247
|
return axios.post(url, payload, {
|