@takeal/cusfront-sdk 0.6.8 → 0.6.14

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 (59) hide show
  1. package/CHANGELOG.md +112 -2
  2. package/README.md +26 -9
  3. package/dist/analytics.cjs +44 -6
  4. package/dist/analytics.cjs.map +1 -1
  5. package/dist/analytics.js +44 -6
  6. package/dist/analytics.js.map +1 -1
  7. package/dist/{cards-BgY00UpU.d.ts → cards-DPlgx76p.d.ts} +86 -18
  8. package/dist/{cards-DGz4Rqu1.d.cts → cards-D_krTWzr.d.cts} +86 -18
  9. package/dist/index.cjs +225 -93
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +5 -5
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.js +221 -94
  14. package/dist/index.js.map +1 -1
  15. package/dist/react/index.d.cts +1 -1
  16. package/dist/react/index.d.ts +1 -1
  17. package/dist/resources/attribution.cjs +99 -4
  18. package/dist/resources/attribution.cjs.map +1 -1
  19. package/dist/resources/attribution.d.cts +58 -1
  20. package/dist/resources/attribution.d.ts +58 -1
  21. package/dist/resources/attribution.js +96 -5
  22. package/dist/resources/attribution.js.map +1 -1
  23. package/dist/resources/auth.cjs +64 -3
  24. package/dist/resources/auth.cjs.map +1 -1
  25. package/dist/resources/auth.d.cts +1 -1
  26. package/dist/resources/auth.d.ts +1 -1
  27. package/dist/resources/auth.js +64 -3
  28. package/dist/resources/auth.js.map +1 -1
  29. package/dist/resources/cards.cjs +69 -7
  30. package/dist/resources/cards.cjs.map +1 -1
  31. package/dist/resources/cards.d.cts +2 -1
  32. package/dist/resources/cards.d.ts +2 -1
  33. package/dist/resources/cards.js +69 -8
  34. package/dist/resources/cards.js.map +1 -1
  35. package/dist/resources/codes.cjs.map +1 -1
  36. package/dist/resources/codes.d.cts +21 -1
  37. package/dist/resources/codes.d.ts +21 -1
  38. package/dist/resources/codes.js.map +1 -1
  39. package/dist/resources/consents.cjs +15 -0
  40. package/dist/resources/consents.cjs.map +1 -1
  41. package/dist/resources/consents.js +15 -0
  42. package/dist/resources/consents.js.map +1 -1
  43. package/dist/resources/deposits.cjs +50 -0
  44. package/dist/resources/deposits.cjs.map +1 -1
  45. package/dist/resources/deposits.d.cts +2 -1
  46. package/dist/resources/deposits.d.ts +2 -1
  47. package/dist/resources/deposits.js +50 -0
  48. package/dist/resources/deposits.js.map +1 -1
  49. package/dist/resources/funding-options.d.cts +2 -1
  50. package/dist/resources/funding-options.d.ts +2 -1
  51. package/dist/resources/me.d.cts +1 -1
  52. package/dist/resources/me.d.ts +1 -1
  53. package/dist/telegram.cjs +224 -73
  54. package/dist/telegram.cjs.map +1 -1
  55. package/dist/telegram.d.cts +34 -3
  56. package/dist/telegram.d.ts +34 -3
  57. package/dist/telegram.js +224 -74
  58. package/dist/telegram.js.map +1 -1
  59. package/package.json +4 -4
@@ -1,6 +1,7 @@
1
1
  import { Claim } from './resources/claims.cjs';
2
2
  import { ConsentKind, ConsentChannel } from './resources/consents.cjs';
3
3
  import { H as HttpClient } from './http-CL97TjMO.cjs';
4
+ import { AnalyticsIds } from './resources/attribution.cjs';
4
5
 
5
6
  /**
6
7
  * Structured customer billing details — shared by the deposits and cards
@@ -369,6 +370,9 @@ interface InitiateDepositInput {
369
370
  * checks it first.
370
371
  */
371
372
  promo_code?: string;
373
+ /** The visitor's analytics ids for the payment's server-side conversions.
374
+ * Leave out to send the ones this browser holds (see `analyticsIds`). */
375
+ analytics_ids?: AnalyticsIds;
372
376
  }
