@takeal/cusfront-sdk 0.6.6 → 0.6.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +37 -0
  3. package/dist/{cards-DwmzjKDC.d.ts → cards-BgY00UpU.d.ts} +17 -0
  4. package/dist/{cards-BiXmrz7h.d.cts → cards-DGz4Rqu1.d.cts} +17 -0
  5. package/dist/index.cjs +63 -2
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +10 -6
  8. package/dist/index.d.ts +10 -6
  9. package/dist/index.js +63 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/react/index.d.cts +2 -1
  12. package/dist/react/index.d.ts +2 -1
  13. package/dist/resources/auth.cjs.map +1 -1
  14. package/dist/resources/auth.d.cts +2 -1
  15. package/dist/resources/auth.d.ts +2 -1
  16. package/dist/resources/auth.js.map +1 -1
  17. package/dist/resources/cards.cjs +16 -0
  18. package/dist/resources/cards.cjs.map +1 -1
  19. package/dist/resources/cards.d.cts +2 -1
  20. package/dist/resources/cards.d.ts +2 -1
  21. package/dist/resources/cards.js +16 -0
  22. package/dist/resources/cards.js.map +1 -1
  23. package/dist/resources/claims.cjs +40 -0
  24. package/dist/resources/claims.cjs.map +1 -0
  25. package/dist/resources/claims.d.cts +114 -0
  26. package/dist/resources/claims.d.ts +114 -0
  27. package/dist/resources/claims.js +38 -0
  28. package/dist/resources/claims.js.map +1 -0
  29. package/dist/resources/deposits.cjs.map +1 -1
  30. package/dist/resources/deposits.d.cts +2 -1
  31. package/dist/resources/deposits.d.ts +2 -1
  32. package/dist/resources/deposits.js.map +1 -1
  33. package/dist/resources/funding-options.d.cts +2 -1
  34. package/dist/resources/funding-options.d.ts +2 -1
  35. package/dist/resources/me.d.cts +2 -1
  36. package/dist/resources/me.d.ts +2 -1
  37. package/dist/resources/subscription.cjs +9 -0
  38. package/dist/resources/subscription.cjs.map +1 -1
  39. package/dist/resources/subscription.d.cts +19 -2
  40. package/dist/resources/subscription.d.ts +19 -2
  41. package/dist/resources/subscription.js +9 -0
  42. package/dist/resources/subscription.js.map +1 -1
  43. package/dist/resources/support.cjs.map +1 -1
  44. package/dist/resources/support.d.cts +8 -3
  45. package/dist/resources/support.d.ts +8 -3
  46. package/dist/resources/support.js.map +1 -1
  47. package/dist/telegram.cjs +63 -2
  48. package/dist/telegram.cjs.map +1 -1
  49. package/dist/telegram.d.cts +2 -1
  50. package/dist/telegram.d.ts +2 -1
  51. package/dist/telegram.js +63 -2
  52. package/dist/telegram.js.map +1 -1
  53. package/package.json +6 -1
@@ -1,7 +1,8 @@
1
1
  import { CusfrontClient, CreateClientOptions } from './index.cjs';
2
2
  import { JwtIssued, TelegramUnknown } from './resources/auth.cjs';
3
3
  import './http-CL97TjMO.cjs';
4
- import './cards-BiXmrz7h.cjs';
4
+ import './cards-DGz4Rqu1.cjs';
5
+ import './resources/claims.cjs';
5
6
  import './resources/consents.cjs';
6
7
  import './resources/balance.cjs';
7
8
  import './resources/bonus.cjs';
@@ -1,7 +1,8 @@
1
1
  import { CusfrontClient, CreateClientOptions } from './index.js';
2
2
  import { JwtIssued, TelegramUnknown } from './resources/auth.js';
3
3
  import './http-CL97TjMO.js';
4
- import './cards-DwmzjKDC.js';
4
+ import './cards-BgY00UpU.js';
5
+ import './resources/claims.js';
5
6
  import './resources/consents.js';
6
7
  import './resources/balance.js';
7
8
  import './resources/bonus.js';
