@takeal/cusfront-sdk 0.3.12 → 0.3.20

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/index.d.cts CHANGED
@@ -5,7 +5,7 @@ export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInpu
5
5
  import { DepositsResource } from './resources/deposits.cjs';
6
6
  export { CreateDepositRefundInput, CreateQuoteInput, Deposit, DepositMethod, DepositStatus, FundingQuote, InitiateDepositInput, Refund } from './resources/deposits.cjs';
7
7
  import { CardsResource } from './resources/cards.cjs';
8
- export { Card, CardBalance, CardDesignRef, CardProduct, CardProductPrice, CardStatus, CardType, CreateCardInput, RevealCardInput, RevealedCard, UpdateCardInput } from './resources/cards.cjs';
8
+ export { Card, CardBalance, CardDesignRef, CardProduct, CardProductPrice, CardStatus, CardTopUp, CardType, CreateCardInput, RevealCardInput, RevealedCard, TopUpInput, TopUpResult, TopUpTerms, UpdateCardInput } from './resources/cards.cjs';
9
9
  import { BalanceResource } from './resources/balance.cjs';
10
10
  export { Balance } from './resources/balance.cjs';
11
11
  import { BrandingResource } from './resources/branding.cjs';
@@ -119,7 +119,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
119
119
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
120
120
  * release bump that forgets this file fails the test run.
121
121
  */
122
- declare const SDK_VERSION = "0.3.12";
122
+ declare const SDK_VERSION = "0.3.20";
123
123
 
124
124
  /**
125
125
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInpu
5
5
  import { DepositsResource } from './resources/deposits.js';
6
6
  export { CreateDepositRefundInput, CreateQuoteInput, Deposit, DepositMethod, DepositStatus, FundingQuote, InitiateDepositInput, Refund } from './resources/deposits.js';
7
7
  import { CardsResource } from './resources/cards.js';
8
- export { Card, CardBalance, CardDesignRef, CardProduct, CardProductPrice, CardStatus, CardType, CreateCardInput, RevealCardInput, RevealedCard, UpdateCardInput } from './resources/cards.js';
8
+ export { Card, CardBalance, CardDesignRef, CardProduct, CardProductPrice, CardStatus, CardTopUp, CardType, CreateCardInput, RevealCardInput, RevealedCard, TopUpInput, TopUpResult, TopUpTerms, UpdateCardInput } from './resources/cards.js';
9
9
  import { BalanceResource } from './resources/balance.js';
10
10
  export { Balance } from './resources/balance.js';
11
11
  import { BrandingResource } from './resources/branding.js';
@@ -119,7 +119,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
119
119
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
120
120
  * release bump that forgets this file fails the test run.
121
121
  */
122
- declare const SDK_VERSION = "0.3.12";
122
+ declare const SDK_VERSION = "0.3.20";
123
123
 
124
124
  /**
125
125
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
package/dist/index.js CHANGED
@@ -339,6 +339,16 @@ var CardsResource = class {
339
339
  `/me/card-products/${encodeURIComponent(id)}`
340
340
  );
341
341
  }
342
+ /**
343
+ * The public catalog: the same products, order and default as
344
+ * {@link listProducts}, but readable before sign-in, for a landing page or
345
+ * the cabinet's first screen. Prices are list prices (`discount_bps` is
346
+ * always 0); once the user is signed in, {@link listProducts} shows what
347
+ * they pay. The API lets caches keep this response for a minute.
348
+ */
349
+ async catalog() {
350
+ return this.http.get("/card-products");
351
+ }
342
352
  /**
343
353
  * Rename the caller's own card or change its design. Resolves to the
344
354
  * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
@@ -370,6 +380,31 @@ var CardsResource = class {
370
380
  `/me/cards/${encodeURIComponent(id)}/balance?${q}`
371
381
  );
372
382
  }
383
+ /**
384
+ * What a top-up of this card can be right now: whether it is possible, the
385
+ * currency, the wallet balance, and the product's floor and cap for one
386
+ * top-up. Read it before drawing the form. 404 if the card isn't the caller's.
387
+ */
388
+ async topUpTerms(id) {
389
+ return this.http.get(`/me/cards/${encodeURIComponent(id)}/topup`);
390
+ }
391
+ /**
392
+ * Move money from the wallet onto the caller's own card. The wallet is
393
+ * debited first, then the card's provider loads the card; if the provider
394
+ * refuses, the money is back on the wallet and the error says so. Resolves
395
+ * to the card, its new balance and the wallet balance, so no second call
396
+ * is needed. Errors carry a sentence the user can read: 400 outside the
397
+ * floor or cap · 402 not enough in the wallet · 404 not the caller's card ·
398
+ * 409 card frozen, closed or still being issued · 501 provider can't top
399
+ * up · 502/503 provider declined or unreachable (wallet untouched).
400
+ */
401
+ async topUp(id, input) {
402
+ const { idempotencyKey, amount } = input;
403
+ return this.http.post(`/me/cards/${encodeURIComponent(id)}/topup`, {
404
+ body: { amount },
405
+ idempotencyKey
406
+ });
407
+ }
373
408
  /**
374
409
  * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional
375
410
  * `reason` is recorded on the audit trail. Resolves to the updated card.
@@ -752,7 +787,7 @@ var DevicesResource = class {
752
787
  };
753
788
 
754
789
  // src/version.ts
755
- var SDK_VERSION = "0.3.12";
790
+ var SDK_VERSION = "0.3.20";
756
791
 
757
792
  // src/client-platform.ts
758
793
  var CLIENT_HEADER = "X-Takeal-Client";