@swan-admin/swan-ai-measurements 1.1.86 → 1.1.87

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.
@@ -50,7 +50,7 @@ declare class TryOn {
50
50
  deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
51
51
  handleTryOnWebSocket: ({ tryonId, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
52
52
  handleTryOnSubmit({ shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl, token, requestedTryonViews }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
53
- getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
53
+ getShareLink(tryonId: string, token: string): Promise<AxiosResponse<any>>;
54
54
  getTryOnResult: ({ tryonId }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
55
55
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
56
56
  }
package/dist/esm/tryOn.js CHANGED
@@ -89,13 +89,9 @@ class TryOn {
89
89
  };
90
90
  socket.onclose = () => {
91
91
  onClose === null || onClose === void 0 ? void 0 : onClose();
92
- // this.#disconnectSocket(tryonId);
93
92
  };
94
93
  socket.onerror = (event) => {
95
94
  onError === null || onError === void 0 ? void 0 : onError(event);
96
- // const timer = this.#timerMap.get(tryonId);
97
- // if (timer) clearTimeout(timer);
98
- // this.#timerMap.delete(tryonId);
99
95
  };
100
96
  };
101
97
  _TryOn_handleGetTryOnResult.set(this, (_a) => __awaiter(this, [_a], void 0, function* ({ onSuccess, onError, tryonId }) {
@@ -196,9 +192,9 @@ class TryOn {
196
192
  headers,
197
193
  });
198
194
  }
199
- getShareLink(tryonId) {
195
+ getShareLink(tryonId, token) {
200
196
  return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, urlType: __classPrivateFieldGet(this, _TryOn_urlType, "f") })}${API_ENDPOINTS.TRY_ON_SHARE}`, { tryonId }, {
201
- headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
197
+ headers: Object.assign({ "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") }, (token ? { Authorization: `Bearer ${token}` } : {})),
202
198
  });
203
199
  }
204
200
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }) {
package/dist/tryOn.d.ts CHANGED
@@ -50,7 +50,7 @@ declare class TryOn {
50
50
  deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
51
51
  handleTryOnWebSocket: ({ tryonId, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
52
52
  handleTryOnSubmit({ shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl, token, requestedTryonViews }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
53
- getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
53
+ getShareLink(tryonId: string, token: string): Promise<AxiosResponse<any>>;
54
54
  getTryOnResult: ({ tryonId }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
55
55
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
56
56
  }
package/dist/tryOn.js CHANGED
@@ -157,13 +157,9 @@ class TryOn {
157
157
  };
158
158
  socket.onclose = () => {
159
159
  onClose?.();
160
- // this.#disconnectSocket(tryonId);
161
160
  };
162
161
  socket.onerror = (event) => {
163
162
  onError?.(event);
164
- // const timer = this.#timerMap.get(tryonId);
165
- // if (timer) clearTimeout(timer);
166
- // this.#timerMap.delete(tryonId);
167
163
  };
168
164
  };
169
165
  handleTryOnSubmit({ shopDomain, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl, token, requestedTryonViews }) {
@@ -198,9 +194,9 @@ class TryOn {
198
194
  onError?.(error);
199
195
  }
200
196
  };
201
- getShareLink(tryonId) {
197
+ getShareLink(tryonId, token) {
202
198
  return axios_1.default.post(`${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, urlType: this.#urlType })}${constants_js_1.API_ENDPOINTS.TRY_ON_SHARE}`, { tryonId }, {
203
- headers: { "X-Api-Key": this.#accessKey },
199
+ headers: { "X-Api-Key": this.#accessKey, ...(token ? { Authorization: `Bearer ${token}` } : {}) },
204
200
  });
205
201
  }
206
202
  getTryOnResult = ({ tryonId }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.86",
3
+ "version": "1.1.87",
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
@@ -222,14 +222,10 @@ class TryOn {
222
222
 
223
223
  socket.onclose = () => {
224
224
  onClose?.();
225
- // this.#disconnectSocket(tryonId);
226
225
  };
227
226
 
228
227
  socket.onerror = (event) => {
229
228
  onError?.(event);
230
- // const timer = this.#timerMap.get(tryonId);
231
- // if (timer) clearTimeout(timer);
232
- // this.#timerMap.delete(tryonId);
233
229
  };
234
230
  };
235
231
 
@@ -268,12 +264,12 @@ class TryOn {
268
264
  }
269
265
  };
270
266
 
271
- getShareLink(tryonId: string) {
267
+ getShareLink(tryonId: string,token:string): Promise<AxiosResponse<any>> {
272
268
  return axios.post(
273
269
  `${getUrl({ urlName: APP_AUTH_BASE_URL, urlType: this.#urlType })}${API_ENDPOINTS.TRY_ON_SHARE}`,
274
270
  { tryonId },
275
271
  {
276
- headers: { "X-Api-Key": this.#accessKey },
272
+ headers: { "X-Api-Key": this.#accessKey, ...(token ? { Authorization: `Bearer ${token}` } : {}) },
277
273
  },
278
274
  );
279
275
  }