@takeal/cusfront-sdk 0.6.14 → 0.8.1
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/CHANGELOG.md +57 -0
- package/README.md +53 -1
- package/dist/analytics.cjs +88 -7
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.d.cts +30 -2
- package/dist/analytics.d.ts +30 -2
- package/dist/analytics.js +86 -8
- package/dist/analytics.js.map +1 -1
- package/dist/{cards-D_krTWzr.d.cts → cards-BPu8Ill7.d.cts} +122 -2
- package/dist/{cards-DPlgx76p.d.ts → cards-DP1fJc_c.d.ts} +122 -2
- package/dist/index.cjs +147 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +147 -15
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/resources/auth.cjs +8 -4
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +17 -6
- package/dist/resources/auth.d.ts +17 -6
- package/dist/resources/auth.js +8 -4
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +60 -1
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +2 -1
- package/dist/resources/cards.d.ts +2 -1
- package/dist/resources/cards.js +59 -2
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +2 -1
- package/dist/resources/deposits.d.ts +2 -1
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/funding-options.d.cts +2 -1
- package/dist/resources/funding-options.d.ts +2 -1
- package/dist/resources/me.d.cts +1 -1
- package/dist/resources/me.d.ts +1 -1
- package/dist/telegram.cjs +54 -7
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +2 -2
- package/dist/telegram.d.ts +2 -2
- package/dist/telegram.js +54 -7
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
package/dist/telegram.d.cts
CHANGED
|
@@ -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-
|
|
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';
|
package/dist/telegram.d.ts
CHANGED
|
@@ -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-
|
|
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),
|
|
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
|
|
@@ -788,10 +833,12 @@ var AuthResource = class {
|
|
|
788
833
|
await Promise.resolve(this.tokens.set(resp.access_token));
|
|
789
834
|
return resp;
|
|
790
835
|
}
|
|
791
|
-
/**
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
* {@link requestEmailChange} and {@link confirmEmailChange}
|
|
836
|
+
/** Always answers 409 `email_change_needs_code` on platform 0.8.1 and
|
|
837
|
+
* newer: an address is attached only after a code sent to it comes back.
|
|
838
|
+
* For the first real email of a Telegram-made account use
|
|
839
|
+
* {@link requestEmailChange} and {@link confirmEmailChange}; they clear
|
|
840
|
+
* `email_pending` too.
|
|
841
|
+
* @deprecated Use {@link requestEmailChange} and {@link confirmEmailChange}. */
|
|
795
842
|
async linkEmail(input) {
|
|
796
843
|
return this.http.post("/me/email", { body: { email: input.email } });
|
|
797
844
|
}
|
|
@@ -1669,7 +1716,7 @@ var FundingOptionsResource = class {
|
|
|
1669
1716
|
};
|
|
1670
1717
|
|
|
1671
1718
|
// src/version.ts
|
|
1672
|
-
var SDK_VERSION = "0.
|
|
1719
|
+
var SDK_VERSION = "0.8.1";
|
|
1673
1720
|
|
|
1674
1721
|
// src/client-platform.ts
|
|
1675
1722
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1744,7 +1791,7 @@ function isAbsolute(url) {
|
|
|
1744
1791
|
}
|
|
1745
1792
|
|
|
1746
1793
|
// src/compat.ts
|
|
1747
|
-
var SUPPORTED_MEISTER = ">=0.
|
|
1794
|
+
var SUPPORTED_MEISTER = ">=0.8.0, <1.0.0";
|
|
1748
1795
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1749
1796
|
function parse(v) {
|
|
1750
1797
|
const m = SEMVER.exec(v.trim());
|