@takeal/cusfront-sdk 0.6.5 → 0.6.8

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 (97) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +90 -0
  3. package/dist/{cards-ColpW52n.d.ts → cards-BgY00UpU.d.ts} +18 -1
  4. package/dist/{cards-CEFKrVkl.d.cts → cards-DGz4Rqu1.d.cts} +18 -1
  5. package/dist/{devices-B_YveTl9.d.ts → devices-C88c38hm.d.ts} +1 -1
  6. package/dist/{devices-a5Z45Mx_.d.cts → devices-CiJrlXum.d.cts} +1 -1
  7. package/dist/{http-DeANAoTs.d.cts → http-CL97TjMO.d.cts} +4 -0
  8. package/dist/{http-DeANAoTs.d.ts → http-CL97TjMO.d.ts} +4 -0
  9. package/dist/index.cjs +142 -6
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +19 -11
  12. package/dist/index.d.ts +19 -11
  13. package/dist/index.js +142 -6
  14. package/dist/index.js.map +1 -1
  15. package/dist/react/index.d.cts +5 -3
  16. package/dist/react/index.d.ts +5 -3
  17. package/dist/resources/attribution.d.cts +1 -1
  18. package/dist/resources/attribution.d.ts +1 -1
  19. package/dist/resources/auth.cjs.map +1 -1
  20. package/dist/resources/auth.d.cts +3 -2
  21. package/dist/resources/auth.d.ts +3 -2
  22. package/dist/resources/auth.js.map +1 -1
  23. package/dist/resources/balance.d.cts +1 -1
  24. package/dist/resources/balance.d.ts +1 -1
  25. package/dist/resources/blog.d.cts +1 -1
  26. package/dist/resources/blog.d.ts +1 -1
  27. package/dist/resources/bonus.d.cts +1 -1
  28. package/dist/resources/bonus.d.ts +1 -1
  29. package/dist/resources/branding.d.cts +1 -1
  30. package/dist/resources/branding.d.ts +1 -1
  31. package/dist/resources/cards.cjs +16 -0
  32. package/dist/resources/cards.cjs.map +1 -1
  33. package/dist/resources/cards.d.cts +3 -2
  34. package/dist/resources/cards.d.ts +3 -2
  35. package/dist/resources/cards.js +16 -0
  36. package/dist/resources/cards.js.map +1 -1
  37. package/dist/resources/claims.cjs +40 -0
  38. package/dist/resources/claims.cjs.map +1 -0
  39. package/dist/resources/claims.d.cts +114 -0
  40. package/dist/resources/claims.d.ts +114 -0
  41. package/dist/resources/claims.js +38 -0
  42. package/dist/resources/claims.js.map +1 -0
  43. package/dist/resources/close-requests.d.cts +1 -1
  44. package/dist/resources/close-requests.d.ts +1 -1
  45. package/dist/resources/codes.d.cts +1 -1
  46. package/dist/resources/codes.d.ts +1 -1
  47. package/dist/resources/consents.d.cts +1 -1
  48. package/dist/resources/consents.d.ts +1 -1
  49. package/dist/resources/debt.d.cts +1 -1
  50. package/dist/resources/debt.d.ts +1 -1
  51. package/dist/resources/deposits.cjs.map +1 -1
  52. package/dist/resources/deposits.d.cts +3 -2
  53. package/dist/resources/deposits.d.ts +3 -2
  54. package/dist/resources/deposits.js.map +1 -1
  55. package/dist/resources/devices.d.cts +2 -2
  56. package/dist/resources/devices.d.ts +2 -2
  57. package/dist/resources/documents.d.cts +1 -1
  58. package/dist/resources/documents.d.ts +1 -1
  59. package/dist/resources/funding-options.d.cts +3 -2
  60. package/dist/resources/funding-options.d.ts +3 -2
  61. package/dist/resources/history.d.cts +1 -1
  62. package/dist/resources/history.d.ts +1 -1
  63. package/dist/resources/me.d.cts +3 -2
  64. package/dist/resources/me.d.ts +3 -2
  65. package/dist/resources/notifications.d.cts +1 -1
  66. package/dist/resources/notifications.d.ts +1 -1
  67. package/dist/resources/push.d.cts +1 -1
  68. package/dist/resources/push.d.ts +1 -1
  69. package/dist/resources/receipts.d.cts +1 -1
  70. package/dist/resources/receipts.d.ts +1 -1
  71. package/dist/resources/referral.d.cts +1 -1
  72. package/dist/resources/referral.d.ts +1 -1
  73. package/dist/resources/sessions.d.cts +1 -1
  74. package/dist/resources/sessions.d.ts +1 -1
  75. package/dist/resources/subscription.cjs +9 -0
  76. package/dist/resources/subscription.cjs.map +1 -1
  77. package/dist/resources/subscription.d.cts +20 -3
  78. package/dist/resources/subscription.d.ts +20 -3
  79. package/dist/resources/subscription.js +9 -0
  80. package/dist/resources/subscription.js.map +1 -1
  81. package/dist/resources/subscriptions.d.cts +1 -1
  82. package/dist/resources/subscriptions.d.ts +1 -1
  83. package/dist/resources/support.cjs +69 -0
  84. package/dist/resources/support.cjs.map +1 -0
  85. package/dist/resources/support.d.cts +115 -0
  86. package/dist/resources/support.d.ts +115 -0
  87. package/dist/resources/support.js +67 -0
  88. package/dist/resources/support.js.map +1 -0
  89. package/dist/resources/wallet.d.cts +1 -1
  90. package/dist/resources/wallet.d.ts +1 -1
  91. package/dist/telegram.cjs +142 -6
  92. package/dist/telegram.cjs.map +1 -1
  93. package/dist/telegram.d.cts +5 -3
  94. package/dist/telegram.d.ts +5 -3
  95. package/dist/telegram.js +142 -6
  96. package/dist/telegram.js.map +1 -1
  97. package/package.json +11 -1
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.cjs';
2
- export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.cjs';
1
+ import { T as TokenStore, F as FetchLike } from './http-CL97TjMO.cjs';
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-CEFKrVkl.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 RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-CEFKrVkl.cjs';
5
+ import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-DGz4Rqu1.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 RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-DGz4Rqu1.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';
@@ -12,12 +12,14 @@ import { DebtResource } from './resources/debt.cjs';
12
12
  export { CardFeeKind, Debt, DebtAmount, DebtLine } from './resources/debt.cjs';
13
13
  import { CloseRequestsResource } from './resources/close-requests.cjs';
14
14
  export { CloseAmount, CloseRefund, CloseRequest, CloseRequestError, CloseRequestStatus, PayoutDetailsInput, PayoutDetailsShown } from './resources/close-requests.cjs';
15
+ import { ClaimsResource } from './resources/claims.cjs';
16
+ export { Claim, ClaimError, ClaimKind, ClaimPage, ClaimStatus, ClaimTransaction, CreateClaimInput } from './resources/claims.cjs';
15
17
  import { CodesResource } from './resources/codes.cjs';
16
18
  export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.cjs';
17
19
  import { ReferralResource } from './resources/referral.cjs';
18
20
  export { InvitedFriend, Referral, ReferralReward } from './resources/referral.cjs';
19
21
  import { SubscriptionResource } from './resources/subscription.cjs';
20
- export { UserSubscription } from './resources/subscription.cjs';
22
+ export { CancelledSubscription, UserSubscription } from './resources/subscription.cjs';
21
23
  import { BrandingResource } from './resources/branding.cjs';
22
24
  export { Branding } from './resources/branding.cjs';
23
25
  import { WalletResource } from './resources/wallet.cjs';
@@ -35,8 +37,8 @@ export { PushCapableRegistration, PushStatus, PushSubscriptionInput } from './re
35
37
  import { MeResource } from './resources/me.cjs';
36
38
  import { NotificationsResource } from './resources/notifications.cjs';
37
39
  export { CardOtpData, InboxItem, ListNotificationsParams, NotificationCategory, NotificationCategoryPreferences, NotificationChannel, NotificationLocale, NotificationPage, NotificationPreferences, NotificationPreferencesInput, isCardOtp } from './resources/notifications.cjs';
38
- import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-a5Z45Mx_.cjs';
39
- 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';
40
+ import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-CiJrlXum.cjs';
41
+ 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-CiJrlXum.cjs';
40
42
  import { AttributionResource } from './resources/attribution.cjs';
41
43
  export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.cjs';
42
44
  import { HistoryResource } from './resources/history.cjs';
@@ -45,6 +47,8 @@ import { ConsentsResource } from './resources/consents.cjs';
45
47
  export { ConsentChannel, ConsentDocument, ConsentKind, ConsentOptions, ConsentState, Consents, CookieChoiceInput, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT } from './resources/consents.cjs';
46
48
  import { ReceiptsResource } from './resources/receipts.cjs';
47
49
  export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.cjs';
50
+ import { SupportResource } from './resources/support.cjs';
51
+ export { SupportAttachment, SupportChannel, SupportConversation, SupportConversationStatus, SupportFile, SupportMessage, SupportMessageStatus, SupportRatingRequest } from './resources/support.cjs';
48
52
  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';
49
53
 
50
54
  /**
@@ -77,7 +81,7 @@ interface BrandConfig {
77
81
  * Which platform versions this SDK works with, as a semver range:
78
82
  * comparators separated by ", ". Keep this the only definition.
79
83
  */
80
- declare const SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
84
+ declare const SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
81
85
  /** What `client.ready()` returns. */
