@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
@@ -1,15 +1,15 @@
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-D_krTWzr.cjs';
4
+ import './cards-BPu8Ill7.cjs';
5
5
  import './resources/claims.cjs';
6
+ import './resources/codes.cjs';
6
7
  import './resources/consents.cjs';
7
8
  import './resources/attribution.cjs';
8
9
  import './resources/balance.cjs';
9
10
  import './resources/bonus.cjs';
10
11
  import './resources/debt.cjs';
11
12
  import './resources/close-requests.cjs';
12
- import './resources/codes.cjs';
13
13
  import './resources/referral.cjs';
14
14
  import './resources/subscription.cjs';
15
15
  import './resources/branding.cjs';
@@ -1,15 +1,15 @@
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-DPlgx76p.js';
4
+ import './cards-DP1fJc_c.js';
5
5
  import './resources/claims.js';
6
+ import './resources/codes.js';
6
7
  import './resources/consents.js';
7
8
  import './resources/attribution.js';
8
9
  import './resources/balance.js';
9
10
  import './resources/bonus.js';
10
11
  import './resources/debt.js';
11
12
  import './resources/close-requests.js';
12
- import './resources/codes.js';
13
13
  import './resources/referral.js';
14
14
  import './resources/subscription.js';
15
15
  import './resources/branding.js';
package/dist/telegram.js CHANGED
@@ -309,6 +309,19 @@ function cardRequestBody(input) {
309
309
  if (consentChannel !== void 0) body["consent_channel"] = consentChannel;
310
310
  return body;
311
311
  }
312
+ function cardOrderQuoteBody(input) {
313
+ const body = {
314
+ product_id: input.productId,
315
+ method: input.method
316
+ };
317
+ if (input.designId !== void 0) body["design_id"] = input.designId;
318
+ if (input.funderSlug !== void 0) body["funder_slug"] = input.funderSlug;
319
+ if (input.currency !== void 0) body["currency"] = input.currency;
320
+ if (input.extraLoad !== void 0) body["extra_load"] = input.extraLoad;
321
+ if (input.promoCode !== void 0) body["promo_code"] = input.promoCode;
322
+ if (input.useBonus !== void 0) body["use_bonus"] = input.useBonus;
323
+ return body;
324
+ }
312
325
  function cardOrderBody(input) {
313
326
  const body = {
314
327
  product_id: input.productId,
@@ -326,6 +339,8 @@ function cardOrderBody(input) {
326
339
  if (input.metadata !== void 0) body["metadata"] = input.metadata;
327
340
  const ids = input.analyticsIds ?? analyticsIds();
328
341
  if (ids !== void 0) body["analytics_ids"] = ids;
342
+ if (input.expectedAmount !== void 0) body["expected_amount"] = input.expectedAmount;
343
+ if (input.expectedCurrency !== void 0) body["expected_currency"] = input.expectedCurrency;
329
344
  return body;
330
345
  }
331
346
  function revealState(r) {
@@ -363,7 +378,10 @@ var CardsResource = class {
363
378
  * `holder_data_required` and the user has not agreed to it), 409
364
379
  * `payments_on_hold` (a payment on this account was not accepted and new
365
380
  * ones wait until support sorts it out: show the message and point the
366
- * user to support), 503 no funding connector or no exchange rate.
381
+ * user to support), 409 `price_changed` (the order came to another amount
382
+ * than `expectedAmount`; no payment was opened, and
383
+ * {@link priceChangedQuote} gives the new quote), 503 no funding connector
384
+ * or no exchange rate.
367
385
  */
368
386
  async order(input) {
369
387
  const { idempotencyKey, ...order } = input;
@@ -372,6 +390,33 @@ var CardsResource = class {
372
390
  idempotencyKey
373
391
  });
374
392
  }
393
+ /**
394
+ * What an order of this card would cost the signed-in user now, with the
395
+ * promo code: the same calculation {@link order} makes, with every
396
+ * condition of the code checked. Nothing is reserved or used up. Pass
397
+ * `amount` and `currency` to the order as `expectedAmount` and
398
+ * `expectedCurrency`.
399
+ */
400
+ async quote(input) {
401
+ return this.http.post("/me/card-orders/quote", {
402
+ body: cardOrderQuoteBody(input)
403
+ });
404
+ }
405
+ /**
406
+ * The same quote before sign-in, for a landing page or the purchase form
407
+ * before the e-mail code. Prices are list prices, and a code whose
408
+ * conditions depend on the person (first card only, say) comes back
409
+ * `conditional`, with `preliminary` set. Send `expectedAmount` with the
410
+ * order placed at sign-in: if the price turns out different, no payment
411
+ * is opened and `card_order_error` carries the new quote. The API limits
412
+ * how often one address can ask (429 `too_many_requests`).
413
+ */
414
+ async quotePublic(input) {
415
+ return this.http.post("/card-orders/quote", {
416
+ body: cardOrderQuoteBody(input),
417
+ skipAuth: true
418
+ });
419
+ }
375
420
  /**
376
421
  * The cards the caller can order, in the order the storefront shows them
377
422
  * (`is_default` marks the one issued when none is chosen). Each item
@@ -1669,7 +1714,7 @@ var FundingOptionsResource = class {
1669
1714
  };
1670
1715
 
1671
1716
  // src/version.ts
1672
- var SDK_VERSION = "0.6.14";
1717
+ var SDK_VERSION = "0.8.0";
1673
1718
 
1674
1719
  // src/client-platform.ts
1675
1720
  var CLIENT_HEADER = "X-Takeal-Client";
@@ -1744,7 +1789,7 @@ function isAbsolute(url) {
1744
1789
  }
1745
1790
 
1746
1791
  // src/compat.ts
1747
- var SUPPORTED_MEISTER = ">=0.7.6, <1.0.0";
1792
+ var SUPPORTED_MEISTER = ">=0.8.0, <1.0.0";
1748
1793
  var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
1749
1794
  function parse(v) {
1750
1795
  const m = SEMVER.exec(v.trim());