package/dist/telegram.js CHANGED
@@ -356,6 +356,22 @@ var CardsResource = class {
356
356
  async unfreeze(id) {
357
357
  return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
358
358
  }
359
+ /**
360
+ * Report the card lost or stolen. Works at any time, on an active or a
361
+ * frozen card. The report is recorded first with the server's time, which
362
+ * decides who pays for operations someone else made; then the card is
363
+ * frozen at its issuer and only support can unfreeze it. Resolves to the
364
+ * claim (`client.claims`): show its `number` and `reported_at`. When the
365
+ * issuer can't be reached, `card_freeze` is `"pending"`: the report still
366
+ * counts and support freezes the card by hand. Reporting again while the
367
+ * report is open returns the same claim. 404 / 403 not the user's card ·
368
+ * 409 `card_not_open`: the card is closed or was never issued.
369
+ */
370
+ async reportLost(id, input) {
371
+ return this.http.post(`/me/cards/${encodeURIComponent(id)}/report-lost`, {
372
+ body: { kind: input.kind, details: input.details }
373
+ });
374
+ }
359
375
  /**
360
376
  * Set the PIN of the caller's own physical card. The session is enough; the
361
377
  * call is rate-limited like {@link reveal} and the PIN is kept nowhere.
@@ -808,6 +824,41 @@ var CloseRequestsResource = class {
808
824
  }
809
825
  };
810
826
 
827
+ // src/resources/claims.ts
828
+ var ClaimsResource = class {
829
+ constructor(http) {
830
+ this.http = http;
831
+ }
832
+ /**
833
+ * Dispute a card operation, or complain. 400 `validation`: a description
834
+ * that is too short or too long, an operation that isn't on the user's
835
+ * cards, or a lost or stolen card (use `cards.reportLost()`) · 404 no
836
+ * such card · 409 `too_many_claims`: 20 claims are waiting for an answer.
837
+ */
838
+ async create(input) {
839
+ return this.http.post("/me/claims", {
840
+ body: {
841
+ kind: input.kind,
842
+ description: input.description,
843
+ card_id: input.cardId,
844
+ transaction_id: input.transactionId
845
+ }
846
+ });
847
+ }
848
+ /** The user's claims, lost and stolen cards included, newest first. */
849
+ async list(opts = {}) {
850
+ const qs = new URLSearchParams();
851
+ if (opts.limit != null) qs.set("limit", String(opts.limit));
852
+ if (opts.offset != null) qs.set("offset", String(opts.offset));
853
+ const q = qs.toString();
854
+ return this.http.get(`/me/claims${q ? `?${q}` : ""}`, { signal: opts.signal });
855
+ }
856
+ /** One claim. 404 when it isn't the user's. */
857
+ async get(id, opts = {}) {
858
+ return this.http.get(`/me/claims/${encodeURIComponent(id)}`, { signal: opts.signal });
859
+ }
860
+ };
861
+
811
862
  // src/resources/codes.ts
812
863
  var CodesResource = class {
813
864
  constructor(http) {
@@ -851,6 +902,15 @@ var SubscriptionResource = class {
851
902
  async setPromoCode(code) {
852
903
  return this.http.put("/me/subscription/promo-code", { body: { code } });
853
904
  }
905
+ /**
906
+ * Cancel the subscription now, in one step. What was paid for the current
907
+ * period comes back to the balance for the days not used. No subscription
908
+ * running → 404; 503 `refund_unavailable` when the refund can't be made
909
+ * right now (the subscription keeps running; try again).
910
+ */
911
+ async cancel() {
912
+ return this.http.post("/me/subscription/cancel", {});
913
+ }
854
914
  };
855
915
 
856
916
  // src/resources/branding.ts
@@ -1493,7 +1553,7 @@ var FundingOptionsResource = class {
1493
1553
  };
1494
1554
 
1495
1555
  // src/version.ts
1496
- var SDK_VERSION = "0.6.6";
1556
+ var SDK_VERSION = "0.6.8";
1497
1557
 
1498
1558
  // src/client-platform.ts
1499
1559
  var CLIENT_HEADER = "X-Takeal-Client";
@@ -1568,7 +1628,7 @@ function isAbsolute(url) {
1568
1628
  }
1569
1629
 
1570
1630
  // src/compat.ts
1571
- var SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
1631
+ var SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
1572
1632
  var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
1573
1633
  function parse(v) {
1574
1634
  const m = SEMVER.exec(v.trim());
@@ -1665,6 +1725,7 @@ function createClient(opts) {
1665
1725
  bonus: new BonusResource(http),
1666
1726
  debt: new DebtResource(http),
1667
1727
  closeRequests: new CloseRequestsResource(http),
1728
+ claims: new ClaimsResource(http),
1668
1729
  codes: new CodesResource(http),
1669
1730
  referral: new ReferralResource(http),
1670
1731
  subscription: new SubscriptionResource(http),