@neetru/sdk 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +66 -1
  3. package/dist/ai.cjs +298 -391
  4. package/dist/ai.d.cts +1 -1
  5. package/dist/ai.d.ts +1 -1
  6. package/dist/ai.mjs +298 -391
  7. package/dist/auth.cjs +3717 -5005
  8. package/dist/auth.d.cts +1 -1
  9. package/dist/auth.d.ts +1 -1
  10. package/dist/auth.mjs +3714 -5002
  11. package/dist/build-guard.cjs +101 -119
  12. package/dist/build-guard.mjs +91 -109
  13. package/dist/catalog.cjs +220 -225
  14. package/dist/catalog.d.cts +1 -1
  15. package/dist/catalog.d.ts +1 -1
  16. package/dist/catalog.mjs +220 -225
  17. package/dist/checkout.cjs +307 -323
  18. package/dist/checkout.d.cts +1 -1
  19. package/dist/checkout.d.ts +1 -1
  20. package/dist/checkout.mjs +306 -322
  21. package/dist/db-react.cjs +59 -87
  22. package/dist/db-react.d.cts +1 -1
  23. package/dist/db-react.d.ts +1 -1
  24. package/dist/db-react.mjs +56 -84
  25. package/dist/db.cjs +2128 -3014
  26. package/dist/db.d.cts +1 -1
  27. package/dist/db.d.ts +1 -1
  28. package/dist/db.mjs +2141 -3027
  29. package/dist/entitlements.cjs +19 -20
  30. package/dist/entitlements.d.cts +1 -1
  31. package/dist/entitlements.d.ts +1 -1
  32. package/dist/entitlements.mjs +19 -20
  33. package/dist/errors.cjs +16 -12
  34. package/dist/errors.d.cts +59 -3
  35. package/dist/errors.d.ts +59 -3
  36. package/dist/errors.mjs +15 -12
  37. package/dist/firestore-compat.cjs +241 -297
  38. package/dist/firestore-compat.d.cts +1 -1
  39. package/dist/firestore-compat.d.ts +1 -1
  40. package/dist/firestore-compat.mjs +215 -271
  41. package/dist/index.cjs +3942 -5134
  42. package/dist/index.d.cts +181 -5
  43. package/dist/index.d.ts +181 -5
  44. package/dist/index.mjs +4040 -5239
  45. package/dist/mobile.cjs +459 -344
  46. package/dist/mobile.d.cts +59 -4
  47. package/dist/mobile.d.ts +59 -4
  48. package/dist/mobile.mjs +459 -344
  49. package/dist/mocks.cjs +319 -447
  50. package/dist/mocks.d.cts +1 -1
  51. package/dist/mocks.d.ts +1 -1
  52. package/dist/mocks.mjs +313 -441
  53. package/dist/notifications.cjs +296 -317
  54. package/dist/notifications.d.cts +1 -1
  55. package/dist/notifications.d.ts +1 -1
  56. package/dist/notifications.mjs +295 -316
  57. package/dist/react.cjs +557 -707
  58. package/dist/react.d.cts +1 -1
  59. package/dist/react.d.ts +1 -1
  60. package/dist/react.mjs +547 -697
  61. package/dist/support.cjs +402 -328
  62. package/dist/support.d.cts +29 -3
  63. package/dist/support.d.ts +29 -3
  64. package/dist/support.mjs +401 -328
  65. package/dist/telemetry.cjs +267 -304
  66. package/dist/telemetry.d.cts +1 -1
  67. package/dist/telemetry.d.ts +1 -1
  68. package/dist/telemetry.mjs +267 -304
  69. package/dist/{types-Du_iioJ7.d.cts → types-D-9bjlM0.d.cts} +74 -1
  70. package/dist/{types-BPATkXYu.d.ts → types-bVztFQTI.d.ts} +74 -1
  71. package/dist/usage.cjs +233 -230
  72. package/dist/usage.d.cts +1 -1
  73. package/dist/usage.d.ts +1 -1
  74. package/dist/usage.mjs +233 -230
  75. package/dist/webhooks.cjs +328 -362
  76. package/dist/webhooks.d.cts +1 -1
  77. package/dist/webhooks.d.ts +1 -1
  78. package/dist/webhooks.mjs +325 -359
  79. package/package.json +5 -3
  80. package/dist/ai.cjs.map +0 -1
  81. package/dist/ai.mjs.map +0 -1
  82. package/dist/auth.cjs.map +0 -1
  83. package/dist/auth.mjs.map +0 -1
  84. package/dist/build-guard.cjs.map +0 -1
  85. package/dist/build-guard.mjs.map +0 -1
  86. package/dist/catalog.cjs.map +0 -1
  87. package/dist/catalog.mjs.map +0 -1
  88. package/dist/checkout.cjs.map +0 -1
  89. package/dist/checkout.mjs.map +0 -1
  90. package/dist/db-react.cjs.map +0 -1
  91. package/dist/db-react.mjs.map +0 -1
  92. package/dist/db.cjs.map +0 -1
  93. package/dist/db.mjs.map +0 -1
  94. package/dist/entitlements.cjs.map +0 -1
  95. package/dist/entitlements.mjs.map +0 -1
  96. package/dist/errors.cjs.map +0 -1
  97. package/dist/errors.mjs.map +0 -1
  98. package/dist/firestore-compat.cjs.map +0 -1
  99. package/dist/firestore-compat.mjs.map +0 -1
  100. package/dist/index.cjs.map +0 -1
  101. package/dist/index.mjs.map +0 -1
  102. package/dist/mobile.cjs.map +0 -1
  103. package/dist/mobile.mjs.map +0 -1
  104. package/dist/mocks.cjs.map +0 -1
  105. package/dist/mocks.mjs.map +0 -1
  106. package/dist/notifications.cjs.map +0 -1
  107. package/dist/notifications.mjs.map +0 -1
  108. package/dist/react.cjs.map +0 -1
  109. package/dist/react.mjs.map +0 -1
  110. package/dist/support.cjs.map +0 -1
  111. package/dist/support.mjs.map +0 -1
  112. package/dist/telemetry.cjs.map +0 -1
  113. package/dist/telemetry.mjs.map +0 -1
  114. package/dist/usage.cjs.map +0 -1
  115. package/dist/usage.mjs.map +0 -1
  116. package/dist/webhooks.cjs.map +0 -1
  117. package/dist/webhooks.mjs.map +0 -1
