@swan-admin/swan-ai-measurements 1.1.4 → 1.1.6

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/custom.js CHANGED
@@ -15,16 +15,18 @@ class Custom {
15
15
  }
16
16
  createCustomer(payload) {
17
17
  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
- payload,
18
+ ...payload,
19
19
  headers: { "X-Api-Key": this.#accessKey },
20
20
  });
21
21
  }
22
- ;
23
22
  getCustomCustomerConfig = (store_url) => {
24
23
  if ((0, utils_js_1.checkParameters)(store_url) === false) {
25
24
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
26
25
  }
27
- 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.CUSTOM_CUSTOMER}`, {
26
+ return axios_1.default.get(`${(0, utils_js_1.getUrl)({
27
+ urlName: constants_js_1.APP_AUTH_BASE_URL,
28
+ stagingUrl: this.#stagingUrl,
29
+ })}${constants_js_1.API_ENDPOINTS.CUSTOM_CUSTOMER}`, {
28
30
  params: { store_url },
29
31
  headers: { "X-Api-Key": this.#accessKey },
30
32
  });
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _Custom_accessKey, _Custom_stagingUrl;
13
13
  import axios from "axios";
14
- import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE } from "./constants.js";
14
+ import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE, } from "./constants.js";
15
15
  import { checkParameters, getUrl } from "./utils.js";
16
16
  class Custom {
17
17
  constructor(accessKey, stagingUrl = false) {
@@ -21,7 +21,10 @@ class Custom {
21
21
  if (checkParameters(store_url) === false) {
22
22
  throw new Error(REQUIRED_MESSAGE);
23
23
  }
24
- return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _Custom_stagingUrl, "f") })}${API_ENDPOINTS.CUSTOM_CUSTOMER}`, {
24
+ return axios.get(`${getUrl({
25
+ urlName: APP_AUTH_BASE_URL,
26
+ stagingUrl: __classPrivateFieldGet(this, _Custom_stagingUrl, "f"),
27
+ })}${API_ENDPOINTS.CUSTOM_CUSTOMER}`, {
25
28
  params: { store_url },
26
29
  headers: { "X-Api-Key": __classPrivateFieldGet(this, _Custom_accessKey, "f") },
27
30
  });
@@ -38,12 +41,8 @@ class Custom {
38
41
  __classPrivateFieldSet(this, _Custom_stagingUrl, stagingUrl, "f");
39
42
  }
40
43
  createCustomer(payload) {
41
- return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _Custom_stagingUrl, "f") })}${API_ENDPOINTS.CREATE_CUSTOMER}`, {
42
- payload,
43
- headers: { "X-Api-Key": __classPrivateFieldGet(this, _Custom_accessKey, "f") },
44
- });
44
+ 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
45
  }
46
- ;
47
46
  }
48
47
  _Custom_accessKey = new WeakMap(), _Custom_stagingUrl = new WeakMap();
49
48
  export default Custom;
@@ -22,7 +22,7 @@ var _FileUpload_uppyIns, _FileUpload_accessKey, _FileUpload_stagingUrl;
22
22
  import axios from "axios";
23
23
  import { REQUIRED_MESSAGE, REQUIRED_MESSAGE_FOR_META_DATA, FILE_UPLOAD_ENDPOINT, APP_AUTH_BASE_URL } from "./constants.js";
24
24
  import { checkMetaDataValue, checkParameters, fetchData, getFileChunks, getUrl } from "./utils.js";
25
- import Uppy from "@uppy/core";
25
+ import Uppy from "@uppy/core";
26
26
  import AwsS3Multipart from "@uppy/aws-s3-multipart";
27
27
  class FileUpload {
28
28
  constructor(accessKey, stagingUrl = false) {
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const axios_1 = __importDefault(require("axios"));
7
7
  const constants_js_1 = require("./constants.js");
8
8
  const utils_js_1 = require("./utils.js");
9
- import Uppy from "@uppy/core";
10
- import AwsS3Multipart from "@uppy/aws-s3-multipart";
9
+ const Uppy = require("fix-esm").require("@uppy/core");
10
+ const AwsS3Multipart = require("fix-esm").require("@uppy/aws-s3-multipart");
11
11
  class FileUpload {
12
12
  #uppyIns;
13
13
  #accessKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
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
@@ -1,5 +1,9 @@
1
1
  import axios, { AxiosResponse } from "axios";
2
- import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE } from "./constants.js";
2
+ import {
3
+ API_ENDPOINTS,
4
+ APP_AUTH_BASE_URL,
5
+ REQUIRED_MESSAGE,
6
+ } from "./constants.js";
3
7
  import { checkParameters, getUrl } from "./utils.js";
4
8
 
5
9
  class Custom {
@@ -10,30 +14,54 @@ class Custom {
10
14
  this.#stagingUrl = stagingUrl;
11
15
  }
12
16
 
13
- createCustomer(payload: {name: string, storeUrl: string, location: string, email: string, emailsTier_1: string, emailsTier_2: string}): Promise<AxiosResponse<any>>{
14
- return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.CREATE_CUSTOMER}`, {
15
- payload,
16
- headers: { "X-Api-Key": this.#accessKey },
17
- });
18
- };
17
+ createCustomer(payload: {
18
+ name: string;
19
+ storeUrl: string;
20
+ location: string;
21
+ email: string;
22
+ emailsTier_1: string;
23
+ emailsTier_2: string;
24
+ }): Promise<AxiosResponse<any>> {
25
+ return axios.post(
26
+ `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${
27
+ API_ENDPOINTS.CREATE_CUSTOMER
28
+ }`,
29
+ {
30
+ ...payload,
31
+ headers: { "X-Api-Key": this.#accessKey },
32
+ }
33
+ );
34
+ }
19
35
 
20
- getCustomCustomerConfig: (store_url: string) => Promise<AxiosResponse<any>> = (store_url: string) => {
21
- if (checkParameters(store_url) === false) {
22
- throw new Error(REQUIRED_MESSAGE);
23
- }
24
- return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.CUSTOM_CUSTOMER}`, {
25
- params: { store_url },
26
- headers: { "X-Api-Key": this.#accessKey },
27
- });
28
- };
36
+ getCustomCustomerConfig: (store_url: string) => Promise<AxiosResponse<any>> =
37
+ (store_url: string) => {
38
+ if (checkParameters(store_url) === false) {
39
+ throw new Error(REQUIRED_MESSAGE);
40
+ }
41
+ return axios.get(
42
+ `${getUrl({
43
+ urlName: APP_AUTH_BASE_URL,
44
+ stagingUrl: this.#stagingUrl,
45
+ })}${API_ENDPOINTS.CUSTOM_CUSTOMER}`,
46
+ {
47
+ params: { store_url },
48
+ headers: { "X-Api-Key": this.#accessKey },
49
+ }
50
+ );
51
+ };
29
52
 
30
53
  getModelUrl: (id: string) => Promise<AxiosResponse<any>> = (id: string) => {
31
54
  if (checkParameters(id) === false) {
32
55
  throw new Error(REQUIRED_MESSAGE);
33
56
  }
34
- return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.MODEL}/${id}`, {
35
- headers: { "X-Api-Key": this.#accessKey },
36
- });
57
+ return axios.get(
58
+ `${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${
59
+ API_ENDPOINTS.MODEL
60
+ }/${id}`,
61
+ {
62
+ headers: { "X-Api-Key": this.#accessKey },
63
+ }
64
+ );
37
65
  };
38
66
  }
39
67