@takeal/cusfront-sdk 0.3.18 → 0.5.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.
- package/CHANGELOG.md +139 -0
- package/README.md +430 -9
- package/dist/analytics.cjs +417 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.cts +129 -0
- package/dist/analytics.d.ts +129 -0
- package/dist/analytics.js +403 -0
- package/dist/analytics.js.map +1 -0
- package/dist/cards-B_aNY35J.d.cts +514 -0
- package/dist/cards-Ba1wZttb.d.ts +514 -0
- package/dist/deposits-BEc8U80M.d.cts +310 -0
- package/dist/deposits-DScyT_D9.d.ts +310 -0
- package/dist/{devices-DP_hxwmW.d.ts → devices-B_YveTl9.d.ts} +1 -1
- package/dist/{devices-C3JHi2Hi.d.cts → devices-a5Z45Mx_.d.cts} +1 -1
- package/dist/{http-B-OQwMYn.d.cts → http-DeANAoTs.d.cts} +11 -3
- package/dist/{http-B-OQwMYn.d.ts → http-DeANAoTs.d.ts} +11 -3
- package/dist/index.cjs +964 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -13
- package/dist/index.d.ts +101 -13
- package/dist/index.js +949 -78
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +12 -5
- package/dist/react/index.d.ts +12 -5
- package/dist/resources/attribution.cjs +82 -0
- package/dist/resources/attribution.cjs.map +1 -0
- package/dist/resources/attribution.d.cts +100 -0
- package/dist/resources/attribution.d.ts +100 -0
- package/dist/resources/attribution.js +78 -0
- package/dist/resources/attribution.js.map +1 -0
- package/dist/resources/auth.cjs +81 -15
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +53 -6
- package/dist/resources/auth.d.ts +53 -6
- package/dist/resources/auth.js +81 -15
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/balance.d.cts +1 -1
- package/dist/resources/balance.d.ts +1 -1
- package/dist/resources/blog.cjs.map +1 -1
- package/dist/resources/blog.d.cts +8 -1
- package/dist/resources/blog.d.ts +8 -1
- package/dist/resources/blog.js.map +1 -1
- package/dist/resources/bonus.cjs +28 -0
- package/dist/resources/bonus.cjs.map +1 -0
- package/dist/resources/bonus.d.cts +121 -0
- package/dist/resources/bonus.d.ts +121 -0
- package/dist/resources/bonus.js +26 -0
- package/dist/resources/bonus.js.map +1 -0
- package/dist/resources/branding.d.cts +1 -1
- package/dist/resources/branding.d.ts +1 -1
- package/dist/resources/cards.cjs +73 -10
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +2 -281
- package/dist/resources/cards.d.ts +2 -281
- package/dist/resources/cards.js +73 -11
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/codes.cjs +20 -0
- package/dist/resources/codes.cjs.map +1 -0
- package/dist/resources/codes.d.cts +100 -0
- package/dist/resources/codes.d.ts +100 -0
- package/dist/resources/codes.js +18 -0
- package/dist/resources/codes.js.map +1 -0
- package/dist/resources/deposits.cjs +28 -3
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +3 -176
- package/dist/resources/deposits.d.ts +3 -176
- package/dist/resources/deposits.js +28 -3
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/devices.d.cts +2 -2
- package/dist/resources/devices.d.ts +2 -2
- package/dist/resources/documents.cjs +64 -0
- package/dist/resources/documents.cjs.map +1 -0
- package/dist/resources/documents.d.cts +212 -0
- package/dist/resources/documents.d.ts +212 -0
- package/dist/resources/documents.js +62 -0
- package/dist/resources/documents.js.map +1 -0
- package/dist/resources/funding-options.cjs +16 -0
- package/dist/resources/funding-options.cjs.map +1 -0
- package/dist/resources/funding-options.d.cts +3 -0
- package/dist/resources/funding-options.d.ts +3 -0
- package/dist/resources/funding-options.js +14 -0
- package/dist/resources/funding-options.js.map +1 -0
- package/dist/resources/history.cjs +31 -0
- package/dist/resources/history.cjs.map +1 -0
- package/dist/resources/history.d.cts +95 -0
- package/dist/resources/history.d.ts +95 -0
- package/dist/resources/history.js +29 -0
- package/dist/resources/history.js.map +1 -0
- package/dist/resources/me.d.cts +3 -1
- package/dist/resources/me.d.ts +3 -1
- package/dist/resources/notifications.d.cts +1 -1
- package/dist/resources/notifications.d.ts +1 -1
- package/dist/resources/push.d.cts +1 -1
- package/dist/resources/push.d.ts +1 -1
- package/dist/resources/referral.cjs +16 -0
- package/dist/resources/referral.cjs.map +1 -0
- package/dist/resources/referral.d.cts +58 -0
- package/dist/resources/referral.d.ts +58 -0
- package/dist/resources/referral.js +14 -0
- package/dist/resources/referral.js.map +1 -0
- package/dist/resources/sessions.d.cts +1 -1
- package/dist/resources/sessions.d.ts +1 -1
- package/dist/resources/subscription.cjs +24 -0
- package/dist/resources/subscription.cjs.map +1 -0
- package/dist/resources/subscription.d.cts +48 -0
- package/dist/resources/subscription.d.ts +48 -0
- package/dist/resources/subscription.js +22 -0
- package/dist/resources/subscription.js.map +1 -0
- package/dist/resources/subscriptions.d.cts +1 -1
- package/dist/resources/subscriptions.d.ts +1 -1
- package/dist/resources/wallet.d.cts +1 -1
- package/dist/resources/wallet.d.ts +1 -1
- package/dist/telegram.cjs +499 -77
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +12 -5
- package/dist/telegram.d.ts +12 -5
- package/dist/telegram.js +499 -77
- package/dist/telegram.js.map +1 -1
- package/package.json +46 -1
- package/dist/customer-CoxPwe5o.d.cts +0 -32
- package/dist/customer-CoxPwe5o.d.ts +0 -32
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { T as TokenStore, F as FetchLike } from './http-
|
|
2
|
-
export { d as defaultBrowserStore, i as inMemoryStore } from './http-
|
|
1
|
+
import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.cjs';
|
|
2
|
+
export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.cjs';
|
|
3
3
|
import { AuthResource } from './resources/auth.cjs';
|
|
4
4
|
export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.cjs';
|
|
5
|
-
import { DepositsResource } from './
|
|
6
|
-
export { CreateDepositRefundInput, CreateQuoteInput, Deposit, DepositMethod, DepositStatus, FundingQuote, InitiateDepositInput, Refund } from './
|
|
7
|
-
import { CardsResource } from './
|
|
8
|
-
export { Card, CardBalance, CardDesignRef, CardProduct, CardProductPrice, CardStatus, CardType, CreateCardInput, RevealCardInput, RevealedCard, UpdateCardInput } from './
|
|
5
|
+
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-BEc8U80M.cjs';
|
|
6
|
+
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as FunderMode, h as FundingOption, i as FundingQuote, I as InitiateDepositInput, j as IssueCardInput, R as Refund } from './deposits-BEc8U80M.cjs';
|
|
7
|
+
import { b as CardsResource } from './cards-B_aNY35J.cjs';
|
|
8
|
+
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct, e as CardProductPrice, f as CardStatus, g as CardTopUp, h as CardTransfer, i as CardType, j as CreateCardInput, k as CustomerInfo, I as IssuanceBonus, R as RevealCardInput, l as RevealedCard, T as TopUpInput, m as TopUpResult, n as TopUpTerms, o as TransferInput, p as TransferResult, U as UpdateCardInput } from './cards-B_aNY35J.cjs';
|
|
9
9
|
import { BalanceResource } from './resources/balance.cjs';
|
|
10
10
|
export { Balance } from './resources/balance.cjs';
|
|
11
|
+
import { BonusResource } from './resources/bonus.cjs';
|
|
12
|
+
export { BonusLot, BonusMovement, BonusPreview, BonusPreviewInput, BonusPurpose, BonusTarget, BonusWallet } from './resources/bonus.cjs';
|
|
13
|
+
import { CodesResource } from './resources/codes.cjs';
|
|
14
|
+
export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.cjs';
|
|
15
|
+
import { ReferralResource } from './resources/referral.cjs';
|
|
16
|
+
export { InvitedFriend, Referral, ReferralReward } from './resources/referral.cjs';
|
|
17
|
+
import { SubscriptionResource } from './resources/subscription.cjs';
|
|
18
|
+
export { UserSubscription } from './resources/subscription.cjs';
|
|
11
19
|
import { BrandingResource } from './resources/branding.cjs';
|
|
12
20
|
export { Branding } from './resources/branding.cjs';
|
|
13
21
|
import { WalletResource } from './resources/wallet.cjs';
|
|
14
22
|
export { Wallet } from './resources/wallet.cjs';
|
|
15
23
|
import { BlogResource } from './resources/blog.cjs';
|
|
16
24
|
export { BlogBlock, BlogList, BlogListInput, BlogPost } from './resources/blog.cjs';
|
|
25
|
+
import { DocumentsResource } from './resources/documents.cjs';
|
|
26
|
+
export { Document, DocumentBlock, DocumentCategory, DocumentFolder, DocumentList, DocumentListInput, DocumentPathStep, DocumentScope, DocumentTag, DocumentTree, DocumentTreeEntry, DocumentVersionSummary } from './resources/documents.cjs';
|
|
17
27
|
import { SubscriptionsResource } from './resources/subscriptions.cjs';
|
|
18
28
|
export { BroadcastChannel, Subscriptions } from './resources/subscriptions.cjs';
|
|
19
29
|
import { SessionsResource } from './resources/sessions.cjs';
|
|
@@ -23,9 +33,13 @@ export { PushCapableRegistration, PushStatus, PushSubscriptionInput } from './re
|
|
|
23
33
|
import { MeResource } from './resources/me.cjs';
|
|
24
34
|
import { NotificationsResource } from './resources/notifications.cjs';
|
|
25
35
|
export { CardOtpData, InboxItem, ListNotificationsParams, NotificationCategory, NotificationCategoryPreferences, NotificationChannel, NotificationLocale, NotificationPage, NotificationPreferences, NotificationPreferencesInput, isCardOtp } from './resources/notifications.cjs';
|
|
26
|
-
import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-
|
|
27
|
-
export { a as CLIENT_HEADER, b as ClientPlatform, c as Device, d as DeviceKind, e as DevicePlatform, M as MobilePushCredential, f as RegisterDeviceInput, g as RegisterWebPushOptions, h as RegisteredDevice, U as UnregisterWebPushOptions, W as WebPushCredential, i as detectClientPlatform } from './devices-
|
|
28
|
-
|
|
36
|
+
import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-a5Z45Mx_.cjs';
|
|
37
|
+
export { a as CLIENT_HEADER, b as ClientPlatform, c as Device, d as DeviceKind, e as DevicePlatform, M as MobilePushCredential, f as RegisterDeviceInput, g as RegisterWebPushOptions, h as RegisteredDevice, U as UnregisterWebPushOptions, W as WebPushCredential, i as detectClientPlatform } from './devices-a5Z45Mx_.cjs';
|
|
38
|
+
import { AttributionResource } from './resources/attribution.cjs';
|
|
39
|
+
export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.cjs';
|
|
40
|
+
import { HistoryResource } from './resources/history.cjs';
|
|
41
|
+
export { HistoryAmount, HistoryCard, HistoryItem, HistoryKind, HistoryPage, HistoryStatus, ListHistoryParams } from './resources/history.cjs';
|
|
42
|
+
export { ANALYTICS_EVENTS, AnalyticsEvent, AnalyticsOptions, AnalyticsProperties, AnalyticsZone, METRIKA_GOALS, MetrikaOptions, NO_CAPTURE_CLASS, PostHogLike, PostHogOptions, identify, initAnalytics, page, posthogDistinctId, resetAnalytics, sanitizeProperties, sanitizeUrl, setAnalyticsZone, track } from './analytics.cjs';
|
|
29
43
|
|
|
30
44
|
/**
|
|
31
45
|
* Brand config — runtime-passed, not build-time-baked.
|
|
@@ -53,6 +67,50 @@ interface BrandConfig {
|
|
|
53
67
|
walletLabel?: string;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Which platform versions this SDK works with, as a semver range:
|
|
72
|
+
* comparators separated by ", ". Keep this the only definition.
|
|
73
|
+
*/
|
|
74
|
+
declare const SUPPORTED_MEISTER = ">=0.5.0, <0.6.0";
|
|
75
|
+
/** What `client.ready()` returns. */
|
|
76
|
+
interface ReadyInfo {
|
|
77
|
+
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
78
|
+
compatible: boolean;
|
|
79
|
+
/** The platform version the deployment reported, or `null` when it didn't. */
|
|
80
|
+
platformVersion: string | null;
|
|
81
|
+
/** The range this SDK supports (`SUPPORTED_MEISTER`). */
|
|
82
|
+
supportedMeister: string;
|
|
83
|
+
/** Why `compatible` is false, in one English sentence for logs or a banner. */
|
|
84
|
+
warning?: string;
|
|
85
|
+
/** `true` when every platform dependency answered (HTTP 200), `false` on 503. */
|
|
86
|
+
healthy: boolean;
|
|
87
|
+
/** `ready` or `degraded`, as the platform reports it. */
|
|
88
|
+
status: string;
|
|
89
|
+
/** The raw `GET /ready` body, for fields this type doesn't name. */
|
|
90
|
+
raw: ReadyBody;
|
|
91
|
+
}
|
|
92
|
+
/** The part of the `GET /ready` body the SDK reads. */
|
|
93
|
+
interface ReadyBody {
|
|
94
|
+
status?: string;
|
|
95
|
+
ops?: {
|
|
96
|
+
/** Build version of the API process. */
|
|
97
|
+
version?: string;
|
|
98
|
+
/** The platform version. Missing on platforms before 0.5.0. */
|
|
99
|
+
platform_version?: string;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
};
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `satisfies("0.5.3", ">=0.5.0, <0.6.0")` → `true`.
|
|
106
|
+
*
|
|
107
|
+
* The range is comma-separated comparators (`>=`, `>`, `<=`, `<`, `=`) or a
|
|
108
|
+
* bare version meaning exactly that version; all must hold. A prerelease
|
|
109
|
+
* (`0.5.1-rc.1`) never satisfies a range unless a comparator names it
|
|
110
|
+
* exactly. Anything unparseable gives `false`.
|
|
111
|
+
*/
|
|
112
|
+
declare function satisfies(version: string, range: string): boolean;
|
|
113
|
+
|
|
56
114
|
/**
|
|
57
115
|
* Resolve an image URL the API hands back (`design.image_url`, a logo, …)
|
|
58
116
|
* into something a browser can load.
|
|
@@ -119,7 +177,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
119
177
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
120
178
|
* release bump that forgets this file fails the test run.
|
|
121
179
|
*/
|
|
122
|
-
declare const SDK_VERSION = "0.
|
|
180
|
+
declare const SDK_VERSION = "0.5.0";
|
|
123
181
|
|
|
124
182
|
/**
|
|
125
183
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
|
@@ -152,6 +210,10 @@ interface CreateClientOptions {
|
|
|
152
210
|
/** Token persistence. Defaults to `defaultBrowserStore()` when
|
|
153
211
|
* `window.localStorage` is present, else `inMemoryStore()`. */
|
|
154
212
|
tokenStore?: TokenStore;
|
|
213
|
+
/** Where the remember token of a "remember me" sign-in is kept. Defaults
|
|
214
|
+
* to `localStorage` under `takeal_remember` in a browser, in memory
|
|
215
|
+
* elsewhere. Native wrappers should pass secure storage. */
|
|
216
|
+
rememberStore?: TokenStore;
|
|
155
217
|
/** Override the `fetch` implementation — useful for Node < 18,
|
|
156
218
|
* React Native < 0.74, MSW intercept layers, etc. */
|
|
157
219
|
fetch?: FetchLike;
|
|
@@ -168,17 +230,30 @@ interface CusfrontClient {
|
|
|
168
230
|
readonly client: ResolvedClientDescriptor;
|
|
169
231
|
/** Auth resource: login, refresh, current user, logout. */
|
|
170
232
|
readonly auth: AuthResource;
|
|
171
|
-
/** Deposits (money IN via a funder connector): initiate, get, list, refund. */
|
|
233
|
+
/** Deposits (money IN via a funder connector, to the wallet or straight onto a card): initiate, get, list, refund. */
|
|
172
234
|
readonly deposits: DepositsResource;
|
|
235
|
+
/** The ways to top up: each funding connector, where its top-ups land and the methods it takes. */
|
|
236
|
+
readonly fundingOptions: FundingOptionsResource;
|
|
173
237
|
/** Cards (money OUT via an issuer connector): the product catalog, create, get, list, update, balance. */
|
|
174
238
|
readonly cards: CardsResource;
|
|
175
239
|
/** Wallet balance lookup (defaults to the wallet's own currency). */
|
|
176
240
|
readonly balance: BalanceResource;
|
|
241
|
+
/** Bonuses: a discount on the platform's services. Balance, credits, history and a price preview. */
|
|
242
|
+
readonly bonus: BonusResource;
|
|
243
|
+
/** Promo and referral codes: check what a code would do before using it. */
|
|
244
|
+
readonly codes: CodesResource;
|
|
245
|
+
/** For referrers: the referral code, the link to share, invited friends and rewards. */
|
|
246
|
+
readonly referral: ReferralResource;
|
|
247
|
+
/** The user's own subscription tier or gift, and a promo code for its monthly fee. */
|
|
248
|
+
readonly subscription: SubscriptionResource;
|
|
177
249
|
/** The wallet's currency: read it, switch it while the wallet is empty. */
|
|
178
250
|
readonly wallet: WalletResource;
|
|
179
251
|
/** Runtime white-label config (`GET /branding`, public): names, logo, wallet label. */
|
|
180
252
|
readonly branding: BrandingResource;
|
|
181
|
-
/**
|
|
253
|
+
/** Documents: blog posts, the knowledge base, legal pages. Public before sign-in, more once signed in. */
|
|
254
|
+
readonly documents: DocumentsResource;
|
|
255
|
+
/** Public blog posts, returned as structured blocks to render in your own style.
|
|
256
|
+
* @deprecated Use `documents.list({ category: "blog" })` and `documents.get(slug)`; the blog is a category of Documents now. The old paths answer for one more release. */
|
|
182
257
|
readonly blog: BlogResource;
|
|
183
258
|
/** The user's announcement channel subscriptions.
|
|
184
259
|
* @deprecated Use `notifications.setPreferences({ categories: { marketing: {...} } })`. */
|
|
@@ -194,6 +269,10 @@ interface CusfrontClient {
|
|
|
194
269
|
readonly devices: DevicesResource;
|
|
195
270
|
/** Profile actions for the signed-in user: link or unlink Telegram. */
|
|
196
271
|
readonly me: MeResource;
|
|
272
|
+
/** Where users come from: record visits, ask "how did you hear about us". */
|
|
273
|
+
readonly attribution: AttributionResource;
|
|
274
|
+
/** Everything that happened to the user's money in one list, or one card's part of it. */
|
|
275
|
+
readonly history: HistoryResource;
|
|
197
276
|
/** Direct access to the token store (e.g. for an explicit sign-out
|
|
198
277
|
* on Capacitor's lifecycle "app pausing" event). */
|
|
199
278
|
readonly tokens: TokenStore;
|
|
@@ -204,6 +283,15 @@ interface CusfrontClient {
|
|
|
204
283
|
* design, `/card-designs/default.svg`) is joined onto `baseUrl`.
|
|
205
284
|
*/
|
|
206
285
|
assetUrl(url: string): string;
|
|
286
|
+
/**
|
|
287
|
+
* Ask the deployment whether it is up and which platform version it runs
|
|
288
|
+
* (`GET /ready`, public). `compatible` is false, with a `warning`, when the
|
|
289
|
+
* version is outside `SUPPORTED_MEISTER` or the platform didn't report one.
|
|
290
|
+
* A degraded platform (503) answers with `healthy: false`, not an error.
|
|
291
|
+
*/
|
|
292
|
+
ready(opts?: {
|
|
293
|
+
signal?: AbortSignal;
|
|
294
|
+
}): Promise<ReadyInfo>;
|
|
207
295
|
}
|
|
208
296
|
/**
|
|
209
297
|
* Build a new client. Stateless across calls — multiple clients can
|
|
@@ -215,4 +303,4 @@ interface CusfrontClient {
|
|
|
215
303
|
*/
|
|
216
304
|
declare function createClient(opts: CreateClientOptions): CusfrontClient;
|
|
217
305
|
|
|
218
|
-
export { ApiError, type BrandConfig, ClientDescriptor, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, ResolvedClientDescriptor, SDK_VERSION, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl };
|
|
306
|
+
export { ApiError, type BrandConfig, ClientDescriptor, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { T as TokenStore, F as FetchLike } from './http-
|
|
2
|
-
export { d as defaultBrowserStore, i as inMemoryStore } from './http-
|
|
1
|
+
import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.js';
|
|
2
|
+
export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.js';
|
|
3
3
|
import { AuthResource } from './resources/auth.js';
|
|
4
4
|
export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.js';
|
|
5
|
-
import { DepositsResource } from './
|
|
6
|
-
export { CreateDepositRefundInput, CreateQuoteInput, Deposit, DepositMethod, DepositStatus, FundingQuote, InitiateDepositInput, Refund } from './
|
|
7
|
-
import { CardsResource } from './
|
|
8
|
-
export { Card, CardBalance, CardDesignRef, CardProduct, CardProductPrice, CardStatus, CardType, CreateCardInput, RevealCardInput, RevealedCard, UpdateCardInput } from './
|
|
5
|
+
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-DScyT_D9.js';
|
|
6
|
+
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as FunderMode, h as FundingOption, i as FundingQuote, I as InitiateDepositInput, j as IssueCardInput, R as Refund } from './deposits-DScyT_D9.js';
|
|
7
|
+
import { b as CardsResource } from './cards-Ba1wZttb.js';
|
|
8
|
+
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct, e as CardProductPrice, f as CardStatus, g as CardTopUp, h as CardTransfer, i as CardType, j as CreateCardInput, k as CustomerInfo, I as IssuanceBonus, R as RevealCardInput, l as RevealedCard, T as TopUpInput, m as TopUpResult, n as TopUpTerms, o as TransferInput, p as TransferResult, U as UpdateCardInput } from './cards-Ba1wZttb.js';
|
|
9
9
|
import { BalanceResource } from './resources/balance.js';
|
|
10
10
|
export { Balance } from './resources/balance.js';
|
|
11
|
+
import { BonusResource } from './resources/bonus.js';
|
|
12
|
+
export { BonusLot, BonusMovement, BonusPreview, BonusPreviewInput, BonusPurpose, BonusTarget, BonusWallet } from './resources/bonus.js';
|
|
13
|
+
import { CodesResource } from './resources/codes.js';
|
|
14
|
+
export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.js';
|
|
15
|
+
import { ReferralResource } from './resources/referral.js';
|
|
16
|
+
export { InvitedFriend, Referral, ReferralReward } from './resources/referral.js';
|
|
17
|
+
import { SubscriptionResource } from './resources/subscription.js';
|
|
18
|
+
export { UserSubscription } from './resources/subscription.js';
|
|
11
19
|
import { BrandingResource } from './resources/branding.js';
|
|
12
20
|
export { Branding } from './resources/branding.js';
|
|
13
21
|
import { WalletResource } from './resources/wallet.js';
|
|
14
22
|
export { Wallet } from './resources/wallet.js';
|
|
15
23
|
import { BlogResource } from './resources/blog.js';
|
|
16
24
|
export { BlogBlock, BlogList, BlogListInput, BlogPost } from './resources/blog.js';
|
|
25
|
+
import { DocumentsResource } from './resources/documents.js';
|
|
26
|
+
export { Document, DocumentBlock, DocumentCategory, DocumentFolder, DocumentList, DocumentListInput, DocumentPathStep, DocumentScope, DocumentTag, DocumentTree, DocumentTreeEntry, DocumentVersionSummary } from './resources/documents.js';
|
|
17
27
|
import { SubscriptionsResource } from './resources/subscriptions.js';
|
|
18
28
|
export { BroadcastChannel, Subscriptions } from './resources/subscriptions.js';
|
|
19
29
|
import { SessionsResource } from './resources/sessions.js';
|
|
@@ -23,9 +33,13 @@ export { PushCapableRegistration, PushStatus, PushSubscriptionInput } from './re
|
|
|
23
33
|
import { MeResource } from './resources/me.js';
|
|
24
34
|
import { NotificationsResource } from './resources/notifications.js';
|
|
25
35
|
export { CardOtpData, InboxItem, ListNotificationsParams, NotificationCategory, NotificationCategoryPreferences, NotificationChannel, NotificationLocale, NotificationPage, NotificationPreferences, NotificationPreferencesInput, isCardOtp } from './resources/notifications.js';
|
|
26
|
-
import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-
|
|
27
|
-
export { a as CLIENT_HEADER, b as ClientPlatform, c as Device, d as DeviceKind, e as DevicePlatform, M as MobilePushCredential, f as RegisterDeviceInput, g as RegisterWebPushOptions, h as RegisteredDevice, U as UnregisterWebPushOptions, W as WebPushCredential, i as detectClientPlatform } from './devices-
|
|
28
|
-
|
|
36
|
+
import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-B_YveTl9.js';
|
|
37
|
+
export { a as CLIENT_HEADER, b as ClientPlatform, c as Device, d as DeviceKind, e as DevicePlatform, M as MobilePushCredential, f as RegisterDeviceInput, g as RegisterWebPushOptions, h as RegisteredDevice, U as UnregisterWebPushOptions, W as WebPushCredential, i as detectClientPlatform } from './devices-B_YveTl9.js';
|
|
38
|
+
import { AttributionResource } from './resources/attribution.js';
|
|
39
|
+
export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.js';
|
|
40
|
+
import { HistoryResource } from './resources/history.js';
|
|
41
|
+
export { HistoryAmount, HistoryCard, HistoryItem, HistoryKind, HistoryPage, HistoryStatus, ListHistoryParams } from './resources/history.js';
|
|
42
|
+
export { ANALYTICS_EVENTS, AnalyticsEvent, AnalyticsOptions, AnalyticsProperties, AnalyticsZone, METRIKA_GOALS, MetrikaOptions, NO_CAPTURE_CLASS, PostHogLike, PostHogOptions, identify, initAnalytics, page, posthogDistinctId, resetAnalytics, sanitizeProperties, sanitizeUrl, setAnalyticsZone, track } from './analytics.js';
|
|
29
43
|
|
|
30
44
|
/**
|
|
31
45
|
* Brand config — runtime-passed, not build-time-baked.
|
|
@@ -53,6 +67,50 @@ interface BrandConfig {
|
|
|
53
67
|
walletLabel?: string;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Which platform versions this SDK works with, as a semver range:
|
|
72
|
+
* comparators separated by ", ". Keep this the only definition.
|
|
73
|
+
*/
|
|
74
|
+
declare const SUPPORTED_MEISTER = ">=0.5.0, <0.6.0";
|
|
75
|
+
/** What `client.ready()` returns. */
|
|
76
|
+
interface ReadyInfo {
|
|
77
|
+
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
78
|
+
compatible: boolean;
|
|
79
|
+
/** The platform version the deployment reported, or `null` when it didn't. */
|
|
80
|
+
platformVersion: string | null;
|
|
81
|
+
/** The range this SDK supports (`SUPPORTED_MEISTER`). */
|
|
82
|
+
supportedMeister: string;
|
|
83
|
+
/** Why `compatible` is false, in one English sentence for logs or a banner. */
|
|
84
|
+
warning?: string;
|
|
85
|
+
/** `true` when every platform dependency answered (HTTP 200), `false` on 503. */
|
|
86
|
+
healthy: boolean;
|
|
87
|
+
/** `ready` or `degraded`, as the platform reports it. */
|
|
88
|
+
status: string;
|
|
89
|
+
/** The raw `GET /ready` body, for fields this type doesn't name. */
|
|
90
|
+
raw: ReadyBody;
|
|
91
|
+
}
|
|
92
|
+
/** The part of the `GET /ready` body the SDK reads. */
|
|
93
|
+
interface ReadyBody {
|
|
94
|
+
status?: string;
|
|
95
|
+
ops?: {
|
|
96
|
+
/** Build version of the API process. */
|
|
97
|
+
version?: string;
|
|
98
|
+
/** The platform version. Missing on platforms before 0.5.0. */
|
|
99
|
+
platform_version?: string;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
};
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `satisfies("0.5.3", ">=0.5.0, <0.6.0")` → `true`.
|
|
106
|
+
*
|
|
107
|
+
* The range is comma-separated comparators (`>=`, `>`, `<=`, `<`, `=`) or a
|
|
108
|
+
* bare version meaning exactly that version; all must hold. A prerelease
|
|
109
|
+
* (`0.5.1-rc.1`) never satisfies a range unless a comparator names it
|
|
110
|
+
* exactly. Anything unparseable gives `false`.
|
|
111
|
+
*/
|
|
112
|
+
declare function satisfies(version: string, range: string): boolean;
|
|
113
|
+
|
|
56
114
|
/**
|
|
57
115
|
* Resolve an image URL the API hands back (`design.image_url`, a logo, …)
|
|
58
116
|
* into something a browser can load.
|
|
@@ -119,7 +177,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
119
177
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
120
178
|
* release bump that forgets this file fails the test run.
|
|
121
179
|
*/
|
|
122
|
-
declare const SDK_VERSION = "0.
|
|
180
|
+
declare const SDK_VERSION = "0.5.0";
|
|
123
181
|
|
|
124
182
|
/**
|
|
125
183
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
|
@@ -152,6 +210,10 @@ interface CreateClientOptions {
|
|
|
152
210
|
/** Token persistence. Defaults to `defaultBrowserStore()` when
|
|
153
211
|
* `window.localStorage` is present, else `inMemoryStore()`. */
|
|
154
212
|
tokenStore?: TokenStore;
|
|
213
|
+
/** Where the remember token of a "remember me" sign-in is kept. Defaults
|
|
214
|
+
* to `localStorage` under `takeal_remember` in a browser, in memory
|
|
215
|
+
* elsewhere. Native wrappers should pass secure storage. */
|
|
216
|
+
rememberStore?: TokenStore;
|
|
155
217
|
/** Override the `fetch` implementation — useful for Node < 18,
|
|
156
218
|
* React Native < 0.74, MSW intercept layers, etc. */
|
|
157
219
|
fetch?: FetchLike;
|
|
@@ -168,17 +230,30 @@ interface CusfrontClient {
|
|
|
168
230
|
readonly client: ResolvedClientDescriptor;
|
|
169
231
|
/** Auth resource: login, refresh, current user, logout. */
|
|
170
232
|
readonly auth: AuthResource;
|
|
171
|
-
/** Deposits (money IN via a funder connector): initiate, get, list, refund. */
|
|
233
|
+
/** Deposits (money IN via a funder connector, to the wallet or straight onto a card): initiate, get, list, refund. */
|
|
172
234
|
readonly deposits: DepositsResource;
|
|
235
|
+
/** The ways to top up: each funding connector, where its top-ups land and the methods it takes. */
|
|
236
|
+
readonly fundingOptions: FundingOptionsResource;
|
|
173
237
|
/** Cards (money OUT via an issuer connector): the product catalog, create, get, list, update, balance. */
|
|
174
238
|
readonly cards: CardsResource;
|
|
175
239
|
/** Wallet balance lookup (defaults to the wallet's own currency). */
|
|
176
240
|
readonly balance: BalanceResource;
|
|
241
|
+
/** Bonuses: a discount on the platform's services. Balance, credits, history and a price preview. */
|
|
242
|
+
readonly bonus: BonusResource;
|
|
243
|
+
/** Promo and referral codes: check what a code would do before using it. */
|
|
244
|
+
readonly codes: CodesResource;
|
|
245
|
+
/** For referrers: the referral code, the link to share, invited friends and rewards. */
|
|
246
|
+
readonly referral: ReferralResource;
|
|
247
|
+
/** The user's own subscription tier or gift, and a promo code for its monthly fee. */
|
|
248
|
+
readonly subscription: SubscriptionResource;
|
|
177
249
|
/** The wallet's currency: read it, switch it while the wallet is empty. */
|
|
178
250
|
readonly wallet: WalletResource;
|
|
179
251
|
/** Runtime white-label config (`GET /branding`, public): names, logo, wallet label. */
|
|
180
252
|
readonly branding: BrandingResource;
|
|
181
|
-
/**
|
|
253
|
+
/** Documents: blog posts, the knowledge base, legal pages. Public before sign-in, more once signed in. */
|
|
254
|
+
readonly documents: DocumentsResource;
|
|
255
|
+
/** Public blog posts, returned as structured blocks to render in your own style.
|
|
256
|
+
* @deprecated Use `documents.list({ category: "blog" })` and `documents.get(slug)`; the blog is a category of Documents now. The old paths answer for one more release. */
|
|
182
257
|
readonly blog: BlogResource;
|
|
183
258
|
/** The user's announcement channel subscriptions.
|
|
184
259
|
* @deprecated Use `notifications.setPreferences({ categories: { marketing: {...} } })`. */
|
|
@@ -194,6 +269,10 @@ interface CusfrontClient {
|
|
|
194
269
|
readonly devices: DevicesResource;
|
|
195
270
|
/** Profile actions for the signed-in user: link or unlink Telegram. */
|
|
196
271
|
readonly me: MeResource;
|
|
272
|
+
/** Where users come from: record visits, ask "how did you hear about us". */
|
|
273
|
+
readonly attribution: AttributionResource;
|
|
274
|
+
/** Everything that happened to the user's money in one list, or one card's part of it. */
|
|
275
|
+
readonly history: HistoryResource;
|
|
197
276
|
/** Direct access to the token store (e.g. for an explicit sign-out
|
|
198
277
|
* on Capacitor's lifecycle "app pausing" event). */
|
|
199
278
|
readonly tokens: TokenStore;
|
|
@@ -204,6 +283,15 @@ interface CusfrontClient {
|
|
|
204
283
|
* design, `/card-designs/default.svg`) is joined onto `baseUrl`.
|
|
205
284
|
*/
|
|
206
285
|
assetUrl(url: string): string;
|
|
286
|
+
/**
|
|
287
|
+
* Ask the deployment whether it is up and which platform version it runs
|
|
288
|
+
* (`GET /ready`, public). `compatible` is false, with a `warning`, when the
|
|
289
|
+
* version is outside `SUPPORTED_MEISTER` or the platform didn't report one.
|
|
290
|
+
* A degraded platform (503) answers with `healthy: false`, not an error.
|
|
291
|
+
*/
|
|
292
|
+
ready(opts?: {
|
|
293
|
+
signal?: AbortSignal;
|
|
294
|
+
}): Promise<ReadyInfo>;
|
|
207
295
|
}
|
|
208
296
|
/**
|
|
209
297
|
* Build a new client. Stateless across calls — multiple clients can
|
|
@@ -215,4 +303,4 @@ interface CusfrontClient {
|
|
|
215
303
|
*/
|
|
216
304
|
declare function createClient(opts: CreateClientOptions): CusfrontClient;
|
|
217
305
|
|
|
218
|
-
export { ApiError, type BrandConfig, ClientDescriptor, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, ResolvedClientDescriptor, SDK_VERSION, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl };
|
|
306
|
+
export { ApiError, type BrandConfig, ClientDescriptor, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
|