@swan-admin/swan-ai-measurements 1.1.8 → 1.1.10

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
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.REQUIRED_MESSAGE_FOR_META_DATA = exports.REQUIRED_MESSAGE = exports.requiredMetaData = exports.API_ENDPOINTS = exports.APP_POSE_DETECTION_WEBSOCKET_URL = exports.APP_BASE_WEBSOCKET_URL = exports.APP_AUTH_BASE_URL = exports.FILE_UPLOAD_ENDPOINT = exports.PROD_URL = exports.STAGING_URL = void 0;
4
4
  exports.STAGING_URL = {
5
- APP_AUTH_BASE_URL: "https://staging.api.swanvision.ai/",
5
+ APP_AUTH_BASE_URL: "https://staging.api.swanvision.ai",
6
6
  APP_BASE_WEBSOCKET_URL: "wss://staging.wsnotify.api.getswan.co",
7
7
  APP_POSE_DETECTION_WEBSOCKET_URL: "https://posedetect-service-staging.ft2a64raup4pg.us-east-1.cs.amazonlightsail.com",
8
8
  };
package/dist/custom.d.ts CHANGED
@@ -4,8 +4,8 @@ interface CreateCustomer {
4
4
  storeUrl: string;
5
5
  location: string;
6
6
  email: string;
7
- emailsTier_1: string;
8
- emailsTier_2: string;
7
+ emailsTier_1?: string;
8
+ emailsTier_2?: string;
9
9
  }
10
10
  declare class Custom {
11
11
  #private;
package/dist/custom.js CHANGED
@@ -14,6 +14,9 @@ class Custom {
14
14
  this.#stagingUrl = stagingUrl;
15
15
  }
16
16
  createCustomer(payload) {
17
+ if ((0, utils_js_1.checkParameters)(payload.name, payload.storeUrl, payload.email, payload.location) === false) {
18
+ throw new Error(constants_js_1.REQUIRED_MESSAGE);
19
+ }
17
20
  return axios_1.default.post(`${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.CREATE_CUSTOMER}`, {
18
21
  ...payload,
19
22
  headers: { "X-Api-Key": this.#accessKey },
@@ -1,5 +1,5 @@
1
1
  export const STAGING_URL = {
2
- APP_AUTH_BASE_URL: "https://staging.api.swanvision.ai/",
2
+ APP_AUTH_BASE_URL: "https://staging.api.swanvision.ai",
3
3
  APP_BASE_WEBSOCKET_URL: "wss://staging.wsnotify.api.getswan.co",
4
4
  APP_POSE_DETECTION_WEBSOCKET_URL: "https://posedetect-service-staging.ft2a64raup4pg.us-east-1.cs.amazonlightsail.com",
5
5
  };
@@ -4,8 +4,8 @@ interface CreateCustomer {
4
4
  storeUrl: string;
5
5
  location: string;
6
6
  email: string;
7
- emailsTier_1: string;
8
- emailsTier_2: string;
7
+ emailsTier_1?: string;
8
+ emailsTier_2?: string;
9
9
  }
10
10
  declare class Custom {
11
11
  #private;
@@ -41,6 +41,9 @@ class Custom {
41
41
  __classPrivateFieldSet(this, _Custom_stagingUrl, stagingUrl, "f");
42
42
  }
43
43
  createCustomer(payload) {
44
+ if (checkParameters(payload.name, payload.storeUrl, payload.email, payload.location) === false) {
45
+ throw new Error(REQUIRED_MESSAGE);
46
+ }
44
47
  return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _Custom_stagingUrl, "f") })}${API_ENDPOINTS.CREATE_CUSTOMER}`, Object.assign(Object.assign({}, payload), { headers: { "X-Api-Key": __classPrivateFieldGet(this, _Custom_accessKey, "f") } }));
45
48
  }
46
49
  }
package/dist/esm/utils.js CHANGED
@@ -14,6 +14,7 @@ export function fetchData(options) {
14
14
  const { path, body, queryParams, baseUrl = APP_AUTH_BASE_URL, apiKey = "", throwError = false, headers = { "X-Api-Key": apiKey, "Content-Type": "application/json" }, stagingUrl = false, } = options;
15
15
  const apiUrl = `${getUrl({ urlName: baseUrl, stagingUrl: stagingUrl })}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
16
16
  try {
17
+ console.log(body);
17
18
  const res = yield axios.post(apiUrl, body, { headers });
18
19
  if (res.status >= 200 && res.status < 300) {
19
20
  return res.data;
package/dist/utils.js CHANGED
@@ -10,6 +10,7 @@ async function fetchData(options) {
10
10
  const { path, body, queryParams, baseUrl = constants_js_1.APP_AUTH_BASE_URL, apiKey = "", throwError = false, headers = { "X-Api-Key": apiKey, "Content-Type": "application/json" }, stagingUrl = false, } = options;
11
11
  const apiUrl = `${(0, exports.getUrl)({ urlName: baseUrl, stagingUrl: stagingUrl })}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
12
12
  try {
13
+ console.log(body);
13
14
  const res = await axios_1.default.post(apiUrl, body, { headers });
14
15
  if (res.status >= 200 && res.status < 300) {
15
16
  return res.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/custom.ts CHANGED
@@ -19,7 +19,7 @@ class Custom {
19
19
  }
20
20
 
21
21
  createCustomer(payload: CreateCustomer): Promise<AxiosResponse<any>> {
22
- if (checkParameters(payload.name, payload.storeUrl, payload.email, payload.location)) {
22
+ if (checkParameters(payload.name, payload.storeUrl, payload.email, payload.location) === false) {
23
23
  throw new Error(REQUIRED_MESSAGE);
24
24
  }
25
25
  return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.CREATE_CUSTOMER}`, {
package/src/utils.ts CHANGED
@@ -26,6 +26,7 @@ export async function fetchData(options: FetchDataOptions): Promise<any> {
26
26
 
27
27
  const apiUrl = `${getUrl({ urlName: baseUrl, stagingUrl: stagingUrl })}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
28
28
  try {
29
+ console.log(body);
29
30
  const res: AxiosResponse<any> = await axios.post(apiUrl, body, { headers });
30
31
  if (res.status >= 200 && res.status < 300) {
31
32
  return res.data;