@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
package/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import { T as TokenStore, F as FetchLike } from './http-CL97TjMO.cjs';
2
2
  export { d as defaultBrowserStore, i as inMemoryStore } from './http-CL97TjMO.cjs';
3
3
  import { AuthResource } from './resources/auth.cjs';
4
4
  export { ChangePasswordInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, RequestEmailCodeInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User, VerifyEmailCodeInput } from './resources/auth.cjs';
5
- import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-BiXmrz7h.cjs';
6
- export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, C as CardProduct, l as CardProductPrice, m as CardStatus, n as CardStatusSource, o as CardTariff, p as CardTopUp, q as CardTopUpStatus, r as CardTransfer, s as CardType, t as Cardholder, u as CloseBlockedReason, v as CreateCardInput, w as CreateDepositRefundInput, x as CreateQuoteInput, y as CustomerInfo, D as Deposit, z as DepositMethod, E as DepositStatus, G as DepositTarget, H as FeeKind, I as FunderMode, J as FundingOption, K as FundingQuote, L as InitiateDepositInput, M as IssuanceBonus, N as IssueCardInput, O as MethodTerms, R as Refund, P as RevealCardInput, Q as RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-BiXmrz7h.cjs';
5
+ import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-DGz4Rqu1.cjs';
6
+ export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, C as CardProduct, l as CardProductPrice, m as CardStatus, n as CardStatusSource, o as CardTariff, p as CardTopUp, q as CardTopUpStatus, r as CardTransfer, s as CardType, t as Cardholder, u as CloseBlockedReason, v as CreateCardInput, w as CreateDepositRefundInput, x as CreateQuoteInput, y as CustomerInfo, D as Deposit, z as DepositMethod, E as DepositStatus, G as DepositTarget, H as FeeKind, I as FunderMode, J as FundingOption, K as FundingQuote, L as InitiateDepositInput, M as IssuanceBonus, N as IssueCardInput, O as MethodTerms, R as Refund, P as RevealCardInput, Q as RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-DGz4Rqu1.cjs';
7
7
  import { BalanceResource } from './resources/balance.cjs';
8
8
  export { Balance } from './resources/balance.cjs';
9
9
  import { BonusResource } from './resources/bonus.cjs';
@@ -12,12 +12,14 @@ import { DebtResource } from './resources/debt.cjs';
12
12
  export { CardFeeKind, Debt, DebtAmount, DebtLine } from './resources/debt.cjs';
13
13
  import { CloseRequestsResource } from './resources/close-requests.cjs';
14
14
  export { CloseAmount, CloseRefund, CloseRequest, CloseRequestError, CloseRequestStatus, PayoutDetailsInput, PayoutDetailsShown } from './resources/close-requests.cjs';
15
+ import { ClaimsResource } from './resources/claims.cjs';
16
+ export { Claim, ClaimError, ClaimKind, ClaimPage, ClaimStatus, ClaimTransaction, CreateClaimInput } from './resources/claims.cjs';
15
17
  import { CodesResource } from './resources/codes.cjs';
16
18
  export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.cjs';
17
19
  import { ReferralResource } from './resources/referral.cjs';
18
20
  export { InvitedFriend, Referral, ReferralReward } from './resources/referral.cjs';
19
21
  import { SubscriptionResource } from './resources/subscription.cjs';
20
- export { UserSubscription } from './resources/subscription.cjs';
22
+ export { CancelledSubscription, UserSubscription } from './resources/subscription.cjs';
21
23
  import { BrandingResource } from './resources/branding.cjs';
22
24
  export { Branding } from './resources/branding.cjs';
23
25
  import { WalletResource } from './resources/wallet.cjs';
