@swan-admin/swan-ai-measurements 1.1.56 → 1.1.58

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.
@@ -15,10 +15,7 @@ interface EligibiltyImageParams {
15
15
  productDescription: string;
16
16
  }
17
17
  interface HandleTryOnWebSocketParams {
18
- userEmail: string;
19
- shopDomain: string;
20
18
  tryonId: string;
21
- productName: string;
22
19
  onError?: (error: any) => void;
23
20
  onSuccess?: (data: any) => void;
24
21
  onClose?: () => void;
@@ -27,11 +24,11 @@ interface HandleTryOnWebSocketParams {
27
24
  interface Products {
28
25
  productUrl: string;
29
26
  productHandle: string;
30
- openTryonId: string;
27
+ openTryonId?: string;
31
28
  selectedProductImageUrl: string;
32
29
  }
33
30
  interface HandleForLatestImageParams {
34
- customerStoreUrl: string;
31
+ shopDomain: string;
35
32
  userEmail: string;
36
33
  products: Products[];
37
34
  selectedUserImages: string[];
@@ -41,9 +38,7 @@ interface HandleForLatestImageParams {
41
38
  selectedProductImageUrl?: string;
42
39
  }
43
40
  interface GetTryOnResultParams {
44
- shopDomain: string;
45
- userEmail: string;
46
- productName: string;
41
+ tryonId: string;
47
42
  }
48
43
  declare class TryOn {
49
44
  #private;
@@ -51,10 +46,10 @@ declare class TryOn {
51
46
  uploadFile({ files, userEmail, fileNoLimit }: UploadFileParams): Promise<string>;
52
47
  getUploadedFiles(userEmail: string): Promise<AxiosResponse<any>>;
53
48
  deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
54
- handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
55
- handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
49
+ handleTryOnWebSocket: ({ tryonId, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
50
+ handleTryOnSubmit({ userEmail, shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
56
51
  getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
57
- getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
52
+ getTryOnResult: ({ tryonId }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
58
53
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
59
54
  }
60
55
  export default TryOn;
package/dist/esm/tryOn.js CHANGED
@@ -36,26 +36,26 @@ class TryOn {
36
36
  clearTimeout(__classPrivateFieldGet(this, _TryOn_timerWaitingRef, "f"));
37
37
  }
38
38
  });
39
- _TryOn_handleTimeOut.set(this, ({ onSuccess, onError, shopDomain, userEmail, productName }) => {
39
+ _TryOn_handleTimeOut.set(this, ({ onSuccess, onError, tryonId }) => {
40
40
  __classPrivateFieldSet(this, _TryOn_timerWaitingRef, setTimeout(() => {
41
- __classPrivateFieldGet(this, _TryOn_handleGetTryOnResult, "f").call(this, { shopDomain, userEmail, productName, onSuccess, onError });
41
+ __classPrivateFieldGet(this, _TryOn_handleGetTryOnResult, "f").call(this, { onSuccess, onError, tryonId });
42
42
  __classPrivateFieldGet(this, _TryOn_disconnectSocket, "f").call(this);
43
43
  }, 138000), "f");
44
44
  });
45
- this.handleTryOnWebSocket = ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }) => {
46
- if (checkParameters(shopDomain, tryonId, productName, userEmail) === false) {
45
+ this.handleTryOnWebSocket = ({ tryonId, onError, onSuccess, onClose, onOpen }) => {
46
+ if (checkParameters(tryonId) === false) {
47
47
  throw new Error(REQUIRED_MESSAGE);
48
48
  }
49
- if (!isValidEmail(userEmail.trim())) {
50
- throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
51
- }
49
+ // if (!isValidEmail(userEmail.trim())) {
50
+ // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
51
+ // }
52
52
  __classPrivateFieldGet(this, _TryOn_disconnectSocket, "f").call(this);
53
53
  const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON}?tryonId=${tryonId}`;
54
54
  __classPrivateFieldSet(this, _TryOn_tryOnSocketRef, new WebSocket(url), "f");
55
55
  if (__classPrivateFieldGet(this, _TryOn_tryOnSocketRef, "f")) {
56
56
  __classPrivateFieldGet(this, _TryOn_tryOnSocketRef, "f").onopen = () => __awaiter(this, void 0, void 0, function* () {
57
57
  onOpen === null || onOpen === void 0 ? void 0 : onOpen();
58
- __classPrivateFieldGet(this, _TryOn_handleTimeOut, "f").call(this, { onSuccess, onError, shopDomain, userEmail, productName });
58
+ __classPrivateFieldGet(this, _TryOn_handleTimeOut, "f").call(this, { onSuccess, onError, tryonId });
59
59
  });
60
60
  __classPrivateFieldGet(this, _TryOn_tryOnSocketRef, "f").onmessage = (event) => {
61
61
  let data;
@@ -90,29 +90,29 @@ class TryOn {
90
90
  console.log("no connection made for websocket");
91
91
  }
92
92
  };
93
- _TryOn_handleGetTryOnResult.set(this, (_a) => __awaiter(this, [_a], void 0, function* ({ onSuccess, onError, shopDomain, userEmail, productName }) {
93
+ _TryOn_handleGetTryOnResult.set(this, (_a) => __awaiter(this, [_a], void 0, function* ({ onSuccess, onError, tryonId }) {
94
94
  try {
95
- const data = yield this.getTryOnResult({ shopDomain, userEmail, productName });
95
+ const data = yield this.getTryOnResult({ tryonId });
96
96
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data.data);
97
97
  }
98
98
  catch (error) {
99
99
  onError === null || onError === void 0 ? void 0 : onError(error);
100
100
  }
101
101
  }));
102
- this.getTryOnResult = ({ userEmail, shopDomain, productName }) => {
103
- if (checkParameters(shopDomain, userEmail, productName) === false) {
102
+ this.getTryOnResult = ({ tryonId }) => {
103
+ if (checkParameters(tryonId) === false) {
104
104
  throw new Error(REQUIRED_MESSAGE);
105
105
  }
106
- if (!isValidEmail(userEmail.trim())) {
107
- throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
108
- }
109
- const payload = {
110
- productName,
111
- userEmail,
112
- customerStoreUrl: shopDomain,
113
- };
114
- const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON_RESULT_IMAGE_DOWNLOAD}`;
115
- return axios.post(url, payload, {
106
+ // if (!isValidEmail(userEmail.trim())) {
107
+ // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
108
+ // }
109
+ // const payload = {
110
+ // products,
111
+ // userEmail,
112
+ // customerStoreUrl: shopDomain,
113
+ // };
114
+ const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON_RESULT_IMAGE_DOWNLOAD}/${tryonId}`;
115
+ return axios.post(url, null, {
116
116
  headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
117
117
  });
118
118
  };
@@ -182,8 +182,8 @@ class TryOn {
182
182
  data: payload,
183
183
  });
184
184
  }
185
- handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
186
- if (checkParameters(customerStoreUrl, userEmail, products, selectedUserImages) === false) {
185
+ handleTryOnSubmit({ userEmail, shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
186
+ if (checkParameters(shopDomain, userEmail, products, selectedUserImages) === false) {
187
187
  throw new Error(REQUIRED_MESSAGE);
188
188
  }
189
189
  if (!selectedUserImages.length) {
@@ -193,9 +193,7 @@ class TryOn {
193
193
  throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
194
194
  }
195
195
  const payload = Object.assign(Object.assign(Object.assign(Object.assign({ products,
196
- userEmail,
197
- customerStoreUrl,
198
- selectedUserImages }, (requestSource !== undefined && requestSource !== null && { requestSource })), (callbackUrl !== undefined && callbackUrl !== null && { callbackUrl })), (openTryonId !== undefined && openTryonId !== null && { openTryonId })), (selectedProductImageUrl !== undefined && selectedProductImageUrl !== null && { selectedProductImageUrl }));
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 }));
199
197
  const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON}`;
200
198
  return axios.post(url, payload, {
201
199
  headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
package/dist/tryOn.d.ts CHANGED
@@ -15,10 +15,7 @@ interface EligibiltyImageParams {
15
15
  productDescription: string;
16
16
  }
17
17
  interface HandleTryOnWebSocketParams {
18
- userEmail: string;
19
- shopDomain: string;
20
18
  tryonId: string;
21
- productName: string;
22
19
  onError?: (error: any) => void;
23
20
  onSuccess?: (data: any) => void;
24
21
  onClose?: () => void;
@@ -27,11 +24,11 @@ interface HandleTryOnWebSocketParams {
27
24
  interface Products {
28
25
  productUrl: string;
29
26
  productHandle: string;
30
- openTryonId: string;
27
+ openTryonId?: string;
31
28
  selectedProductImageUrl: string;
32
29
  }
33
30
  interface HandleForLatestImageParams {
34
- customerStoreUrl: string;
31
+ shopDomain: string;
35
32
  userEmail: string;
36
33
  products: Products[];
37
34
  selectedUserImages: string[];
@@ -41,9 +38,7 @@ interface HandleForLatestImageParams {
41
38
  selectedProductImageUrl?: string;
42
39
  }
43
40
  interface GetTryOnResultParams {
44
- shopDomain: string;
45
- userEmail: string;
46
- productName: string;
41
+ tryonId: string;
47
42
  }
48
43
  declare class TryOn {
49
44
  #private;
@@ -51,10 +46,10 @@ declare class TryOn {
51
46
  uploadFile({ files, userEmail, fileNoLimit }: UploadFileParams): Promise<string>;
52
47
  getUploadedFiles(userEmail: string): Promise<AxiosResponse<any>>;
53
48
  deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
54
- handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
55
- handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
49
+ handleTryOnWebSocket: ({ tryonId, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
50
+ handleTryOnSubmit({ userEmail, shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
56
51
  getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
57
- getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
52
+ getTryOnResult: ({ tryonId }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
58
53
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
59
54
  }
60
55
  export default TryOn;
package/dist/tryOn.js CHANGED
@@ -103,26 +103,26 @@ class TryOn {
103
103
  clearTimeout(this.#timerWaitingRef);
104
104
  }
105
105
  };
106
- #handleTimeOut = ({ onSuccess, onError, shopDomain, userEmail, productName }) => {
106
+ #handleTimeOut = ({ onSuccess, onError, tryonId }) => {
107
107
  this.#timerWaitingRef = setTimeout(() => {
108
- this.#handleGetTryOnResult({ shopDomain, userEmail, productName, onSuccess, onError });
108
+ this.#handleGetTryOnResult({ onSuccess, onError, tryonId });
109
109
  this.#disconnectSocket();
110
110
  }, 138000);
111
111
  };
112
- handleTryOnWebSocket = ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }) => {
113
- if ((0, utils_js_1.checkParameters)(shopDomain, tryonId, productName, userEmail) === false) {
112
+ handleTryOnWebSocket = ({ tryonId, onError, onSuccess, onClose, onOpen }) => {
113
+ if ((0, utils_js_1.checkParameters)(tryonId) === false) {
114
114
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
115
115
  }
116
- if (!(0, utils_js_1.isValidEmail)(userEmail.trim())) {
117
- throw new Error(constants_js_1.REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
118
- }
116
+ // if (!isValidEmail(userEmail.trim())) {
117
+ // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
118
+ // }
119
119
  this.#disconnectSocket();
120
120
  const url = `${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.TRY_ON}?tryonId=${tryonId}`;
121
121
  this.#tryOnSocketRef = new WebSocket(url);
122
122
  if (this.#tryOnSocketRef) {
123
123
  this.#tryOnSocketRef.onopen = async () => {
124
124
  onOpen?.();
125
- this.#handleTimeOut({ onSuccess, onError, shopDomain, userEmail, productName });
125
+ this.#handleTimeOut({ onSuccess, onError, tryonId });
126
126
  };
127
127
  this.#tryOnSocketRef.onmessage = (event) => {
128
128
  let data;
@@ -157,8 +157,8 @@ class TryOn {
157
157
  console.log("no connection made for websocket");
158
158
  }
159
159
  };
160
- handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
161
- if ((0, utils_js_1.checkParameters)(customerStoreUrl, userEmail, products, selectedUserImages) === false) {
160
+ handleTryOnSubmit({ userEmail, shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
161
+ if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, products, selectedUserImages) === false) {
162
162
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
163
163
  }
164
164
  if (!selectedUserImages.length) {
@@ -170,7 +170,7 @@ class TryOn {
170
170
  const payload = {
171
171
  products,
172
172
  userEmail,
173
- customerStoreUrl,
173
+ customerStoreUrl: shopDomain,
174
174
  selectedUserImages,
175
175
  ...(requestSource !== undefined && requestSource !== null && { requestSource }),
176
176
  ...(callbackUrl !== undefined && callbackUrl !== null && { callbackUrl }),
@@ -182,9 +182,9 @@ class TryOn {
182
182
  headers: { "X-Api-Key": this.#accessKey },
183
183
  });
184
184
  }
185
- #handleGetTryOnResult = async ({ onSuccess, onError, shopDomain, userEmail, productName }) => {
185
+ #handleGetTryOnResult = async ({ onSuccess, onError, tryonId }) => {
186
186
  try {
187
- const data = await this.getTryOnResult({ shopDomain, userEmail, productName });
187
+ const data = await this.getTryOnResult({ tryonId });
188
188
  onSuccess?.(data.data);
189
189
  }
190
190
  catch (error) {
@@ -196,20 +196,20 @@ class TryOn {
196
196
  headers: { "X-Api-Key": this.#accessKey },
197
197
  });
198
198
  }
199
- getTryOnResult = ({ userEmail, shopDomain, productName }) => {
200
- if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, productName) === false) {
199
+ getTryOnResult = ({ tryonId }) => {
200
+ if ((0, utils_js_1.checkParameters)(tryonId) === false) {
201
201
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
202
202
  }
203
- if (!(0, utils_js_1.isValidEmail)(userEmail.trim())) {
204
- throw new Error(constants_js_1.REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
205
- }
206
- const payload = {
207
- productName,
208
- userEmail,
209
- customerStoreUrl: shopDomain,
210
- };
211
- 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_RESULT_IMAGE_DOWNLOAD}`;
212
- return axios_1.default.post(url, payload, {
203
+ // if (!isValidEmail(userEmail.trim())) {
204
+ // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
205
+ // }
206
+ // const payload = {
207
+ // products,
208
+ // userEmail,
209
+ // customerStoreUrl: shopDomain,
210
+ // };
211
+ 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_RESULT_IMAGE_DOWNLOAD}/${tryonId}`;
212
+ return axios_1.default.post(url, null, {
213
213
  headers: { "X-Api-Key": this.#accessKey },
214
214
  });
215
215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.56",
3
+ "version": "1.1.58",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/tryOn.ts CHANGED
@@ -18,10 +18,11 @@ interface DeleteImageParams {
18
18
  }
19
19
  interface EligibiltyImageParams {storeUrl:string,productHandle:string,imageURL:string,productDescription:string}
20
20
  interface HandleTryOnWebSocketParams {
21
- userEmail: string;
22
- shopDomain: string;
23
- tryonId: string;
24
- productName: string;
21
+ tryonId:string
22
+ // userEmail: string;
23
+ // shopDomain: string;
24
+ // tryonId: string;
25
+ // products: Products[];
25
26
  onError?: (error: any) => void;
26
27
  onSuccess?: (data: any) => void;
27
28
  onClose?: () => void;
@@ -31,12 +32,12 @@ interface Products
31
32
  {
32
33
  productUrl:string,
33
34
  productHandle: string,
34
- openTryonId: string,
35
+ openTryonId?: string,
35
36
  selectedProductImageUrl:string
36
37
  }
37
38
 
38
39
  interface HandleForLatestImageParams {
39
- customerStoreUrl: string;
40
+ shopDomain: string;
40
41
  userEmail: string;
41
42
  products:Products[];
42
43
  selectedUserImages:string[];
@@ -49,15 +50,17 @@ interface HandleForLatestImageParams {
49
50
  interface HandleTimeOutParams {
50
51
  onSuccess?: (data: any) => void;
51
52
  onError?: (error: any) => void;
52
- shopDomain: string;
53
- userEmail: string;
54
- productName: string;
53
+ tryonId:string
54
+ // shopDomain: string;
55
+ // userEmail: string;
56
+ // products: Products[];
55
57
  }
56
58
 
57
59
  interface GetTryOnResultParams {
58
- shopDomain: string;
59
- userEmail: string;
60
- productName: string;
60
+ // shopDomain: string;
61
+ // userEmail: string;
62
+ // products: Products[];
63
+ tryonId :string
61
64
  }
62
65
 
63
66
  class TryOn {
@@ -166,27 +169,27 @@ class TryOn {
166
169
  }
167
170
  };
168
171
 
169
- #handleTimeOut = ({ onSuccess, onError, shopDomain, userEmail, productName }: HandleTimeOutParams): void => {
172
+ #handleTimeOut = ({ onSuccess, onError,tryonId }: HandleTimeOutParams): void => {
170
173
  this.#timerWaitingRef = setTimeout(() => {
171
- this.#handleGetTryOnResult({ shopDomain, userEmail, productName, onSuccess, onError });
174
+ this.#handleGetTryOnResult({ onSuccess, onError,tryonId });
172
175
  this.#disconnectSocket();
173
176
  }, 138000);
174
177
  };
175
178
 
176
- handleTryOnWebSocket = ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams): void => {
177
- if (checkParameters(shopDomain, tryonId, productName, userEmail) === false) {
179
+ handleTryOnWebSocket = ({ tryonId, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams): void => {
180
+ if (checkParameters(tryonId) === false) {
178
181
  throw new Error(REQUIRED_MESSAGE);
179
182
  }
180
- if (!isValidEmail(userEmail.trim())) {
181
- throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
182
- }
183
+ // if (!isValidEmail(userEmail.trim())) {
184
+ // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
185
+ // }
183
186
  this.#disconnectSocket();
184
187
  const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON}?tryonId=${tryonId}`;
185
188
  this.#tryOnSocketRef = new WebSocket(url);
186
189
  if(this.#tryOnSocketRef){
187
190
  this.#tryOnSocketRef.onopen = async () => {
188
191
  onOpen?.();
189
- this.#handleTimeOut({ onSuccess, onError, shopDomain, userEmail, productName });
192
+ this.#handleTimeOut({ onSuccess, onError, tryonId });
190
193
  };
191
194
  this.#tryOnSocketRef.onmessage = (event) => {
192
195
  let data;
@@ -223,7 +226,7 @@ class TryOn {
223
226
 
224
227
  handleTryOnSubmit({
225
228
  userEmail,
226
- customerStoreUrl,
229
+ shopDomain,
227
230
  products,
228
231
  selectedUserImages,
229
232
  requestSource,
@@ -231,7 +234,7 @@ class TryOn {
231
234
  openTryonId,
232
235
  selectedProductImageUrl
233
236
  }: HandleForLatestImageParams): Promise<AxiosResponse<any>> {
234
- if (checkParameters(customerStoreUrl, userEmail, products,selectedUserImages) === false) {
237
+ if (checkParameters(shopDomain, userEmail, products,selectedUserImages) === false) {
235
238
  throw new Error(REQUIRED_MESSAGE);
236
239
  }
237
240
  if (!selectedUserImages.length) {
@@ -243,7 +246,7 @@ class TryOn {
243
246
  const payload = {
244
247
  products,
245
248
  userEmail,
246
- customerStoreUrl,
249
+ customerStoreUrl:shopDomain,
247
250
  selectedUserImages,
248
251
  ...(requestSource!==undefined && requestSource!==null &&{requestSource}),
249
252
  ...(callbackUrl!==undefined && callbackUrl!==null &&{callbackUrl}),
@@ -256,9 +259,9 @@ class TryOn {
256
259
  });
257
260
  }
258
261
 
259
- #handleGetTryOnResult = async ({ onSuccess, onError, shopDomain, userEmail, productName }: HandleTimeOutParams): Promise<void> => {
262
+ #handleGetTryOnResult = async ({ onSuccess, onError, tryonId }: HandleTimeOutParams): Promise<void> => {
260
263
  try {
261
- const data = await this.getTryOnResult({ shopDomain, userEmail, productName });
264
+ const data = await this.getTryOnResult({ tryonId });
262
265
  onSuccess?.(data.data);
263
266
  } catch (error) {
264
267
  onError?.(error);
@@ -275,23 +278,23 @@ class TryOn {
275
278
  );
276
279
  }
277
280
 
278
- getTryOnResult = ({ userEmail, shopDomain, productName }: GetTryOnResultParams): Promise<AxiosResponse<any>> => {
279
- if (checkParameters(shopDomain, userEmail, productName) === false) {
281
+ getTryOnResult = ({tryonId }: GetTryOnResultParams): Promise<AxiosResponse<any>> => {
282
+ if (checkParameters(tryonId) === false) {
280
283
  throw new Error(REQUIRED_MESSAGE);
281
284
  }
282
285
 
283
- if (!isValidEmail(userEmail.trim())) {
284
- throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
285
- }
286
+ // if (!isValidEmail(userEmail.trim())) {
287
+ // throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
288
+ // }
286
289
 
287
- const payload = {
288
- productName,
289
- userEmail,
290
- customerStoreUrl: shopDomain,
291
- };
290
+ // const payload = {
291
+ // products,
292
+ // userEmail,
293
+ // customerStoreUrl: shopDomain,
294
+ // };
292
295
 
293
- const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON_RESULT_IMAGE_DOWNLOAD}`;
294
- return axios.post(url, payload, {
296
+ const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON_RESULT_IMAGE_DOWNLOAD}/${tryonId}`;
297
+ return axios.post(url, null,{
295
298
  headers: { "X-Api-Key": this.#accessKey },
296
299
  });
297
300
  };