@bytexbyte/ike-app-api 1.0.82 → 1.0.84

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,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -1,11 +1,11 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
- declare type RegisterBody = {
2
+ type RegisterBody = {
3
3
  token: string;
4
4
  device: string;
5
5
  deviceOsType: 'ios' | 'android' | 'windows' | 'macos' | 'web';
6
6
  deviceId?: string;
7
7
  };
8
- declare type RegisterResult = {
8
+ type RegisterResult = {
9
9
  error?: 'You are not logged in.' | 'Invalid request';
10
10
  };
11
11
  declare class IKEAppRegisterDeviceCodeApi extends BxBApi {
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
package/lib/Rsa/index.js CHANGED
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -1,10 +1,10 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
2
  import { Scan } from '../types';
3
- declare type ScanBody = Pick<Scan, 'isAppClip' | 'latitude' | 'longitude' | 'tagTokenId' | 'deviceId' | 'tail'> & {
3
+ type ScanBody = Pick<Scan, 'isAppClip' | 'latitude' | 'longitude' | 'tagTokenId' | 'deviceId' | 'tail'> & {
4
4
  uid: string;
5
5
  deviceOsType: 'ios' | 'android' | 'windows' | 'macos' | 'web';
6
6
  };
7
- declare type UpdateBody = {
7
+ type UpdateBody = {
8
8
  isVisitedPromo: Pick<Scan, 'isVisitedPromo'>['isVisitedPromo'];
9
9
  isVisitedShop?: undefined;
10
10
  isVisitedExplore?: undefined;
@@ -17,12 +17,12 @@ declare type UpdateBody = {
17
17
  isVisitedShop?: undefined;
18
18
  isVisitedExplore: Pick<Scan, 'isVisitedExplore'>['isVisitedExplore'];
19
19
  };
20
- declare type ScanResult = {
20
+ type ScanResult = {
21
21
  scan: Scan;
22
22
  } | {
23
23
  error: 'Token is not exist.' | 'tokenId and UID do not match.' | 'This device is deactivated.' | 'Server timeout.' | 'The device does not support' | 'This is a IKE tag, You are not authorized to call this API.';
24
24
  };
25
- declare type UpdateResult = {
25
+ type UpdateResult = {
26
26
  error?: 'scanId type error.' | 'scanId not found.' | 'This is a IKE tag, You are not authorized to call this API.' | 'Scan not found.';
27
27
  };
28
28
  declare class IKEAppScanApi extends BxBApi {
package/lib/Scan/index.js CHANGED
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -1,7 +1,7 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
2
  import { ikeApi } from '../config';
3
3
  import { BlockChainStatusType } from '../types';
4
- declare type GetResult = {
4
+ type GetResult = {
5
5
  tokenId: string;
6
6
  batchId: string;
7
7
  batchSerialNumber: number;
@@ -11,48 +11,48 @@ declare type GetResult = {
11
11
  }[];
12
12
  };
13
13
  } | null;
14
- declare type GetManyQuery = {
14
+ type GetManyQuery = {
15
15
  batchId: string;
16
16
  batchSerialNumberGte?: string;
17
17
  batchSerialNumberLte?: string;
18
18
  };
19
- declare type GetManyResult = {
19
+ type GetManyResult = {
20
20
  tokenId: string;
21
21
  batchSerialNumber: number;
22
22
  }[];
23
- declare type PostBody = {
23
+ type PostBody = {
24
24
  ownerId: string;
25
25
  };
26
- declare type PostResult = {
26
+ type PostResult = {
27
27
  tagTokenId: string;
28
28
  error?: undefined;
29
29
  } | {
30
30
  tagTokenId?: undefined;
31
31
  error: 'this is not your account.' | 'create error.' | 'this is not your tag.' | 'undo expired.' | 'delete error.';
32
32
  };
33
- declare type PutBody = Parameters<typeof ikeApi.tags.updateMany>[0];
34
- declare type PutResult = Awaited<ReturnType<typeof ikeApi.tags.updateMany>>;
35
- declare type TransferBody = {
33
+ type PutBody = Parameters<typeof ikeApi.tags.updateMany>[0];
34
+ type PutResult = Awaited<ReturnType<typeof ikeApi.tags.updateMany>>;
35
+ type TransferBody = {
36
36
  ownerId: string;
37
37
  transferId: string;
38
38
  };
39
- declare type UndoTransferBody = {
39
+ type UndoTransferBody = {
40
40
  ownerId: string;
41
41
  };
42
- declare type PutInfoVisible = {
42
+ type PutInfoVisible = {
43
43
  ownerId: string;
44
44
  isInfoVisible: boolean;
45
45
  };
46
- declare type PutInfoVisibleResult = {
46
+ type PutInfoVisibleResult = {
47
47
  error?: 'this is not your account.' | 'this is not your tag.' | 'update error.';
48
48
  };
49
- declare type PutUpdateDisplayName = {
49
+ type PutUpdateDisplayName = {
50
50
  displayName: string;
51
51
  };
52
- declare type PutUpdateDisplayNameResult = {
52
+ type PutUpdateDisplayNameResult = {
53
53
  error?: 'update error.';
54
54
  };
55
- declare type TagCheckListStatus = 'pass' | 'fail' | 'none';
55
+ type TagCheckListStatus = 'pass' | 'fail' | 'none';
56
56
  declare class IKEAppTagsApi extends BxBApi {
57
57
  constructor({ host, credentials, onSuccess, onError, }: {
58
58
  host: string;
package/lib/Tags/index.js CHANGED
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -1,6 +1,6 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
2
  import { User, UserLog, UserLogAction, Wallet } from '../types';
3
- declare type GetResult = {
3
+ type GetResult = {
4
4
  user: {
5
5
  email: string | null;
6
6
  phone: string | null;
@@ -12,21 +12,21 @@ declare type GetResult = {
12
12
  user?: undefined;
13
13
  error: 'Authentication type error.' | 'Incorrect userID.' | 'User not found.' | 'You are not authorized to call this API.';
14
14
  };
15
- declare type UpdateBody = Pick<User, 'image' | 'firstName' | 'lastName'>;
16
- declare type UpdateResult = Pick<User, 'id' | 'email' | 'phone' | 'image' | 'firstName' | 'lastName'> | {
15
+ type UpdateBody = Pick<User, 'image' | 'firstName' | 'lastName'>;
16
+ type UpdateResult = Pick<User, 'id' | 'email' | 'phone' | 'image' | 'firstName' | 'lastName'> | {
17
17
  error?: 'Authentication type error.' | 'Incorrect userID.' | 'You cannot make changes to this user.' | 'You are not authorized to call this API.';
18
18
  };
19
- declare type DeleteResult = User | {
19
+ type DeleteResult = User | {
20
20
  error?: 'Authentication type error.' | 'Incorrect userID.' | 'You cannot make changes to this user.' | 'User not found.' | 'You are not authorized to call this API.';
21
21
  };
22
- declare type GetWalletResult = {
22
+ type GetWalletResult = {
23
23
  address: Pick<Wallet, 'address'>['address'];
24
24
  error?: undefined;
25
25
  } | {
26
26
  address?: undefined;
27
27
  error: 'Incorrect userID.' | 'You are not logged in.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Invalid id.';
28
28
  };
29
- declare type GetUserIdByEmailResult = {
29
+ type GetUserIdByEmailResult = {
30
30
  user: {
31
31
  id: string;
32
32
  };
@@ -35,18 +35,18 @@ declare type GetUserIdByEmailResult = {
35
35
  user?: undefined;
36
36
  error: 'Invalid email.' | 'You are not logged in.' | 'Incorrect userID.' | 'You cannot make changes to this user.' | 'Missing userId.';
37
37
  };
38
- declare type PostWalletBody = {
38
+ type PostWalletBody = {
39
39
  address: string;
40
40
  };
41
- declare type PostWalletResult = {
41
+ type PostWalletResult = {
42
42
  userId: string;
43
43
  address: string;
44
44
  };
45
- declare type LogoutResult = {
45
+ type LogoutResult = {
46
46
  success?: boolean;
47
47
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'You cannot make changes to this user.' | 'Missing userId.';
48
48
  };
49
- declare type GetScanHistoryResult = {
49
+ type GetScanHistoryResult = {
50
50
  scanList: {
51
51
  id: number;
52
52
  tagTokenId: string;
@@ -75,25 +75,43 @@ declare type GetScanHistoryResult = {
75
75
  } | {
76
76
  error: 'You are not logged in.' | 'Incorrect userID.' | 'You cannot get data of this user.' | 'Missing userId.';
77
77
  };
78
- declare type RemoveScanHistoryResult = {
78
+ type RemoveScanHistoryResult = {
79
79
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect tagUid.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing scanHistoryId.' | 'Missing tagUid.';
80
80
  };
81
- declare type RemoveAllScanHistoryResult = {
81
+ type RemoveAllScanHistoryResult = {
82
82
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'You cannot make changes to this user.' | 'Missing userId.';
83
83
  };
84
- declare type SaveProductResult = {
84
+ type SaveProductResult = {
85
85
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect batchId.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing batchId.';
86
86
  };
87
- declare type RemoveProductResult = {
87
+ /** POST/DELETE `/api/user/:userId/portfolio/:tagTokenId` one tag per owner (see `portfolio` table). */
88
+ type PortfolioDeviceResult = {
89
+ error?: string;
90
+ };
91
+ type PortfolioListItem = {
92
+ tagTokenId: string;
93
+ uid: string | null;
94
+ displayName: string;
95
+ productName: string;
96
+ manufacturer: string;
97
+ imageUrl: string;
98
+ portfolioAddedAt: string;
99
+ };
100
+ type GetPortfolioResult = {
101
+ devices: PortfolioListItem[];
102
+ } | {
103
+ error: string;
104
+ };
105
+ type RemoveProductResult = {
88
106
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect digitalCustomizationId.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing digitalCustomizationId.';
89
107
  };
90
- declare type CreateNotificationResult = {
108
+ type CreateNotificationResult = {
91
109
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect digitalCustomizationId.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing digitalCustomizationId.' | 'Missing digitalCustomization.';
92
110
  };
93
- declare type RemoveNotificationResult = {
111
+ type RemoveNotificationResult = {
94
112
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect digitalCustomizationId.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing digitalCustomizationId.';
95
113
  };
96
- declare type UpdateNotificationResult = {
114
+ type UpdateNotificationResult = {
97
115
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect digitalCustomizationId.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing digitalCustomizationId.';
98
116
  };
99
117
  declare enum RuleType {
@@ -102,7 +120,7 @@ declare enum RuleType {
102
120
  redeemNFT = "redeemNFT",
103
121
  redeemGoldenTicket = "redeemGoldenTicket"
104
122
  }
105
- declare type GetConnectDeviceAtResult = {
123
+ type GetConnectDeviceAtResult = {
106
124
  connectDeviceAt: Date;
107
125
  error?: undefined;
108
126
  } | {
@@ -127,6 +145,10 @@ declare class IKEAppUserApi extends BxBApi {
127
145
  removeAllScanHistory(userId: string): Promise<RemoveAllScanHistoryResult>;
128
146
  saveProduct(userId: string, batchId: string): Promise<SaveProductResult>;
129
147
  removeProduct(userId: string, batchId: string): Promise<RemoveProductResult>;
148
+ claimPortfolio(userId: string, tagTokenId: string): Promise<PortfolioDeviceResult>;
149
+ releasePortfolio(userId: string, tagTokenId: string): Promise<PortfolioDeviceResult>;
150
+ /** GET `/api/user/:userId/portfolio` — all tags claimed for this user (see `portfolio` table). */
151
+ getPortfolio(userId: string): Promise<GetPortfolioResult>;
130
152
  logout(userId: string, form: {
131
153
  deviceToken: string;
132
154
  }): Promise<LogoutResult>;
package/lib/User/index.js CHANGED
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -277,6 +277,80 @@ var IKEAppUserApi = /** @class */ (function (_super) {
277
277
  });
278
278
  });
279
279
  };
280
+ IKEAppUserApi.prototype.claimPortfolio = function (userId, tagTokenId) {
281
+ return __awaiter(this, void 0, void 0, function () {
282
+ var encoded, response;
283
+ return __generator(this, function (_a) {
284
+ switch (_a.label) {
285
+ case 0:
286
+ encoded = encodeURIComponent(tagTokenId);
287
+ return [4 /*yield*/, this.bxbFetch({
288
+ method: 'POST',
289
+ headers: userId
290
+ ? {
291
+ 'Content-Type': 'application/json',
292
+ 'IKE-App-User-Id': userId,
293
+ }
294
+ : {
295
+ 'Content-Type': 'application/json',
296
+ },
297
+ }, "".concat(userId, "/portfolio/").concat(encoded))];
298
+ case 1:
299
+ response = _a.sent();
300
+ return [2 /*return*/, response.json()];
301
+ }
302
+ });
303
+ });
304
+ };
305
+ IKEAppUserApi.prototype.releasePortfolio = function (userId, tagTokenId) {
306
+ return __awaiter(this, void 0, void 0, function () {
307
+ var encoded, response;
308
+ return __generator(this, function (_a) {
309
+ switch (_a.label) {
310
+ case 0:
311
+ encoded = encodeURIComponent(tagTokenId);
312
+ return [4 /*yield*/, this.bxbFetch({
313
+ method: 'DELETE',
314
+ headers: userId
315
+ ? {
316
+ 'Content-Type': 'application/json',
317
+ 'IKE-App-User-Id': userId,
318
+ }
319
+ : {
320
+ 'Content-Type': 'application/json',
321
+ },
322
+ }, "".concat(userId, "/portfolio/").concat(encoded))];
323
+ case 1:
324
+ response = _a.sent();
325
+ return [2 /*return*/, response.json()];
326
+ }
327
+ });
328
+ });
329
+ };
330
+ /** GET `/api/user/:userId/portfolio` — all tags claimed for this user (see `portfolio` table). */
331
+ IKEAppUserApi.prototype.getPortfolio = function (userId) {
332
+ return __awaiter(this, void 0, void 0, function () {
333
+ var response;
334
+ return __generator(this, function (_a) {
335
+ switch (_a.label) {
336
+ case 0: return [4 /*yield*/, this.bxbFetch({
337
+ method: 'GET',
338
+ headers: userId
339
+ ? {
340
+ 'Content-Type': 'application/json',
341
+ 'IKE-App-User-Id': userId,
342
+ }
343
+ : {
344
+ 'Content-Type': 'application/json',
345
+ },
346
+ }, "".concat(userId, "/portfolio"))];
347
+ case 1:
348
+ response = _a.sent();
349
+ return [2 /*return*/, response.json()];
350
+ }
351
+ });
352
+ });
353
+ };
280
354
  IKEAppUserApi.prototype.logout = function (userId, form) {
281
355
  return __awaiter(this, void 0, void 0, function () {
282
356
  var response;
package/lib/index.js CHANGED
@@ -20,12 +20,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {