@takeal/cusfront-sdk 0.6.5 → 0.6.6

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 (79) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +53 -0
  3. package/dist/{cards-CEFKrVkl.d.cts → cards-BiXmrz7h.d.cts} +1 -1
  4. package/dist/{cards-ColpW52n.d.ts → cards-DwmzjKDC.d.ts} +1 -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 +81 -6
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +13 -9
  12. package/dist/index.d.ts +13 -9
  13. package/dist/index.js +81 -6
  14. package/dist/index.js.map +1 -1
  15. package/dist/react/index.d.cts +4 -3
  16. package/dist/react/index.d.ts +4 -3
  17. package/dist/resources/attribution.d.cts +1 -1
  18. package/dist/resources/attribution.d.ts +1 -1
  19. package/dist/resources/auth.d.cts +2 -2
  20. package/dist/resources/auth.d.ts +2 -2
  21. package/dist/resources/balance.d.cts +1 -1
  22. package/dist/resources/balance.d.ts +1 -1
  23. package/dist/resources/blog.d.cts +1 -1
  24. package/dist/resources/blog.d.ts +1 -1
  25. package/dist/resources/bonus.d.cts +1 -1
  26. package/dist/resources/bonus.d.ts +1 -1
  27. package/dist/resources/branding.d.cts +1 -1
  28. package/dist/resources/branding.d.ts +1 -1
  29. package/dist/resources/cards.d.cts +2 -2
  30. package/dist/resources/cards.d.ts +2 -2
  31. package/dist/resources/close-requests.d.cts +1 -1
  32. package/dist/resources/close-requests.d.ts +1 -1
  33. package/dist/resources/codes.d.cts +1 -1
  34. package/dist/resources/codes.d.ts +1 -1
  35. package/dist/resources/consents.d.cts +1 -1
  36. package/dist/resources/consents.d.ts +1 -1
  37. package/dist/resources/debt.d.cts +1 -1
  38. package/dist/resources/debt.d.ts +1 -1
  39. package/dist/resources/deposits.d.cts +2 -2
  40. package/dist/resources/deposits.d.ts +2 -2
  41. package/dist/resources/devices.d.cts +2 -2
  42. package/dist/resources/devices.d.ts +2 -2
  43. package/dist/resources/documents.d.cts +1 -1
  44. package/dist/resources/documents.d.ts +1 -1
  45. package/dist/resources/funding-options.d.cts +2 -2
  46. package/dist/resources/funding-options.d.ts +2 -2
  47. package/dist/resources/history.d.cts +1 -1
  48. package/dist/resources/history.d.ts +1 -1
  49. package/dist/resources/me.d.cts +2 -2
  50. package/dist/resources/me.d.ts +2 -2
  51. package/dist/resources/notifications.d.cts +1 -1
  52. package/dist/resources/notifications.d.ts +1 -1
  53. package/dist/resources/push.d.cts +1 -1
  54. package/dist/resources/push.d.ts +1 -1
  55. package/dist/resources/receipts.d.cts +1 -1
  56. package/dist/resources/receipts.d.ts +1 -1
  57. package/dist/resources/referral.d.cts +1 -1
  58. package/dist/resources/referral.d.ts +1 -1
  59. package/dist/resources/sessions.d.cts +1 -1
  60. package/dist/resources/sessions.d.ts +1 -1
  61. package/dist/resources/subscription.d.cts +1 -1
  62. package/dist/resources/subscription.d.ts +1 -1
  63. package/dist/resources/subscriptions.d.cts +1 -1
  64. package/dist/resources/subscriptions.d.ts +1 -1
  65. package/dist/resources/support.cjs +69 -0
  66. package/dist/resources/support.cjs.map +1 -0
  67. package/dist/resources/support.d.cts +110 -0
  68. package/dist/resources/support.d.ts +110 -0
  69. package/dist/resources/support.js +67 -0
  70. package/dist/resources/support.js.map +1 -0
  71. package/dist/resources/wallet.d.cts +1 -1
  72. package/dist/resources/wallet.d.ts +1 -1
  73. package/dist/telegram.cjs +81 -6
  74. package/dist/telegram.cjs.map +1 -1
  75. package/dist/telegram.d.cts +4 -3
  76. package/dist/telegram.d.ts +4 -3
  77. package/dist/telegram.js +81 -6
  78. package/dist/telegram.js.map +1 -1
  79. package/package.json +6 -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-BiXmrz7h.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-BiXmrz7h.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';
@@ -35,8 +35,8 @@ export { PushCapableRegistration, PushStatus, PushSubscriptionInput } from './re
35
35
  import { MeResource } from './resources/me.cjs';
36
36
  import { NotificationsResource } from './resources/notifications.cjs';
37
37
  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';
38
+ import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-CiJrlXum.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-CiJrlXum.cjs';
40
40
  import { AttributionResource } from './resources/attribution.cjs';
