@takeal/cusfront-sdk 0.6.14 → 0.8.0

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 (39) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +51 -0
  3. package/dist/{cards-D_krTWzr.d.cts → cards-BPu8Ill7.d.cts} +122 -2
  4. package/dist/{cards-DPlgx76p.d.ts → cards-DP1fJc_c.d.ts} +122 -2
  5. package/dist/index.cjs +56 -3
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +4 -4
  8. package/dist/index.d.ts +4 -4
  9. package/dist/index.js +56 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/react/index.d.cts +1 -1
  12. package/dist/react/index.d.ts +1 -1
  13. package/dist/resources/auth.cjs +2 -0
  14. package/dist/resources/auth.cjs.map +1 -1
  15. package/dist/resources/auth.d.cts +7 -2
  16. package/dist/resources/auth.d.ts +7 -2
  17. package/dist/resources/auth.js +2 -0
  18. package/dist/resources/auth.js.map +1 -1
  19. package/dist/resources/cards.cjs +60 -1
  20. package/dist/resources/cards.cjs.map +1 -1
  21. package/dist/resources/cards.d.cts +2 -1
  22. package/dist/resources/cards.d.ts +2 -1
  23. package/dist/resources/cards.js +59 -2
  24. package/dist/resources/cards.js.map +1 -1
  25. package/dist/resources/deposits.cjs.map +1 -1
  26. package/dist/resources/deposits.d.cts +2 -1
  27. package/dist/resources/deposits.d.ts +2 -1
  28. package/dist/resources/deposits.js.map +1 -1
  29. package/dist/resources/funding-options.d.cts +2 -1
  30. package/dist/resources/funding-options.d.ts +2 -1
  31. package/dist/resources/me.d.cts +1 -1
  32. package/dist/resources/me.d.ts +1 -1
  33. package/dist/telegram.cjs +48 -3
  34. package/dist/telegram.cjs.map +1 -1
  35. package/dist/telegram.d.cts +2 -2
  36. package/dist/telegram.d.ts +2 -2
  37. package/dist/telegram.js +48 -3
  38. package/dist/telegram.js.map +1 -1
  39. package/package.json +1 -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-D_krTWzr.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 RevealState, S as RevealedCard, T as SetPinInput, U as TopUpInput, V as TopUpResult, W as TopUpTerms, X as TransferInput, Y as TransferResult, Z as UpdateCardInput, _ as revealState } from './cards-D_krTWzr.cjs';
