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

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.
@@ -24,10 +24,16 @@ interface HandleTryOnWebSocketParams {
24
24
  onClose?: () => void;
25
25
  onOpen?: () => void;
26
26
  }
27
+ interface Products {
28
+ productUrl: string;
29
+ productHandle: string;
30
+ openTryonId: string;
31
+ selectedProductImageUrl: string;
32
+ }
27
33
  interface HandleForLatestImageParams {
28
- shopDomain: string;
34
+ customerStoreUrl: string;
29
35
  userEmail: string;
30
- productName: string;
36
+ products: Products[];
31
37
  selectedUserImages: string[];
32
38
  requestSource?: string;
33
39
  callbackUrl?: string;
@@ -46,7 +52,7 @@ declare class TryOn {
46
52
  getUploadedFiles(userEmail: string): Promise<AxiosResponse<any>>;
47
53
  deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
48
54
  handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
49
- handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
55
+ handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
50
56
  getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
51
57
  getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
52
58
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
package/dist/esm/tryOn.js CHANGED
@@ -182,8 +182,8 @@ class TryOn {
182
182
  data: payload,
183
183
  });
184
184
  }
185
- handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
186
- if (checkParameters(shopDomain, userEmail, productName, selectedUserImages) === false) {
185
+ handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
186
+ if (checkParameters(customerStoreUrl, userEmail, products, selectedUserImages) === false) {
187
187
  throw new Error(REQUIRED_MESSAGE);
188
188
  }
189
189
  if (!selectedUserImages.length) {
@@ -192,8 +192,10 @@ 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(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 }));
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 }));
197
199
  const url = `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON}`;
198
200
  return axios.post(url, payload, {
199
201
  headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
package/dist/tryOn.d.ts CHANGED
@@ -24,10 +24,16 @@ interface HandleTryOnWebSocketParams {
24
24
  onClose?: () => void;
25
25
  onOpen?: () => void;
26
26
  }
27
+ interface Products {
28
+ productUrl: string;
29
+ productHandle: string;
30
+ openTryonId: string;
31
+ selectedProductImageUrl: string;
32
+ }
27
33
  interface HandleForLatestImageParams {
28
- shopDomain: string;
34
+ customerStoreUrl: string;
29
35
  userEmail: string;
30
- productName: string;
36
+ products: Products[];
31
37
  selectedUserImages: string[];
32
38
  requestSource?: string;
33
39
  callbackUrl?: string;
@@ -46,7 +52,7 @@ declare class TryOn {
46
52
  getUploadedFiles(userEmail: string): Promise<AxiosResponse<any>>;
47
53
  deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
48
54
  handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
49
- handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
55
+ handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
50
56
  getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
51
57
  getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
52
58
  getProductImageEligibility({ storeUrl, productHandle, imageURL, productDescription }: EligibiltyImageParams): Promise<AxiosResponse<any, any>>;
package/dist/tryOn.js CHANGED
@@ -157,8 +157,8 @@ class TryOn {
157
157
  console.log("no connection made for websocket");
158
158
  }
159
159
  };
160
- handleTryOnSubmit({ userEmail, shopDomain, productName, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
161
- if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, productName, selectedUserImages) === false) {
160
+ handleTryOnSubmit({ userEmail, customerStoreUrl, products, selectedUserImages, requestSource, callbackUrl, openTryonId, selectedProductImageUrl }) {
161
+ if ((0, utils_js_1.checkParameters)(customerStoreUrl, userEmail, products, selectedUserImages) === false) {
162
162
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
163
163
  }
164
164
  if (!selectedUserImages.length) {
@@ -168,9 +168,9 @@ class TryOn {
168
168
  throw new Error(constants_js_1.REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
169
169
  }
170
170
  const payload = {
171
- productName,
171
+ products,
172
172
  userEmail,
173
- customerStoreUrl: shopDomain,
173
+ customerStoreUrl,
174
174
  selectedUserImages,
175
175
  ...(requestSource !== undefined && requestSource !== null && { requestSource }),
176
176
  ...(callbackUrl !== undefined && callbackUrl !== null && { callbackUrl }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.55",
3
+ "version": "1.1.56",
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
@@ -27,11 +27,18 @@ interface HandleTryOnWebSocketParams {
27
27
  onClose?: () => void;
28
28
  onOpen?: () => void;
29
29
  }
30
+ interface Products
31
+ {
32
+ productUrl:string,
33
+ productHandle: string,
34
+ openTryonId: string,
35
+ selectedProductImageUrl:string
36
+ }
30
37
 
31
38
  interface HandleForLatestImageParams {
32
- shopDomain: string;
39
+ customerStoreUrl: string;
33
40
  userEmail: string;
34
- productName: string;
41
+ products:Products[];
35
42
  selectedUserImages:string[];
36
43
  requestSource?: string;
37
44
  callbackUrl?: string;
@@ -216,15 +223,15 @@ class TryOn {
216
223
 
217
224
  handleTryOnSubmit({
218
225
  userEmail,
219
- shopDomain,
220
- productName,
226
+ customerStoreUrl,
227
+ products,
221
228
  selectedUserImages,
222
229
  requestSource,
223
230
  callbackUrl,
224
231
  openTryonId,
225
232
  selectedProductImageUrl
226
233
  }: HandleForLatestImageParams): Promise<AxiosResponse<any>> {
227
- if (checkParameters(shopDomain, userEmail, productName,selectedUserImages) === false) {
234
+ if (checkParameters(customerStoreUrl, userEmail, products,selectedUserImages) === false) {
228
235
  throw new Error(REQUIRED_MESSAGE);
229
236
  }
230
237
  if (!selectedUserImages.length) {
@@ -234,9 +241,9 @@ class TryOn {
234
241
  throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
235
242
  }
236
243
  const payload = {
237
- productName,
244
+ products,
238
245
  userEmail,
239
- customerStoreUrl: shopDomain,
246
+ customerStoreUrl,
240
247
  selectedUserImages,
241
248
  ...(requestSource!==undefined && requestSource!==null &&{requestSource}),
242
249
  ...(callbackUrl!==undefined && callbackUrl!==null &&{callbackUrl}),