@swan-admin/swan-ai-measurements 1.1.28 → 1.1.29

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/constants.js CHANGED
@@ -36,6 +36,7 @@ exports.API_ENDPOINTS = {
36
36
  TRY_ON: "/tryon",
37
37
  AUTH: "/auth",
38
38
  SCANNING: "/scanning",
39
+ RECOMMENDATION: "/recommendation",
39
40
  };
40
41
  exports.requiredMetaData = ["gender", "focal_length", "height", "customer_store_url", "callback_url", "clothes_fit"];
41
42
  exports.REQUIRED_MESSAGE = "Please verify required parameters";
@@ -33,6 +33,7 @@ export const API_ENDPOINTS = {
33
33
  TRY_ON: "/tryon",
34
34
  AUTH: "/auth",
35
35
  SCANNING: "/scanning",
36
+ RECOMMENDATION: "/recommendation",
36
37
  };
37
38
  export const requiredMetaData = ["gender", "focal_length", "height", "customer_store_url", "callback_url", "clothes_fit"];
38
39
  export const REQUIRED_MESSAGE = "Please verify required parameters";
@@ -8,6 +8,11 @@ interface TryOnSocketOptions {
8
8
  onClose?: () => void;
9
9
  onOpen?: () => void;
10
10
  }
11
+ interface MeasurementRecommendation {
12
+ shopDomain: string;
13
+ scanId: string;
14
+ productName: string;
15
+ }
11
16
  interface MeasurementSocketOptions {
12
17
  scanId: string;
13
18
  onError?: (error: any) => void;
@@ -19,6 +24,7 @@ declare class Measurement {
19
24
  #private;
20
25
  constructor(accessKey: string, stagingUrl?: boolean);
21
26
  getMeasurementResult(scanId: string): Promise<AxiosResponse<any>>;
27
+ getMeasurementRecommendation({ scanId, shopDomain, productName }: MeasurementRecommendation): Promise<AxiosResponse<any>>;
22
28
  getTryOnMeasurements({ scanId, shopDomain, productName }: TryOnSocketOptions): Promise<AxiosResponse<any>>;
23
29
  handleTryOnSocket(options: TryOnSocketOptions): void;
24
30
  handleMeasurementSocket(options: MeasurementSocketOptions): void;
@@ -44,6 +44,12 @@ class Measurement {
44
44
  headers: { "X-Api-Key": __classPrivateFieldGet(this, _Measurement_accessKey, "f") },
45
45
  });
46
46
  }
47
+ getMeasurementRecommendation({ scanId, shopDomain, productName }) {
48
+ if (!checkParameters(scanId, shopDomain, productName)) {
49
+ throw new Error(REQUIRED_MESSAGE);
50
+ }
51
+ return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _Measurement_stagingUrl, "f") })}${API_ENDPOINTS.RECOMMENDATION}/scan/${scanId}/shop/${shopDomain}/product/${productName}`, { headers: { "X-Api-Key": __classPrivateFieldGet(this, _Measurement_accessKey, "f") } });
52
+ }
47
53
  getTryOnMeasurements({ scanId, shopDomain, productName }) {
48
54
  if (!checkParameters(scanId, shopDomain, productName)) {
49
55
  throw new Error(REQUIRED_MESSAGE);
@@ -8,6 +8,11 @@ interface TryOnSocketOptions {
8
8
  onClose?: () => void;
9
9
  onOpen?: () => void;
10
10
  }
11
+ interface MeasurementRecommendation {
12
+ shopDomain: string;
13
+ scanId: string;
14
+ productName: string;
15
+ }
11
16
  interface MeasurementSocketOptions {
12
17
  scanId: string;
13
18
  onError?: (error: any) => void;
@@ -19,6 +24,7 @@ declare class Measurement {
19
24
  #private;
20
25
  constructor(accessKey: string, stagingUrl?: boolean);
21
26
  getMeasurementResult(scanId: string): Promise<AxiosResponse<any>>;
27
+ getMeasurementRecommendation({ scanId, shopDomain, productName }: MeasurementRecommendation): Promise<AxiosResponse<any>>;
22
28
  getTryOnMeasurements({ scanId, shopDomain, productName }: TryOnSocketOptions): Promise<AxiosResponse<any>>;
23
29
  handleTryOnSocket(options: TryOnSocketOptions): void;
24
30
  handleMeasurementSocket(options: MeasurementSocketOptions): void;
@@ -27,6 +27,12 @@ class Measurement {
27
27
  headers: { "X-Api-Key": this.#accessKey },
28
28
  });
29
29
  }
30
+ getMeasurementRecommendation({ scanId, shopDomain, productName }) {
31
+ if (!(0, utils_js_1.checkParameters)(scanId, shopDomain, productName)) {
32
+ throw new Error(constants_js_1.REQUIRED_MESSAGE);
33
+ }
34
+ return axios_1.default.get(`${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.RECOMMENDATION}/scan/${scanId}/shop/${shopDomain}/product/${productName}`, { headers: { "X-Api-Key": this.#accessKey } });
35
+ }
30
36
  getTryOnMeasurements({ scanId, shopDomain, productName }) {
31
37
  if (!(0, utils_js_1.checkParameters)(scanId, shopDomain, productName)) {
32
38
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/constants.ts CHANGED
@@ -43,6 +43,7 @@ export const API_ENDPOINTS: {
43
43
  TRY_ON: "/tryon",
44
44
  AUTH: "/auth",
45
45
  SCANNING: "/scanning",
46
+ RECOMMENDATION: "/recommendation",
46
47
  };
47
48
  export interface ObjMetaData {
48
49
  gender: string;
@@ -12,6 +12,11 @@ interface TryOnSocketOptions {
12
12
  onOpen?: () => void;
13
13
  }
14
14
 
15
+ interface MeasurementRecommendation {
16
+ shopDomain: string;
17
+ scanId: string;
18
+ productName: string;
19
+ }
15
20
  interface MeasurementSocketOptions {
16
21
  scanId: string;
17
22
  onError?: (error: any) => void;
@@ -62,6 +67,18 @@ class Measurement {
62
67
  });
63
68
  }
64
69
 
70
+ getMeasurementRecommendation({ scanId, shopDomain, productName }: MeasurementRecommendation): Promise<AxiosResponse<any>> {
71
+ if (!checkParameters(scanId, shopDomain, productName)) {
72
+ throw new Error(REQUIRED_MESSAGE);
73
+ }
74
+ return axios.get(
75
+ `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${
76
+ API_ENDPOINTS.RECOMMENDATION
77
+ }/scan/${scanId}/shop/${shopDomain}/product/${productName}`,
78
+ { headers: { "X-Api-Key": this.#accessKey } }
79
+ );
80
+ }
81
+
65
82
  getTryOnMeasurements({ scanId, shopDomain, productName }: TryOnSocketOptions): Promise<AxiosResponse<any>> {
66
83
  if (!checkParameters(scanId, shopDomain, productName)) {
67
84
  throw new Error(REQUIRED_MESSAGE);