41
41
  export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.cjs';
42
42
  import { HistoryResource } from './resources/history.cjs';
@@ -45,6 +45,8 @@ import { ConsentsResource } from './resources/consents.cjs';
45
45
  export { ConsentChannel, ConsentDocument, ConsentKind, ConsentOptions, ConsentState, Consents, CookieChoiceInput, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT } from './resources/consents.cjs';
46
46
  import { ReceiptsResource } from './resources/receipts.cjs';
47
47
  export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.cjs';
48
+ import { SupportResource } from './resources/support.cjs';
49
+ export { SupportAttachment, SupportChannel, SupportConversation, SupportConversationStatus, SupportFile, SupportMessage, SupportMessageStatus, SupportRatingRequest } from './resources/support.cjs';
48
50
  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
51
 
50
52
  /**
@@ -77,7 +79,7 @@ interface BrandConfig {
77
79
  * Which platform versions this SDK works with, as a semver range:
78
80
  * comparators separated by ", ". Keep this the only definition.
79
81
  */
80
- declare const SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
82
+ declare const SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
81
83
  /** What `client.ready()` returns. */
82
84
  interface ReadyInfo {
83
85
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -183,7 +185,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
183
185
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
184
186
  * release bump that forgets this file fails the test run.
185
187
  */
186
- declare const SDK_VERSION = "0.6.5";
188
+ declare const SDK_VERSION = "0.6.6";
187
189
 
188
190
  /**
189
191
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
@@ -287,6 +289,8 @@ interface CusfrontClient {
287
289
  readonly consents: ConsentsResource;
288
290
  /** A numbered receipt for every payment. */
289
291
  readonly receipts: ReceiptsResource;
292
+ /** The chat with support: messages, files, the conversation's status. */
293
+ readonly support: SupportResource;
290
294
  /** Direct access to the token store (e.g. for an explicit sign-out
291
295
  * on Capacitor's lifecycle "app pausing" event). */
292
296
  readonly tokens: TokenStore;
@@ -317,4 +321,4 @@ interface CusfrontClient {
317
321
  */
318
322
  declare function createClient(opts: CreateClientOptions): CusfrontClient;
319
323
 
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 };
324
+ 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-DwmzjKDC.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-DwmzjKDC.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';
@@ -35,8 +35,8 @@ export { PushCapableRegistration, PushStatus, PushSubscriptionInput } from './re
35
35
  import { MeResource } from './resources/me.js';
36
36
  import { NotificationsResource } from './resources/notifications.js';
37
37
  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';
38
+ import { C as ClientDescriptor, R as ResolvedClientDescriptor, D as DevicesResource } from './devices-C88c38hm.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-C88c38hm.js';
40
40
  import { AttributionResource } from './resources/attribution.js';
41
41
  export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.js';
42
42
  import { HistoryResource } from './resources/history.js';
@@ -45,6 +45,8 @@ import { ConsentsResource } from './resources/consents.js';
45
45
  export { ConsentChannel, ConsentDocument, ConsentKind, ConsentOptions, ConsentState, Consents, CookieChoiceInput, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT } from './resources/consents.js';
46
46
  import { ReceiptsResource } from './resources/receipts.js';
47
47
  export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.js';
48
+ import { SupportResource } from './resources/support.js';
49
+ export { SupportAttachment, SupportChannel, SupportConversation, SupportConversationStatus, SupportFile, SupportMessage, SupportMessageStatus, SupportRatingRequest } from './resources/support.js';
48
50
  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
51
 
50
52
  /**
@@ -77,7 +79,7 @@ interface BrandConfig {
77
79
  * Which platform versions this SDK works with, as a semver range:
78
80
  * comparators separated by ", ". Keep this the only definition.
79
81
  */
80
- declare const SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
82
+ declare const SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
81
83
  /** What `client.ready()` returns. */
82
84
  interface ReadyInfo {
83
85
  /** `true` when the platform reported a version inside `supportedMeister`. */
@@ -183,7 +185,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
183
185
  * `define`. `src/version.test.ts` checks it matches `package.json`, so a
184
186
  * release bump that forgets this file fails the test run.
185
187
  */
186
- declare const SDK_VERSION = "0.6.5";
188
+ declare const SDK_VERSION = "0.6.6";
187
189
 
188
190
  /**
189
191
  * `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
@@ -287,6 +289,8 @@ interface CusfrontClient {
287
289
  readonly consents: ConsentsResource;
288
290
  /** A numbered receipt for every payment. */
289
291
  readonly receipts: ReceiptsResource;
292
+ /** The chat with support: messages, files, the conversation's status. */
293
+ readonly support: SupportResource;
290
294
  /** Direct access to the token store (e.g. for an explicit sign-out
291
295
  * on Capacitor's lifecycle "app pausing" event). */
292
296
  readonly tokens: TokenStore;
@@ -317,4 +321,4 @@ interface CusfrontClient {
317
321
  */
318
322
  declare function createClient(opts: CreateClientOptions): CusfrontClient;
319
323
 
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 };
324
+ 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;
@@ -1427,6 +1437,70 @@ var ReceiptsResource = class {
1427
1437
  }
1428
1438
  };
1429
1439
 
1440
+ // src/resources/support.ts
1441
+ function bytesToBase64(bytes) {
1442
+ let binary = "";
1443
+ const chunk = 32768;
1444
+ for (let i = 0; i < bytes.length; i += chunk) {
1445
+ binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
1446
+ }
1447
+ return btoa(binary);
1448
+ }
1449
+ async function toBase64(data) {
1450
+ if (typeof data === "string") return data;
1451
+ if (data instanceof Uint8Array) return bytesToBase64(data);
1452
+ if (data instanceof ArrayBuffer) return bytesToBase64(new Uint8Array(data));
1453
+ return bytesToBase64(new Uint8Array(await data.arrayBuffer()));
1454
+ }
1455
+ var SupportResource = class {
1456
+ constructor(http) {
1457
+ this.http = http;
1458
+ }
1459
+ /** The latest messages, oldest first, and the conversation's status.
1460
+ * `before` reads further back; `limit` is 1 to 100 (50). */
1461
+ async list(opts = {}) {
1462
+ const q = new URLSearchParams();
1463
+ if (opts.before) q.set("before", opts.before);
1464
+ if (opts.limit !== void 0) q.set("limit", String(opts.limit));
1465
+ const qs = q.toString();
1466
+ return this.http.get(`/me/support/messages${qs ? `?${qs}` : ""}`, {
1467
+ signal: opts.signal
1468
+ });
1469
+ }
1470
+ /** Write to support. Text, files or both; up to 10 files. */
1471
+ async send(message, opts = {}) {
1472
+ const attachments = await Promise.all(
1473
+ (message.files ?? []).map(async (f) => ({
1474
+ file_name: f.fileName,
1475
+ content_type: f.contentType,
1476
+ data_base64: await toBase64(f.data)
1477
+ }))
1478
+ );
1479
+ return this.http.post("/me/support/messages", {
1480
+ body: { text: message.text ?? "", attachments },
1481
+ signal: opts.signal
1482
+ });
1483
+ }
1484
+ /** A file from the conversation: the person's own or one support sent. */
1485
+ async attachment(id, opts = {}) {
1486
+ return this.http.getBlob(`/me/support/attachments/${encodeURIComponent(id)}`, {
1487
+ signal: opts.signal
1488
+ });
1489
+ }
1490
+ /** Answer `rating_request`: 1 (bad) to 5 (great), a comment if the person
1491
+ * wrote one. Each question takes one answer; a second one is a 404. */
1492
+ async rate(id, answer, opts = {}) {
1493
+ await this.http.post(`/me/support/ratings/${encodeURIComponent(id)}`, {
1494
+ body: { rating: answer.rating, ...answer.comment ? { comment: answer.comment } : {} },
1495
+ signal: opts.signal
1496
+ });
1497
+ }
1498
+ /** Just the conversation's status. */
1499
+ async status(opts = {}) {
1500
+ return (await this.list({ limit: 1, signal: opts.signal })).status;
1501
+ }
1502
+ };
1503
+
1430
1504
  // src/resources/funding-options.ts
1431
1505
  var FundingOptionsResource = class {
1432
1506
  constructor(http) {
@@ -1439,7 +1513,7 @@ var FundingOptionsResource = class {
1439
1513
  };
1440
1514
 
1441
1515
  // src/version.ts
1442
- var SDK_VERSION = "0.6.5";
1516
+ var SDK_VERSION = "0.6.6";
1443
1517
 
1444
1518
  // src/client-platform.ts
1445
1519
  var CLIENT_HEADER = "X-Takeal-Client";
@@ -1514,7 +1588,7 @@ function isAbsolute(url) {
1514
1588
  }
1515
1589
 
1516
1590
  // src/compat.ts
1517
- var SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
1591
+ var SUPPORTED_MEISTER = ">=0.6.12, <0.7.0";
1518
1592
  var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
1519
1593
  function parse(v) {
1520
1594
  const m = SEMVER.exec(v.trim());
@@ -2045,7 +2119,8 @@ function createClient(opts) {
2045
2119
  attribution: new AttributionResource(http),
2046
2120
  history: new HistoryResource(http),
2047
2121
  consents: new ConsentsResource(http),
2048
- receipts: new ReceiptsResource(http)
2122
+ receipts: new ReceiptsResource(http),
2123
+ support: new SupportResource(http)
2049
2124
  };
2050
2125
  }
2051
2126
  function pickDefaultStore(key) {