@vitalfit/sdk 0.3.4 → 0.3.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/index.cjs +49 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -951,19 +951,23 @@ type CheckInResponse = {
|
|
|
951
951
|
message: string;
|
|
952
952
|
service_name: string;
|
|
953
953
|
};
|
|
954
|
-
type
|
|
954
|
+
type ServiceUsage = {
|
|
955
955
|
attendance_id: string;
|
|
956
|
-
user_id: string;
|
|
957
|
-
user_name: string;
|
|
958
956
|
service_id: string;
|
|
959
957
|
service_name: string;
|
|
958
|
+
branch_id?: string;
|
|
959
|
+
branch_name?: string;
|
|
960
960
|
check_in_time: string;
|
|
961
961
|
status: string;
|
|
962
962
|
};
|
|
963
|
-
type
|
|
963
|
+
type AttendanceHistory = {
|
|
964
964
|
attendance_id: string;
|
|
965
|
+
user_id: string;
|
|
966
|
+
user_name: string;
|
|
965
967
|
service_id: string;
|
|
966
968
|
service_name: string;
|
|
969
|
+
class_name?: string;
|
|
970
|
+
class_time?: string;
|
|
967
971
|
check_in_time: string;
|
|
968
972
|
status: string;
|
|
969
973
|
};
|
|
@@ -1446,6 +1450,16 @@ declare class AuditService {
|
|
|
1446
1450
|
getUserLogs(jwt: string, userId: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<AuditLog[]>>;
|
|
1447
1451
|
}
|
|
1448
1452
|
|
|
1453
|
+
declare class NotificationService {
|
|
1454
|
+
private client;
|
|
1455
|
+
constructor(client: Client);
|
|
1456
|
+
getNotifications(jwt: string): Promise<DataResponse<NotificationResponse[]>>;
|
|
1457
|
+
getUnreadCount(jwt: string): Promise<UnreadCountResponse>;
|
|
1458
|
+
markAsRead(notificationId: string, jwt: string): Promise<void>;
|
|
1459
|
+
markAllAsRead(jwt: string): Promise<void>;
|
|
1460
|
+
sendBroadcast(data: BroadcastRequest, jwt: string): Promise<void>;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1449
1463
|
declare class APIError extends Error {
|
|
1450
1464
|
status: number;
|
|
1451
1465
|
messages: string[];
|
|
@@ -1477,6 +1491,7 @@ declare class VitalFit {
|
|
|
1477
1491
|
wishList: WishListService;
|
|
1478
1492
|
policy: PolicyService;
|
|
1479
1493
|
audit: AuditService;
|
|
1494
|
+
notification: NotificationService;
|
|
1480
1495
|
constructor(isDevMode: boolean, origin?: string);
|
|
1481
1496
|
static getInstance(isDevMode?: boolean): VitalFit;
|
|
1482
1497
|
version(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -951,19 +951,23 @@ type CheckInResponse = {
|
|
|
951
951
|
message: string;
|
|
952
952
|
service_name: string;
|
|
953
953
|
};
|
|
954
|
-
type
|
|
954
|
+
type ServiceUsage = {
|
|
955
955
|
attendance_id: string;
|
|
956
|
-
user_id: string;
|
|
957
|
-
user_name: string;
|
|
958
956
|
service_id: string;
|
|
959
957
|
service_name: string;
|
|
958
|
+
branch_id?: string;
|
|
959
|
+
branch_name?: string;
|
|
960
960
|
check_in_time: string;
|
|
961
961
|
status: string;
|
|
962
962
|
};
|
|
963
|
-
type
|
|
963
|
+
type AttendanceHistory = {
|
|
964
964
|
attendance_id: string;
|
|
965
|
+
user_id: string;
|
|
966
|
+
user_name: string;
|
|
965
967
|
service_id: string;
|
|
966
968
|
service_name: string;
|
|
969
|
+
class_name?: string;
|
|
970
|
+
class_time?: string;
|
|
967
971
|
check_in_time: string;
|
|
968
972
|
status: string;
|
|
969
973
|
};
|
|
@@ -1446,6 +1450,16 @@ declare class AuditService {
|
|
|
1446
1450
|
getUserLogs(jwt: string, userId: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<AuditLog[]>>;
|
|
1447
1451
|
}
|
|
1448
1452
|
|
|
1453
|
+
declare class NotificationService {
|
|
1454
|
+
private client;
|
|
1455
|
+
constructor(client: Client);
|
|
1456
|
+
getNotifications(jwt: string): Promise<DataResponse<NotificationResponse[]>>;
|
|
1457
|
+
getUnreadCount(jwt: string): Promise<UnreadCountResponse>;
|
|
1458
|
+
markAsRead(notificationId: string, jwt: string): Promise<void>;
|
|
1459
|
+
markAllAsRead(jwt: string): Promise<void>;
|
|
1460
|
+
sendBroadcast(data: BroadcastRequest, jwt: string): Promise<void>;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1449
1463
|
declare class APIError extends Error {
|
|
1450
1464
|
status: number;
|
|
1451
1465
|
messages: string[];
|
|
@@ -1477,6 +1491,7 @@ declare class VitalFit {
|
|
|
1477
1491
|
wishList: WishListService;
|
|
1478
1492
|
policy: PolicyService;
|
|
1479
1493
|
audit: AuditService;
|
|
1494
|
+
notification: NotificationService;
|
|
1480
1495
|
constructor(isDevMode: boolean, origin?: string);
|
|
1481
1496
|
static getInstance(isDevMode?: boolean): VitalFit;
|
|
1482
1497
|
version(): string;
|
package/dist/index.js
CHANGED
|
@@ -2289,6 +2289,52 @@ var AuditService = class {
|
|
|
2289
2289
|
}
|
|
2290
2290
|
};
|
|
2291
2291
|
|
|
2292
|
+
// src/services/notifications.ts
|
|
2293
|
+
var NotificationService = class {
|
|
2294
|
+
client;
|
|
2295
|
+
constructor(client) {
|
|
2296
|
+
this.client = client;
|
|
2297
|
+
this.getNotifications = this.getNotifications.bind(this);
|
|
2298
|
+
this.getUnreadCount = this.getUnreadCount.bind(this);
|
|
2299
|
+
this.markAsRead = this.markAsRead.bind(this);
|
|
2300
|
+
this.markAllAsRead = this.markAllAsRead.bind(this);
|
|
2301
|
+
this.sendBroadcast = this.sendBroadcast.bind(this);
|
|
2302
|
+
}
|
|
2303
|
+
async getNotifications(jwt) {
|
|
2304
|
+
const response = await this.client.get({
|
|
2305
|
+
url: "/notifications",
|
|
2306
|
+
jwt
|
|
2307
|
+
});
|
|
2308
|
+
return response;
|
|
2309
|
+
}
|
|
2310
|
+
async getUnreadCount(jwt) {
|
|
2311
|
+
const response = await this.client.get({
|
|
2312
|
+
url: "/notifications/unread-count",
|
|
2313
|
+
jwt
|
|
2314
|
+
});
|
|
2315
|
+
return response;
|
|
2316
|
+
}
|
|
2317
|
+
async markAsRead(notificationId, jwt) {
|
|
2318
|
+
await this.client.patch({
|
|
2319
|
+
url: `/notifications/${notificationId}/read`,
|
|
2320
|
+
jwt
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
async markAllAsRead(jwt) {
|
|
2324
|
+
await this.client.patch({
|
|
2325
|
+
url: "/notifications/read-all",
|
|
2326
|
+
jwt
|
|
2327
|
+
});
|
|
2328
|
+
}
|
|
2329
|
+
async sendBroadcast(data, jwt) {
|
|
2330
|
+
await this.client.post({
|
|
2331
|
+
url: "/notifications/broadcast",
|
|
2332
|
+
jwt,
|
|
2333
|
+
data
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
};
|
|
2337
|
+
|
|
2292
2338
|
// src/types/auth.ts
|
|
2293
2339
|
var UserGender = /* @__PURE__ */ ((UserGender2) => {
|
|
2294
2340
|
UserGender2["male"] = "male";
|
|
@@ -2414,6 +2460,7 @@ var VitalFit = class _VitalFit {
|
|
|
2414
2460
|
wishList;
|
|
2415
2461
|
policy;
|
|
2416
2462
|
audit;
|
|
2463
|
+
notification;
|
|
2417
2464
|
constructor(isDevMode, origin) {
|
|
2418
2465
|
this.client = new Client(isDevMode, origin);
|
|
2419
2466
|
this.auth = new AuthService(this.client);
|
|
@@ -2437,6 +2484,7 @@ var VitalFit = class _VitalFit {
|
|
|
2437
2484
|
this.wishList = new WishListService(this.client);
|
|
2438
2485
|
this.policy = new PolicyService(this.client);
|
|
2439
2486
|
this.audit = new AuditService(this.client);
|
|
2487
|
+
this.notification = new NotificationService(this.client);
|
|
2440
2488
|
}
|
|
2441
2489
|
static getInstance(isDevMode = false) {
|
|
2442
2490
|
if (!_VitalFit.instance) {
|
|
@@ -2445,7 +2493,7 @@ var VitalFit = class _VitalFit {
|
|
|
2445
2493
|
return _VitalFit.instance;
|
|
2446
2494
|
}
|
|
2447
2495
|
version() {
|
|
2448
|
-
return "0.3.
|
|
2496
|
+
return "0.3.6";
|
|
2449
2497
|
}
|
|
2450
2498
|
};
|
|
2451
2499
|
export {
|