@gymspace/sdk 1.2.4 → 1.2.8
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/.tsbuildinfo +1 -0
- package/dist/index.d.mts +289 -42
- package/dist/index.d.ts +289 -42
- package/dist/index.js +363 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/auth.ts +18 -2
- package/src/models/clients.ts +1 -13
- package/src/models/collaborators.ts +2 -0
- package/src/models/index.ts +5 -2
- package/src/models/invitations.ts +2 -29
- package/src/models/payment-methods.ts +15 -2
- package/src/models/roles.ts +5 -0
- package/src/models/whatsapp.ts +142 -0
- package/src/resources/clients.ts +27 -28
- package/src/resources/collaborators.ts +68 -0
- package/src/resources/contracts.ts +27 -19
- package/src/resources/index.ts +5 -1
- package/src/resources/invitations.ts +21 -17
- package/src/resources/roles.ts +29 -0
- package/src/resources/sales.ts +28 -25
- package/src/resources/whatsapp-templates.ts +80 -0
- package/src/resources/whatsapp.ts +97 -0
- package/src/sdk.ts +34 -3
- package/src/types.ts +2 -2
- package/src/utils/agent-fetch.ts +25 -0
package/dist/index.js
CHANGED
|
@@ -194,6 +194,26 @@ var ApiClient = class {
|
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
+
// src/utils/agent-fetch.ts
|
|
198
|
+
function createAgentFetch(apiClient, customFetch) {
|
|
199
|
+
const fetchFn = customFetch || fetch;
|
|
200
|
+
return async (path, options) => {
|
|
201
|
+
const fullUrl = `${apiClient.getBaseUrl()}/agent${path}`;
|
|
202
|
+
const axiosInstance = apiClient.axiosInstance;
|
|
203
|
+
const gymId = axiosInstance?.defaults?.headers?.common?.["X-Gym-Id"];
|
|
204
|
+
const headers = {
|
|
205
|
+
"Content-Type": "application/json",
|
|
206
|
+
...apiClient.getAccessToken() && { Authorization: `Bearer ${apiClient.getAccessToken()}` },
|
|
207
|
+
...gymId && { "X-Gym-Id": gymId },
|
|
208
|
+
...options?.headers || {}
|
|
209
|
+
};
|
|
210
|
+
return fetchFn(fullUrl, {
|
|
211
|
+
...options,
|
|
212
|
+
headers
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
197
217
|
// src/resources/base.ts
|
|
198
218
|
var BaseResource = class {
|
|
199
219
|
constructor(client) {
|
|
@@ -371,6 +391,61 @@ var GymsResource = class extends BaseResource {
|
|
|
371
391
|
}
|
|
372
392
|
};
|
|
373
393
|
|
|
394
|
+
// src/resources/collaborators.ts
|
|
395
|
+
var CollaboratorsResource = class extends BaseResource {
|
|
396
|
+
constructor() {
|
|
397
|
+
super(...arguments);
|
|
398
|
+
this.basePath = "collaborators";
|
|
399
|
+
}
|
|
400
|
+
async list(params, options) {
|
|
401
|
+
return this.paginate(this.basePath, params, options);
|
|
402
|
+
}
|
|
403
|
+
async get(id, options) {
|
|
404
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
405
|
+
}
|
|
406
|
+
async update(id, data, options) {
|
|
407
|
+
return this.client.patch(`${this.basePath}/${id}`, data, options);
|
|
408
|
+
}
|
|
409
|
+
async updateRole(id, data, options) {
|
|
410
|
+
return this.client.patch(`${this.basePath}/${id}/role`, data, options);
|
|
411
|
+
}
|
|
412
|
+
async updateStatus(id, data, options) {
|
|
413
|
+
return this.client.patch(`${this.basePath}/${id}/status`, data, options);
|
|
414
|
+
}
|
|
415
|
+
async getActivity(id, params, options) {
|
|
416
|
+
return this.client.get(`${this.basePath}/${id}/activity`, params, options);
|
|
417
|
+
}
|
|
418
|
+
async getStats(id, params, options) {
|
|
419
|
+
return this.client.get(`${this.basePath}/${id}/stats`, params, options);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// src/resources/roles.ts
|
|
424
|
+
var RolesResource = class extends BaseResource {
|
|
425
|
+
constructor() {
|
|
426
|
+
super(...arguments);
|
|
427
|
+
this.basePath = "roles";
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Get all roles of the organization (without pagination)
|
|
431
|
+
*/
|
|
432
|
+
async getRoles(options) {
|
|
433
|
+
return this.client.get(this.basePath, void 0, options);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Get a specific role by ID
|
|
437
|
+
*/
|
|
438
|
+
async getRole(id, options) {
|
|
439
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Get all available permissions organized by category
|
|
443
|
+
*/
|
|
444
|
+
async getAvailablePermissions(options) {
|
|
445
|
+
return this.client.get(`${this.basePath}/permissions`, void 0, options);
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
|
|
374
449
|
// src/resources/clients.ts
|
|
375
450
|
var ClientsResource = class extends BaseResource {
|
|
376
451
|
constructor() {
|
|
@@ -381,7 +456,7 @@ var ClientsResource = class extends BaseResource {
|
|
|
381
456
|
return this.client.post(this.basePath, data, options);
|
|
382
457
|
}
|
|
383
458
|
async searchClients(params, options) {
|
|
384
|
-
return this.
|
|
459
|
+
return this.client.get(this.basePath, params, options);
|
|
385
460
|
}
|
|
386
461
|
async getClient(id, options) {
|
|
387
462
|
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
@@ -396,20 +471,24 @@ var ClientsResource = class extends BaseResource {
|
|
|
396
471
|
return this.client.get(`${this.basePath}/${id}/stats`, void 0, options);
|
|
397
472
|
}
|
|
398
473
|
async getClientStat(id, statKey, options) {
|
|
399
|
-
return this.client.get(
|
|
474
|
+
return this.client.get(
|
|
475
|
+
`${this.basePath}/${id}/stats/${statKey}`,
|
|
476
|
+
void 0,
|
|
477
|
+
options
|
|
478
|
+
);
|
|
400
479
|
}
|
|
401
480
|
async getClientStatsByCategory(id, category, options) {
|
|
402
|
-
return this.client.get(
|
|
481
|
+
return this.client.get(
|
|
482
|
+
`${this.basePath}/${id}/stats/category/${category}`,
|
|
483
|
+
void 0,
|
|
484
|
+
options
|
|
485
|
+
);
|
|
403
486
|
}
|
|
404
487
|
async getAvailableStats(options) {
|
|
405
488
|
return this.client.get(`${this.basePath}/stats/available`, void 0, options);
|
|
406
489
|
}
|
|
407
490
|
async searchClientsForCheckIn(params, options) {
|
|
408
|
-
return this.client.get(
|
|
409
|
-
`${this.basePath}/search/check-in`,
|
|
410
|
-
params,
|
|
411
|
-
options
|
|
412
|
-
);
|
|
491
|
+
return this.client.get(`${this.basePath}/search/check-in`, params, options);
|
|
413
492
|
}
|
|
414
493
|
};
|
|
415
494
|
|
|
@@ -459,11 +538,7 @@ var ContractsResource = class extends BaseResource {
|
|
|
459
538
|
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
460
539
|
}
|
|
461
540
|
async getClientContracts(clientId, options) {
|
|
462
|
-
return this.client.get(
|
|
463
|
-
`${this.basePath}/client/${clientId}`,
|
|
464
|
-
void 0,
|
|
465
|
-
options
|
|
466
|
-
);
|
|
541
|
+
return this.client.get(`${this.basePath}/client/${clientId}`, void 0, options);
|
|
467
542
|
}
|
|
468
543
|
async renewContract(id, data, options) {
|
|
469
544
|
return this.client.post(`${this.basePath}/${id}/renew`, data, options);
|
|
@@ -474,6 +549,13 @@ var ContractsResource = class extends BaseResource {
|
|
|
474
549
|
async cancelContract(id, data, options) {
|
|
475
550
|
return this.client.put(`${this.basePath}/${id}/cancel`, data, options);
|
|
476
551
|
}
|
|
552
|
+
async resendWhatsAppNotification(contractId, options) {
|
|
553
|
+
return this.client.post(
|
|
554
|
+
`${this.basePath}/${contractId}/resend-whatsapp`,
|
|
555
|
+
{},
|
|
556
|
+
options
|
|
557
|
+
);
|
|
558
|
+
}
|
|
477
559
|
};
|
|
478
560
|
|
|
479
561
|
// src/resources/dashboard.ts
|
|
@@ -625,8 +707,11 @@ var InvitationsResource = class extends BaseResource {
|
|
|
625
707
|
async getGymInvitations(params, options) {
|
|
626
708
|
return this.client.get(this.basePath, params, options);
|
|
627
709
|
}
|
|
628
|
-
async
|
|
629
|
-
return this.client.post(`${this.basePath}
|
|
710
|
+
async validateByCode(data, options) {
|
|
711
|
+
return this.client.post(`${this.basePath}/validate-by-code`, data, options);
|
|
712
|
+
}
|
|
713
|
+
async acceptInvitation(data, options) {
|
|
714
|
+
return this.client.post(`${this.basePath}/accept`, data, options);
|
|
630
715
|
}
|
|
631
716
|
async cancelInvitation(id, options) {
|
|
632
717
|
return this.client.put(`${this.basePath}/${id}/cancel`, void 0, options);
|
|
@@ -972,7 +1057,11 @@ var SalesResource = class extends BaseResource {
|
|
|
972
1057
|
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
973
1058
|
}
|
|
974
1059
|
async updatePaymentStatus(id, paymentStatus, options) {
|
|
975
|
-
return this.client.put(
|
|
1060
|
+
return this.client.put(
|
|
1061
|
+
`${this.basePath}/${id}/payment-status`,
|
|
1062
|
+
{ paymentStatus },
|
|
1063
|
+
options
|
|
1064
|
+
);
|
|
976
1065
|
}
|
|
977
1066
|
async paySale(id, data, options) {
|
|
978
1067
|
return this.client.post(`${this.basePath}/${id}/payment`, data, options);
|
|
@@ -994,11 +1083,7 @@ var SalesResource = class extends BaseResource {
|
|
|
994
1083
|
const params = { limit };
|
|
995
1084
|
if (startDate) params.startDate = startDate;
|
|
996
1085
|
if (endDate) params.endDate = endDate;
|
|
997
|
-
return this.client.get(
|
|
998
|
-
`${this.basePath}/top-products`,
|
|
999
|
-
params,
|
|
1000
|
-
options
|
|
1001
|
-
);
|
|
1086
|
+
return this.client.get(`${this.basePath}/top-products`, params, options);
|
|
1002
1087
|
}
|
|
1003
1088
|
async getSalesByCustomer(startDate, endDate, options) {
|
|
1004
1089
|
const params = {};
|
|
@@ -1010,6 +1095,13 @@ var SalesResource = class extends BaseResource {
|
|
|
1010
1095
|
options
|
|
1011
1096
|
);
|
|
1012
1097
|
}
|
|
1098
|
+
async resendWhatsAppNotification(saleId, options) {
|
|
1099
|
+
return this.client.post(
|
|
1100
|
+
`${this.basePath}/${saleId}/resend-whatsapp`,
|
|
1101
|
+
{},
|
|
1102
|
+
options
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1013
1105
|
};
|
|
1014
1106
|
|
|
1015
1107
|
// src/resources/suppliers.ts
|
|
@@ -1220,6 +1312,129 @@ var PaymentMethodsResource = class extends BaseResource {
|
|
|
1220
1312
|
}
|
|
1221
1313
|
};
|
|
1222
1314
|
|
|
1315
|
+
// src/resources/whatsapp.ts
|
|
1316
|
+
var WhatsAppResource = class extends BaseResource {
|
|
1317
|
+
constructor() {
|
|
1318
|
+
super(...arguments);
|
|
1319
|
+
this.basePath = "whatsapp";
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Get WhatsApp configuration for the current gym
|
|
1323
|
+
*/
|
|
1324
|
+
async getConfig(options) {
|
|
1325
|
+
return this.client.get(`${this.basePath}/config`, void 0, options);
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Initialize WhatsApp connection
|
|
1329
|
+
* Returns QR code if needed
|
|
1330
|
+
*/
|
|
1331
|
+
async initializeConnection(options) {
|
|
1332
|
+
return this.client.post(
|
|
1333
|
+
`${this.basePath}/initialize`,
|
|
1334
|
+
{},
|
|
1335
|
+
options
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Update WhatsApp configuration
|
|
1340
|
+
*/
|
|
1341
|
+
async updateConfig(data, options) {
|
|
1342
|
+
return this.client.put(`${this.basePath}/config`, data, options);
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Get WhatsApp connection status
|
|
1346
|
+
*/
|
|
1347
|
+
async getConnectionStatus(options) {
|
|
1348
|
+
return this.client.get(
|
|
1349
|
+
`${this.basePath}/connection-status`,
|
|
1350
|
+
void 0,
|
|
1351
|
+
options
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Send a WhatsApp message
|
|
1356
|
+
*/
|
|
1357
|
+
async sendMessage(data, options) {
|
|
1358
|
+
return this.client.post(`${this.basePath}/send-message`, data, options);
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Get WhatsApp messages with pagination and filters
|
|
1362
|
+
*/
|
|
1363
|
+
async getMessages(params, options) {
|
|
1364
|
+
return this.paginate(`${this.basePath}/messages`, params, options);
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Get a specific WhatsApp message by ID
|
|
1368
|
+
*/
|
|
1369
|
+
async getMessage(id, options) {
|
|
1370
|
+
return this.client.get(`${this.basePath}/messages/${id}`, void 0, options);
|
|
1371
|
+
}
|
|
1372
|
+
async listContacts(options) {
|
|
1373
|
+
return this.client.get(`${this.basePath}/contacts`, void 0, options);
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Disconnect WhatsApp instance
|
|
1377
|
+
* Logs out from WhatsApp without deleting the instance
|
|
1378
|
+
*/
|
|
1379
|
+
async disconnect(options) {
|
|
1380
|
+
return this.client.post(`${this.basePath}/disconnect`, {}, options);
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
// src/resources/whatsapp-templates.ts
|
|
1385
|
+
var WhatsAppTemplatesResource = class extends BaseResource {
|
|
1386
|
+
constructor() {
|
|
1387
|
+
super(...arguments);
|
|
1388
|
+
this.basePath = "whatsapp/templates";
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Create a new WhatsApp template
|
|
1392
|
+
*/
|
|
1393
|
+
async create(data, options) {
|
|
1394
|
+
return this.client.post(this.basePath, data, options);
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Get all WhatsApp templates with pagination and filters
|
|
1398
|
+
*/
|
|
1399
|
+
async findAll(params, options) {
|
|
1400
|
+
return this.paginate(this.basePath, params, options);
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Get a specific WhatsApp template by ID
|
|
1404
|
+
*/
|
|
1405
|
+
async findOne(id, options) {
|
|
1406
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Get a WhatsApp template by code
|
|
1410
|
+
*/
|
|
1411
|
+
async findByCode(code, options) {
|
|
1412
|
+
return this.client.get(`${this.basePath}/code/${code}`, void 0, options);
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Update a WhatsApp template
|
|
1416
|
+
*/
|
|
1417
|
+
async update(id, data, options) {
|
|
1418
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Delete a WhatsApp template
|
|
1422
|
+
*/
|
|
1423
|
+
async remove(id, options) {
|
|
1424
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Preview a template with variables
|
|
1428
|
+
*/
|
|
1429
|
+
async preview(id, variables, options) {
|
|
1430
|
+
return this.client.post(
|
|
1431
|
+
`${this.basePath}/${id}/preview`,
|
|
1432
|
+
variables,
|
|
1433
|
+
options
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1223
1438
|
// src/sdk.ts
|
|
1224
1439
|
var GymSpaceSdk = class {
|
|
1225
1440
|
constructor(config) {
|
|
@@ -1227,6 +1442,8 @@ var GymSpaceSdk = class {
|
|
|
1227
1442
|
this.auth = new AuthResource(this.client);
|
|
1228
1443
|
this.organizations = new OrganizationsResource(this.client);
|
|
1229
1444
|
this.gyms = new GymsResource(this.client);
|
|
1445
|
+
this.collaborators = new CollaboratorsResource(this.client);
|
|
1446
|
+
this.roles = new RolesResource(this.client);
|
|
1230
1447
|
this.clients = new ClientsResource(this.client);
|
|
1231
1448
|
this.membershipPlans = new MembershipPlansResource(this.client);
|
|
1232
1449
|
this.contracts = new ContractsResource(this.client);
|
|
@@ -1248,6 +1465,8 @@ var GymSpaceSdk = class {
|
|
|
1248
1465
|
this.subscriptionPlans = new SubscriptionPlansResource(this.client);
|
|
1249
1466
|
this.adminSubscriptionManagement = new AdminSubscriptionManagementResource(this.client);
|
|
1250
1467
|
this.paymentMethods = new PaymentMethodsResource(this.client);
|
|
1468
|
+
this.whatsapp = new WhatsAppResource(this.client);
|
|
1469
|
+
this.whatsappTemplates = new WhatsAppTemplatesResource(this.client);
|
|
1251
1470
|
}
|
|
1252
1471
|
/**
|
|
1253
1472
|
* Set the authentication token
|
|
@@ -1279,6 +1498,21 @@ var GymSpaceSdk = class {
|
|
|
1279
1498
|
clearAuth() {
|
|
1280
1499
|
this.client.clearAuth();
|
|
1281
1500
|
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Set Expo fetch for React Native environments
|
|
1503
|
+
* Should be called once during app initialization
|
|
1504
|
+
*/
|
|
1505
|
+
setExpoFetch(fetchFn) {
|
|
1506
|
+
this.expoFetch = fetchFn;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Create a fetch function for agent endpoints
|
|
1510
|
+
* Uses the /agent/* proxy that includes request context
|
|
1511
|
+
* Automatically uses Expo fetch if set
|
|
1512
|
+
*/
|
|
1513
|
+
createAgentFetch() {
|
|
1514
|
+
return createAgentFetch(this.client, this.expoFetch);
|
|
1515
|
+
}
|
|
1282
1516
|
/**
|
|
1283
1517
|
* Get the underlying API client
|
|
1284
1518
|
*/
|
|
@@ -1310,6 +1544,7 @@ var CollaboratorStatus = /* @__PURE__ */ ((CollaboratorStatus2) => {
|
|
|
1310
1544
|
var InvitationStatus = /* @__PURE__ */ ((InvitationStatus2) => {
|
|
1311
1545
|
InvitationStatus2["PENDING"] = "pending";
|
|
1312
1546
|
InvitationStatus2["ACCEPTED"] = "accepted";
|
|
1547
|
+
InvitationStatus2["CANCELLED"] = "cancelled";
|
|
1313
1548
|
InvitationStatus2["EXPIRED"] = "expired";
|
|
1314
1549
|
return InvitationStatus2;
|
|
1315
1550
|
})(InvitationStatus || {});
|
|
@@ -1479,10 +1714,14 @@ var PERMISSIONS = {
|
|
|
1479
1714
|
PAYMENT_METHODS_CREATE: "PAYMENT_METHODS_CREATE",
|
|
1480
1715
|
PAYMENT_METHODS_READ: "PAYMENT_METHODS_READ",
|
|
1481
1716
|
PAYMENT_METHODS_UPDATE: "PAYMENT_METHODS_UPDATE",
|
|
1482
|
-
PAYMENT_METHODS_DELETE: "PAYMENT_METHODS_DELETE"
|
|
1717
|
+
PAYMENT_METHODS_DELETE: "PAYMENT_METHODS_DELETE",
|
|
1718
|
+
// Special permissions
|
|
1719
|
+
SUPER_ADMIN: "SUPER_ADMIN",
|
|
1720
|
+
OWNER: "OWNER",
|
|
1721
|
+
All: "ALL"
|
|
1483
1722
|
};
|
|
1484
1723
|
var ROLE_PERMISSIONS = {
|
|
1485
|
-
|
|
1724
|
+
ADMIN: Object.values(PERMISSIONS),
|
|
1486
1725
|
MANAGER: [
|
|
1487
1726
|
PERMISSIONS.GYMS_READ,
|
|
1488
1727
|
PERMISSIONS.COLLABORATORS_READ,
|
|
@@ -1522,26 +1761,6 @@ var ROLE_PERMISSIONS = {
|
|
|
1522
1761
|
PERMISSIONS.PAYMENT_METHODS_READ,
|
|
1523
1762
|
PERMISSIONS.PAYMENT_METHODS_UPDATE,
|
|
1524
1763
|
PERMISSIONS.PAYMENT_METHODS_DELETE
|
|
1525
|
-
],
|
|
1526
|
-
STAFF: [
|
|
1527
|
-
PERMISSIONS.CLIENTS_READ,
|
|
1528
|
-
PERMISSIONS.CHECKINS_CREATE,
|
|
1529
|
-
PERMISSIONS.CHECKINS_READ,
|
|
1530
|
-
PERMISSIONS.PRODUCTS_READ,
|
|
1531
|
-
PERMISSIONS.PRODUCT_CATEGORIES_READ,
|
|
1532
|
-
PERMISSIONS.SALES_CREATE,
|
|
1533
|
-
PERMISSIONS.SALES_READ,
|
|
1534
|
-
PERMISSIONS.PAYMENT_METHODS_READ
|
|
1535
|
-
],
|
|
1536
|
-
ADVISOR: [
|
|
1537
|
-
PERMISSIONS.CLIENTS_READ,
|
|
1538
|
-
PERMISSIONS.EVALUATIONS_CREATE,
|
|
1539
|
-
PERMISSIONS.EVALUATIONS_READ,
|
|
1540
|
-
PERMISSIONS.EVALUATIONS_UPDATE,
|
|
1541
|
-
PERMISSIONS.ASSETS_CREATE,
|
|
1542
|
-
PERMISSIONS.ASSETS_READ,
|
|
1543
|
-
PERMISSIONS.FILES_CREATE,
|
|
1544
|
-
PERMISSIONS.FILES_READ
|
|
1545
1764
|
]
|
|
1546
1765
|
};
|
|
1547
1766
|
var CACHE_TTL = {
|
|
@@ -1578,6 +1797,95 @@ var HEADERS = {
|
|
|
1578
1797
|
GYM_ID: "X-Gym-Id",
|
|
1579
1798
|
REQUEST_ID: "X-Request-Id"
|
|
1580
1799
|
};
|
|
1800
|
+
var RoleNames = /* @__PURE__ */ ((RoleNames2) => {
|
|
1801
|
+
RoleNames2["ADMIN"] = "Admin";
|
|
1802
|
+
RoleNames2["ENCARGADO"] = "Encargado";
|
|
1803
|
+
RoleNames2["OWNER"] = "OWNER";
|
|
1804
|
+
return RoleNames2;
|
|
1805
|
+
})(RoleNames || {});
|
|
1806
|
+
var ROLE_NAMES = RoleNames;
|
|
1807
|
+
function isAdminRole(roleName) {
|
|
1808
|
+
return roleName === "Admin";
|
|
1809
|
+
}
|
|
1810
|
+
function isEncargadoRole(roleName) {
|
|
1811
|
+
return roleName === "Encargado";
|
|
1812
|
+
}
|
|
1813
|
+
function canAccessFeature(userRole, allowedRoles) {
|
|
1814
|
+
if (!userRole) return false;
|
|
1815
|
+
if (userRole === "OWNER") return true;
|
|
1816
|
+
return allowedRoles.includes(userRole);
|
|
1817
|
+
}
|
|
1818
|
+
function getRoleDisplayName(roleName) {
|
|
1819
|
+
if (!roleName) return "";
|
|
1820
|
+
switch (roleName) {
|
|
1821
|
+
case "Admin":
|
|
1822
|
+
return "Administrador";
|
|
1823
|
+
case "Encargado":
|
|
1824
|
+
return "Encargado";
|
|
1825
|
+
case "OWNER":
|
|
1826
|
+
return "Propietario";
|
|
1827
|
+
default:
|
|
1828
|
+
return roleName;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
function getRoleDescription(roleName) {
|
|
1832
|
+
if (!roleName) return "";
|
|
1833
|
+
switch (roleName) {
|
|
1834
|
+
case "Admin":
|
|
1835
|
+
return "Acceso completo a todas las funcionalidades del gimnasio, gesti\xF3n de colaboradores y configuraci\xF3n";
|
|
1836
|
+
case "Encargado":
|
|
1837
|
+
return "Gesti\xF3n diaria del gimnasio: clientes, contratos, check-ins y reportes";
|
|
1838
|
+
case "OWNER":
|
|
1839
|
+
return "Acceso completo a todas las funcionalidades, organizaci\xF3n y suscripci\xF3n";
|
|
1840
|
+
default:
|
|
1841
|
+
return "";
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
function getRoleCapabilities(roleName) {
|
|
1845
|
+
if (!roleName) return [];
|
|
1846
|
+
switch (roleName) {
|
|
1847
|
+
case "OWNER":
|
|
1848
|
+
return [
|
|
1849
|
+
"Acceso completo a todas las funcionalidades",
|
|
1850
|
+
"Gesti\xF3n de organizaci\xF3n",
|
|
1851
|
+
"Gesti\xF3n de suscripci\xF3n y facturaci\xF3n",
|
|
1852
|
+
"Gesti\xF3n completa de clientes",
|
|
1853
|
+
"Gesti\xF3n completa de contratos",
|
|
1854
|
+
"Gesti\xF3n de colaboradores",
|
|
1855
|
+
"Configuraci\xF3n del gimnasio",
|
|
1856
|
+
"Gesti\xF3n de planes",
|
|
1857
|
+
"Gesti\xF3n de proveedores",
|
|
1858
|
+
"Gesti\xF3n de m\xE9todos de pago",
|
|
1859
|
+
"Reportes y estad\xEDsticas",
|
|
1860
|
+
"Gesti\xF3n de inventario",
|
|
1861
|
+
"Check-ins"
|
|
1862
|
+
];
|
|
1863
|
+
case "Admin":
|
|
1864
|
+
return [
|
|
1865
|
+
"Gesti\xF3n completa de clientes",
|
|
1866
|
+
"Gesti\xF3n completa de contratos",
|
|
1867
|
+
"Gesti\xF3n de colaboradores",
|
|
1868
|
+
"Configuraci\xF3n del gimnasio",
|
|
1869
|
+
"Gesti\xF3n de planes",
|
|
1870
|
+
"Gesti\xF3n de proveedores",
|
|
1871
|
+
"Gesti\xF3n de m\xE9todos de pago",
|
|
1872
|
+
"Reportes y estad\xEDsticas",
|
|
1873
|
+
"Gesti\xF3n de inventario",
|
|
1874
|
+
"Check-ins"
|
|
1875
|
+
];
|
|
1876
|
+
case "Encargado":
|
|
1877
|
+
return [
|
|
1878
|
+
"Gesti\xF3n de clientes (ver, crear, editar)",
|
|
1879
|
+
"Creaci\xF3n y renovaci\xF3n de contratos",
|
|
1880
|
+
"Check-ins",
|
|
1881
|
+
"Ver reportes",
|
|
1882
|
+
"Gesti\xF3n de inventario",
|
|
1883
|
+
"Ventas"
|
|
1884
|
+
];
|
|
1885
|
+
default:
|
|
1886
|
+
return [];
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1581
1889
|
|
|
1582
1890
|
// src/models/onboarding.ts
|
|
1583
1891
|
var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
|
|
@@ -1601,6 +1909,7 @@ exports.CheckInsResource = CheckInsResource;
|
|
|
1601
1909
|
exports.ClientStatus = ClientStatus;
|
|
1602
1910
|
exports.ClientsResource = ClientsResource;
|
|
1603
1911
|
exports.CollaboratorStatus = CollaboratorStatus;
|
|
1912
|
+
exports.CollaboratorsResource = CollaboratorsResource;
|
|
1604
1913
|
exports.CommentType = CommentType;
|
|
1605
1914
|
exports.ContractAssetType = ContractAssetType;
|
|
1606
1915
|
exports.ContractStatus = ContractStatus;
|
|
@@ -1636,7 +1945,10 @@ exports.PaymentMethodsResource = PaymentMethodsResource;
|
|
|
1636
1945
|
exports.PlanStatus = PlanStatus;
|
|
1637
1946
|
exports.ProductsResource = ProductsResource;
|
|
1638
1947
|
exports.PublicCatalogResource = PublicCatalogResource;
|
|
1948
|
+
exports.ROLE_NAMES = ROLE_NAMES;
|
|
1639
1949
|
exports.ROLE_PERMISSIONS = ROLE_PERMISSIONS;
|
|
1950
|
+
exports.RoleNames = RoleNames;
|
|
1951
|
+
exports.RolesResource = RolesResource;
|
|
1640
1952
|
exports.SalesResource = SalesResource;
|
|
1641
1953
|
exports.SubscriptionPlansResource = SubscriptionPlansResource;
|
|
1642
1954
|
exports.SubscriptionStatus = SubscriptionStatus;
|
|
@@ -1645,5 +1957,13 @@ exports.SuppliersResource = SuppliersResource;
|
|
|
1645
1957
|
exports.UserType = UserType;
|
|
1646
1958
|
exports.UsersResource = UsersResource;
|
|
1647
1959
|
exports.ValidationError = ValidationError;
|
|
1960
|
+
exports.WhatsAppResource = WhatsAppResource;
|
|
1961
|
+
exports.WhatsAppTemplatesResource = WhatsAppTemplatesResource;
|
|
1962
|
+
exports.canAccessFeature = canAccessFeature;
|
|
1963
|
+
exports.getRoleCapabilities = getRoleCapabilities;
|
|
1964
|
+
exports.getRoleDescription = getRoleDescription;
|
|
1965
|
+
exports.getRoleDisplayName = getRoleDisplayName;
|
|
1966
|
+
exports.isAdminRole = isAdminRole;
|
|
1967
|
+
exports.isEncargadoRole = isEncargadoRole;
|
|
1648
1968
|
//# sourceMappingURL=index.js.map
|
|
1649
1969
|
//# sourceMappingURL=index.js.map
|