@@ -113,6 +113,28 @@ declare class MockCheckout implements CheckoutNamespace {
113
113
  }
114
114
  declare function createCheckoutNamespace(config: ResolvedConfig): CheckoutNamespace;
115
115
 
116
+ /**
117
+ * 3.8.0 — Provedor de token do USUÁRIO FINAL, síncrono OU assíncrono.
118
+ *
119
+ * O namespace `auth` web lê o id_token de `localStorage` (síncrono). Em React
120
+ * Native o storage é assíncrono (`@neetru/sdk/mobile` → `getIdToken():
121
+ * Promise`). Antes desta versão `support` e a barra de conta só aceitavam o
122
+ * contrato síncrono — o módulo mobile ficava solto do `createNeetruClient`.
123
+ *
124
+ * Agora `createNeetruClient({ endUserAuth })` aceita qualquer objeto com
125
+ * `getIdToken()` (sync ou Promise) e, opcionalmente, `refreshTokens()` — o
126
+ * `MobileAuthNamespace` encaixa direto. O provedor fica registrado por client
127
+ * (WeakMap, sem mudar o shape público do `NeetruClient`) para a barra de conta
128
+ * (`fetchNeetruAccountBar`) achá-lo.
129
+ */
130
+
131
+ interface EndUserTokenProvider {
132
+ /** id_token OIDC do usuário logado, ou `null`. Pode ser síncrono ou Promise. */
133
+ getIdToken(): string | null | undefined | Promise<string | null | undefined>;
134
+ /** Renova a sessão (refresh_token → id_token novo). `true` se renovou. */
135
+ refreshTokens?(): Promise<boolean>;
136
+ }
137
+
116
138
  /** Bloco de texto de uma mensagem multimodal (OpenAI-compat). */
