@bytexbyte/ike-app-api 1.0.83 → 1.0.85

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.
@@ -1,5 +1,5 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
- import { CheckReadedInAppNotificationsResult, CreateInAppNotificationResult, DeleteInAppNotificationResult, DeleteInAppNotificationsResult, InAppNotificationType, PutInAppNotificationResult, PutInAppNotificationsResult } from './type';
2
+ import { CheckReadedInAppNotificationsResult, CreateInAppNotificationResult, DeleteInAppNotificationResult, DeleteInAppNotificationsResult, InAppNotificationType, ListInAppNotificationsResult, PatchInAppNotificationMarkUnreadResult, PutInAppNotificationResult, PutInAppNotificationsResult } from './type';
3
3
  declare class IKEAppInAppNotificationApi extends BxBApi {
4
4
  constructor({ host, secretKey, secret, credentials, onSuccess, onError, }: {
5
5
  host: string;
@@ -18,6 +18,8 @@ declare class IKEAppInAppNotificationApi extends BxBApi {
18
18
  }): Promise<CreateInAppNotificationResult>;
19
19
  putInAppNotification(notificationId: number): Promise<PutInAppNotificationResult>;
20
20
  deleteInAppNotification(notificationId: number): Promise<DeleteInAppNotificationResult>;
21
+ listInAppNotifications(): Promise<ListInAppNotificationsResult>;
22
+ patchInAppNotificationMarkUnread(notificationId: number): Promise<PatchInAppNotificationMarkUnreadResult>;
21
23
  putInAppNotifications(): Promise<PutInAppNotificationsResult>;
22
24
  deleteInAppNotifications(): Promise<DeleteInAppNotificationsResult>;
23
25
  checkReadedInAppNotifications(): Promise<CheckReadedInAppNotificationsResult>;
@@ -122,6 +122,43 @@ var IKEAppInAppNotificationApi = /** @class */ (function (_super) {
122
122
  });
123
123
  });
124
124
  };
125
+ IKEAppInAppNotificationApi.prototype.listInAppNotifications = function () {
126
+ return __awaiter(this, void 0, void 0, function () {
127
+ var response;
128
+ return __generator(this, function (_a) {
129
+ switch (_a.label) {
130
+ case 0: return [4 /*yield*/, this.bxbFetch({
131
+ method: 'GET',
132
+ headers: {
133
+ 'Content-Type': 'application/json',
134
+ },
135
+ })];
136
+ case 1:
137
+ response = _a.sent();
138
+ return [2 /*return*/, response.json()];
139
+ }
140
+ });
141
+ });
142
+ };
143
+ IKEAppInAppNotificationApi.prototype.patchInAppNotificationMarkUnread = function (notificationId) {
144
+ return __awaiter(this, void 0, void 0, function () {
145
+ var response;
146
+ return __generator(this, function (_a) {
147
+ switch (_a.label) {
148
+ case 0: return [4 /*yield*/, this.bxbFetch({
149
+ method: 'PATCH',
150
+ headers: {
151
+ 'Content-Type': 'application/json',
152
+ },
153
+ body: JSON.stringify({}),
154
+ }, "".concat(notificationId))];
155
+ case 1:
156
+ response = _a.sent();
157
+ return [2 /*return*/, response.json()];
158
+ }
159
+ });
160
+ });
161
+ };
125
162
  IKEAppInAppNotificationApi.prototype.putInAppNotifications = function () {
126
163
  return __awaiter(this, void 0, void 0, function () {
127
164
  var response;
@@ -13,8 +13,32 @@ export type PutInAppNotificationsResult = {
13
13
  export type DeleteInAppNotificationsResult = PutInAppNotificationsResult;
14
14
  export type PutInAppNotificationResult = PutInAppNotificationsResult | {
15
15
  error: 'Id is required.';
16
+ } | {
17
+ error: 'Not found.';
16
18
  };
17
19
  export type DeleteInAppNotificationResult = PutInAppNotificationResult;
20
+ export type InAppNotificationListItem = {
21
+ id: number;
22
+ title: string;
23
+ body: string;
24
+ linkWebpage: string | null;
25
+ readed: boolean;
26
+ createdAt: string;
27
+ };
28
+ export type ListInAppNotificationsResult = {
29
+ notifications: InAppNotificationListItem[];
30
+ error?: undefined;
31
+ } | {
32
+ notifications?: undefined;
33
+ error: 'You are not authorized to call this API.';
34
+ };
35
+ export type PatchInAppNotificationMarkUnreadResult = {
36
+ success: 'ok';
37
+ error?: undefined;
38
+ } | {
39
+ success?: undefined;
40
+ error: 'You are not authorized to call this API.' | 'Id is required.' | 'Not found.';
41
+ };
18
42
  export type CheckReadedInAppNotificationsResult = {
19
43
  isAllRead: boolean;
20
44
  error?: undefined;
@@ -88,6 +88,20 @@ type SaveProductResult = {
88
88
  type PortfolioDeviceResult = {
89
89
  error?: string;
90
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
+ };
91
105
  type RemoveProductResult = {
92
106
  error?: 'You are not logged in.' | 'Incorrect userID.' | 'Incorrect digitalCustomizationId.' | 'You cannot make changes to this user.' | 'Missing userId.' | 'Missing digitalCustomizationId.';
93
107
  };
@@ -133,6 +147,8 @@ declare class IKEAppUserApi extends BxBApi {
133
147
  removeProduct(userId: string, batchId: string): Promise<RemoveProductResult>;
134
148
  claimPortfolio(userId: string, tagTokenId: string): Promise<PortfolioDeviceResult>;
135
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>;
136
152
  logout(userId: string, form: {
137
153
  deviceToken: string;
138
154
  }): Promise<LogoutResult>;
package/lib/User/index.js CHANGED
@@ -327,6 +327,30 @@ var IKEAppUserApi = /** @class */ (function (_super) {
327
327
  });
328
328
  });
329
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
+ };
330
354
  IKEAppUserApi.prototype.logout = function (userId, form) {
331
355
  return __awaiter(this, void 0, void 0, function () {
332
356
  var response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/ike-app-api",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "description": "app api",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",