@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.mjs
CHANGED
|
@@ -188,6 +188,26 @@ var ApiClient = class {
|
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
+
// src/utils/agent-fetch.ts
|
|
192
|
+
function createAgentFetch(apiClient, customFetch) {
|
|
193
|
+
const fetchFn = customFetch || fetch;
|
|
194
|
+
return async (path, options) => {
|
|
195
|
+
const fullUrl = `${apiClient.getBaseUrl()}/agent${path}`;
|
|
196
|
+
const axiosInstance = apiClient.axiosInstance;
|
|
197
|
+
const gymId = axiosInstance?.defaults?.headers?.common?.["X-Gym-Id"];
|
|
198
|
+
const headers = {
|
|
199
|
+
"Content-Type": "application/json",
|
|
200
|
+
...apiClient.getAccessToken() && { Authorization: `Bearer ${apiClient.getAccessToken()}` },
|
|
201
|
+
...gymId && { "X-Gym-Id": gymId },
|
|
202
|
+
...options?.headers || {}
|
|
203
|
+
};
|
|
204
|
+
return fetchFn(fullUrl, {
|
|
205
|
+
...options,
|
|
206
|
+
headers
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
191
211
|
// src/resources/base.ts
|
|
192
212
|
var BaseResource = class {
|
|
193
213
|
constructor(client) {
|
|
@@ -365,6 +385,61 @@ var GymsResource = class extends BaseResource {
|
|
|
365
385
|
}
|
|
366
386
|
};
|
|
367
387
|
|
|
388
|
+
// src/resources/collaborators.ts
|
|
389
|
+
var CollaboratorsResource = class extends BaseResource {
|
|
390
|
+
constructor() {
|
|
391
|
+
super(...arguments);
|
|
392
|
+
this.basePath = "collaborators";
|
|
393
|
+
}
|
|
394
|
+
async list(params, options) {
|
|
395
|
+
return this.paginate(this.basePath, params, options);
|
|
396
|
+
}
|
|
397
|
+
async get(id, options) {
|
|
398
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
399
|
+
}
|
|
400
|
+
async update(id, data, options) {
|
|
401
|
+
return this.client.patch(`${this.basePath}/${id}`, data, options);
|
|
402
|
+
}
|
|
403
|
+
async updateRole(id, data, options) {
|
|
404
|
+
return this.client.patch(`${this.basePath}/${id}/role`, data, options);
|
|
405
|
+
}
|
|
406
|
+
async updateStatus(id, data, options) {
|
|
407
|
+
return this.client.patch(`${this.basePath}/${id}/status`, data, options);
|
|
408
|
+
}
|
|
409
|
+
async getActivity(id, params, options) {
|
|
410
|
+
return this.client.get(`${this.basePath}/${id}/activity`, params, options);
|
|
411
|
+
}
|
|
412
|
+
async getStats(id, params, options) {
|
|
413
|
+
return this.client.get(`${this.basePath}/${id}/stats`, params, options);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// src/resources/roles.ts
|
|
418
|
+
var RolesResource = class extends BaseResource {
|
|
419
|
+
constructor() {
|
|
420
|
+
super(...arguments);
|
|
421
|
+
this.basePath = "roles";
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Get all roles of the organization (without pagination)
|
|
425
|
+
*/
|
|
426
|
+
async getRoles(options) {
|
|
427
|
+
return this.client.get(this.basePath, void 0, options);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Get a specific role by ID
|
|
431
|
+
*/
|
|
432
|
+
async getRole(id, options) {
|
|
433
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Get all available permissions organized by category
|
|
437
|
+
*/
|
|
438
|
+
async getAvailablePermissions(options) {
|
|
439
|
+
return this.client.get(`${this.basePath}/permissions`, void 0, options);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
368
443
|
// src/resources/clients.ts
|
|
369
444
|
var ClientsResource = class extends BaseResource {
|
|
370
445
|
constructor() {
|
|
@@ -375,7 +450,7 @@ var ClientsResource = class extends BaseResource {
|
|
|
375
450
|
return this.client.post(this.basePath, data, options);
|
|
376
451
|
}
|
|
377
452
|
async searchClients(params, options) {
|
|
378
|
-
return this.
|
|
453
|
+
return this.client.get(this.basePath, params, options);
|
|
379
454
|
}
|
|
380
455
|
async getClient(id, options) {
|
|
381
456
|
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
@@ -390,20 +465,24 @@ var ClientsResource = class extends BaseResource {
|
|
|
390
465
|
return this.client.get(`${this.basePath}/${id}/stats`, void 0, options);
|
|
391
466
|
}
|
|
392
467
|
async getClientStat(id, statKey, options) {
|
|
393
|
-
return this.client.get(
|
|
468
|
+
return this.client.get(
|
|
469
|
+
`${this.basePath}/${id}/stats/${statKey}`,
|
|
470
|
+
void 0,
|
|
471
|
+
options
|
|
472
|
+
);
|
|
394
473
|
}
|
|
395
474
|
async getClientStatsByCategory(id, category, options) {
|
|
396
|
-
return this.client.get(
|
|
475
|
+
return this.client.get(
|
|
476
|
+
`${this.basePath}/${id}/stats/category/${category}`,
|
|
477
|
+
void 0,
|
|
478
|
+
options
|
|
479
|
+
);
|
|
397
480
|
}
|
|
398
481
|
async getAvailableStats(options) {
|
|
399
482
|
return this.client.get(`${this.basePath}/stats/available`, void 0, options);
|
|
400
483
|
}
|
|
401
484
|
async searchClientsForCheckIn(params, options) {
|
|
402
|
-
return this.client.get(
|
|
403
|
-
`${this.basePath}/search/check-in`,
|
|
404
|
-
params,
|
|
405
|
-
options
|
|
406
|
-
);
|
|
485
|
+
return this.client.get(`${this.basePath}/search/check-in`, params, options);
|
|
407
486
|
}
|
|
408
487
|
};
|
|
409
488
|
|
|
@@ -453,11 +532,7 @@ var ContractsResource = class extends BaseResource {
|
|
|
453
532
|
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
454
533
|
}
|
|
455
534
|
async getClientContracts(clientId, options) {
|
|
456
|
-
return this.client.get(
|
|
457
|
-
`${this.basePath}/client/${clientId}`,
|
|
458
|
-
void 0,
|
|
459
|
-
options
|
|
460
|
-
);
|
|
535
|
+
return this.client.get(`${this.basePath}/client/${clientId}`, void 0, options);
|
|
461
536
|
}
|
|
462
537
|
async renewContract(id, data, options) {
|
|
463
538
|
return this.client.post(`${this.basePath}/${id}/renew`, data, options);
|
|
@@ -468,6 +543,13 @@ var ContractsResource = class extends BaseResource {
|
|
|
468
543
|
async cancelContract(id, data, options) {
|
|
469
544
|
return this.client.put(`${this.basePath}/${id}/cancel`, data, options);
|
|
470
545
|
}
|
|
546
|
+
async resendWhatsAppNotification(contractId, options) {
|
|
547
|
+
return this.client.post(
|
|
548
|
+
`${this.basePath}/${contractId}/resend-whatsapp`,
|
|
549
|
+
{},
|
|
550
|
+
options
|
|
551
|
+
);
|
|
552
|
+
}
|
|
471
553
|
};
|
|
472
554
|
|
|
473
555
|
// src/resources/dashboard.ts
|
|
@@ -619,8 +701,11 @@ var InvitationsResource = class extends BaseResource {
|
|
|
619
701
|
async getGymInvitations(params, options) {
|
|
620
702
|
return this.client.get(this.basePath, params, options);
|
|
621
703
|
}
|
|
622
|
-
async
|
|
623
|
-
return this.client.post(`${this.basePath}
|
|
704
|
+
async validateByCode(data, options) {
|
|
705
|
+
return this.client.post(`${this.basePath}/validate-by-code`, data, options);
|
|
706
|
+
}
|
|
707
|
+
async acceptInvitation(data, options) {
|
|
708
|
+
return this.client.post(`${this.basePath}/accept`, data, options);
|
|
624
709
|
}
|
|
625
710
|
async cancelInvitation(id, options) {
|
|
626
711
|
return this.client.put(`${this.basePath}/${id}/cancel`, void 0, options);
|
|
@@ -966,7 +1051,11 @@ var SalesResource = class extends BaseResource {
|
|
|
966
1051
|
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
967
1052
|
}
|
|
968
1053
|
async updatePaymentStatus(id, paymentStatus, options) {
|
|
969
|
-
return this.client.put(
|
|
1054
|
+
return this.client.put(
|
|
1055
|
+
`${this.basePath}/${id}/payment-status`,
|
|
1056
|
+
{ paymentStatus },
|
|
1057
|
+
options
|
|
1058
|
+
);
|
|
970
1059
|
}
|
|
971
1060
|
async paySale(id, data, options) {
|
|
972
1061
|
return this.client.post(`${this.basePath}/${id}/payment`, data, options);
|
|
@@ -988,11 +1077,7 @@ var SalesResource = class extends BaseResource {
|
|
|
988
1077
|
const params = { limit };
|
|
989
1078
|
if (startDate) params.startDate = startDate;
|
|
990
1079
|
if (endDate) params.endDate = endDate;
|
|
991
|
-
return this.client.get(
|
|
992
|
-
`${this.basePath}/top-products`,
|
|
993
|
-
params,
|
|
994
|
-
options
|
|
995
|
-
);
|
|
1080
|
+
return this.client.get(`${this.basePath}/top-products`, params, options);
|
|
996
1081
|
}
|
|
997
1082
|
async getSalesByCustomer(startDate, endDate, options) {
|
|
998
1083
|
const params = {};
|
|
@@ -1004,6 +1089,13 @@ var SalesResource = class extends BaseResource {
|
|
|
1004
1089
|
options
|
|
1005
1090
|
);
|
|
1006
1091
|
}
|
|
1092
|
+
async resendWhatsAppNotification(saleId, options) {
|
|
1093
|
+
return this.client.post(
|
|
1094
|
+
`${this.basePath}/${saleId}/resend-whatsapp`,
|
|
1095
|
+
{},
|
|
1096
|
+
options
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1007
1099
|
};
|
|
1008
1100
|
|
|
1009
1101
|
// src/resources/suppliers.ts
|
|
@@ -1214,6 +1306,129 @@ var PaymentMethodsResource = class extends BaseResource {
|
|
|
1214
1306
|
}
|
|
1215
1307
|
};
|
|
1216
1308
|
|
|
1309
|
+
// src/resources/whatsapp.ts
|
|
1310
|
+
var WhatsAppResource = class extends BaseResource {
|
|
1311
|
+
constructor() {
|
|
1312
|
+
super(...arguments);
|
|
1313
|
+
this.basePath = "whatsapp";
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Get WhatsApp configuration for the current gym
|
|
1317
|
+
*/
|
|
1318
|
+
async getConfig(options) {
|
|
1319
|
+
return this.client.get(`${this.basePath}/config`, void 0, options);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Initialize WhatsApp connection
|
|
1323
|
+
* Returns QR code if needed
|
|
1324
|
+
*/
|
|
1325
|
+
async initializeConnection(options) {
|
|
1326
|
+
return this.client.post(
|
|
1327
|
+
`${this.basePath}/initialize`,
|
|
1328
|
+
{},
|
|
1329
|
+
options
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Update WhatsApp configuration
|
|
1334
|
+
*/
|
|
1335
|
+
async updateConfig(data, options) {
|
|
1336
|
+
return this.client.put(`${this.basePath}/config`, data, options);
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Get WhatsApp connection status
|
|
1340
|
+
*/
|
|
1341
|
+
async getConnectionStatus(options) {
|
|
1342
|
+
return this.client.get(
|
|
1343
|
+
`${this.basePath}/connection-status`,
|
|
1344
|
+
void 0,
|
|
1345
|
+
options
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Send a WhatsApp message
|
|
1350
|
+
*/
|
|
1351
|
+
async sendMessage(data, options) {
|
|
1352
|
+
return this.client.post(`${this.basePath}/send-message`, data, options);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Get WhatsApp messages with pagination and filters
|
|
1356
|
+
*/
|
|
1357
|
+
async getMessages(params, options) {
|
|
1358
|
+
return this.paginate(`${this.basePath}/messages`, params, options);
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Get a specific WhatsApp message by ID
|
|
1362
|
+
*/
|
|
1363
|
+
async getMessage(id, options) {
|
|
1364
|
+
return this.client.get(`${this.basePath}/messages/${id}`, void 0, options);
|
|
1365
|
+
}
|
|
1366
|
+
async listContacts(options) {
|
|
1367
|
+
return this.client.get(`${this.basePath}/contacts`, void 0, options);
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Disconnect WhatsApp instance
|
|
1371
|
+
* Logs out from WhatsApp without deleting the instance
|
|
1372
|
+
*/
|
|
1373
|
+
async disconnect(options) {
|
|
1374
|
+
return this.client.post(`${this.basePath}/disconnect`, {}, options);
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
// src/resources/whatsapp-templates.ts
|
|
1379
|
+
var WhatsAppTemplatesResource = class extends BaseResource {
|
|
1380
|
+
constructor() {
|
|
1381
|
+
super(...arguments);
|
|
1382
|
+
this.basePath = "whatsapp/templates";
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Create a new WhatsApp template
|
|
1386
|
+
*/
|
|
1387
|
+
async create(data, options) {
|
|
1388
|
+
return this.client.post(this.basePath, data, options);
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Get all WhatsApp templates with pagination and filters
|
|
1392
|
+
*/
|
|
1393
|
+
async findAll(params, options) {
|
|
1394
|
+
return this.paginate(this.basePath, params, options);
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Get a specific WhatsApp template by ID
|
|
1398
|
+
*/
|
|
1399
|
+
async findOne(id, options) {
|
|
1400
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Get a WhatsApp template by code
|
|
1404
|
+
*/
|
|
1405
|
+
async findByCode(code, options) {
|
|
1406
|
+
return this.client.get(`${this.basePath}/code/${code}`, void 0, options);
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Update a WhatsApp template
|
|
1410
|
+
*/
|
|
1411
|
+
async update(id, data, options) {
|
|
1412
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Delete a WhatsApp template
|
|
1416
|
+
*/
|
|
1417
|
+
async remove(id, options) {
|
|
1418
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Preview a template with variables
|
|
1422
|
+
*/
|
|
1423
|
+
async preview(id, variables, options) {
|
|
1424
|
+
return this.client.post(
|
|
1425
|
+
`${this.basePath}/${id}/preview`,
|
|
1426
|
+
variables,
|
|
1427
|
+
options
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1217
1432
|
// src/sdk.ts
|
|
1218
1433
|
var GymSpaceSdk = class {
|
|
1219
1434
|
constructor(config) {
|
|
@@ -1221,6 +1436,8 @@ var GymSpaceSdk = class {
|
|
|
1221
1436
|
this.auth = new AuthResource(this.client);
|
|
1222
1437
|
this.organizations = new OrganizationsResource(this.client);
|
|
1223
1438
|
this.gyms = new GymsResource(this.client);
|
|
1439
|
+
this.collaborators = new CollaboratorsResource(this.client);
|
|
1440
|
+
this.roles = new RolesResource(this.client);
|
|
1224
1441
|
this.clients = new ClientsResource(this.client);
|
|
1225
1442
|
this.membershipPlans = new MembershipPlansResource(this.client);
|
|
1226
1443
|
this.contracts = new ContractsResource(this.client);
|
|
@@ -1242,6 +1459,8 @@ var GymSpaceSdk = class {
|
|
|
1242
1459
|
this.subscriptionPlans = new SubscriptionPlansResource(this.client);
|
|
1243
1460
|
this.adminSubscriptionManagement = new AdminSubscriptionManagementResource(this.client);
|
|
1244
1461
|
this.paymentMethods = new PaymentMethodsResource(this.client);
|
|
1462
|
+
this.whatsapp = new WhatsAppResource(this.client);
|
|
1463
|
+
this.whatsappTemplates = new WhatsAppTemplatesResource(this.client);
|
|
1245
1464
|
}
|
|
1246
1465
|
/**
|
|
1247
1466
|
* Set the authentication token
|
|
@@ -1273,6 +1492,21 @@ var GymSpaceSdk = class {
|
|
|
1273
1492
|
clearAuth() {
|
|
1274
1493
|
this.client.clearAuth();
|
|
1275
1494
|
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Set Expo fetch for React Native environments
|
|
1497
|
+
* Should be called once during app initialization
|
|
1498
|
+
*/
|
|
1499
|
+
setExpoFetch(fetchFn) {
|
|
1500
|
+
this.expoFetch = fetchFn;
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Create a fetch function for agent endpoints
|
|
1504
|
+
* Uses the /agent/* proxy that includes request context
|
|
1505
|
+
* Automatically uses Expo fetch if set
|
|
1506
|
+
*/
|
|
1507
|
+
createAgentFetch() {
|
|
1508
|
+
return createAgentFetch(this.client, this.expoFetch);
|
|
1509
|
+
}
|
|
1276
1510
|
/**
|
|
1277
1511
|
* Get the underlying API client
|
|
1278
1512
|
*/
|
|
@@ -1304,6 +1538,7 @@ var CollaboratorStatus = /* @__PURE__ */ ((CollaboratorStatus2) => {
|
|
|
1304
1538
|
var InvitationStatus = /* @__PURE__ */ ((InvitationStatus2) => {
|
|
1305
1539
|
InvitationStatus2["PENDING"] = "pending";
|
|
1306
1540
|
InvitationStatus2["ACCEPTED"] = "accepted";
|
|
1541
|
+
InvitationStatus2["CANCELLED"] = "cancelled";
|
|
1307
1542
|
InvitationStatus2["EXPIRED"] = "expired";
|
|
1308
1543
|
return InvitationStatus2;
|
|
1309
1544
|
})(InvitationStatus || {});
|
|
@@ -1473,10 +1708,14 @@ var PERMISSIONS = {
|
|
|
1473
1708
|
PAYMENT_METHODS_CREATE: "PAYMENT_METHODS_CREATE",
|
|
1474
1709
|
PAYMENT_METHODS_READ: "PAYMENT_METHODS_READ",
|
|
1475
1710
|
PAYMENT_METHODS_UPDATE: "PAYMENT_METHODS_UPDATE",
|
|
1476
|
-
PAYMENT_METHODS_DELETE: "PAYMENT_METHODS_DELETE"
|
|
1711
|
+
PAYMENT_METHODS_DELETE: "PAYMENT_METHODS_DELETE",
|
|
1712
|
+
// Special permissions
|
|
1713
|
+
SUPER_ADMIN: "SUPER_ADMIN",
|
|
1714
|
+
OWNER: "OWNER",
|
|
1715
|
+
All: "ALL"
|
|
1477
1716
|
};
|
|
1478
1717
|
var ROLE_PERMISSIONS = {
|
|
1479
|
-
|
|
1718
|
+
ADMIN: Object.values(PERMISSIONS),
|
|
1480
1719
|
MANAGER: [
|
|
1481
1720
|
PERMISSIONS.GYMS_READ,
|
|
1482
1721
|
PERMISSIONS.COLLABORATORS_READ,
|
|
@@ -1516,26 +1755,6 @@ var ROLE_PERMISSIONS = {
|
|
|
1516
1755
|
PERMISSIONS.PAYMENT_METHODS_READ,
|
|
1517
1756
|
PERMISSIONS.PAYMENT_METHODS_UPDATE,
|
|
1518
1757
|
PERMISSIONS.PAYMENT_METHODS_DELETE
|
|
1519
|
-
],
|
|
1520
|
-
STAFF: [
|
|
1521
|
-
PERMISSIONS.CLIENTS_READ,
|
|
1522
|
-
PERMISSIONS.CHECKINS_CREATE,
|
|
1523
|
-
PERMISSIONS.CHECKINS_READ,
|
|
1524
|
-
PERMISSIONS.PRODUCTS_READ,
|
|
1525
|
-
PERMISSIONS.PRODUCT_CATEGORIES_READ,
|
|
1526
|
-
PERMISSIONS.SALES_CREATE,
|
|
1527
|
-
PERMISSIONS.SALES_READ,
|
|
1528
|
-
PERMISSIONS.PAYMENT_METHODS_READ
|
|
1529
|
-
],
|
|
1530
|
-
ADVISOR: [
|
|
1531
|
-
PERMISSIONS.CLIENTS_READ,
|
|
1532
|
-
PERMISSIONS.EVALUATIONS_CREATE,
|
|
1533
|
-
PERMISSIONS.EVALUATIONS_READ,
|
|
1534
|
-
PERMISSIONS.EVALUATIONS_UPDATE,
|
|
1535
|
-
PERMISSIONS.ASSETS_CREATE,
|
|
1536
|
-
PERMISSIONS.ASSETS_READ,
|
|
1537
|
-
PERMISSIONS.FILES_CREATE,
|
|
1538
|
-
PERMISSIONS.FILES_READ
|
|
1539
1758
|
]
|
|
1540
1759
|
};
|
|
1541
1760
|
var CACHE_TTL = {
|
|
@@ -1572,6 +1791,95 @@ var HEADERS = {
|
|
|
1572
1791
|
GYM_ID: "X-Gym-Id",
|
|
1573
1792
|
REQUEST_ID: "X-Request-Id"
|
|
1574
1793
|
};
|
|
1794
|
+
var RoleNames = /* @__PURE__ */ ((RoleNames2) => {
|
|
1795
|
+
RoleNames2["ADMIN"] = "Admin";
|
|
1796
|
+
RoleNames2["ENCARGADO"] = "Encargado";
|
|
1797
|
+
RoleNames2["OWNER"] = "OWNER";
|
|
1798
|
+
return RoleNames2;
|
|
1799
|
+
})(RoleNames || {});
|
|
1800
|
+
var ROLE_NAMES = RoleNames;
|
|
1801
|
+
function isAdminRole(roleName) {
|
|
1802
|
+
return roleName === "Admin";
|
|
1803
|
+
}
|
|
1804
|
+
function isEncargadoRole(roleName) {
|
|
1805
|
+
return roleName === "Encargado";
|
|
1806
|
+
}
|
|
1807
|
+
function canAccessFeature(userRole, allowedRoles) {
|
|
1808
|
+
if (!userRole) return false;
|
|
1809
|
+
if (userRole === "OWNER") return true;
|
|
1810
|
+
return allowedRoles.includes(userRole);
|
|
1811
|
+
}
|
|
1812
|
+
function getRoleDisplayName(roleName) {
|
|
1813
|
+
if (!roleName) return "";
|
|
1814
|
+
switch (roleName) {
|
|
1815
|
+
case "Admin":
|
|
1816
|
+
return "Administrador";
|
|
1817
|
+
case "Encargado":
|
|
1818
|
+
return "Encargado";
|
|
1819
|
+
case "OWNER":
|
|
1820
|
+
return "Propietario";
|
|
1821
|
+
default:
|
|
1822
|
+
return roleName;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
function getRoleDescription(roleName) {
|
|
1826
|
+
if (!roleName) return "";
|
|
1827
|
+
switch (roleName) {
|
|
1828
|
+
case "Admin":
|
|
1829
|
+
return "Acceso completo a todas las funcionalidades del gimnasio, gesti\xF3n de colaboradores y configuraci\xF3n";
|
|
1830
|
+
case "Encargado":
|
|
1831
|
+
return "Gesti\xF3n diaria del gimnasio: clientes, contratos, check-ins y reportes";
|
|
1832
|
+
case "OWNER":
|
|
1833
|
+
return "Acceso completo a todas las funcionalidades, organizaci\xF3n y suscripci\xF3n";
|
|
1834
|
+
default:
|
|
1835
|
+
return "";
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
function getRoleCapabilities(roleName) {
|
|
1839
|
+
if (!roleName) return [];
|
|
1840
|
+
switch (roleName) {
|
|
1841
|
+
case "OWNER":
|
|
1842
|
+
return [
|
|
1843
|
+
"Acceso completo a todas las funcionalidades",
|
|
1844
|
+
"Gesti\xF3n de organizaci\xF3n",
|
|
1845
|
+
"Gesti\xF3n de suscripci\xF3n y facturaci\xF3n",
|
|
1846
|
+
"Gesti\xF3n completa de clientes",
|
|
1847
|
+
"Gesti\xF3n completa de contratos",
|
|
1848
|
+
"Gesti\xF3n de colaboradores",
|
|
1849
|
+
"Configuraci\xF3n del gimnasio",
|
|
1850
|
+
"Gesti\xF3n de planes",
|
|
1851
|
+
"Gesti\xF3n de proveedores",
|
|
1852
|
+
"Gesti\xF3n de m\xE9todos de pago",
|
|
1853
|
+
"Reportes y estad\xEDsticas",
|
|
1854
|
+
"Gesti\xF3n de inventario",
|
|
1855
|
+
"Check-ins"
|
|
1856
|
+
];
|
|
1857
|
+
case "Admin":
|
|
1858
|
+
return [
|
|
1859
|
+
"Gesti\xF3n completa de clientes",
|
|
1860
|
+
"Gesti\xF3n completa de contratos",
|
|
1861
|
+
"Gesti\xF3n de colaboradores",
|
|
1862
|
+
"Configuraci\xF3n del gimnasio",
|
|
1863
|
+
"Gesti\xF3n de planes",
|
|
1864
|
+
"Gesti\xF3n de proveedores",
|
|
1865
|
+
"Gesti\xF3n de m\xE9todos de pago",
|
|
1866
|
+
"Reportes y estad\xEDsticas",
|
|
1867
|
+
"Gesti\xF3n de inventario",
|
|
1868
|
+
"Check-ins"
|
|
1869
|
+
];
|
|
1870
|
+
case "Encargado":
|
|
1871
|
+
return [
|
|
1872
|
+
"Gesti\xF3n de clientes (ver, crear, editar)",
|
|
1873
|
+
"Creaci\xF3n y renovaci\xF3n de contratos",
|
|
1874
|
+
"Check-ins",
|
|
1875
|
+
"Ver reportes",
|
|
1876
|
+
"Gesti\xF3n de inventario",
|
|
1877
|
+
"Ventas"
|
|
1878
|
+
];
|
|
1879
|
+
default:
|
|
1880
|
+
return [];
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1575
1883
|
|
|
1576
1884
|
// src/models/onboarding.ts
|
|
1577
1885
|
var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
|
|
@@ -1582,6 +1890,6 @@ var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
|
|
|
1582
1890
|
return OnboardingStep2;
|
|
1583
1891
|
})(OnboardingStep || {});
|
|
1584
1892
|
|
|
1585
|
-
export { AdminSubscriptionManagementResource, ApiClient, AssetCategory, AssetStatus, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, CACHE_TTL, CheckInsResource, ClientStatus, ClientsResource, CollaboratorStatus, CommentType, ContractAssetType, ContractStatus, ContractsResource, DATE_FORMATS, DashboardResource, EvaluationAssetCategory, EvaluationAssetStage, EvaluationStatus, EvaluationType, EvaluationsResource, FILE_LIMITS, FilesResource, GymSpaceError, GymSpaceSdk, GymsResource, HEADERS, HealthResource, InvitationStatus, InvitationsResource, LeadStatus, LeadsResource, MembershipPlansResource, NetworkError, NotFoundError, OnboardingResource, OnboardingStep, OrganizationsResource, PAGINATION_DEFAULTS, PERMISSIONS, PaymentFrequency, PaymentMethodsResource, PlanStatus, ProductsResource, PublicCatalogResource, ROLE_PERMISSIONS, SalesResource, SubscriptionPlansResource, SubscriptionStatus, SubscriptionsResource, SuppliersResource, UserType, UsersResource, ValidationError };
|
|
1893
|
+
export { AdminSubscriptionManagementResource, ApiClient, AssetCategory, AssetStatus, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, CACHE_TTL, CheckInsResource, ClientStatus, ClientsResource, CollaboratorStatus, CollaboratorsResource, CommentType, ContractAssetType, ContractStatus, ContractsResource, DATE_FORMATS, DashboardResource, EvaluationAssetCategory, EvaluationAssetStage, EvaluationStatus, EvaluationType, EvaluationsResource, FILE_LIMITS, FilesResource, GymSpaceError, GymSpaceSdk, GymsResource, HEADERS, HealthResource, InvitationStatus, InvitationsResource, LeadStatus, LeadsResource, MembershipPlansResource, NetworkError, NotFoundError, OnboardingResource, OnboardingStep, OrganizationsResource, PAGINATION_DEFAULTS, PERMISSIONS, PaymentFrequency, PaymentMethodsResource, PlanStatus, ProductsResource, PublicCatalogResource, ROLE_NAMES, ROLE_PERMISSIONS, RoleNames, RolesResource, SalesResource, SubscriptionPlansResource, SubscriptionStatus, SubscriptionsResource, SuppliersResource, UserType, UsersResource, ValidationError, WhatsAppResource, WhatsAppTemplatesResource, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, isAdminRole, isEncargadoRole };
|
|
1586
1894
|
//# sourceMappingURL=index.mjs.map
|
|
1587
1895
|
//# sourceMappingURL=index.mjs.map
|