5
+ import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-BPu8Ill7.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, l as CardOrderQuote, m as CardOrderQuoteInput, C as CardProduct, n as CardProductPrice, o as CardStatus, p as CardStatusSource, q as CardTariff, r as CardTopUp, s as CardTopUpStatus, t as CardTransfer, u as CardType, v as Cardholder, w as CloseBlockedReason, x as CreateCardInput, y as CreateDepositRefundInput, z as CreateQuoteInput, E as CustomerInfo, D as Deposit, G as DepositMethod, H as DepositStatus, I as DepositTarget, J as FeeKind, K as FunderMode, L as FundingOption, M as FundingQuote, N as InitiateDepositInput, O as IssuanceBonus, P as IssueCardInput, Q as MethodTerms, R as PromoCodeQuote, S as PromoCodeStatus, T as Refund, U as RevealCardInput, V as RevealState, W as RevealedCard, X as SetPinInput, Y as TopUpInput, Z as TopUpResult, _ as TopUpTerms, $ as TransferInput, a0 as TransferResult, a1 as UpdateCardInput, a2 as priceChangedQuote, a3 as revealState } from './cards-BPu8Ill7.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';
@@ -81,7 +81,7 @@ interface BrandConfig {
81
81
  * Which platform versions this SDK works with, as a semver range:
82
82
  * comparators separated by ", ". Keep this the only definition.
83
83
  */
84
- declare const SUPPORTED_MEISTER = ">=0.7.6, <1.0.0";
84
+ declare const SUPPORTED_MEISTER = ">=0.8.0, <1.0.0";
85
85
  /** What `client.ready()` returns. */
86
86
  interface ReadyInfo {
87
87
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -187,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
187
187
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
188
188
  * release bump that forgets this file fails the test run.
189
189
  */
190
- declare const SDK_VERSION = "0.6.14";
190
+ declare const SDK_VERSION = "0.8.0";
191
191
 
192
192
  /**
193
193
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
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-DPlgx76p.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 RevealState, S as RevealedCard, T as SetPinInput, U as TopUpInput, V as TopUpResult, W as TopUpTerms, X as TransferInput, Y as TransferResult, Z as UpdateCardInput, _ as revealState } from './cards-DPlgx76p.js';
5
+ import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-DP1fJc_c.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, l as CardOrderQuote, m as CardOrderQuoteInput, C as CardProduct, n as CardProductPrice, o as CardStatus, p as CardStatusSource, q as CardTariff, r as CardTopUp, s as CardTopUpStatus, t as CardTransfer, u as CardType, v as Cardholder, w as CloseBlockedReason, x as CreateCardInput, y as CreateDepositRefundInput, z as CreateQuoteInput, E as CustomerInfo, D as Deposit, G as DepositMethod, H as DepositStatus, I as DepositTarget, J as FeeKind, K as FunderMode, L as FundingOption, M as FundingQuote, N as InitiateDepositInput, O as IssuanceBonus, P as IssueCardInput, Q as MethodTerms, R as PromoCodeQuote, S as PromoCodeStatus, T as Refund, U as RevealCardInput, V as RevealState, W as RevealedCard, X as SetPinInput, Y as TopUpInput, Z as TopUpResult, _ as TopUpTerms, $ as TransferInput, a0 as TransferResult, a1 as UpdateCardInput, a2 as priceChangedQuote, a3 as revealState } from './cards-DP1fJc_c.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';
@@ -81,7 +81,7 @@ interface BrandConfig {
81
81
  * Which platform versions this SDK works with, as a semver range:
82
82
  * comparators separated by ", ". Keep this the only definition.
83
83
  */
84
- declare const SUPPORTED_MEISTER = ">=0.7.6, <1.0.0";
84
+ declare const SUPPORTED_MEISTER = ">=0.8.0, <1.0.0";
85
85
  /** What `client.ready()` returns. */
86
86
  interface ReadyInfo {
87
87
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -187,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
187
187
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
188
188
  * release bump that forgets this file fails the test run.
189
189
  */
190
- declare const SDK_VERSION = "0.6.14";
190
+ declare const SDK_VERSION = "0.8.0";
191
191
 
192
192
  /**
193
193
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
package/dist/index.js CHANGED
@@ -334,6 +334,26 @@ function cardRequestBody(input) {
334
334
  if (consentChannel !== void 0) body["consent_channel"] = consentChannel;
335
335
  return body;
336
336
  }
337
+ function priceChangedQuote(error) {
338
+ const body = isApiError(error) ? error.body : error;
339
+ if (typeof body !== "object" || body === null) return void 0;
340
+ const { code, quote } = body;
341
+ if (code !== "price_changed" || typeof quote !== "object" || quote === null) return void 0;
342
+ return quote;
343
+ }
344
+ function cardOrderQuoteBody(input) {
345
+ const body = {
346
+ product_id: input.productId,
347
+ method: input.method
348
+ };
349
+ if (input.designId !== void 0) body["design_id"] = input.designId;
350
+ if (input.funderSlug !== void 0) body["funder_slug"] = input.funderSlug;
351
+ if (input.currency !== void 0) body["currency"] = input.currency;
352
+ if (input.extraLoad !== void 0) body["extra_load"] = input.extraLoad;
353
+ if (input.promoCode !== void 0) body["promo_code"] = input.promoCode;
354
+ if (input.useBonus !== void 0) body["use_bonus"] = input.useBonus;
355
+ return body;
356
+ }
337
357
  function cardOrderBody(input) {
338
358
  const body = {
339
359
  product_id: input.productId,
@@ -351,6 +371,8 @@ function cardOrderBody(input) {
351
371
  if (input.metadata !== void 0) body["metadata"] = input.metadata;
352
372
  const ids = input.analyticsIds ?? analyticsIds();
353
373
  if (ids !== void 0) body["analytics_ids"] = ids;
374
+ if (input.expectedAmount !== void 0) body["expected_amount"] = input.expectedAmount;
375
+ if (input.expectedCurrency !== void 0) body["expected_currency"] = input.expectedCurrency;
354
376
  return body;
355
377
  }
356
378
  function revealState(r) {
@@ -388,7 +410,10 @@ var CardsResource = class {
388
410
  * `holder_data_required` and the user has not agreed to it), 409
389
411
  * `payments_on_hold` (a payment on this account was not accepted and new
390
412
  * ones wait until support sorts it out: show the message and point the
391
- * user to support), 503 no funding connector or no exchange rate.
413
+ * user to support), 409 `price_changed` (the order came to another amount
414
+ * than `expectedAmount`; no payment was opened, and
415
+ * {@link priceChangedQuote} gives the new quote), 503 no funding connector
416
+ * or no exchange rate.
392
417
  */
393
418
  async order(input) {
394
419
  const { idempotencyKey, ...order } = input;
@@ -397,6 +422,33 @@ var CardsResource = class {
397
422
  idempotencyKey
398
423
  });
399
424
  }
425
+ /**
426
+ * What an order of this card would cost the signed-in user now, with the
427
+ * promo code: the same calculation {@link order} makes, with every
428
+ * condition of the code checked. Nothing is reserved or used up. Pass
429
+ * `amount` and `currency` to the order as `expectedAmount` and
430
+ * `expectedCurrency`.
431
+ */
432
+ async quote(input) {
433
+ return this.http.post("/me/card-orders/quote", {
434
+ body: cardOrderQuoteBody(input)
435
+ });
436
+ }
437
+ /**
438
+ * The same quote before sign-in, for a landing page or the purchase form
439
+ * before the e-mail code. Prices are list prices, and a code whose
440
+ * conditions depend on the person (first card only, say) comes back
441
+ * `conditional`, with `preliminary` set. Send `expectedAmount` with the
442
+ * order placed at sign-in: if the price turns out different, no payment
443
+ * is opened and `card_order_error` carries the new quote. The API limits
444
+ * how often one address can ask (429 `too_many_requests`).
445
+ */
446
+ async quotePublic(input) {
447
+ return this.http.post("/card-orders/quote", {
448
+ body: cardOrderQuoteBody(input),
449
+ skipAuth: true
450
+ });
451
+ }
400
452
  /**
401
453
  * The cards the caller can order, in the order the storefront shows them
402
454
  * (`is_default` marks the one issued when none is chosen). Each item
@@ -1697,7 +1749,7 @@ var FundingOptionsResource = class {
1697
1749
  };
1698
1750
 
1699
1751
  // src/version.ts
1700
- var SDK_VERSION = "0.6.14";
1752
+ var SDK_VERSION = "0.8.0";
1701
1753
 
1702
1754
  // src/client-platform.ts
1703
1755
  var CLIENT_HEADER = "X-Takeal-Client";
@@ -1772,7 +1824,7 @@ function isAbsolute(url) {
1772
1824
  }
1773
1825
 
1774
1826
  // src/compat.ts
1775
- var SUPPORTED_MEISTER = ">=0.7.6, <1.0.0";
1827
+ var SUPPORTED_MEISTER = ">=0.8.0, <1.0.0";
1776
1828
  var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
1777
1829
  function parse(v) {
1778
1830
  const m = SEMVER.exec(v.trim());
@@ -2326,6 +2378,6 @@ function defaultFetch() {
2326
2378
  );
2327
2379
  }
2328
2380
 
2329
- export { ANALYTICS_EVENTS, ApiError, CLIENT_HEADER, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT, METRIKA_GOALS, NO_CAPTURE_CLASS, NetworkError, SDK_VERSION, SUPPORTED_MEISTER, analyticsIds, anonymousKey, createClient, currentTouch, defaultBrowserStore, detectClientPlatform, forgetAnalyticsIds, identify, inMemoryStore, initAnalytics, isApiError, isCardOtp, isNetworkError, page, posthogDistinctId, rememberAnalyticsIds, resetAnalytics, resolveAssetUrl, revealState, sanitizeProperties, sanitizeUrl, satisfies, setAnalyticsZone, track, withAnalyticsIds };
2381
+ export { ANALYTICS_EVENTS, ApiError, CLIENT_HEADER, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT, METRIKA_GOALS, NO_CAPTURE_CLASS, NetworkError, SDK_VERSION, SUPPORTED_MEISTER, analyticsIds, anonymousKey, createClient, currentTouch, defaultBrowserStore, detectClientPlatform, forgetAnalyticsIds, identify, inMemoryStore, initAnalytics, isApiError, isCardOtp, isNetworkError, page, posthogDistinctId, priceChangedQuote, rememberAnalyticsIds, resetAnalytics, resolveAssetUrl, revealState, sanitizeProperties, sanitizeUrl, satisfies, setAnalyticsZone, track, withAnalyticsIds };
2330
2382
  //# sourceMappingURL=index.js.map
2331
2383
  //# sourceMappingURL=index.js.map