117
139
  interface AiTextPart {
118
140
  type: 'text';
@@ -1975,6 +1997,10 @@ interface NeetruClientConfig {
1975
1997
  *
1976
1998
  * Endpoints públicos (catalog) funcionam sem apiKey. Endpoints autenticados
1977
1999
  * (entitlements, telemetry) lançam `missing_api_key` se ausente.
2000
+ *
2001
+ * **3.8.0: SÓ DE SERVIDOR.** Nunca coloque a chave no navegador ou no app
2002
+ * (`NEXT_PUBLIC_*`/`EXPO_PUBLIC_*`): o site/app chama a API do próprio produto
2003
+ * e o backend usa o SDK com a chave. Ver `strictServerOnlyKey`.
1978
2004
  */
1979
2005
  apiKey?: string;
1980
2006
  /**
@@ -2053,6 +2079,27 @@ interface NeetruClientConfig {
2053
2079
  * Bypass total: `NEETRU_ALLOW_INSECURE_BASEURL=1` no env.
2054
2080
  */
2055
2081
  allowedHosts?: string[];
2082
+ /**
2083
+ * 3.8.0 — a credencial `nrt_` é SÓ DE SERVIDOR. Quando o SDK recebe chave
2084
+ * (via `apiKey` ou `NEETRU_API_KEY`) rodando em navegador ou React Native:
2085
+ * - `false`/omitido (padrão nesta minor): aviso único no console (PT-BR,
2086
+ * sem imprimir a chave) e segue funcionando — pra não quebrar produtos
2087
+ * que ainda estão migrando;
2088
+ * - `true`: falha FECHADO com `NeetruError('server_only_key')`.
2089
+ *
2090
+ * **Na próxima MAJOR (4.0) a falha fechada vira o padrão.** No servidor
2091
+ * (Node/Edge) a opção não tem efeito.
2092
+ */
2093
+ strictServerOnlyKey?: boolean;
2094
+ /**
2095
+ * 3.8.0 — provedor do token do USUÁRIO FINAL usado pelo `support`
2096
+ * (`X-Neetru-End-User-Token`) e pela barra de conta. Aceita `getIdToken()`
2097
+ * síncrono ou assíncrono (+ `refreshTokens()` opcional). Encaixa direto o
2098
+ * `createMobileAuthNamespace(...)` de `@neetru/sdk/mobile`; no backend do
2099
+ * produto, pode ser `{ getIdToken: () => idTokenQueOAppMandou }`.
2100
+ * Default: `client.auth`.
2101
+ */
2102
+ endUserAuth?: EndUserTokenProvider;
2056
2103
  }
2057
2104
  /**
2058
2105
  * Status do produto no catálogo público.
@@ -2362,6 +2409,13 @@ interface AuthNamespace {
2362
2409
  * decodificados use `getUser()`; para validar assinatura use `verifyToken()`.
2363
2410
  */
2364
2411
  getIdToken(): string | null;
2412
+ /**
2413
+ * 3.7.0 — renova a sessão do usuário final via `refresh_token` (rotation).
2414
+ * Resolve `true` se gravou um id_token novo; `false` em qualquer falha (sem
2415
+ * refresh token, revogado, rede). Opcional: mocks/implementações próprias
2416
+ * podem omitir. Usado pelo `client.support` antes de desistir num 401.
2417
+ */
2418
+ refreshTokens?(): Promise<boolean>;
2365
2419
  /** Limpa session local + revoga refresh token no servidor. */
2366
2420
  signOut(): Promise<void>;
2367
2421
  /** Retorna o user atual (do id_token cached) ou `null` se não logado. */
@@ -2557,7 +2611,17 @@ interface SupportTicket {
2557
2611
  * 3.4: URL do primeiro anexo (screenshot) do ticket, quando enviado via
2558
2612
  * `createTicket({ screenshotBase64 })`. `null` se nenhum anexo.
2559
2613
  */
2614
+ /**
2615
+ * Print do ticket. **3.7.0**: na LISTAGEM (`listMyTickets`) vem sempre `null`
2616
+ * — o Core não devolve mais `attachments`/`consoleLogs` na lista (pesados e
2617
+ * sensíveis). Use `screenshotAttached` pra saber se há print.
2618
+ */
2560
2619
  screenshotUrl: string | null;
2620
+ /**
2621
+ * 3.7.0 — se o ticket tem print anexado. Na LISTAGEM o Core não devolve mais
2622
+ * o anexo (`screenshotUrl` vem `null`); use este campo pra saber se há print.
2623
+ */
2624
+ screenshotAttached?: boolean;
2561
2625
  /**
2562
2626
  * 3.4: ISO — setado pelo Core na transição do ticket pra `resolved`.
2563
2627
  * `null` enquanto não resolvido.
@@ -2623,9 +2687,18 @@ interface SupportNamespace {
2623
2687
  /**
2624
2688
  * Lista meus tickets abertos. **3.0**: GET `/api/sdk/v1/support/tickets?productId=...`
2625
2689
  * (canonical). `options.productSlug` override do `config.productId` default.
2690
+ *
2691
+ * **3.7.0**: o Core só lista os tickets do usuário final logado — o SDK manda
2692
+ * o id_token dele (`auth.getIdToken()`) em `X-Neetru-End-User-Token`. Sem
2693
+ * usuário logado lança `NeetruAuthRequiredError` (sem request). O mesmo vale
2694
+ * pra `markResolvedSeen`/`recordSatisfactionAttempt`/`submitSatisfaction`/
2695
+ * `contestTicket`. `createTicket` manda o header quando há usuário (o ticket
2696
+ * fica amarrado a ele) e segue sem ele quando não há.
2626
2697
  */
2627
2698
  listMyTickets(options?: {
2628
2699
  productSlug?: string;
2700
+ /** 3.7.0: quantos tickets (inteiro 1-50). Omitido → default do Core: 20. Máximo 50. */
2701
+ limit?: number;
2629
2702
  }): Promise<SupportTicket[]>;
2630
2703
  /**
2631
2704
  * 3.4: marca que o usuário viu a notificação de resolução do ticket
@@ -2695,4 +2768,4 @@ interface CatalogListOptions {
2695
2768
  includeDrafts?: boolean;
2696
2769
  }
2697
2770
 
2698
- export { NeetruDbError as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EntitlementCheck as O, type FieldSentinel as P, type IncrementSentinel as Q, type ListNotificationsOptions as R, MockCheckout as S, MockNotifications as T, MockWebhooks as U, NEETRU_SENTINEL_KEY as V, type NeetruClient as W, type NeetruClientConfig as X, type NeetruDb as Y, type NeetruDbDocuments as Z, type NeetruDbEngine as _, type AiChatMessage as a, type NeetruDbErrorCode as a0, type NeetruDbOptions as a1, type NeetruDbTransport as a2, type NeetruEnv as a3, type NeetruSqlClient as a4, type NeetruUser as a5, type NotificationScopeOptions as a6, type NotificationsNamespace as a7, type Product as a8, type ProductNotification as a9, type VerifyWebhookRequestOptions as aA, type VerifyWebhookRequestResult as aB, type WebhookEndpoint as aC, type WebhookEvent as aD, type WebhookScopeOptions as aE, type WebhookTestResult as aF, type WebhooksNamespace as aG, type WithFieldSentinels as aH, __resetDbIdWarningForTests as aI, createAiNamespace as aJ, createCheckoutNamespace as aK, createNeetruDb as aL, createNotificationsNamespace as aM, createRestSyncTransport as aN, createWebhooksNamespace as aO, getWebSocketRealtimeClient as aP, increment as aQ, isFieldSentinel as aR, isIncrementSentinel as aS, isServerTimestampSentinel as aT, serverTimestamp as aU, verifyWebhookRequest as aV, verifyWebhookSignature as aW, type ProductNotificationSeverity as aa, type ProductPlan as ab, type ProductStatus as ac, type RealtimeTransport as ad, type RedirectCallbackResult as ae, type RegisterWebhookInput as af, type ResolvedConfig as ag, type SendNotificationInput as ah, type ServerTimestampSentinel as ai, type SignInOptions as aj, type SqlOptions as ak, type SupportNamespace as al, type SupportSeverity as am, type SupportStatus as an, type SupportTicket as ao, type SyncErrorEvent as ap, type SyncState as aq, type TelemetryEventAck as ar, type TelemetryEventInput as as, type TelemetryLogAck as at, type TelemetryLogInput as au, type Unsubscribe as av, type UsageEventInput as aw, type UsageNamespace as ax, type UsageQuota as ay, type VerifyTokenOptions as az, type AiChatOptions as b, type AiChatResult as c, type AiChatUsage as d, type AiContentPart as e, type AiImageUrlPart as f, type AiNamespace as g, type AiResponseFormat as h, type AiStreamHandle as i, type AiStreamMeta as j, type AiTextPart as k, type AuthNamespace as l, type AuthStateListener as m, type CatalogListResponse as n, type CheckoutAuthOpts as o, type CheckoutIntentInfo as p, type CheckoutIntentStatus as q, type CheckoutNamespace as r, type CheckoutStartInput as s, type CheckoutStartResult as t, type CheckoutTenantType as u, type CompleteSignInResult as v, type ConflictRecord as w, type CreateOfflineDocumentsOptions as x, type CreateTicketInput as y, type DbBatchOp as z };
2771
+ export { type NeetruDbEngine as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EndUserTokenProvider as O, type EntitlementCheck as P, type FieldSentinel as Q, type IncrementSentinel as R, type ListNotificationsOptions as S, MockCheckout as T, MockNotifications as U, MockWebhooks as V, NEETRU_SENTINEL_KEY as W, type NeetruClient as X, type NeetruClientConfig as Y, type NeetruDb as Z, type NeetruDbDocuments as _, type AiChatMessage as a, NeetruDbError as a0, type NeetruDbErrorCode as a1, type NeetruDbOptions as a2, type NeetruDbTransport as a3, type NeetruEnv as a4, type NeetruSqlClient as a5, type NeetruUser as a6, type NotificationScopeOptions as a7, type NotificationsNamespace as a8, type Product as a9, type VerifyTokenOptions as aA, type VerifyWebhookRequestOptions as aB, type VerifyWebhookRequestResult as aC, type WebhookEndpoint as aD, type WebhookEvent as aE, type WebhookScopeOptions as aF, type WebhookTestResult as aG, type WebhooksNamespace as aH, type WithFieldSentinels as aI, __resetDbIdWarningForTests as aJ, createAiNamespace as aK, createCheckoutNamespace as aL, createNeetruDb as aM, createNotificationsNamespace as aN, createRestSyncTransport as aO, createWebhooksNamespace as aP, getWebSocketRealtimeClient as aQ, increment as aR, isFieldSentinel as aS, isIncrementSentinel as aT, isServerTimestampSentinel as aU, serverTimestamp as aV, verifyWebhookRequest as aW, verifyWebhookSignature as aX, type ProductNotification as aa, type ProductNotificationSeverity as ab, type ProductPlan as ac, type ProductStatus as ad, type RealtimeTransport as ae, type RedirectCallbackResult as af, type RegisterWebhookInput as ag, type ResolvedConfig as ah, type SendNotificationInput as ai, type ServerTimestampSentinel as aj, type SignInOptions as ak, type SqlOptions as al, type SupportNamespace as am, type SupportSeverity as an, type SupportStatus as ao, type SupportTicket as ap, type SyncErrorEvent as aq, type SyncState as ar, type TelemetryEventAck as as, type TelemetryEventInput as at, type TelemetryLogAck as au, type TelemetryLogInput as av, type Unsubscribe as aw, type UsageEventInput as ax, type UsageNamespace as ay, type UsageQuota as az, type AiChatOptions as b, type AiChatResult as c, type AiChatUsage as d, type AiContentPart as e, type AiImageUrlPart as f, type AiNamespace as g, type AiResponseFormat as h, type AiStreamHandle as i, type AiStreamMeta as j, type AiTextPart as k, type AuthNamespace as l, type AuthStateListener as m, type CatalogListResponse as n, type CheckoutAuthOpts as o, type CheckoutIntentInfo as p, type CheckoutIntentStatus as q, type CheckoutNamespace as r, type CheckoutStartInput as s, type CheckoutStartResult as t, type CheckoutTenantType as u, type CompleteSignInResult as v, type ConflictRecord as w, type CreateOfflineDocumentsOptions as x, type CreateTicketInput as y, type DbBatchOp as z };
@@ -113,6 +113,28 @@ declare class MockCheckout implements CheckoutNamespace {
113
113
  }
114
114
  declare function createCheckoutNamespace(config: ResolvedConfig): CheckoutNamespace;
115
115
 
116
+ /**
117
+ * 3.8.0 — Provedor de token do USUÁRIO FINAL, síncrono OU assíncrono.
118
+ *
119
+ * O namespace `auth` web lê o id_token de `localStorage` (síncrono). Em React
120
+ * Native o storage é assíncrono (`@neetru/sdk/mobile` → `getIdToken():
121
+ * Promise`). Antes desta versão `support` e a barra de conta só aceitavam o
122
+ * contrato síncrono — o módulo mobile ficava solto do `createNeetruClient`.
123
+ *
124
+ * Agora `createNeetruClient({ endUserAuth })` aceita qualquer objeto com
125
+ * `getIdToken()` (sync ou Promise) e, opcionalmente, `refreshTokens()` — o
126
+ * `MobileAuthNamespace` encaixa direto. O provedor fica registrado por client
127
+ * (WeakMap, sem mudar o shape público do `NeetruClient`) para a barra de conta
128
+ * (`fetchNeetruAccountBar`) achá-lo.
129
+ */
130
+
131
+ interface EndUserTokenProvider {
132
+ /** id_token OIDC do usuário logado, ou `null`. Pode ser síncrono ou Promise. */
133
+ getIdToken(): string | null | undefined | Promise<string | null | undefined>;
134
+ /** Renova a sessão (refresh_token → id_token novo). `true` se renovou. */
135
+ refreshTokens?(): Promise<boolean>;
136
+ }
137
+
116
138
  /** Bloco de texto de uma mensagem multimodal (OpenAI-compat). */
117
139
  interface AiTextPart {
118
140
  type: 'text';
@@ -1975,6 +1997,10 @@ interface NeetruClientConfig {
1975
1997
  *
1976
1998
  * Endpoints públicos (catalog) funcionam sem apiKey. Endpoints autenticados
1977
1999
  * (entitlements, telemetry) lançam `missing_api_key` se ausente.
2000
+ *
2001
+ * **3.8.0: SÓ DE SERVIDOR.** Nunca coloque a chave no navegador ou no app
2002
+ * (`NEXT_PUBLIC_*`/`EXPO_PUBLIC_*`): o site/app chama a API do próprio produto
2003
+ * e o backend usa o SDK com a chave. Ver `strictServerOnlyKey`.
1978
2004
  */
1979
2005
  apiKey?: string;
1980
2006
  /**
@@ -2053,6 +2079,27 @@ interface NeetruClientConfig {
2053
2079
  * Bypass total: `NEETRU_ALLOW_INSECURE_BASEURL=1` no env.
2054
2080
  */
2055
2081
  allowedHosts?: string[];
2082
+ /**
2083
+ * 3.8.0 — a credencial `nrt_` é SÓ DE SERVIDOR. Quando o SDK recebe chave
2084
+ * (via `apiKey` ou `NEETRU_API_KEY`) rodando em navegador ou React Native:
2085
+ * - `false`/omitido (padrão nesta minor): aviso único no console (PT-BR,
2086
+ * sem imprimir a chave) e segue funcionando — pra não quebrar produtos
2087
+ * que ainda estão migrando;
2088
+ * - `true`: falha FECHADO com `NeetruError('server_only_key')`.
2089
+ *
2090
+ * **Na próxima MAJOR (4.0) a falha fechada vira o padrão.** No servidor
2091
+ * (Node/Edge) a opção não tem efeito.
2092
+ */
2093
+ strictServerOnlyKey?: boolean;
2094
+ /**
2095
+ * 3.8.0 — provedor do token do USUÁRIO FINAL usado pelo `support`
2096
+ * (`X-Neetru-End-User-Token`) e pela barra de conta. Aceita `getIdToken()`
2097
+ * síncrono ou assíncrono (+ `refreshTokens()` opcional). Encaixa direto o
2098
+ * `createMobileAuthNamespace(...)` de `@neetru/sdk/mobile`; no backend do
2099
+ * produto, pode ser `{ getIdToken: () => idTokenQueOAppMandou }`.
2100
+ * Default: `client.auth`.
2101
+ */
2102
+ endUserAuth?: EndUserTokenProvider;
2056
2103
  }
2057
2104
  /**
2058
2105
  * Status do produto no catálogo público.
@@ -2362,6 +2409,13 @@ interface AuthNamespace {
2362
2409
  * decodificados use `getUser()`; para validar assinatura use `verifyToken()`.
2363
2410
  */
2364
2411
  getIdToken(): string | null;
2412
+ /**
2413
+ * 3.7.0 — renova a sessão do usuário final via `refresh_token` (rotation).
2414
+ * Resolve `true` se gravou um id_token novo; `false` em qualquer falha (sem
2415
+ * refresh token, revogado, rede). Opcional: mocks/implementações próprias
2416
+ * podem omitir. Usado pelo `client.support` antes de desistir num 401.
2417
+ */
2418
+ refreshTokens?(): Promise<boolean>;
2365
2419
  /** Limpa session local + revoga refresh token no servidor. */
2366
2420
  signOut(): Promise<void>;
2367
2421
  /** Retorna o user atual (do id_token cached) ou `null` se não logado. */
@@ -2557,7 +2611,17 @@ interface SupportTicket {
2557
2611
  * 3.4: URL do primeiro anexo (screenshot) do ticket, quando enviado via
2558
2612
  * `createTicket({ screenshotBase64 })`. `null` se nenhum anexo.
2559
2613
  */
2614
+ /**
2615
+ * Print do ticket. **3.7.0**: na LISTAGEM (`listMyTickets`) vem sempre `null`
2616
+ * — o Core não devolve mais `attachments`/`consoleLogs` na lista (pesados e
2617
+ * sensíveis). Use `screenshotAttached` pra saber se há print.
2618
+ */
2560
2619
  screenshotUrl: string | null;
2620
+ /**
2621
+ * 3.7.0 — se o ticket tem print anexado. Na LISTAGEM o Core não devolve mais
2622
+ * o anexo (`screenshotUrl` vem `null`); use este campo pra saber se há print.
2623
+ */
2624
+ screenshotAttached?: boolean;
2561
2625
  /**
2562
2626
  * 3.4: ISO — setado pelo Core na transição do ticket pra `resolved`.
2563
2627
  * `null` enquanto não resolvido.
@@ -2623,9 +2687,18 @@ interface SupportNamespace {
2623
2687
  /**
2624
2688
  * Lista meus tickets abertos. **3.0**: GET `/api/sdk/v1/support/tickets?productId=...`
2625
2689
  * (canonical). `options.productSlug` override do `config.productId` default.
2690
+ *
2691
+ * **3.7.0**: o Core só lista os tickets do usuário final logado — o SDK manda
2692
+ * o id_token dele (`auth.getIdToken()`) em `X-Neetru-End-User-Token`. Sem
2693
+ * usuário logado lança `NeetruAuthRequiredError` (sem request). O mesmo vale
2694
+ * pra `markResolvedSeen`/`recordSatisfactionAttempt`/`submitSatisfaction`/
2695
+ * `contestTicket`. `createTicket` manda o header quando há usuário (o ticket
2696
+ * fica amarrado a ele) e segue sem ele quando não há.
2626
2697
  */
2627
2698
  listMyTickets(options?: {
2628
2699
  productSlug?: string;
2700
+ /** 3.7.0: quantos tickets (inteiro 1-50). Omitido → default do Core: 20. Máximo 50. */
2701
+ limit?: number;
2629
2702
  }): Promise<SupportTicket[]>;
2630
2703
  /**
2631
2704
  * 3.4: marca que o usuário viu a notificação de resolução do ticket
@@ -2695,4 +2768,4 @@ interface CatalogListOptions {
2695
2768
  includeDrafts?: boolean;
2696
2769
  }
2697
2770
 
2698
- export { NeetruDbError as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EntitlementCheck as O, type FieldSentinel as P, type IncrementSentinel as Q, type ListNotificationsOptions as R, MockCheckout as S, MockNotifications as T, MockWebhooks as U, NEETRU_SENTINEL_KEY as V, type NeetruClient as W, type NeetruClientConfig as X, type NeetruDb as Y, type NeetruDbDocuments as Z, type NeetruDbEngine as _, type AiChatMessage as a, type NeetruDbErrorCode as a0, type NeetruDbOptions as a1, type NeetruDbTransport as a2, type NeetruEnv as a3, type NeetruSqlClient as a4, type NeetruUser as a5, type NotificationScopeOptions as a6, type NotificationsNamespace as a7, type Product as a8, type ProductNotification as a9, type VerifyWebhookRequestOptions as aA, type VerifyWebhookRequestResult as aB, type WebhookEndpoint as aC, type WebhookEvent as aD, type WebhookScopeOptions as aE, type WebhookTestResult as aF, type WebhooksNamespace as aG, type WithFieldSentinels as aH, __resetDbIdWarningForTests as aI, createAiNamespace as aJ, createCheckoutNamespace as aK, createNeetruDb as aL, createNotificationsNamespace as aM, createRestSyncTransport as aN, createWebhooksNamespace as aO, getWebSocketRealtimeClient as aP, increment as aQ, isFieldSentinel as aR, isIncrementSentinel as aS, isServerTimestampSentinel as aT, serverTimestamp as aU, verifyWebhookRequest as aV, verifyWebhookSignature as aW, type ProductNotificationSeverity as aa, type ProductPlan as ab, type ProductStatus as ac, type RealtimeTransport as ad, type RedirectCallbackResult as ae, type RegisterWebhookInput as af, type ResolvedConfig as ag, type SendNotificationInput as ah, type ServerTimestampSentinel as ai, type SignInOptions as aj, type SqlOptions as ak, type SupportNamespace as al, type SupportSeverity as am, type SupportStatus as an, type SupportTicket as ao, type SyncErrorEvent as ap, type SyncState as aq, type TelemetryEventAck as ar, type TelemetryEventInput as as, type TelemetryLogAck as at, type TelemetryLogInput as au, type Unsubscribe as av, type UsageEventInput as aw, type UsageNamespace as ax, type UsageQuota as ay, type VerifyTokenOptions as az, type AiChatOptions as b, type AiChatResult as c, type AiChatUsage as d, type AiContentPart as e, type AiImageUrlPart as f, type AiNamespace as g, type AiResponseFormat as h, type AiStreamHandle as i, type AiStreamMeta as j, type AiTextPart as k, type AuthNamespace as l, type AuthStateListener as m, type CatalogListResponse as n, type CheckoutAuthOpts as o, type CheckoutIntentInfo as p, type CheckoutIntentStatus as q, type CheckoutNamespace as r, type CheckoutStartInput as s, type CheckoutStartResult as t, type CheckoutTenantType as u, type CompleteSignInResult as v, type ConflictRecord as w, type CreateOfflineDocumentsOptions as x, type CreateTicketInput as y, type DbBatchOp as z };
2771
+ export { type NeetruDbEngine as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EndUserTokenProvider as O, type EntitlementCheck as P, type FieldSentinel as Q, type IncrementSentinel as R, type ListNotificationsOptions as S, MockCheckout as T, MockNotifications as U, MockWebhooks as V, NEETRU_SENTINEL_KEY as W, type NeetruClient as X, type NeetruClientConfig as Y, type NeetruDb as Z, type NeetruDbDocuments as _, type AiChatMessage as a, NeetruDbError as a0, type NeetruDbErrorCode as a1, type NeetruDbOptions as a2, type NeetruDbTransport as a3, type NeetruEnv as a4, type NeetruSqlClient as a5, type NeetruUser as a6, type NotificationScopeOptions as a7, type NotificationsNamespace as a8, type Product as a9, type VerifyTokenOptions as aA, type VerifyWebhookRequestOptions as aB, type VerifyWebhookRequestResult as aC, type WebhookEndpoint as aD, type WebhookEvent as aE, type WebhookScopeOptions as aF, type WebhookTestResult as aG, type WebhooksNamespace as aH, type WithFieldSentinels as aI, __resetDbIdWarningForTests as aJ, createAiNamespace as aK, createCheckoutNamespace as aL, createNeetruDb as aM, createNotificationsNamespace as aN, createRestSyncTransport as aO, createWebhooksNamespace as aP, getWebSocketRealtimeClient as aQ, increment as aR, isFieldSentinel as aS, isIncrementSentinel as aT, isServerTimestampSentinel as aU, serverTimestamp as aV, verifyWebhookRequest as aW, verifyWebhookSignature as aX, type ProductNotification as aa, type ProductNotificationSeverity as ab, type ProductPlan as ac, type ProductStatus as ad, type RealtimeTransport as ae, type RedirectCallbackResult as af, type RegisterWebhookInput as ag, type ResolvedConfig as ah, type SendNotificationInput as ai, type ServerTimestampSentinel as aj, type SignInOptions as ak, type SqlOptions as al, type SupportNamespace as am, type SupportSeverity as an, type SupportStatus as ao, type SupportTicket as ap, type SyncErrorEvent as aq, type SyncState as ar, type TelemetryEventAck as as, type TelemetryEventInput as at, type TelemetryLogAck as au, type TelemetryLogInput as av, type Unsubscribe as aw, type UsageEventInput as ax, type UsageNamespace as ay, type UsageQuota as az, type AiChatOptions as b, type AiChatResult as c, type AiChatUsage as d, type AiContentPart as e, type AiImageUrlPart as f, type AiNamespace as g, type AiResponseFormat as h, type AiStreamHandle as i, type AiStreamMeta as j, type AiTextPart as k, type AuthNamespace as l, type AuthStateListener as m, type CatalogListResponse as n, type CheckoutAuthOpts as o, type CheckoutIntentInfo as p, type CheckoutIntentStatus as q, type CheckoutNamespace as r, type CheckoutStartInput as s, type CheckoutStartResult as t, type CheckoutTenantType as u, type CompleteSignInResult as v, type ConflictRecord as w, type CreateOfflineDocumentsOptions as x, type CreateTicketInput as y, type DbBatchOp as z };