@gymspace/sdk 1.2.15 → 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.js
CHANGED
|
@@ -61,6 +61,23 @@ var ApiClient = class {
|
|
|
61
61
|
headers: {
|
|
62
62
|
"Content-Type": "application/json",
|
|
63
63
|
...config.headers
|
|
64
|
+
},
|
|
65
|
+
paramsSerializer: (params) => {
|
|
66
|
+
const parts = [];
|
|
67
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
68
|
+
if (value === void 0 || value === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
if (value.length > 0) {
|
|
73
|
+
const encodedValues = value.map((v) => encodeURIComponent(String(v))).join(",");
|
|
74
|
+
parts.push(`${encodeURIComponent(key)}=${encodedValues}`);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return parts.join("&");
|
|
64
81
|
}
|
|
65
82
|
});
|
|
66
83
|
this.setupInterceptors();
|
|
@@ -1706,6 +1723,221 @@ var TagsResource = class extends BaseResource {
|
|
|
1706
1723
|
}
|
|
1707
1724
|
};
|
|
1708
1725
|
|
|
1726
|
+
// src/resources/commission-config.ts
|
|
1727
|
+
var CommissionConfigResource = class extends BaseResource {
|
|
1728
|
+
constructor() {
|
|
1729
|
+
super(...arguments);
|
|
1730
|
+
this.basePath = "commissions/config";
|
|
1731
|
+
}
|
|
1732
|
+
async createConfig(data, options) {
|
|
1733
|
+
return this.client.post(this.basePath, data, options);
|
|
1734
|
+
}
|
|
1735
|
+
async getActiveConfig(options) {
|
|
1736
|
+
return this.client.get(`${this.basePath}/active`, void 0, options);
|
|
1737
|
+
}
|
|
1738
|
+
async getConfig(id, options) {
|
|
1739
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1740
|
+
}
|
|
1741
|
+
async listConfigs(params, options) {
|
|
1742
|
+
return this.paginate(this.basePath, params, options);
|
|
1743
|
+
}
|
|
1744
|
+
async updateConfig(id, data, options) {
|
|
1745
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1746
|
+
}
|
|
1747
|
+
async deactivateConfig(id, options) {
|
|
1748
|
+
return this.client.put(`${this.basePath}/${id}/deactivate`, {}, options);
|
|
1749
|
+
}
|
|
1750
|
+
async getConfigHistory(id, params, options) {
|
|
1751
|
+
return this.paginate(`${this.basePath}/${id}/history`, params, options);
|
|
1752
|
+
}
|
|
1753
|
+
async validateConfig(data, options) {
|
|
1754
|
+
return this.client.post(
|
|
1755
|
+
`${this.basePath}/validate`,
|
|
1756
|
+
data,
|
|
1757
|
+
options
|
|
1758
|
+
);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1762
|
+
// src/resources/commission-rules.ts
|
|
1763
|
+
var CommissionRulesResource = class extends BaseResource {
|
|
1764
|
+
constructor() {
|
|
1765
|
+
super(...arguments);
|
|
1766
|
+
this.basePath = "commissions/rules";
|
|
1767
|
+
}
|
|
1768
|
+
async createRule(data, options) {
|
|
1769
|
+
return this.client.post(this.basePath, data, options);
|
|
1770
|
+
}
|
|
1771
|
+
async getRule(id, options) {
|
|
1772
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1773
|
+
}
|
|
1774
|
+
async listRules(params, options) {
|
|
1775
|
+
return this.paginate(this.basePath, params, options);
|
|
1776
|
+
}
|
|
1777
|
+
async updateRule(id, data, options) {
|
|
1778
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1779
|
+
}
|
|
1780
|
+
async deleteRule(id, options) {
|
|
1781
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
1782
|
+
}
|
|
1783
|
+
async activateRule(id, options) {
|
|
1784
|
+
return this.client.put(`${this.basePath}/${id}/activate`, {}, options);
|
|
1785
|
+
}
|
|
1786
|
+
async deactivateRule(id, options) {
|
|
1787
|
+
return this.client.put(`${this.basePath}/${id}/deactivate`, {}, options);
|
|
1788
|
+
}
|
|
1789
|
+
async getRuleHistory(id, params, options) {
|
|
1790
|
+
return this.paginate(`${this.basePath}/${id}/history`, params, options);
|
|
1791
|
+
}
|
|
1792
|
+
async validateRule(data, options) {
|
|
1793
|
+
return this.client.post(
|
|
1794
|
+
`${this.basePath}/validate`,
|
|
1795
|
+
data,
|
|
1796
|
+
options
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
async getMyRules(options) {
|
|
1800
|
+
return this.client.get(`${this.basePath}/me`, void 0, options);
|
|
1801
|
+
}
|
|
1802
|
+
async getApplicableRule(params, options) {
|
|
1803
|
+
return this.client.get(
|
|
1804
|
+
`${this.basePath}/applicable`,
|
|
1805
|
+
params,
|
|
1806
|
+
options
|
|
1807
|
+
);
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1811
|
+
// src/resources/commission-calculations.ts
|
|
1812
|
+
var CommissionCalculationsResource = class extends BaseResource {
|
|
1813
|
+
constructor() {
|
|
1814
|
+
super(...arguments);
|
|
1815
|
+
this.basePath = "commissions/calculations";
|
|
1816
|
+
}
|
|
1817
|
+
async createCalculation(data, options) {
|
|
1818
|
+
return this.client.post(this.basePath, data, options);
|
|
1819
|
+
}
|
|
1820
|
+
async getCalculation(id, options) {
|
|
1821
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1822
|
+
}
|
|
1823
|
+
async getCalculations(params, options) {
|
|
1824
|
+
return this.paginate(this.basePath, params, options);
|
|
1825
|
+
}
|
|
1826
|
+
async getCollaboratorCalculations(collaboratorId, params, options) {
|
|
1827
|
+
return this.paginate(
|
|
1828
|
+
`${this.basePath}/collaborator/${collaboratorId}`,
|
|
1829
|
+
params,
|
|
1830
|
+
options
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
async confirmCalculation(id, data, options) {
|
|
1834
|
+
return this.client.put(
|
|
1835
|
+
`${this.basePath}/${id}/confirm`,
|
|
1836
|
+
data,
|
|
1837
|
+
options
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
async reverseCalculation(id, data, options) {
|
|
1841
|
+
return this.client.put(
|
|
1842
|
+
`${this.basePath}/${id}/reverse`,
|
|
1843
|
+
data,
|
|
1844
|
+
options
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
async markAsPaid(id, data, options) {
|
|
1848
|
+
return this.client.put(`${this.basePath}/${id}/paid`, data, options);
|
|
1849
|
+
}
|
|
1850
|
+
async simulate(data, options) {
|
|
1851
|
+
return this.client.post("commissions/simulator", data, options);
|
|
1852
|
+
}
|
|
1853
|
+
async getMyCommissions(params, options) {
|
|
1854
|
+
return this.paginate("commissions/me", params, options);
|
|
1855
|
+
}
|
|
1856
|
+
async getMyCommissionsSummary(options) {
|
|
1857
|
+
return this.client.get("commissions/me/summary", void 0, options);
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1861
|
+
// src/resources/commission-reports.ts
|
|
1862
|
+
var CommissionReportsResource = class extends BaseResource {
|
|
1863
|
+
constructor() {
|
|
1864
|
+
super(...arguments);
|
|
1865
|
+
this.basePath = "commissions/reports";
|
|
1866
|
+
}
|
|
1867
|
+
async getSummary(params, options) {
|
|
1868
|
+
return this.client.get(`${this.basePath}/summary`, params, options);
|
|
1869
|
+
}
|
|
1870
|
+
async getByRule(params, options) {
|
|
1871
|
+
return this.client.get(`${this.basePath}/by-rule`, params, options);
|
|
1872
|
+
}
|
|
1873
|
+
async getByCollaborator(params, options) {
|
|
1874
|
+
return this.client.get(
|
|
1875
|
+
`${this.basePath}/by-collaborator`,
|
|
1876
|
+
params,
|
|
1877
|
+
options
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
async getPromotionAnalytics(params, options) {
|
|
1881
|
+
return this.client.get(`${this.basePath}/promotions`, params, options);
|
|
1882
|
+
}
|
|
1883
|
+
async exportToCSV(params, options) {
|
|
1884
|
+
return this.client.get(`${this.basePath}/export/csv`, params, options);
|
|
1885
|
+
}
|
|
1886
|
+
async getTrends(params, options) {
|
|
1887
|
+
return this.client.get(
|
|
1888
|
+
`${this.basePath}/trends`,
|
|
1889
|
+
params,
|
|
1890
|
+
options
|
|
1891
|
+
);
|
|
1892
|
+
}
|
|
1893
|
+
async getTopPerformers(params, options) {
|
|
1894
|
+
return this.client.get(
|
|
1895
|
+
`${this.basePath}/top-performers`,
|
|
1896
|
+
params,
|
|
1897
|
+
options
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
|
|
1902
|
+
// src/resources/commission-promotions.ts
|
|
1903
|
+
var CommissionPromotionsResource = class extends BaseResource {
|
|
1904
|
+
constructor() {
|
|
1905
|
+
super(...arguments);
|
|
1906
|
+
this.basePath = "commissions/promotions";
|
|
1907
|
+
}
|
|
1908
|
+
async createPromotion(data, options) {
|
|
1909
|
+
return this.client.post(this.basePath, data, options);
|
|
1910
|
+
}
|
|
1911
|
+
async getPromotion(id, options) {
|
|
1912
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
1913
|
+
}
|
|
1914
|
+
async listPromotions(params, options) {
|
|
1915
|
+
return this.paginate(this.basePath, params, options);
|
|
1916
|
+
}
|
|
1917
|
+
async updatePromotion(id, data, options) {
|
|
1918
|
+
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
1919
|
+
}
|
|
1920
|
+
async deletePromotion(id, options) {
|
|
1921
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
1922
|
+
}
|
|
1923
|
+
async activatePromotion(id, options) {
|
|
1924
|
+
return this.client.put(`${this.basePath}/${id}/activate`, {}, options);
|
|
1925
|
+
}
|
|
1926
|
+
async deactivatePromotion(id, options) {
|
|
1927
|
+
return this.client.put(`${this.basePath}/${id}/deactivate`, {}, options);
|
|
1928
|
+
}
|
|
1929
|
+
async validatePromotion(data, options) {
|
|
1930
|
+
return this.client.post(
|
|
1931
|
+
`${this.basePath}/validate`,
|
|
1932
|
+
data,
|
|
1933
|
+
options
|
|
1934
|
+
);
|
|
1935
|
+
}
|
|
1936
|
+
async estimateImpact(id, options) {
|
|
1937
|
+
return this.client.get(`${this.basePath}/${id}/impact`, void 0, options);
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1709
1941
|
// src/sdk.ts
|
|
1710
1942
|
var GymSpaceSdk = class {
|
|
1711
1943
|
constructor(config) {
|
|
@@ -1739,6 +1971,11 @@ var GymSpaceSdk = class {
|
|
|
1739
1971
|
this.bulkMessaging = new BulkMessagingResource(this.client);
|
|
1740
1972
|
this.activities = new ActivitiesResource(this.client);
|
|
1741
1973
|
this.tags = new TagsResource(this.client);
|
|
1974
|
+
this.commissionConfig = new CommissionConfigResource(this.client);
|
|
1975
|
+
this.commissionRules = new CommissionRulesResource(this.client);
|
|
1976
|
+
this.commissionCalculations = new CommissionCalculationsResource(this.client);
|
|
1977
|
+
this.commissionReports = new CommissionReportsResource(this.client);
|
|
1978
|
+
this.commissionPromotions = new CommissionPromotionsResource(this.client);
|
|
1742
1979
|
}
|
|
1743
1980
|
/**
|
|
1744
1981
|
* Set the authentication token
|
|
@@ -2193,6 +2430,32 @@ var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
|
|
|
2193
2430
|
return OnboardingStep2;
|
|
2194
2431
|
})(OnboardingStep || {});
|
|
2195
2432
|
|
|
2433
|
+
// src/models/commissions.ts
|
|
2434
|
+
var CommissionRuleType = /* @__PURE__ */ ((CommissionRuleType2) => {
|
|
2435
|
+
CommissionRuleType2["PLAN"] = "PLAN";
|
|
2436
|
+
CommissionRuleType2["AMOUNT"] = "AMOUNT";
|
|
2437
|
+
CommissionRuleType2["PROMOTION"] = "PROMOTION";
|
|
2438
|
+
return CommissionRuleType2;
|
|
2439
|
+
})(CommissionRuleType || {});
|
|
2440
|
+
var CommissionStatus = /* @__PURE__ */ ((CommissionStatus2) => {
|
|
2441
|
+
CommissionStatus2["PENDING"] = "PENDING";
|
|
2442
|
+
CommissionStatus2["CONFIRMED"] = "CONFIRMED";
|
|
2443
|
+
CommissionStatus2["PAID"] = "PAID";
|
|
2444
|
+
CommissionStatus2["REVERSED"] = "REVERSED";
|
|
2445
|
+
return CommissionStatus2;
|
|
2446
|
+
})(CommissionStatus || {});
|
|
2447
|
+
var CommissionChangeType = /* @__PURE__ */ ((CommissionChangeType2) => {
|
|
2448
|
+
CommissionChangeType2["CREATED"] = "CREATED";
|
|
2449
|
+
CommissionChangeType2["UPDATED"] = "UPDATED";
|
|
2450
|
+
CommissionChangeType2["DELETED"] = "DELETED";
|
|
2451
|
+
return CommissionChangeType2;
|
|
2452
|
+
})(CommissionChangeType || {});
|
|
2453
|
+
var CommissionEntityType = /* @__PURE__ */ ((CommissionEntityType2) => {
|
|
2454
|
+
CommissionEntityType2["CONFIG"] = "CONFIG";
|
|
2455
|
+
CommissionEntityType2["RULE"] = "RULE";
|
|
2456
|
+
return CommissionEntityType2;
|
|
2457
|
+
})(CommissionEntityType || {});
|
|
2458
|
+
|
|
2196
2459
|
exports.ActivitiesResource = ActivitiesResource;
|
|
2197
2460
|
exports.AdminSubscriptionManagementResource = AdminSubscriptionManagementResource;
|
|
2198
2461
|
exports.ApiClient = ApiClient;
|
|
@@ -2211,6 +2474,15 @@ exports.ClientsResource = ClientsResource;
|
|
|
2211
2474
|
exports.CollaboratorStatus = CollaboratorStatus;
|
|
2212
2475
|
exports.CollaboratorsResource = CollaboratorsResource;
|
|
2213
2476
|
exports.CommentType = CommentType;
|
|
2477
|
+
exports.CommissionCalculationsResource = CommissionCalculationsResource;
|
|
2478
|
+
exports.CommissionChangeType = CommissionChangeType;
|
|
2479
|
+
exports.CommissionConfigResource = CommissionConfigResource;
|
|
2480
|
+
exports.CommissionEntityType = CommissionEntityType;
|
|
2481
|
+
exports.CommissionPromotionsResource = CommissionPromotionsResource;
|
|
2482
|
+
exports.CommissionReportsResource = CommissionReportsResource;
|
|
2483
|
+
exports.CommissionRuleType = CommissionRuleType;
|
|
2484
|
+
exports.CommissionRulesResource = CommissionRulesResource;
|
|
2485
|
+
exports.CommissionStatus = CommissionStatus;
|
|
2214
2486
|
exports.ContractAssetType = ContractAssetType;
|
|
2215
2487
|
exports.ContractStatus = ContractStatus;
|
|
2216
2488
|
exports.ContractsResource = ContractsResource;
|