82
86
  interface ReadyInfo {
83
87
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -183,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
183
187
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
184
188
  * release bump that forgets this file fails the test run.
185
189
  */
186
- declare const SDK_VERSION = "0.6.5";
190
+ declare const SDK_VERSION = "0.6.8";
187
191
 
188
192
  /**
189
193
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
@@ -250,11 +254,13 @@ interface CusfrontClient {
250
254
  readonly debt: DebtResource;
251
255
  /** Close a card that still holds money: the rest goes back the way it was paid. */
252
256
  readonly closeRequests: CloseRequestsResource;
257
+ /** Dispute a card operation or complain, and follow claims (lost and stolen cards included) by number and status. */
258
+ readonly claims: ClaimsResource;
253
259
  /** Promo and referral codes: check what a code would do before using it. */
254
260
  readonly codes: CodesResource;
255
261
  /** For referrers: the referral code, the link to share, invited friends and rewards. */
256
262
  readonly referral: ReferralResource;
257
- /** The user's own subscription tier or gift, and a promo code for its monthly fee. */
263
+ /** The user's own subscription tier or gift, a promo code for its monthly fee, and cancelling it. */
258
264
  readonly subscription: SubscriptionResource;
259
265
  /** The wallet's currency: read it, switch it while the wallet is empty. */
260
266
  readonly wallet: WalletResource;
@@ -287,6 +293,8 @@ interface CusfrontClient {
287
293
  readonly consents: ConsentsResource;
288
294
  /** A numbered receipt for every payment. */
289
295
  readonly receipts: ReceiptsResource;
296
+ /** The chat with support: messages, files, the conversation's status. */
297
+ readonly support: SupportResource;
290
298
  /** Direct access to the token store (e.g. for an explicit sign-out
291
299
  * on Capacitor's lifecycle "app pausing" event). */
292
300
  readonly tokens: TokenStore;
@@ -317,4 +325,4 @@ interface CusfrontClient {
317
325
  */
318
326
  declare function createClient(opts: CreateClientOptions): CusfrontClient;
319
327
 
320
- export { ApiError, type BrandConfig, ClientDescriptor, ConsentsResource, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ReceiptsResource, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
328
+ export { ApiError, type BrandConfig, ClientDescriptor, ConsentsResource, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ReceiptsResource, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, SupportResource, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.js';
2
- export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.js';
1
+ import { T as TokenStore, F as FetchLike } from './http-CL97TjMO.js';
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-ColpW52n.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 RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-ColpW52n.js';
5
+ import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-BgY00UpU.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 RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-BgY00UpU.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';
@@ -12,12 +12,14 @@ import { DebtResource } from './resources/debt.js';
12
12
  export { CardFeeKind, Debt, DebtAmount, DebtLine } from './resources/debt.js';
13
13
  import { CloseRequestsResource } from './resources/close-requests.js';
14
14
  export { CloseAmount, CloseRefund, CloseRequest, CloseRequestError, CloseRequestStatus, PayoutDetailsInput, PayoutDetailsShown } from './resources/close-requests.js';
15
+ import { ClaimsResource } from './resources/claims.js';
16
+ export { Claim, ClaimError, ClaimKind, ClaimPage, ClaimStatus, ClaimTransaction, CreateClaimInput } from './resources/claims.js';
15
17
  import { CodesResource } from './resources/codes.js';
16
18
  export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.js';
17
19
  import { ReferralResource } from './resources/referral.js';
18
20
  export { InvitedFriend, Referral, ReferralReward } from './resources/referral.js';
19
21
  import { SubscriptionResource } from './resources/subscription.js';
20
- export { UserSubscription } from './resources/subscription.js';
22
+ export { CancelledSubscription, UserSubscription } from './resources/subscription.js';
21
23
  import { BrandingResource } from './resources/branding.js';
22
24
  export { Branding } from './resources/branding.js';
23
25
  import { WalletResource } from './resources/wallet.js';
@@ -35,8 +37,8 @@ export { PushCapableRegistration, PushStatus, PushSubscriptionInput } from './re
35
37
  import { MeResource } from './resources/me.js';
36
38
  import { NotificationsResource } from './resources/notifications.js';
37
39
  export { CardOtpData, InboxItem, ListNotificationsParams, NotificationCategory, NotificationCategoryPreferences, NotificationChannel, NotificationLocale, NotificationPage, NotificationPreferences, NotificationPreferencesInput, isCardOtp } from './resources/notifications.js';
38
- import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-B_YveTl9.js';
39
- 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';
40
+ import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-C88c38hm.js';
41
+ 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-C88c38hm.js';
40
42
  import { AttributionResource } from './resources/attribution.js';
41
43
  export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.js';
42
44
  import { HistoryResource } from './resources/history.js';
@@ -45,6 +47,8 @@ import { ConsentsResource } from './resources/consents.js';
45
47
  export { ConsentChannel, ConsentDocument, ConsentKind, ConsentOptions, ConsentState, Consents, CookieChoiceInput, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT } from './resources/consents.js';
46
48
  import { ReceiptsResource } from './resources/receipts.js';
47
49
  export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.js';
50
+ import { SupportResource } from './resources/support.js';
51
+ export { SupportAttachment, SupportChannel, SupportConversation, SupportConversationStatus, SupportFile, SupportMessage, SupportMessageStatus, SupportRatingRequest } from './resources/support.js';
48
52
  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';
49
53
 
50
54
  /**
@@ -77,7 +81,7 @@ interface BrandConfig {
77
81
  * Which platform versions this SDK works with, as a semver range:
78
82
  * comparators separated by ", ". Keep this the only definition.
79
83
  */
80
- declare const SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
84
+ declare const SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
81
85
  /** What `client.ready()` returns. */
82
86
  interface ReadyInfo {
83
87
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -183,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
183
187
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
184
188
  * release bump that forgets this file fails the test run.
185
189
  */
186
- declare const SDK_VERSION = "0.6.5";
190
+ declare const SDK_VERSION = "0.6.8";
187
191
 
188
192
  /**
189
193
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
@@ -250,11 +254,13 @@ interface CusfrontClient {
250
254
  readonly debt: DebtResource;
251
255
  /** Close a card that still holds money: the rest goes back the way it was paid. */
252
256
  readonly closeRequests: CloseRequestsResource;
257
+ /** Dispute a card operation or complain, and follow claims (lost and stolen cards included) by number and status. */
258
+ readonly claims: ClaimsResource;
253
259
  /** Promo and referral codes: check what a code would do before using it. */
254
260
  readonly codes: CodesResource;
255
261
  /** For referrers: the referral code, the link to share, invited friends and rewards. */
256
262
  readonly referral: ReferralResource;
257
- /** The user's own subscription tier or gift, and a promo code for its monthly fee. */
263
+ /** The user's own subscription tier or gift, a promo code for its monthly fee, and cancelling it. */
258
264
  readonly subscription: SubscriptionResource;
259
265
  /** The wallet's currency: read it, switch it while the wallet is empty. */
260
266
  readonly wallet: WalletResource;
@@ -287,6 +293,8 @@ interface CusfrontClient {
287
293
  readonly consents: ConsentsResource;
288
294
  /** A numbered receipt for every payment. */
289
295
  readonly receipts: ReceiptsResource;
296
+ /** The chat with support: messages, files, the conversation's status. */
297
+ readonly support: SupportResource;
290
298
  /** Direct access to the token store (e.g. for an explicit sign-out
291
299
  * on Capacitor's lifecycle "app pausing" event). */
292
300
  readonly tokens: TokenStore;
@@ -317,4 +325,4 @@ interface CusfrontClient {
317
325
  */
318
326
  declare function createClient(opts: CreateClientOptions): CusfrontClient;
319
327
 
320
- export { ApiError, type BrandConfig, ClientDescriptor, ConsentsResource, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ReceiptsResource, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
328
+ export { ApiError, type BrandConfig, ClientDescriptor, ConsentsResource, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ReceiptsResource, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, SupportResource, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
package/dist/index.js CHANGED
@@ -71,10 +71,20 @@ var HttpClient = class {
71
71
  async delete(path, opts = {}) {
72
72
  return this.request("DELETE", path, opts);
73
73
  }
74
+ /** GET a file. Same auth and refresh as the JSON calls; an error status
75
+ * throws `ApiError` the same way. */
76
+ async getBlob(path, opts = {}) {
77
+ const resp = await this.send("GET", path, { ...opts, accept: "*/*" });
78
+ if (!resp.ok) return parseResponse(resp);
79
+ return resp.blob();
80
+ }
74
81
  async request(method, path, opts) {
82
+ return parseResponse(await this.send(method, path, opts));
83
+ }
84
+ async send(method, path, opts) {
75
85
  const url = this.absolute(path);
76
86
  const headers = {
77
- Accept: "application/json",
87
+ Accept: opts.accept ?? "application/json",
78
88
  ...this.defaultHeaders
79
89
  };
80
90
  if (opts.body !== void 0) headers["Content-Type"] = "application/json";
@@ -100,10 +110,10 @@ var HttpClient = class {
100
110
  }
101
111
  if (resp.status === 401 && !opts.skipAuth && !opts.retried && this.refresher) {
102
112
  if (await this.refreshOnce()) {
103
- return this.request(method, path, { ...opts, retried: true });
113
+ return this.send(method, path, { ...opts, retried: true });
104
114
  }
105
115
  }
106
- return parseResponse(resp);
116
+ return resp;
107
117
  }
108
118
  absolute(path) {
109
119
  if (path.startsWith("http://") || path.startsWith("https://")) return path;
@@ -349,6 +359,22 @@ var CardsResource = class {
349
359
  async unfreeze(id) {
350
360
  return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
351
361
  }
362
+ /**
363
+ * Report the card lost or stolen. Works at any time, on an active or a
364
+ * frozen card. The report is recorded first with the server's time, which
365
+ * decides who pays for operations someone else made; then the card is
366
+ * frozen at its issuer and only support can unfreeze it. Resolves to the
367
+ * claim (`client.claims`): show its `number` and `reported_at`. When the
368
+ * issuer can't be reached, `card_freeze` is `"pending"`: the report still
369
+ * counts and support freezes the card by hand. Reporting again while the
370
+ * report is open returns the same claim. 404 / 403 not the user's card ·
371
+ * 409 `card_not_open`: the card is closed or was never issued.
372
+ */
373
+ async reportLost(id, input) {
374
+ return this.http.post(`/me/cards/${encodeURIComponent(id)}/report-lost`, {
375
+ body: { kind: input.kind, details: input.details }
376
+ });
377
+ }
352
378
  /**
353
379
  * Set the PIN of the caller's own physical card. The session is enough; the
354
380
  * call is rate-limited like {@link reveal} and the PIN is kept nowhere.
@@ -801,6 +827,41 @@ var CloseRequestsResource = class {
801
827
  }
802
828
  };
803
829
 
830
+ // src/resources/claims.ts
831
+ var ClaimsResource = class {
832
+ constructor(http) {
833
+ this.http = http;
834
+ }
835
+ /**
836
+ * Dispute a card operation, or complain. 400 `validation`: a description
837
+ * that is too short or too long, an operation that isn't on the user's
838
+ * cards, or a lost or stolen card (use `cards.reportLost()`) · 404 no
839
+ * such card · 409 `too_many_claims`: 20 claims are waiting for an answer.
840
+ */
841
+ async create(input) {
842
+ return this.http.post("/me/claims", {
843
+ body: {
844
+ kind: input.kind,
845
+ description: input.description,
846
+ card_id: input.cardId,
847
+ transaction_id: input.transactionId
848
+ }
849
+ });
850
+ }
851
+ /** The user's claims, lost and stolen cards included, newest first. */
852
+ async list(opts = {}) {
853
+ const qs = new URLSearchParams();
854
+ if (opts.limit != null) qs.set("limit", String(opts.limit));
855
+ if (opts.offset != null) qs.set("offset", String(opts.offset));
856
+ const q = qs.toString();
857
+ return this.http.get(`/me/claims${q ? `?${q}` : ""}`, { signal: opts.signal });
858
+ }
859
+ /** One claim. 404 when it isn't the user's. */
860
+ async get(id, opts = {}) {
861
+ return this.http.get(`/me/claims/${encodeURIComponent(id)}`, { signal: opts.signal });
862
+ }
863
+ };
864
+
804
865
  // src/resources/codes.ts
805
866
  var CodesResource = class {
806
867
  constructor(http) {
@@ -844,6 +905,15 @@ var SubscriptionResource = class {
844
905
  async setPromoCode(code) {
845
906
  return this.http.put("/me/subscription/promo-code", { body: { code } });
846
907
  }
908
+ /**
909
+ * Cancel the subscription now, in one step. What was paid for the current
910
+ * period comes back to the balance for the days not used. No subscription
911
+ * running → 404; 503 `refund_unavailable` when the refund can't be made
912
+ * right now (the subscription keeps running; try again).
913
+ */
914
+ async cancel() {
915
+ return this.http.post("/me/subscription/cancel", {});
916
+ }
847
917
  };
848
918
 
849
919
  // src/resources/branding.ts
@@ -1427,6 +1497,70 @@ var ReceiptsResource = class {
1427
1497
  }
1428
1498
  };
1429
1499
 
1500
+ // src/resources/support.ts
1501
+ function bytesToBase64(bytes) {
1502
+ let binary = "";
1503
+ const chunk = 32768;
1504
+ for (let i = 0; i < bytes.length; i += chunk) {
1505
+ binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
1506
+ }
1507
+ return btoa(binary);
1508
+ }
1509
+ async function toBase64(data) {
1510
+ if (typeof data === "string") return data;
1511
+ if (data instanceof Uint8Array) return bytesToBase64(data);
1512
+ if (data instanceof ArrayBuffer) return bytesToBase64(new Uint8Array(data));
1513
+ return bytesToBase64(new Uint8Array(await data.arrayBuffer()));
1514
+ }
1515
+ var SupportResource = class {
1516
+ constructor(http) {
1517
+ this.http = http;
1518
+ }
1519
+ /** The latest messages, oldest first, and the conversation's status.
1520
+ * `before` reads further back; `limit` is 1 to 100 (50). */
1521
+ async list(opts = {}) {
1522
+ const q = new URLSearchParams();
1523
+ if (opts.before) q.set("before", opts.before);
1524
+ if (opts.limit !== void 0) q.set("limit", String(opts.limit));
1525
+ const qs = q.toString();
1526
+ return this.http.get(`/me/support/messages${qs ? `?${qs}` : ""}`, {
1527
+ signal: opts.signal
1528
+ });
1529
+ }
1530
+ /** Write to support. Text, files or both; up to 10 files. */
1531
+ async send(message, opts = {}) {
1532
+ const attachments = await Promise.all(
1533
+ (message.files ?? []).map(async (f) => ({
1534
+ file_name: f.fileName,
1535
+ content_type: f.contentType,
1536
+ data_base64: await toBase64(f.data)
1537
+ }))
1538
+ );
1539
+ return this.http.post("/me/support/messages", {
1540
+ body: { text: message.text ?? "", attachments },
1541
+ signal: opts.signal
1542
+ });
1543
+ }
1544
+ /** A file from the conversation: the person's own or one support sent. */
1545
+ async attachment(id, opts = {}) {
1546
+ return this.http.getBlob(`/me/support/attachments/${encodeURIComponent(id)}`, {
1547
+ signal: opts.signal
1548
+ });
1549
+ }
1550
+ /** Answer `rating_request`: 1 (bad) to 5 (great), a comment if the person
1551
+ * wrote one. Each question takes one answer; a second one is a 404. */
1552
+ async rate(id, answer, opts = {}) {
1553
+ await this.http.post(`/me/support/ratings/${encodeURIComponent(id)}`, {
1554
+ body: { rating: answer.rating, ...answer.comment ? { comment: answer.comment } : {} },
1555
+ signal: opts.signal
1556
+ });
1557
+ }
1558
+ /** Just the conversation's status. */
1559
+ async status(opts = {}) {
1560
+ return (await this.list({ limit: 1, signal: opts.signal })).status;
1561
+ }
1562
+ };
1563
+
1430
1564
  // src/resources/funding-options.ts
1431
1565
  var FundingOptionsResource = class {
1432
1566
  constructor(http) {
@@ -1439,7 +1573,7 @@ var FundingOptionsResource = class {
1439
1573
  };
1440
1574
 
1441
1575
  // src/version.ts
1442
- var SDK_VERSION = "0.6.5";
1576
+ var SDK_VERSION = "0.6.8";
1443
1577
 
1444
1578
  // src/client-platform.ts
1445
1579
  var CLIENT_HEADER = "X-Takeal-Client";
@@ -1514,7 +1648,7 @@ function isAbsolute(url) {
1514
1648
  }
1515
1649
 
1516
1650
  // src/compat.ts
1517
- var SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
1651
+ var SUPPORTED_MEISTER = ">=0.6.13, <1.0.0";
1518
1652
  var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
1519
1653
  function parse(v) {
1520
1654
  const m = SEMVER.exec(v.trim());
@@ -2029,6 +2163,7 @@ function createClient(opts) {
2029
2163
  bonus: new BonusResource(http),
2030
2164
  debt: new DebtResource(http),
2031
2165
  closeRequests: new CloseRequestsResource(http),
2166
+ claims: new ClaimsResource(http),
2032
2167
  codes: new CodesResource(http),
2033
2168
  referral: new ReferralResource(http),
2034
2169
  subscription: new SubscriptionResource(http),
@@ -2045,7 +2180,8 @@ function createClient(opts) {
2045
2180
  attribution: new AttributionResource(http),
2046
2181
  history: new HistoryResource(http),
2047
2182
  consents: new ConsentsResource(http),
2048
- receipts: new ReceiptsResource(http)
2183
+ receipts: new ReceiptsResource(http),
2184
+ support: new SupportResource(http)
2049
2185
  };
2050
2186
  }
2051
2187
  function pickDefaultStore(key) {