@gymspace/sdk 1.2.14 → 1.2.16
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 -1
- package/dist/index.d.mts +432 -1
- package/dist/index.d.ts +432 -1
- package/dist/index.js +272 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +264 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +26 -4
- package/src/models/clients.ts +13 -0
- package/src/models/commissions.ts +332 -0
- package/src/models/index.ts +1 -0
- package/src/resources/commission-calculations.ts +93 -0
- package/src/resources/commission-config.ts +66 -0
- package/src/resources/commission-promotions.ts +76 -0
- package/src/resources/commission-reports.ts +69 -0
- package/src/resources/commission-rules.ts +91 -0
- package/src/resources/index.ts +5 -0
- package/src/sdk.ts +15 -0
package/dist/index.mjs
CHANGED
|
@@ -55,6 +55,23 @@ var ApiClient = class {
|
|
|
55
55
|
headers: {
|
|
56
56
|
"Content-Type": "application/json",
|
|
57
57
|
...config.headers
|
|
58
|
+
},
|
|
59
|
+
paramsSerializer: (params) => {
|
|
60
|
+
const parts = [];
|
|
61
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
62
|
+
if (value === void 0 || value === null) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
if (value.length > 0) {
|
|
67
|
+
const encodedValues = value.map((v) => encodeURIComponent(String(v))).join(",");
|
|
68
|
+
parts.push(`${encodeURIComponent(key)}=${encodedValues}`);
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return parts.join("&");
|
|
58
75
|
}
|
|
59
76
|
});
|
|
60
77
|
this.setupInterceptors();
|
|
@@ -1700,6 +1717,221 @@ var TagsResource = class extends BaseResource {
|
|
|
1700
1717
|
}
|
|
1701
1718
|
};
|
|
1702
1719
|
|
|
1720
|
+
// src/resources/commission-config.ts
|
|
1721
|
+
var CommissionConfigResource = class extends BaseResource {
|
|
1722
|
+
constructor() {
|
|
1723
|
+
super(...arguments);
|
|
1724
|
+
this.basePath = "commissions/config";
|
|
1725
|
+
}
|
|
1726
|
+
async createConfig(data, options) {
|
|
1727
|
+
return this.client.post(this.basePath, data, options);
|
|
1728
|
+
}
|
|
1729
|
+
async getActiveConfig(options) {
|
|
1730
|
+
return this.client.get(`${this.basePath}/active`, void 0, options);
|
|
1731
|
+
}
|
|
1732
|
+
async getConfig(id, options) {
|
|
1733
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1734
|
+
}
|
|
1735
|
+
async listConfigs(params, options) {
|
|
1736
|
+
return this.paginate(this.basePath, params, options);
|
|
1737
|
+
}
|
|
1738
|
+
async updateConfig(id, data, options) {
|
|
1739
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1740
|
+
}
|
|
1741
|
+
async deactivateConfig(id, options) {
|
|
1742
|
+
return this.client.put(`${this.basePath}/${id}/deactivate`, {}, options);
|
|
1743
|
+
}
|
|
1744
|
+
async getConfigHistory(id, params, options) {
|
|
1745
|
+
return this.paginate(`${this.basePath}/${id}/history`, params, options);
|
|
1746
|
+
}
|
|
1747
|
+
async validateConfig(data, options) {
|
|
1748
|
+
return this.client.post(
|
|
1749
|
+
`${this.basePath}/validate`,
|
|
1750
|
+
data,
|
|
1751
|
+
options
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
// src/resources/commission-rules.ts
|
|
1757
|
+
var CommissionRulesResource = class extends BaseResource {
|
|
1758
|
+
constructor() {
|
|
1759
|
+
super(...arguments);
|
|
1760
|
+
this.basePath = "commissions/rules";
|
|
1761
|
+
}
|
|
1762
|
+
async createRule(data, options) {
|
|
1763
|
+
return this.client.post(this.basePath, data, options);
|
|
1764
|
+
}
|
|
1765
|
+
async getRule(id, options) {
|
|
1766
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1767
|
+
}
|
|
1768
|
+
async listRules(params, options) {
|
|
1769
|
+
return this.paginate(this.basePath, params, options);
|
|
1770
|
+
}
|
|
1771
|
+
async updateRule(id, data, options) {
|
|
1772
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1773
|
+
}
|
|
1774
|
+
async deleteRule(id, options) {
|
|
1775
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
1776
|
+
}
|
|
1777
|
+
async activateRule(id, options) {
|
|
1778
|
+
return this.client.put(`${this.basePath}/${id}/activate`, {}, options);
|
|
1779
|
+
}
|
|
1780
|
+
async deactivateRule(id, options) {
|
|
1781
|
+
return this.client.put(`${this.basePath}/${id}/deactivate`, {}, options);
|
|
1782
|
+
}
|
|
1783
|
+
async getRuleHistory(id, params, options) {
|
|
1784
|
+
return this.paginate(`${this.basePath}/${id}/history`, params, options);
|
|
1785
|
+
}
|
|
1786
|
+
async validateRule(data, options) {
|
|
1787
|
+
return this.client.post(
|
|
1788
|
+
`${this.basePath}/validate`,
|
|
1789
|
+
data,
|
|
1790
|
+
options
|
|
1791
|
+
);
|
|
1792
|
+
}
|
|
1793
|
+
async getMyRules(options) {
|
|
1794
|
+
return this.client.get(`${this.basePath}/me`, void 0, options);
|
|
1795
|
+
}
|
|
1796
|
+
async getApplicableRule(params, options) {
|
|
1797
|
+
return this.client.get(
|
|
1798
|
+
`${this.basePath}/applicable`,
|
|
1799
|
+
params,
|
|
1800
|
+
options
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
// src/resources/commission-calculations.ts
|
|
1806
|
+
var CommissionCalculationsResource = class extends BaseResource {
|
|
1807
|
+
constructor() {
|
|
1808
|
+
super(...arguments);
|
|
1809
|
+
this.basePath = "commissions/calculations";
|
|
1810
|
+
}
|
|
1811
|
+
async createCalculation(data, options) {
|
|
1812
|
+
return this.client.post(this.basePath, data, options);
|
|
1813
|
+
}
|
|
1814
|
+
async getCalculation(id, options) {
|
|
1815
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1816
|
+
}
|
|
1817
|
+
async getCalculations(params, options) {
|
|
1818
|
+
return this.paginate(this.basePath, params, options);
|
|
1819
|
+
}
|
|
1820
|
+
async getCollaboratorCalculations(collaboratorId, params, options) {
|
|
1821
|
+
return this.paginate(
|
|
1822
|
+
`${this.basePath}/collaborator/${collaboratorId}`,
|
|
1823
|
+
params,
|
|
1824
|
+
options
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
async confirmCalculation(id, data, options) {
|
|
1828
|
+
return this.client.put(
|
|
1829
|
+
`${this.basePath}/${id}/confirm`,
|
|
1830
|
+
data,
|
|
1831
|
+
options
|
|
1832
|
+
);
|
|
1833
|
+
}
|
|
1834
|
+
async reverseCalculation(id, data, options) {
|
|
1835
|
+
return this.client.put(
|
|
1836
|
+
`${this.basePath}/${id}/reverse`,
|
|
1837
|
+
data,
|
|
1838
|
+
options
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1841
|
+
async markAsPaid(id, data, options) {
|
|
1842
|
+
return this.client.put(`${this.basePath}/${id}/paid`, data, options);
|
|
1843
|
+
}
|
|
1844
|
+
async simulate(data, options) {
|
|
1845
|
+
return this.client.post("commissions/simulator", data, options);
|
|
1846
|
+
}
|
|
1847
|
+
async getMyCommissions(params, options) {
|
|
1848
|
+
return this.paginate("commissions/me", params, options);
|
|
1849
|
+
}
|
|
1850
|
+
async getMyCommissionsSummary(options) {
|
|
1851
|
+
return this.client.get("commissions/me/summary", void 0, options);
|
|
1852
|
+
}
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
// src/resources/commission-reports.ts
|
|
1856
|
+
var CommissionReportsResource = class extends BaseResource {
|
|
1857
|
+
constructor() {
|
|
1858
|
+
super(...arguments);
|
|
1859
|
+
this.basePath = "commissions/reports";
|
|
1860
|
+
}
|
|
1861
|
+
async getSummary(params, options) {
|
|
1862
|
+
return this.client.get(`${this.basePath}/summary`, params, options);
|
|
1863
|
+
}
|
|
1864
|
+
async getByRule(params, options) {
|
|
1865
|
+
return this.client.get(`${this.basePath}/by-rule`, params, options);
|
|
1866
|
+
}
|
|
1867
|
+
async getByCollaborator(params, options) {
|
|
1868
|
+
return this.client.get(
|
|
1869
|
+
`${this.basePath}/by-collaborator`,
|
|
1870
|
+
params,
|
|
1871
|
+
options
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1874
|
+
async getPromotionAnalytics(params, options) {
|
|
1875
|
+
return this.client.get(`${this.basePath}/promotions`, params, options);
|
|
1876
|
+
}
|
|
1877
|
+
async exportToCSV(params, options) {
|
|
1878
|
+
return this.client.get(`${this.basePath}/export/csv`, params, options);
|
|
1879
|
+
}
|
|
1880
|
+
async getTrends(params, options) {
|
|
1881
|
+
return this.client.get(
|
|
1882
|
+
`${this.basePath}/trends`,
|
|
1883
|
+
params,
|
|
1884
|
+
options
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
async getTopPerformers(params, options) {
|
|
1888
|
+
return this.client.get(
|
|
1889
|
+
`${this.basePath}/top-performers`,
|
|
1890
|
+
params,
|
|
1891
|
+
options
|
|
1892
|
+
);
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
|
|
1896
|
+
// src/resources/commission-promotions.ts
|
|
1897
|
+
var CommissionPromotionsResource = class extends BaseResource {
|
|
1898
|
+
constructor() {
|
|
1899
|
+
super(...arguments);
|
|
1900
|
+
this.basePath = "commissions/promotions";
|
|
1901
|
+
}
|
|
1902
|
+
async createPromotion(data, options) {
|
|
1903
|
+
return this.client.post(this.basePath, data, options);
|
|
1904
|
+
}
|
|
1905
|
+
async getPromotion(id, options) {
|
|
1906
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1907
|
+
}
|
|
1908
|
+
async listPromotions(params, options) {
|
|
1909
|
+
return this.paginate(this.basePath, params, options);
|
|
1910
|
+
}
|
|
1911
|
+
async updatePromotion(id, data, options) {
|
|
1912
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1913
|
+
}
|
|
1914
|
+
async deletePromotion(id, options) {
|
|
1915
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
1916
|
+
}
|
|
1917
|
+
async activatePromotion(id, options) {
|
|
1918
|
+
return this.client.put(`${this.basePath}/${id}/activate`, {}, options);
|
|
1919
|
+
}
|
|
1920
|
+
async deactivatePromotion(id, options) {
|
|
1921
|
+
return this.client.put(`${this.basePath}/${id}/deactivate`, {}, options);
|
|
1922
|
+
}
|
|
1923
|
+
async validatePromotion(data, options) {
|
|
1924
|
+
return this.client.post(
|
|
1925
|
+
`${this.basePath}/validate`,
|
|
1926
|
+
data,
|
|
1927
|
+
options
|
|
1928
|
+
);
|
|
1929
|
+
}
|
|
1930
|
+
async estimateImpact(id, options) {
|
|
1931
|
+
return this.client.get(`${this.basePath}/${id}/impact`, void 0, options);
|
|
1932
|
+
}
|
|
1933
|
+
};
|
|
1934
|
+
|
|
1703
1935
|
// src/sdk.ts
|
|
1704
1936
|
var GymSpaceSdk = class {
|
|
1705
1937
|
constructor(config) {
|
|
@@ -1733,6 +1965,11 @@ var GymSpaceSdk = class {
|
|
|
1733
1965
|
this.bulkMessaging = new BulkMessagingResource(this.client);
|
|
1734
1966
|
this.activities = new ActivitiesResource(this.client);
|
|
1735
1967
|
this.tags = new TagsResource(this.client);
|
|
1968
|
+
this.commissionConfig = new CommissionConfigResource(this.client);
|
|
1969
|
+
this.commissionRules = new CommissionRulesResource(this.client);
|
|
1970
|
+
this.commissionCalculations = new CommissionCalculationsResource(this.client);
|
|
1971
|
+
this.commissionReports = new CommissionReportsResource(this.client);
|
|
1972
|
+
this.commissionPromotions = new CommissionPromotionsResource(this.client);
|
|
1736
1973
|
}
|
|
1737
1974
|
/**
|
|
1738
1975
|
* Set the authentication token
|
|
@@ -2187,6 +2424,32 @@ var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
|
|
|
2187
2424
|
return OnboardingStep2;
|
|
2188
2425
|
})(OnboardingStep || {});
|
|
2189
2426
|
|
|
2190
|
-
|
|
2427
|
+
// src/models/commissions.ts
|
|
2428
|
+
var CommissionRuleType = /* @__PURE__ */ ((CommissionRuleType2) => {
|
|
2429
|
+
CommissionRuleType2["PLAN"] = "PLAN";
|
|
2430
|
+
CommissionRuleType2["AMOUNT"] = "AMOUNT";
|
|
2431
|
+
CommissionRuleType2["PROMOTION"] = "PROMOTION";
|
|
2432
|
+
return CommissionRuleType2;
|
|
2433
|
+
})(CommissionRuleType || {});
|
|
2434
|
+
var CommissionStatus = /* @__PURE__ */ ((CommissionStatus2) => {
|
|
2435
|
+
CommissionStatus2["PENDING"] = "PENDING";
|
|
2436
|
+
CommissionStatus2["CONFIRMED"] = "CONFIRMED";
|
|
2437
|
+
CommissionStatus2["PAID"] = "PAID";
|
|
2438
|
+
CommissionStatus2["REVERSED"] = "REVERSED";
|
|
2439
|
+
return CommissionStatus2;
|
|
2440
|
+
})(CommissionStatus || {});
|
|
2441
|
+
var CommissionChangeType = /* @__PURE__ */ ((CommissionChangeType2) => {
|
|
2442
|
+
CommissionChangeType2["CREATED"] = "CREATED";
|
|
2443
|
+
CommissionChangeType2["UPDATED"] = "UPDATED";
|
|
2444
|
+
CommissionChangeType2["DELETED"] = "DELETED";
|
|
2445
|
+
return CommissionChangeType2;
|
|
2446
|
+
})(CommissionChangeType || {});
|
|
2447
|
+
var CommissionEntityType = /* @__PURE__ */ ((CommissionEntityType2) => {
|
|
2448
|
+
CommissionEntityType2["CONFIG"] = "CONFIG";
|
|
2449
|
+
CommissionEntityType2["RULE"] = "RULE";
|
|
2450
|
+
return CommissionEntityType2;
|
|
2451
|
+
})(CommissionEntityType || {});
|
|
2452
|
+
|
|
2453
|
+
export { ActivitiesResource, AdminSubscriptionManagementResource, ApiClient, AssetCategory, AssetStatus, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, BulkMessagingResource, CACHE_TTL, CancellationReason, CheckInsResource, ClientStatus, ClientsResource, CollaboratorStatus, CollaboratorsResource, CommentType, CommissionCalculationsResource, CommissionChangeType, CommissionConfigResource, CommissionEntityType, CommissionPromotionsResource, CommissionReportsResource, CommissionRuleType, CommissionRulesResource, CommissionStatus, ContractAssetType, ContractStatus, ContractsResource, DATE_FORMATS, DashboardResource, EvaluationAssetCategory, EvaluationAssetStage, EvaluationStatus, EvaluationType, FILE_LIMITS, FilesResource, GymSpaceError, GymSpaceSdk, GymsResource, HEADERS, HealthResource, InvitationStatus, InvitationsResource, LeadStatus, 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, SuspensionType, TagsResource, UserType, UsersResource, ValidationError, WhatsAppResource, WhatsAppTemplatesResource, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, isAdminRole, isEncargadoRole };
|
|
2191
2454
|
//# sourceMappingURL=index.mjs.map
|
|
2192
2455
|
//# sourceMappingURL=index.mjs.map
|