373
377
  interface CreateDepositRefundInput {
374
378
  /** Omit for a full refund of the original confirmed amount; same currency. */
@@ -413,6 +417,11 @@ declare class DepositsResource {
413
417
  * API answers 400 `no_quote_needed`).
414
418
  */
415
419
  quote(input: CreateQuoteInput): Promise<FundingQuote>;
420
+ /**
421
+ * Start a top-up. 409 `payments_on_hold`: a payment on this account was
422
+ * not accepted and new ones wait until support sorts it out. Show the
423
+ * message as it comes and point the user to support.
424
+ */
416
425
  initiate(input: InitiateDepositInput): Promise<Deposit>;
417
426
  /** Fetch one deposit by id — the poll target while a redirect resolves. */
418
427
  get(id: string): Promise<Deposit>;
@@ -462,8 +471,10 @@ type CardType = "credit" | "prepaid" | "gift";
462
471
  /**
463
472
  * Card lifecycle state.
464
473
  *
465
- * - `pending_payment`: the row exists but the issuance fee has not been
466
- * paid yet; the provider has not been called and nothing is visible.
474
+ * - `pending_payment`: an order waiting for its payment, not a card yet.
475
+ * It has no digits and no expiry, and nothing can be done with it:
476
+ * revealing, freezing, closing or renaming it answers 409 `card_pending`.
477
+ * Show it as "waiting for payment", without a way into the card's page.
467
478
  * - `pending`: the issuer accepted the order and has not issued the card
468
479
  * yet. The price is charged. Show the card as "being issued" with no
469
480
  * numbers; it becomes `active` on its own, or `failed` with the price
@@ -520,10 +531,10 @@ interface CardProductPrice {
520
531
  /** What the user pays, decimal string, after their subscription discount. */
521
532
  amount: string;
522
533
  /**
523
- * ISO 4217 code: the currency the buyer pays in. A signed-in user sees
524
- * their wallet currency, converted the way issuance will charge it; the
525
- * public catalog shows the currency the operator priced the card in. It
526
- * is not necessarily the currency the card is held in (`CardProduct.currency`).
534
+ * ISO 4217 code: the currency the operator priced the card in, the same
535
+ * before and after sign-in. A card order paid in this currency costs
536
+ * exactly `amount`. It is not necessarily the currency the card is held
537
+ * in (`CardProduct.currency`).
527
538
  */
528
539
  currency: string;
529
540
  /** Wording for the fee line, e.g. "Card issuance". */
@@ -532,6 +543,15 @@ interface CardProductPrice {
532
543
  base_amount: string;
533
544
  /** Discount applied, in basis points (1000 = 10%). */
534
545
  discount_bps: number;
546
+ /**
547
+ * What issuing costs when paid from the wallet, converted the way that
548
+ * purchase charges it. Only for a signed-in user whose wallet holds another
549
+ * currency than the price; absent otherwise, and when there is no rate.
550
+ */
551
+ from_wallet?: {
552
+ amount: string;
553
+ currency: string;
554
+ } | null;
535
555
  }
536
556
  /**
537
557
  * A card the user can order, as listed by `GET /me/card-products`. The id is
@@ -620,7 +640,7 @@ interface Card {
620
640
  user_id: string;
621
641
  card_type: CardType;
622
642
  status: CardStatus;
623
- /** Last four digits of the PAN — safe to display. */
643
+ /** Last four digits of the PAN — safe to display. Null until the card is paid for and issued. */
624
644
  last4: string | null;
625
645
  expiry_month: number | null;
626
646
  expiry_year: number | null;
@@ -638,10 +658,19 @@ interface Card {
638
658
  close_blocked: CloseBlockedReason | null;
639
659
  /**
640
660
  * Top-ups the issuer has accepted and not loaded yet, summed, decimal
641
- * string in `currency`; `null` when there are none. Show it next to the
661
+ * string in `currency`; `null` when there are none. It counts top-ups from
662
+ * the wallet and top-ups paid straight to the card. Show it next to the
642
663
  * balance as money on its way to the card.
643
664
  */
644
665
  topups_pending: string | null;
666
+ /**
667
+ * `true` while the card's details are being prepared: the card can be
668
+ * used and topped up, but its number can't be shown yet. Show "Details
669
+ * are being prepared" instead of the reveal button and refresh the card
670
+ * later; it turns `false` on its own, usually within minutes. Absent
671
+ * from platforms before 0.7.6.
672
+ */
673
+ details_pending?: boolean;
645
674
  /**
646
675
  * Top-ups the issuer has held for too long, summed, decimal string in
647
676
  * `currency`; `null` when there are none. The money is safe and waits for
@@ -815,6 +844,9 @@ interface CardOrderInput {
815
844
  consentChannel?: ConsentChannel;
816
845
  /** Passed to the payment provider; `return_url` is where the payment page sends the user back. */
817
846
  metadata?: Record<string, string>;
847
+ /** The visitor's analytics ids for the order's server-side conversions.
848
+ * Leave out to send the ones this browser holds (see `analyticsIds`). */
849
+ analyticsIds?: AnalyticsIds;
818
850
  }
819
851
  /** What {@link CardsResource.order} returns: the top-up to pay and its price. */
820
852
  interface CardOrder {
@@ -823,7 +855,7 @@ interface CardOrder {
823
855
  /** What the user pays, decimal string, in `currency`. */
824
856
  amount: string;
825
857
  currency: string;
826
- /** What the payment brings: the card's price, its starting balance and `debt_withheld`, in `card_currency`. */
858
+ /** What the payment brings: the card's price, what goes onto the card and `debt_withheld`, in `card_currency`. A payment in the price's own currency pays the price as it is set; only the rest is converted. */
827
859
  card_amount: string;
828
860
  card_currency: string;
829
861
  /**
@@ -844,6 +876,13 @@ declare function cardOrderBody(input: CardOrderInput): Record<string, unknown>;
844
876
  interface CardBalance {
845
877
  amount: string;
846
878
  currency: string;
879
+ /**
880
+ * From `cards.balance()` only: top-ups the issuer has accepted and not
881
+ * confirmed yet, summed, decimal string in `currency`; `null` when there
882
+ * are none. Not part of `amount`, even when the issuer already shows the
883
+ * money: show it next to the balance as on its way.
884
+ */
885
+ pending?: string | null;
847
886
  }
848
887
  /** What a top-up of a card can be right now, from `GET /me/cards/{id}/topup`. */
849
888
  interface TopUpTerms {
@@ -940,16 +979,30 @@ interface RevealCardInput {
940
979
  password?: string;
941
980
  totpCode?: string;
942
981
  }
982
+ /**
983
+ * What a reveal gave, so a client can switch on one field:
984
+ *
985
+ * - `numbers`: `pan`, `cvv` and the expiry are filled in;
986
+ * - `page`: the issuer shows the numbers on a page of its own, `reveal_url`
987
+ * is set and `pan` and `cvv` are empty;
988
+ * - `pending`: the card's details are still being prepared, nothing else
989
+ * is filled in. Show "Details are being prepared" and try again in a
990
+ * minute or two; the attempt didn't count against the reveal limit.
991
+ */
992
+ type RevealState = "numbers" | "page" | "pending";
943
993
  /**
944
994
  * Full card data from a successful reveal. **Security**: never persist this,
945
995
  * keep it in volatile memory only, clear it within `expires_in_seconds`, and
946
996
  * never write it to localStorage / logs (the API marks the response no-store).
947
997
  *
998
+ * `state` says which of three answers this is (see {@link RevealState}).
948
999
  * Some issuers hand out a page that shows the numbers instead of the
949
- * numbers themselves. Then `reveal_url` is set, `pan` and `cvv` are empty,
950
- * and the client opens the page in a frame; see the README for the frame.
1000
+ * numbers themselves; for some cards the details are still being prepared
1001
+ * right after issuance.
951
1002
  */
952
1003
  interface RevealedCard {
1004
+ /** Which answer this is; set by the SDK from the fields below. */
1005
+ state: RevealState;
953
1006
  /** The card number; empty when `reveal_url` is set. */
954
1007
  pan: string;
955
1008
  /** The security code; empty when `reveal_url` is set. */
@@ -976,7 +1029,14 @@ interface RevealedCard {
976
1029
  billing_address?: BillingAddress;
977
1030
  /** Display window before the client should auto-clear the data. */
978
1031
  expires_in_seconds: number;
1032
+ /**
1033
+ * `true` when the details are still being prepared (`state: "pending"`).
1034
+ * Absent from platforms before 0.7.6.
1035
+ */
1036
+ details_pending?: boolean;
979
1037
  }
1038
+ /** The three answers of a reveal told apart; see {@link RevealState}. */
1039
+ declare function revealState(r: Omit<RevealedCard, "state">): RevealState;
980
1040
  /** Postal address a card is registered at. Which parts exist depends on the country. */
981
1041
  interface BillingAddress {
982
1042
  line1?: string;
@@ -1070,8 +1130,10 @@ declare class CardsResource {
1070
1130
  * `idempotencyKey` returns the same order.
1071
1131
  * Errors: 400 `unknown_product` / `method_not_available` / a limit of the
1072
1132
  * way of paying, 409 `holder_data_consent_required` (the product has
1073
- * `holder_data_required` and the user has not agreed to it), 503 no
1074
- * funding connector or no exchange rate.
1133
+ * `holder_data_required` and the user has not agreed to it), 409
1134
+ * `payments_on_hold` (a payment on this account was not accepted and new
1135
+ * ones wait until support sorts it out: show the message and point the
1136
+ * user to support), 503 no funding connector or no exchange rate.
1075
1137
  */
1076
1138
  order(input: CardOrderInput & {
1077
1139
  idempotencyKey: string;
@@ -1081,7 +1143,9 @@ declare class CardsResource {
1081
1143
  * (`is_default` marks the one issued when none is chosen). Each item
1082
1144
  * carries its product card (name, tagline, benefits, tile picture),
1083
1145
  * artwork, and the issuance price after the caller's subscription
1084
- * discount, in the caller's wallet currency. Pass an item's `id` as
1146
+ * discount, in the currency the operator set it in (`price.from_wallet`
1147
+ * is the same price from the wallet, when that holds another currency).
1148
+ * Pass an item's `id` as
1085
1149
  * `productId` to {@link create}.
1086
1150
  */
1087
1151
  listProducts(): Promise<CardProduct[]>;
@@ -1158,9 +1222,13 @@ declare class CardsResource {
1158
1222
  * keep the result in volatile memory only, never write it to
1159
1223
  * localStorage / logs, and clear it within `expires_in_seconds`.
1160
1224
  *
1161
- * The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
1162
- * when the issuer shows them on a page of its own: open that page in a
1163
- * frame right away, it is short-lived.
1225
+ * `state` tells the three answers apart: `numbers`; `page`, with
1226
+ * `reveal_url` and empty `pan` and `cvv` when the issuer shows them on a
1227
+ * page of its own (open that page in a frame right away, it is
1228
+ * short-lived); or `pending` while the card's details are still being
1229
+ * prepared, which doesn't count against the limit. A card says the same
1230
+ * in {@link Card.details_pending}, so there is no need to call this just
1231
+ * to find out.
1164
1232
  *
1165
1233
  * 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
1166
1234
  * has no sensitive-data endpoint · 503 `provider_unavailable`.
@@ -1208,4 +1276,4 @@ declare class CardsResource {
1208
1276
  terminate(id: string, reason?: string): Promise<Card>;
1209
1277
  }
1210
1278
 
1211
- export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type RevealedCard as Q, type Refund as R, type SetPinInput as S, type TopUpInput as T, type TopUpResult as U, type TopUpTerms as V, type TransferInput as W, type TransferResult as X, type UpdateCardInput as Y, cardOrderBody as Z, cardRequestBody as _, type Card as a, DepositsResource as b, CardsResource as c, type CardBalance as d, type CardDesignRef as e, type CardForm as f, type CardInTransit as g, type CardLoadStatus as h, type CardOrder as i, type CardOrderError as j, type CardOrderInput as k, type CardProductPrice as l, type CardStatus as m, type CardStatusSource as n, type CardTariff as o, type CardTopUp as p, type CardTopUpStatus as q, type CardTransfer as r, type CardType as s, type Cardholder as t, type CloseBlockedReason as u, type CreateCardInput as v, type CreateDepositRefundInput as w, type CreateQuoteInput as x, type CustomerInfo as y, type DepositMethod as z };
1279
+ export { cardOrderBody as $, type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type RevealState as Q, type Refund as R, type RevealedCard as S, type SetPinInput as T, type TopUpInput as U, type TopUpResult as V, type TopUpTerms as W, type TransferInput as X, type TransferResult as Y, type UpdateCardInput as Z, revealState as _, type Card as a, cardRequestBody as a0, DepositsResource as b, CardsResource as c, type CardBalance as d, type CardDesignRef as e, type CardForm as f, type CardInTransit as g, type CardLoadStatus as h, type CardOrder as i, type CardOrderError as j, type CardOrderInput as k, type CardProductPrice as l, type CardStatus as m, type CardStatusSource as n, type CardTariff as o, type CardTopUp as p, type CardTopUpStatus as q, type CardTransfer as r, type CardType as s, type Cardholder as t, type CloseBlockedReason as u, type CreateCardInput as v, type CreateDepositRefundInput as w, type CreateQuoteInput as x, type CustomerInfo as y, type DepositMethod as z };