@@ -79,7 +81,7 @@ interface BrandConfig {
79
81
  * Which platform versions this SDK works with, as a semver range:
80
82
  * comparators separated by ", ". Keep this the only definition.
81
83
  */
82
- declare const SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
84
+ declare const SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
83
85
  /** What `client.ready()` returns. */
84
86
  interface ReadyInfo {
85
87
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -185,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
185
187
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
186
188
  * release bump that forgets this file fails the test run.
187
189
  */
188
- declare const SDK_VERSION = "0.6.6";
190
+ declare const SDK_VERSION = "0.6.8";
189
191
 
190
192
  /**
191
193
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
@@ -252,11 +254,13 @@ interface CusfrontClient {
252
254
  readonly debt: DebtResource;
253
255
  /** Close a card that still holds money: the rest goes back the way it was paid. */
254
256
  readonly closeRequests: CloseRequestsResource;
257
+ /** Dispute a card operation or complain, and follow claims (lost and stolen cards included) by number and status. */
258
+ readonly claims: ClaimsResource;
255
259
  /** Promo and referral codes: check what a code would do before using it. */
256
260
  readonly codes: CodesResource;
257
261
  /** For referrers: the referral code, the link to share, invited friends and rewards. */
258
262
  readonly referral: ReferralResource;
259
- /** The user's own subscription tier or gift, and a promo code for its monthly fee. */
263
+ /** The user's own subscription tier or gift, a promo code for its monthly fee, and cancelling it. */
260
264
  readonly subscription: SubscriptionResource;
261
265
  /** The wallet's currency: read it, switch it while the wallet is empty. */
262
266
  readonly wallet: WalletResource;
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { T as TokenStore, F as FetchLike } from './http-CL97TjMO.js';
2
2
  export { d as defaultBrowserStore, i as inMemoryStore } from './http-CL97TjMO.js';
3
3
  import { AuthResource } from './resources/auth.js';
4
4
  export { ChangePasswordInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, RequestEmailCodeInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User, VerifyEmailCodeInput } from './resources/auth.js';
5
- import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-DwmzjKDC.js';
6
- export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, C as CardProduct, l as CardProductPrice, m as CardStatus, n as CardStatusSource, o as CardTariff, p as CardTopUp, q as CardTopUpStatus, r as CardTransfer, s as CardType, t as Cardholder, u as CloseBlockedReason, v as CreateCardInput, w as CreateDepositRefundInput, x as CreateQuoteInput, y as CustomerInfo, D as Deposit, z as DepositMethod, E as DepositStatus, G as DepositTarget, H as FeeKind, I as FunderMode, J as FundingOption, K as FundingQuote, L as InitiateDepositInput, M as IssuanceBonus, N as IssueCardInput, O as MethodTerms, R as Refund, P as RevealCardInput, Q as RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-DwmzjKDC.js';
5
+ import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-BgY00UpU.js';
6
+ export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, C as CardProduct, l as CardProductPrice, m as CardStatus, n as CardStatusSource, o as CardTariff, p as CardTopUp, q as CardTopUpStatus, r as CardTransfer, s as CardType, t as Cardholder, u as CloseBlockedReason, v as CreateCardInput, w as CreateDepositRefundInput, x as CreateQuoteInput, y as CustomerInfo, D as Deposit, z as DepositMethod, E as DepositStatus, G as DepositTarget, H as FeeKind, I as FunderMode, J as FundingOption, K as FundingQuote, L as InitiateDepositInput, M as IssuanceBonus, N as IssueCardInput, O as MethodTerms, R as Refund, P as RevealCardInput, Q as RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-BgY00UpU.js';
7
7
  import { BalanceResource } from './resources/balance.js';
8
8
  export { Balance } from './resources/balance.js';
9
9
  import { BonusResource } from './resources/bonus.js';
@@ -12,12 +12,14 @@ import { DebtResource } from './resources/debt.js';
12
12
  export { CardFeeKind, Debt, DebtAmount, DebtLine } from './resources/debt.js';
13
13
  import { CloseRequestsResource } from './resources/close-requests.js';
14
14
  export { CloseAmount, CloseRefund, CloseRequest, CloseRequestError, CloseRequestStatus, PayoutDetailsInput, PayoutDetailsShown } from './resources/close-requests.js';
15
+ import { ClaimsResource } from './resources/claims.js';
16
+ export { Claim, ClaimError, ClaimKind, ClaimPage, ClaimStatus, ClaimTransaction, CreateClaimInput } from './resources/claims.js';
15
17
  import { CodesResource } from './resources/codes.js';
16
18
  export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.js';
17
19
  import { ReferralResource } from './resources/referral.js';
18
20
  export { InvitedFriend, Referral, ReferralReward } from './resources/referral.js';
19
21
  import { SubscriptionResource } from './resources/subscription.js';
20
- export { UserSubscription } from './resources/subscription.js';
22
+ export { CancelledSubscription, UserSubscription } from './resources/subscription.js';
21
23
  import { BrandingResource } from './resources/branding.js';
22
24
  export { Branding } from './resources/branding.js';
23
25
  import { WalletResource } from './resources/wallet.js';
@@ -79,7 +81,7 @@ interface BrandConfig {
79
81
  * Which platform versions this SDK works with, as a semver range:
80
82
  * comparators separated by ", ". Keep this the only definition.
81
83
  */
82
- declare const SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
84
+ declare const SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
83
85
  /** What `client.ready()` returns. */
84
86
  interface ReadyInfo {
85
87
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -185,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
185
187
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
186
188
  * release bump that forgets this file fails the test run.
187
189
  */
188
- declare const SDK_VERSION = "0.6.6";
190
+ declare const SDK_VERSION = "0.6.8";
189
191
 
190
192
  /**
191
193
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
@@ -252,11 +254,13 @@ interface CusfrontClient {
252
254
  readonly debt: DebtResource;
253
255
  /** Close a card that still holds money: the rest goes back the way it was paid. */
254
256
  readonly closeRequests: CloseRequestsResource;
257
+ /** Dispute a card operation or complain, and follow claims (lost and stolen cards included) by number and status. */
258
+ readonly claims: ClaimsResource;
255
259
  /** Promo and referral codes: check what a code would do before using it. */
256
260
  readonly codes: CodesResource;
257
261
  /** For referrers: the referral code, the link to share, invited friends and rewards. */
258
262
  readonly referral: ReferralResource;
259
- /** The user's own subscription tier or gift, and a promo code for its monthly fee. */
263
+ /** The user's own subscription tier or gift, a promo code for its monthly fee, and cancelling it. */
260
264
  readonly subscription: SubscriptionResource;
261
265
  /** The wallet's currency: read it, switch it while the wallet is empty. */
262
266
  readonly wallet: WalletResource;
package/dist/index.js CHANGED
@@ -359,6 +359,22 @@ var CardsResource = class {
359
359
  async unfreeze(id) {
360
360
  return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
361
361
  }
362
+ /**
363
+ * Report the card lost or stolen. Works at any time, on an active or a
364
+ * frozen card. The report is recorded first with the server's time, which
365
+ * decides who pays for operations someone else made; then the card is
366
+ * frozen at its issuer and only support can unfreeze it. Resolves to the
367
+ * claim (`client.claims`): show its `number` and `reported_at`. When the
368
+ * issuer can't be reached, `card_freeze` is `"pending"`: the report still
369
+ * counts and support freezes the card by hand. Reporting again while the
370
+ * report is open returns the same claim. 404 / 403 not the user's card ·
371
+ * 409 `card_not_open`: the card is closed or was never issued.
372
+ */
373
+ async reportLost(id, input) {
374
+ return this.http.post(`/me/cards/${encodeURIComponent(id)}/report-lost`, {
375
+ body: { kind: input.kind, details: input.details }
376
+ });
377
+ }
362
378
  /**
363
379
  * Set the PIN of the caller's own physical card. The session is enough; the
364
380
  * call is rate-limited like {@link reveal} and the PIN is kept nowhere.
@@ -811,6 +827,41 @@ var CloseRequestsResource = class {
811
827
  }
812
828
  };
813
829
 
830
+ // src/resources/claims.ts
831
+ var ClaimsResource = class {
832
+ constructor(http) {
833
+ this.http = http;
834
+ }
835
+ /**
836
+ * Dispute a card operation, or complain. 400 `validation`: a description
837
+ * that is too short or too long, an operation that isn't on the user's
838
+ * cards, or a lost or stolen card (use `cards.reportLost()`) · 404 no
839
+ * such card · 409 `too_many_claims`: 20 claims are waiting for an answer.
840
+ */
841
+ async create(input) {
842
+ return this.http.post("/me/claims", {
843
+ body: {
844
+ kind: input.kind,
845
+ description: input.description,
846
+ card_id: input.cardId,
847
+ transaction_id: input.transactionId
848
+ }
849
+ });
850
+ }
851
+ /** The user's claims, lost and stolen cards included, newest first. */
852
+ async list(opts = {}) {
853
+ const qs = new URLSearchParams();
854
+ if (opts.limit != null) qs.set("limit", String(opts.limit));
855
+ if (opts.offset != null) qs.set("offset", String(opts.offset));
856
+ const q = qs.toString();
857
+ return this.http.get(`/me/claims${q ? `?${q}` : ""}`, { signal: opts.signal });
858
+ }
859
+ /** One claim. 404 when it isn't the user's. */
860
+ async get(id, opts = {}) {
861
+ return this.http.get(`/me/claims/${encodeURIComponent(id)}`, { signal: opts.signal });
862
+ }
863
+ };
864
+
814
865
  // src/resources/codes.ts
815
866
  var CodesResource = class {
816
867
  constructor(http) {
@@ -854,6 +905,15 @@ var SubscriptionResource = class {
854
905
  async setPromoCode(code) {
855
906
  return this.http.put("/me/subscription/promo-code", { body: { code } });
856
907
  }
908
+ /**
909
+ * Cancel the subscription now, in one step. What was paid for the current
910
+ * period comes back to the balance for the days not used. No subscription
911
+ * running → 404; 503 `refund_unavailable` when the refund can't be made
912
+ * right now (the subscription keeps running; try again).
913
+ */
914
+ async cancel() {
915
+ return this.http.post("/me/subscription/cancel", {});
916
+ }
857
917
  };
858
918
 
859
919
  // src/resources/branding.ts
@@ -1513,7 +1573,7 @@ var FundingOptionsResource = class {
1513
1573
  };
1514
1574
 
1515
1575
  // src/version.ts
1516
- var SDK_VERSION = "0.6.6";
1576
+ var SDK_VERSION = "0.6.8";
1517
1577
 
1518
1578
  // src/client-platform.ts
1519
1579
  var CLIENT_HEADER = "X-Takeal-Client";
@@ -1588,7 +1648,7 @@ function isAbsolute(url) {
1588
1648
  }
1589
1649
 
1590
1650
  // src/compat.ts
1591
- var SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
1651
+ var SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
1592
1652
  var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
1593
1653
  function parse(v) {
1594
1654
  const m = SEMVER.exec(v.trim());
@@ -2103,6 +2163,7 @@ function createClient(opts) {
2103
2163
  bonus: new BonusResource(http),
2104
2164
  debt: new DebtResource(http),
2105
2165
  closeRequests: new CloseRequestsResource(http),
2166
+ claims: new ClaimsResource(http),
2106
2167
  codes: new CodesResource(http),
2107
2168
  referral: new ReferralResource(http),
2108
2169
  subscription: new SubscriptionResource(http),