@neetru/sdk 3.4.4 → 3.4.5
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 +19 -0
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/auth.cjs +16 -4
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.mjs +16 -4
- package/dist/auth.mjs.map +1 -1
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/db-react.d.cts +1 -1
- package/dist/db-react.d.ts +1 -1
- package/dist/db.d.cts +1 -1
- package/dist/db.d.ts +1 -1
- package/dist/entitlements.d.cts +1 -1
- package/dist/entitlements.d.ts +1 -1
- package/dist/firestore-compat.d.cts +1 -1
- package/dist/firestore-compat.d.ts +1 -1
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/notifications.d.cts +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/support.d.cts +1 -1
- package/dist/support.d.ts +1 -1
- package/dist/telemetry.cjs +16 -4
- package/dist/telemetry.cjs.map +1 -1
- package/dist/telemetry.d.cts +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.mjs +16 -4
- package/dist/telemetry.mjs.map +1 -1
- package/dist/{types-Dw0fqhHm.d.cts → types-DIVZl7nO.d.cts} +3 -0
- package/dist/{types-Bzxb5rlF.d.ts → types-nnztVk7G.d.ts} +3 -0
- package/dist/usage.d.cts +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to `@neetru/sdk` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.4.5] - 2026-09-12 — **fix(telemetry): event()/track() usáveis no browser (401 silencioso em produção)**
|
|
9
|
+
|
|
10
|
+
Release **patch** (correção de bug — `client.telemetry.event()`/`.track()` documentados como uso client-side de alta frequência, mas nunca funcionaram de fato no browser).
|
|
11
|
+
|
|
12
|
+
### Contexto
|
|
13
|
+
|
|
14
|
+
`event()`/`track()` só chamavam `POST /api/sdk/v1/telemetry/event`, que exige `Bearer` com `cli_api_keys` — credencial de operador que nunca deveria estar no browser. Resultado real em produção (achado 2026-09-09, `pdvagiliza.neetru.com`): 401 silencioso, telemetria de UI nunca persistida. Compondo o problema, `productSlug` nunca era enviado no body de nenhum dos dois métodos (só `log()` já mandava) — o Core exige `productSlug` fail-closed, então mesmo corrigindo a auth o evento seria rejeitado.
|
|
15
|
+
|
|
16
|
+
### Corrigido
|
|
17
|
+
|
|
18
|
+
- **`event()`/`track()` agora enviam `productSlug`** no body (`input.productSlug ?? config.productId`, mesmo default de `log()`/`usage.report()`).
|
|
19
|
+
- **Roteamento browser vs server**: em contexto browser (`typeof window !== 'undefined'`), `event()`/`track()` chamam o novo `POST /api/sdk/v1/telemetry/event/public` do Core (sem Bearer — autoriza via `Origin`, não credencial). Server-side continua no endpoint autenticado original, sem mudança de comportamento.
|
|
20
|
+
|
|
21
|
+
### Adicionado (aditivo, opcional)
|
|
22
|
+
|
|
23
|
+
- **`TelemetryEventInput.productSlug?: string`** — override explícito, mesmo padrão de `TelemetryLogInput.productSlug`.
|
|
24
|
+
|
|
25
|
+
Requer Core com a rota `/api/sdk/v1/telemetry/event/public` (PR companion `Neetru/neetru-core#448`) para o caminho browser funcionar; server-side não tem dependência nova.
|
|
26
|
+
|
|
8
27
|
## [3.4.4] - 2026-09-07 — **fix(checkout): aceitar id_token no padrão BFF/cookie (desbloqueia checkout PAGO)**
|
|
9
28
|
|
|
10
29
|
Release **patch** (correção de bug que bloqueava 100% do checkout PAGO no padrão BFF/cookie; aditivos opcionais retrocompatíveis, nenhuma remoção de API, nenhuma mudança de wire além de um header aceito a mais). Bug `bug_72ccf42065304d3384aa3ed09accef8d` (HIGH).
|
package/dist/ai.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, aJ as createAiNamespace } from './types-
|
|
1
|
+
export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, aJ as createAiNamespace } from './types-DIVZl7nO.cjs';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.cjs';
|
package/dist/ai.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, aJ as createAiNamespace } from './types-
|
|
1
|
+
export { A as AiChatChoice, a as AiChatMessage, b as AiChatOptions, c as AiChatResult, d as AiChatUsage, e as AiContentPart, f as AiImageUrlPart, g as AiNamespace, h as AiResponseFormat, i as AiStreamHandle, j as AiStreamMeta, k as AiTextPart, aJ as createAiNamespace } from './types-nnztVk7G.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
package/dist/auth.cjs
CHANGED
|
@@ -1273,6 +1273,12 @@ function createEntitlementsNamespace(config) {
|
|
|
1273
1273
|
init_errors();
|
|
1274
1274
|
init_http();
|
|
1275
1275
|
var VALID_LOG_LEVELS = ["debug", "info", "warn", "error", "fatal"];
|
|
1276
|
+
function isBrowserContext() {
|
|
1277
|
+
return typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
|
|
1278
|
+
}
|
|
1279
|
+
function resolveEventTransport() {
|
|
1280
|
+
return isBrowserContext() ? { path: "/api/sdk/v1/telemetry/event/public", requireAuth: false } : { path: "/api/sdk/v1/telemetry/event", requireAuth: true };
|
|
1281
|
+
}
|
|
1276
1282
|
function consoleFor(level) {
|
|
1277
1283
|
switch (level) {
|
|
1278
1284
|
case "debug":
|
|
@@ -1302,15 +1308,18 @@ function createTelemetryNamespace(config) {
|
|
|
1302
1308
|
batch.map(async (ev) => {
|
|
1303
1309
|
try {
|
|
1304
1310
|
const body = { name: ev.name };
|
|
1311
|
+
const productSlug = ev.productSlug ?? config.productId;
|
|
1312
|
+
if (productSlug) body.productSlug = productSlug;
|
|
1305
1313
|
if (ev.properties && typeof ev.properties === "object") {
|
|
1306
1314
|
body.properties = ev.properties;
|
|
1307
1315
|
}
|
|
1308
1316
|
if (ev.timestamp) body.timestamp = ev.timestamp;
|
|
1317
|
+
const transport = resolveEventTransport();
|
|
1309
1318
|
await httpRequest(config, {
|
|
1310
1319
|
method: "POST",
|
|
1311
|
-
path:
|
|
1320
|
+
path: transport.path,
|
|
1312
1321
|
body,
|
|
1313
|
-
requireAuth:
|
|
1322
|
+
requireAuth: transport.requireAuth,
|
|
1314
1323
|
retries: 1,
|
|
1315
1324
|
// caça-bruxas: retry sem Idempotency-Key duplicava o evento se o
|
|
1316
1325
|
// servidor já tinha persistido antes da falha transiente. Mesmo
|
|
@@ -1363,15 +1372,18 @@ function createTelemetryNamespace(config) {
|
|
|
1363
1372
|
throw new NeetruError("validation_failed", "event.name max 128 chars");
|
|
1364
1373
|
}
|
|
1365
1374
|
const body = { name: input.name };
|
|
1375
|
+
const productSlug = input.productSlug ?? config.productId;
|
|
1376
|
+
if (productSlug) body.productSlug = productSlug;
|
|
1366
1377
|
if (input.properties && typeof input.properties === "object") {
|
|
1367
1378
|
body.properties = input.properties;
|
|
1368
1379
|
}
|
|
1369
1380
|
if (input.timestamp) body.timestamp = input.timestamp;
|
|
1381
|
+
const transport = resolveEventTransport();
|
|
1370
1382
|
const raw = await httpRequest(config, {
|
|
1371
1383
|
method: "POST",
|
|
1372
|
-
path:
|
|
1384
|
+
path: transport.path,
|
|
1373
1385
|
body,
|
|
1374
|
-
requireAuth:
|
|
1386
|
+
requireAuth: transport.requireAuth
|
|
1375
1387
|
});
|
|
1376
1388
|
if (!raw || raw.ok !== true || typeof raw.eventId !== "string") {
|
|
1377
1389
|
throw new NeetruError("invalid_response", "Telemetry response missing eventId");
|