@bytexbyte/ike-app-api 1.0.53 → 1.0.55

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.
@@ -8,15 +8,15 @@ declare class IKEAppProductApi extends BxBApi {
8
8
  });
9
9
  getProductByMacAddress(form: {
10
10
  macAddress: string;
11
- longitude: number | null;
12
- latitude: number | null;
11
+ longitude?: number;
12
+ latitude?: number;
13
13
  }): Promise<Product | {
14
14
  error: 'Token is not exist.' | 'Digital customization is not exist.';
15
15
  }>;
16
16
  getIsSmokeFreeByMacAddress(form: {
17
17
  macAddress: string;
18
- longitude: number | null;
19
- latitude: number | null;
18
+ longitude?: number;
19
+ latitude?: number;
20
20
  }): Promise<{
21
21
  isSmokeFree: boolean;
22
22
  } | {
@@ -69,15 +69,21 @@ var IKEAppProductApi = /** @class */ (function (_super) {
69
69
  }
70
70
  IKEAppProductApi.prototype.getProductByMacAddress = function (form) {
71
71
  return __awaiter(this, void 0, void 0, function () {
72
- var response;
72
+ var params, response;
73
73
  return __generator(this, function (_a) {
74
74
  switch (_a.label) {
75
- case 0: return [4 /*yield*/, this.bxbFetch({
76
- method: 'GET',
77
- headers: {
78
- 'Content-Type': 'application/json',
79
- },
80
- }, "".concat(form.macAddress, "?longitude=").concat(form.longitude, "&latitude=").concat(form.latitude))];
75
+ case 0:
76
+ params = new URLSearchParams();
77
+ if (form.longitude)
78
+ params.append('longitude', form.longitude.toString());
79
+ if (form.latitude)
80
+ params.append('latitude', form.latitude.toString());
81
+ return [4 /*yield*/, this.bxbFetch({
82
+ method: 'GET',
83
+ headers: {
84
+ 'Content-Type': 'application/json',
85
+ },
86
+ }, "".concat(form.macAddress, "?").concat(params.toString()))];
81
87
  case 1:
82
88
  response = _a.sent();
83
89
  return [2 /*return*/, response.json()];
@@ -87,15 +93,21 @@ var IKEAppProductApi = /** @class */ (function (_super) {
87
93
  };
88
94
  IKEAppProductApi.prototype.getIsSmokeFreeByMacAddress = function (form) {
89
95
  return __awaiter(this, void 0, void 0, function () {
90
- var response;
96
+ var params, response;
91
97
  return __generator(this, function (_a) {
92
98
  switch (_a.label) {
93
- case 0: return [4 /*yield*/, this.bxbFetch({
94
- method: 'GET',
95
- headers: {
96
- 'Content-Type': 'application/json',
97
- },
98
- }, "".concat(form.macAddress, "/isSmokeFree?longitude=").concat(form.longitude, "&latitude=").concat(form.latitude))];
99
+ case 0:
100
+ params = new URLSearchParams();
101
+ if (form.longitude)
102
+ params.append('longitude', form.longitude.toString());
103
+ if (form.latitude)
104
+ params.append('latitude', form.latitude.toString());
105
+ return [4 /*yield*/, this.bxbFetch({
106
+ method: 'GET',
107
+ headers: {
108
+ 'Content-Type': 'application/json',
109
+ },
110
+ }, "".concat(form.macAddress, "/isSmokeFree?").concat(params.toString()))];
99
111
  case 1:
100
112
  response = _a.sent();
101
113
  return [2 /*return*/, response.json()];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/ike-app-api",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "app api",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -76,4 +76,4 @@
76
76
  "tsutils": "^2.29.0",
77
77
  "wrappy": "^1.0.2"
78
78
  }
79
- }
79
+ }