@neetru/sdk 3.8.1 → 3.9.1

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 (71) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +14 -1
  3. package/dist/ai.cjs +1 -1
  4. package/dist/ai.d.cts +1 -1
  5. package/dist/ai.d.ts +1 -1
  6. package/dist/ai.mjs +1 -1
  7. package/dist/auth.cjs +844 -803
  8. package/dist/auth.d.cts +1 -1
  9. package/dist/auth.d.ts +1 -1
  10. package/dist/auth.mjs +841 -800
  11. package/dist/build-guard.cjs +186 -82
  12. package/dist/build-guard.d.cts +53 -1
  13. package/dist/build-guard.d.ts +53 -1
  14. package/dist/build-guard.mjs +175 -74
  15. package/dist/catalog.cjs +1 -1
  16. package/dist/catalog.d.cts +1 -1
  17. package/dist/catalog.d.ts +1 -1
  18. package/dist/catalog.mjs +1 -1
  19. package/dist/checkout.cjs +62 -49
  20. package/dist/checkout.d.cts +1 -1
  21. package/dist/checkout.d.ts +1 -1
  22. package/dist/checkout.mjs +62 -49
  23. package/dist/db-react.d.cts +1 -1
  24. package/dist/db-react.d.ts +1 -1
  25. package/dist/db.cjs +200 -187
  26. package/dist/db.d.cts +1 -1
  27. package/dist/db.d.ts +1 -1
  28. package/dist/db.mjs +193 -180
  29. package/dist/entitlements.d.cts +1 -1
  30. package/dist/entitlements.d.ts +1 -1
  31. package/dist/firestore-compat.d.cts +1 -1
  32. package/dist/firestore-compat.d.ts +1 -1
  33. package/dist/index.cjs +880 -839
  34. package/dist/index.d.cts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.mjs +847 -806
  37. package/dist/mobile.cjs +328 -276
  38. package/dist/mobile.d.cts +12 -2
  39. package/dist/mobile.d.ts +12 -2
  40. package/dist/mobile.mjs +328 -276
  41. package/dist/mocks.cjs +5 -5
  42. package/dist/mocks.d.cts +2 -2
  43. package/dist/mocks.d.ts +2 -2
  44. package/dist/mocks.mjs +4 -4
  45. package/dist/notifications.cjs +1 -1
  46. package/dist/notifications.d.cts +1 -1
  47. package/dist/notifications.d.ts +1 -1
  48. package/dist/notifications.mjs +1 -1
  49. package/dist/react.cjs +119 -119
  50. package/dist/react.d.cts +8 -2
  51. package/dist/react.d.ts +8 -2
  52. package/dist/react.mjs +119 -119
  53. package/dist/support.cjs +1 -1
  54. package/dist/support.d.cts +1 -1
  55. package/dist/support.d.ts +1 -1
  56. package/dist/support.mjs +1 -1
  57. package/dist/telemetry.cjs +62 -49
  58. package/dist/telemetry.d.cts +1 -1
  59. package/dist/telemetry.d.ts +1 -1
  60. package/dist/telemetry.mjs +62 -49
  61. package/dist/{types-yv3EDKg2.d.cts → types-Bl_4HROd.d.cts} +62 -3
  62. package/dist/{types-BYPk_3HR.d.ts → types-Bqnsqvow.d.ts} +62 -3
  63. package/dist/usage.cjs +1 -1
  64. package/dist/usage.d.cts +1 -1
  65. package/dist/usage.d.ts +1 -1
  66. package/dist/usage.mjs +1 -1
  67. package/dist/webhooks.cjs +1 -1
  68. package/dist/webhooks.d.cts +1 -1
  69. package/dist/webhooks.d.ts +1 -1
  70. package/dist/webhooks.mjs +1 -1
  71. package/package.json +9 -1
package/dist/react.cjs CHANGED
@@ -45,13 +45,13 @@ var E = class e extends Error {
45
45
  * `undefined` em erros que acontecem antes de qualquer requisição.
46
46
  */
47
47
  correlationId;
48
- constructor(t, i, n, s, c, o) {
49
- super(i), this.name = "NeetruError", this.code = t, this.status = n, this.requestId = s, this.reason = c, this.correlationId = o, Object.setPrototypeOf(this, e.prototype);
48
+ constructor(t, i, n, a, c, o) {
49
+ super(i), this.name = "NeetruError", this.code = t, this.status = n, this.requestId = a, this.reason = c, this.correlationId = o, Object.setPrototypeOf(this, e.prototype);
50
50
  }
51
51
  };
52
52
 
53
53
  // src/types.ts
54
- var O = "https://api.neetru.com";
54
+ var F = "https://api.neetru.com";
55
55
 
56
56
  // src/end-user-token.ts
57
57
  var ee = /* @__PURE__ */ new WeakMap();
@@ -81,9 +81,9 @@ var y = l__namespace.createElement, ne = {
81
81
  async function W(e) {
82
82
  let t = await M(e);
83
83
  if (!t) return null;
84
- let i = e.config, n = (i.baseUrl ?? O).replace(/\/+$/, ""), s = i.fetch ?? globalThis.fetch, c = `${n}/api/sdk/v1/account/bar`;
84
+ let i = e.config, n = (i.baseUrl ?? F).replace(/\/+$/, ""), a = i.fetch ?? globalThis.fetch, c = `${n}/api/sdk/v1/account/bar`;
85
85
  try {
86
- let o = await s(c, {
86
+ let o = await a(c, {
87
87
  headers: { authorization: `Bearer ${t}`, accept: "application/json" }
88
88
  });
89
89
  if (!o.ok) return null;
@@ -118,17 +118,17 @@ var h = {
118
118
  borderSoft: "#e5e5e5"
119
119
  }, H = 0;
120
120
  function re({ size: e = 18, color: t = h.fg }) {
121
- let i = [0, 1, 2].flatMap((c) => [0, 1, 2].map((o) => ({ r: c, c: o }))), n = e / 3, s = Math.max(2, e / 7);
121
+ let i = [0, 1, 2].flatMap((c) => [0, 1, 2].map((o) => ({ r: c, c: o }))), n = e / 3, a = Math.max(2, e / 7);
122
122
  return y(
123
123
  "svg",
124
124
  { width: e, height: e, viewBox: `0 0 ${e} ${e}`, "aria-hidden": true, style: { display: "block" } },
125
125
  i.map(
126
126
  ({ r: c, c: o }) => y("rect", {
127
127
  key: `${c}-${o}`,
128
- x: o * n + (n - s) / 2,
129
- y: c * n + (n - s) / 2,
130
- width: s,
131
- height: s,
128
+ x: o * n + (n - a) / 2,
129
+ y: c * n + (n - a) / 2,
130
+ width: a,
131
+ height: a,
132
132
  fill: t
133
133
  })
134
134
  )
@@ -146,63 +146,63 @@ function oe({
146
146
  currentProductSlug: t,
147
147
  settingsUrl: i,
148
148
  onSignOut: n,
149
- fetchBar: s,
149
+ fetchBar: a,
150
150
  labels: c,
151
151
  className: o
152
152
  }) {
153
153
  let r = { ...ne, ...c }, b = l__namespace.useMemo(() => {
154
154
  try {
155
- let a = e.auth.getUser();
156
- return a ? {
157
- displayName: a.displayName || a.email || "",
158
- email: a.email || "",
159
- photoUrl: a.photoURL ?? null
155
+ let s = e.auth.getUser();
156
+ return s ? {
157
+ displayName: s.displayName || s.email || "",
158
+ email: s.email || "",
159
+ photoUrl: s.photoURL ?? null
160
160
  } : null;
161
161
  } catch {
162
162
  return null;
163
163
  }
164
- }, [e]), [u, f] = l__namespace.useState(null), [m, w] = l__namespace.useState(null), [T, R] = l__namespace.useState(false), p = l__namespace.useRef(null), d = l__namespace.useRef(null), g = l__namespace.useRef(null), C = l__namespace.useRef(null);
164
+ }, [e]), [u, f] = l__namespace.useState(null), [m, x] = l__namespace.useState(null), [T, R] = l__namespace.useState(false), p = l__namespace.useRef(null), d = l__namespace.useRef(null), g = l__namespace.useRef(null), S = l__namespace.useRef(null);
165
165
  l__namespace.useEffect(() => {
166
- let a = false, k = s ?? W;
167
- return Promise.resolve(k(e)).then((S) => {
168
- !a && S && f(S);
166
+ let s = false, k = a ?? W;
167
+ return Promise.resolve(k(e)).then((C) => {
168
+ !s && C && f(C);
169
169
  }).catch(() => {
170
170
  }), () => {
171
- a = true;
171
+ s = true;
172
172
  };
173
- }, [e, s]);
174
- let v = u?.account ?? b, G = u?.accountUrl ?? "https://minhaconta.neetru.com", A = u?.products ?? [], L = l__namespace.useCallback((a) => {
175
- w(null), (a === "apps" ? g.current : d.current)?.focus();
173
+ }, [e, a]);
174
+ let v = u?.account ?? b, G = u?.accountUrl ?? "https://minhaconta.neetru.com", A = u?.products ?? [], L = l__namespace.useCallback((s) => {
175
+ x(null), (s === "apps" ? g.current : d.current)?.focus();
176
176
  }, []);
177
177
  l__namespace.useEffect(() => {
178
178
  if (!m) return;
179
- Q(C.current)[0]?.focus();
180
- let k = (S) => {
181
- p.current && !p.current.contains(S.target) && w(null);
179
+ Q(S.current)[0]?.focus();
180
+ let k = (C) => {
181
+ p.current && !p.current.contains(C.target) && x(null);
182
182
  };
183
183
  return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
184
184
  }, [m]);
185
185
  let P = l__namespace.useCallback(
186
- (a) => {
187
- if (a.key === "Escape") {
188
- a.stopPropagation(), L(m);
186
+ (s) => {
187
+ if (s.key === "Escape") {
188
+ s.stopPropagation(), L(m);
189
189
  return;
190
190
  }
191
- let k = Q(C.current);
191
+ let k = Q(S.current);
192
192
  if (k.length === 0) return;
193
- let S = k.indexOf(document.activeElement);
194
- a.key === "Tab" ? a.shiftKey && S <= 0 ? (a.preventDefault(), k[k.length - 1].focus()) : !a.shiftKey && S === k.length - 1 && (a.preventDefault(), k[0].focus()) : a.key === "ArrowDown" ? (a.preventDefault(), k[(S + 1) % k.length].focus()) : a.key === "ArrowUp" && (a.preventDefault(), k[(S - 1 + k.length) % k.length].focus());
193
+ let C = k.indexOf(document.activeElement);
194
+ s.key === "Tab" ? s.shiftKey && C <= 0 ? (s.preventDefault(), k[k.length - 1].focus()) : !s.shiftKey && C === k.length - 1 && (s.preventDefault(), k[0].focus()) : s.key === "ArrowDown" ? (s.preventDefault(), k[(C + 1) % k.length].focus()) : s.key === "ArrowUp" && (s.preventDefault(), k[(C - 1 + k.length) % k.length].focus());
195
195
  },
196
196
  [m, L]
197
197
  ), K = l__namespace.useCallback(async () => {
198
- if (!T) {
199
- R(true);
200
- try {
201
- await e.auth.signOut();
202
- } catch {
203
- } finally {
204
- R(false), w(null), n?.();
205
- }
198
+ if (T) return;
199
+ R(true);
200
+ let s;
201
+ try {
202
+ s = await e.auth.signOut();
203
+ } catch {
204
+ } finally {
205
+ R(false), x(null), n?.(s);
206
206
  }
207
207
  }, [e, T, n]);
208
208
  if (!v) return null;
@@ -230,7 +230,7 @@ function oe({
230
230
  }
231
231
  },
232
232
  I
233
- ), B = (a) => ({
233
+ ), B = (s) => ({
234
234
  display: "inline-flex",
235
235
  alignItems: "center",
236
236
  justifyContent: "center",
@@ -238,8 +238,8 @@ function oe({
238
238
  height: 36,
239
239
  padding: 0,
240
240
  borderRadius: H,
241
- border: `1px solid ${a ? h.border : h.borderSoft}`,
242
- backgroundColor: a ? h.bgHover : h.bg,
241
+ border: `1px solid ${s ? h.border : h.borderSoft}`,
242
+ backgroundColor: s ? h.bgHover : h.bg,
243
243
  color: h.fg,
244
244
  cursor: "pointer",
245
245
  boxSizing: "border-box",
@@ -254,7 +254,7 @@ function oe({
254
254
  "aria-haspopup": "menu",
255
255
  "aria-expanded": m === "apps",
256
256
  "data-neetru-appswitcher-button": "true",
257
- onClick: () => w((a) => a === "apps" ? null : "apps"),
257
+ onClick: () => x((s) => s === "apps" ? null : "apps"),
258
258
  style: B(m === "apps")
259
259
  },
260
260
  y(re, {})
@@ -267,11 +267,11 @@ function oe({
267
267
  "aria-haspopup": "menu",
268
268
  "aria-expanded": m === "account",
269
269
  "data-neetru-account-button": "true",
270
- onClick: () => w((a) => a === "account" ? null : "account"),
270
+ onClick: () => x((s) => s === "account" ? null : "account"),
271
271
  style: { ...B(m === "account"), width: 36, height: 36 }
272
272
  },
273
273
  V
274
- ), F = {
274
+ ), O = {
275
275
  position: "absolute",
276
276
  top: "calc(100% + 6px)",
277
277
  right: 0,
@@ -302,21 +302,21 @@ function oe({
302
302
  boxSizing: "border-box",
303
303
  fontFamily: "inherit"
304
304
  }, _ = {
305
- onMouseEnter: (a) => {
306
- a.currentTarget.style.backgroundColor = h.bgHover;
305
+ onMouseEnter: (s) => {
306
+ s.currentTarget.style.backgroundColor = h.bgHover;
307
307
  },
308
- onMouseLeave: (a) => {
309
- a.currentTarget.style.backgroundColor = "transparent";
308
+ onMouseLeave: (s) => {
309
+ s.currentTarget.style.backgroundColor = "transparent";
310
310
  }
311
311
  }, Y = m === "account" ? y(
312
312
  "div",
313
313
  {
314
- ref: C,
314
+ ref: S,
315
315
  role: "menu",
316
316
  "aria-label": r.accountButton,
317
317
  "data-neetru-account-menu": "true",
318
318
  onKeyDown: P,
319
- style: F
319
+ style: O
320
320
  },
321
321
  // Header identidade
322
322
  y(
@@ -415,12 +415,12 @@ function oe({
415
415
  ) : null, Z = m === "apps" ? y(
416
416
  "div",
417
417
  {
418
- ref: C,
418
+ ref: S,
419
419
  role: "menu",
420
420
  "aria-label": r.appsTitle,
421
421
  "data-neetru-appswitcher-menu": "true",
422
422
  onKeyDown: P,
423
- style: { ...F, minWidth: 280 }
423
+ style: { ...O, minWidth: 280 }
424
424
  },
425
425
  y(
426
426
  "div",
@@ -451,18 +451,18 @@ function oe({
451
451
  backgroundColor: h.borderSoft
452
452
  }
453
453
  },
454
- A.map((a) => {
455
- let k = !!t && a.slug === t;
454
+ A.map((s) => {
455
+ let k = !!t && s.slug === t;
456
456
  return y(
457
457
  "a",
458
458
  {
459
- key: a.slug,
459
+ key: s.slug,
460
460
  role: "menuitem",
461
- href: a.url,
461
+ href: s.url,
462
462
  "aria-current": k ? "true" : void 0,
463
- "data-neetru-product": a.slug,
463
+ "data-neetru-product": s.slug,
464
464
  "data-current": k ? "true" : void 0,
465
- title: a.name,
465
+ title: s.name,
466
466
  style: {
467
467
  display: "flex",
468
468
  flexDirection: "column",
@@ -475,16 +475,16 @@ function oe({
475
475
  cursor: "pointer",
476
476
  boxSizing: "border-box"
477
477
  },
478
- onMouseEnter: (S) => {
479
- S.currentTarget.style.backgroundColor = h.bgHover;
478
+ onMouseEnter: (C) => {
479
+ C.currentTarget.style.backgroundColor = h.bgHover;
480
480
  },
481
- onMouseLeave: (S) => {
482
- S.currentTarget.style.backgroundColor = k ? h.bgHover : h.bg;
481
+ onMouseLeave: (C) => {
482
+ C.currentTarget.style.backgroundColor = k ? h.bgHover : h.bg;
483
483
  }
484
484
  },
485
485
  // Tile/ícone
486
- a.iconUrl ? y("img", {
487
- src: a.iconUrl,
486
+ s.iconUrl ? y("img", {
487
+ src: s.iconUrl,
488
488
  alt: "",
489
489
  width: 32,
490
490
  height: 32,
@@ -505,7 +505,7 @@ function oe({
505
505
  fontWeight: 700
506
506
  }
507
507
  },
508
- N(a.name)
508
+ N(s.name)
509
509
  ),
510
510
  y(
511
511
  "span",
@@ -522,7 +522,7 @@ function oe({
522
522
  width: "100%"
523
523
  }
524
524
  },
525
- a.name
525
+ s.name
526
526
  ),
527
527
  k ? y(
528
528
  "span",
@@ -575,8 +575,8 @@ function U(e) {
575
575
  let o = c;
576
576
  i = { field: o.field, direction: o.direction };
577
577
  } else c.__constraint === "limit" && (n = c.value);
578
- let s = {};
579
- return t.length > 0 && (s.where = t), i && (s.orderBy = i), n !== void 0 && (s.limit = n), s;
578
+ let a = {};
579
+ return t.length > 0 && (a.where = t), i && (a.orderBy = i), n !== void 0 && (a.limit = n), a;
580
580
  }
581
581
 
582
582
  // src/react.ts
@@ -600,18 +600,18 @@ async function ie(e, t) {
600
600
  i.status
601
601
  );
602
602
  }
603
- let s = n?.intent ?? n ?? {}, c = n?.redirectUrl ?? s.redirectUrl;
603
+ let a = n?.intent ?? n ?? {}, c = n?.redirectUrl ?? a.redirectUrl;
604
604
  if (!c || typeof c != "string")
605
605
  throw new E(
606
606
  "invalid_response",
607
607
  "Resposta do route BFF de checkout sem `redirectUrl`."
608
608
  );
609
609
  return {
610
- intentId: String(n?.intentId ?? s.intentId ?? ""),
610
+ intentId: String(n?.intentId ?? a.intentId ?? ""),
611
611
  redirectUrl: c,
612
- status: n?.status ?? s.status ?? "pending",
613
- expiresAt: typeof n?.expiresAt == "string" ? n.expiresAt : typeof s.expiresAt == "string" ? s.expiresAt : "",
614
- requiresKyc: n?.requiresKyc === true || s.requiresKyc === true
612
+ status: n?.status ?? a.status ?? "pending",
613
+ expiresAt: typeof n?.expiresAt == "string" ? n.expiresAt : typeof a.expiresAt == "string" ? a.expiresAt : "",
614
+ requiresKyc: n?.requiresKyc === true || a.requiresKyc === true
615
615
  };
616
616
  }
617
617
  function se(e) {
@@ -623,7 +623,7 @@ function Ee({
623
623
  startPath: t,
624
624
  productId: i,
625
625
  planId: n,
626
- callbackUrl: s,
626
+ callbackUrl: a,
627
627
  tenantType: c,
628
628
  tenantId: o,
629
629
  children: r,
@@ -632,16 +632,16 @@ function Ee({
632
632
  noAutoRedirect: f,
633
633
  ...m
634
634
  }) {
635
- let [w, T] = l__namespace.useState(false), R = e?.checkout, p = l__namespace.useCallback(
635
+ let [x, T] = l__namespace.useState(false), R = e?.checkout, p = l__namespace.useCallback(
636
636
  async (d) => {
637
- if (d.preventDefault(), !w) {
637
+ if (d.preventDefault(), !x) {
638
638
  if (t) {
639
639
  T(true);
640
640
  try {
641
641
  let g = await ie(t, {
642
642
  productId: i,
643
643
  planId: n,
644
- callbackUrl: s,
644
+ callbackUrl: a,
645
645
  tenantType: c,
646
646
  tenantId: o
647
647
  });
@@ -666,7 +666,7 @@ function Ee({
666
666
  let g = await R.start({
667
667
  productId: i,
668
668
  planId: n,
669
- callbackUrl: s,
669
+ callbackUrl: a,
670
670
  tenantType: c,
671
671
  tenantId: o,
672
672
  autoRedirect: !f
@@ -679,7 +679,7 @@ function Ee({
679
679
  }
680
680
  }
681
681
  },
682
- [w, R, t, i, n, s, c, o, f, b, u]
682
+ [x, R, t, i, n, a, c, o, f, b, u]
683
683
  );
684
684
  return l__namespace.createElement(
685
685
  "a",
@@ -687,7 +687,7 @@ function Ee({
687
687
  ...m,
688
688
  href: m.href ?? "#",
689
689
  onClick: p,
690
- "aria-busy": w || void 0,
690
+ "aria-busy": x || void 0,
691
691
  "data-neetru-checkout-link": "true"
692
692
  },
693
693
  r
@@ -721,14 +721,14 @@ function De({
721
721
  redirectUri: t,
722
722
  scope: i,
723
723
  postLoginRedirect: n,
724
- theme: s = "dark",
724
+ theme: a = "dark",
725
725
  label: c = "Entrar com Neetru",
726
726
  onError: o,
727
727
  style: r,
728
728
  disabled: b,
729
729
  ...u
730
730
  }) {
731
- let [f, m] = l__namespace.useState(false), [w, T] = l__namespace.useState(false), R = de[s], p = !!b || f;
731
+ let [f, m] = l__namespace.useState(false), [x, T] = l__namespace.useState(false), R = de[a], p = !!b || f;
732
732
  l__namespace.useEffect(() => {
733
733
  ge();
734
734
  }, []);
@@ -767,7 +767,7 @@ function De({
767
767
  padding: "0 20px",
768
768
  borderRadius: 0,
769
769
  border: `1px solid ${R.border}`,
770
- backgroundColor: w && !p ? R.bgHover : R.bg,
770
+ backgroundColor: x && !p ? R.bgHover : R.bg,
771
771
  color: R.fg,
772
772
  fontSize: "14px",
773
773
  fontWeight: 700,
@@ -800,7 +800,7 @@ function Ne({
800
800
  feature: t,
801
801
  productSlug: i,
802
802
  mode: n = "block",
803
- fallback: s,
803
+ fallback: a,
804
804
  loading: c,
805
805
  children: o
806
806
  }) {
@@ -813,16 +813,16 @@ function Ne({
813
813
  try {
814
814
  let d, g = e.usage;
815
815
  if (g && typeof g.check == "function" && f) {
816
- let C = await g.check(t, {
816
+ let S = await g.check(t, {
817
817
  productId: u,
818
818
  tenantId: f
819
819
  });
820
820
  d = {
821
- allowed: C.allowed === !0,
822
- reason: C.reason,
823
- limit: C.limit,
824
- currentUsage: C.currentUsage,
825
- behavior: C.behavior
821
+ allowed: S.allowed === !0,
822
+ reason: S.reason,
823
+ limit: S.limit,
824
+ currentUsage: S.currentUsage,
825
+ behavior: S.behavior
826
826
  };
827
827
  } else
828
828
  typeof console < "u" && console.warn(
@@ -837,8 +837,8 @@ function Ne({
837
837
  };
838
838
  }, [e, t, u, f]), r.status === "loading")
839
839
  return l__namespace.createElement(l__namespace.Fragment, null, c ?? null);
840
- let m = r.result, w = m?.allowed === true, T = !w && (n === "readonly" || m?.behavior === "readonly");
841
- return !w && n === "block" && !T ? l__namespace.createElement(l__namespace.Fragment, null, s ?? null) : l__namespace.createElement(
840
+ let m = r.result, x = m?.allowed === true, T = !x && (n === "readonly" || m?.behavior === "readonly");
841
+ return !x && n === "block" && !T ? l__namespace.createElement(l__namespace.Fragment, null, a ?? null) : l__namespace.createElement(
842
842
  $.Provider,
843
843
  {
844
844
  value: {
@@ -864,22 +864,22 @@ function fe(e) {
864
864
  }
865
865
  function me(e) {
866
866
  return e.docs.map((t) => {
867
- let i = t.data, { id: n, ...s } = i;
868
- return { ...s, id: t.id };
867
+ let i = t.data, { id: n, ...a } = i;
868
+ return { ...a, id: t.id };
869
869
  });
870
870
  }
871
871
  function ye(e, t) {
872
872
  let i = e?.docs[0];
873
873
  if (!i) return null;
874
- let n = i.data, { id: s, ...c } = n;
874
+ let n = i.data, { id: a, ...c } = n;
875
875
  return { ...c, id: t };
876
876
  }
877
877
  function Ue(e, t) {
878
- let i = t?.intervalMs ?? q, n = t?.poll ?? false, s = fe(
878
+ let i = t?.intervalMs ?? q, n = t?.poll ?? false, a = fe(
879
879
  e
880
880
  ), [c, o] = l__namespace.useState({
881
881
  data: null,
882
- isLoading: s !== null,
882
+ isLoading: a !== null,
883
883
  error: null,
884
884
  isStale: false,
885
885
  lastUpdated: null
@@ -887,12 +887,12 @@ function Ue(e, t) {
887
887
  return b.current = e, l__namespace.useEffect(() => {
888
888
  r.current = true;
889
889
  let u = b.current;
890
- if (!u || s === null)
890
+ if (!u || a === null)
891
891
  return o({ data: null, isLoading: false, error: null, isStale: false, lastUpdated: null }), () => {
892
892
  r.current = false;
893
893
  };
894
894
  o((d) => ({ ...d, isLoading: d.data === null }));
895
- let f = u.__kind === "query" ? u.collection : u.id, m = u.__kind === "query" ? U(u.constraints) : void 0, w = u.db.collection(f), T = (d) => {
895
+ let f = u.__kind === "query" ? u.collection : u.id, m = u.__kind === "query" ? U(u.constraints) : void 0, x = u.db.collection(f), T = (d) => {
896
896
  r.current && o({
897
897
  data: me(d),
898
898
  isLoading: false,
@@ -913,33 +913,33 @@ function Ue(e, t) {
913
913
  let d = false, g = async () => {
914
914
  if (!(d || z()))
915
915
  try {
916
- let v = await w.list(m);
916
+ let v = await x.list(m);
917
917
  d || T(v);
918
918
  } catch (v) {
919
919
  d || R(v);
920
920
  }
921
921
  };
922
922
  g();
923
- let C = setInterval(g, i);
923
+ let S = setInterval(g, i);
924
924
  return () => {
925
- d = true, clearInterval(C), r.current = false;
925
+ d = true, clearInterval(S), r.current = false;
926
926
  };
927
927
  }
928
928
  let p;
929
929
  try {
930
- p = w.onSnapshot(m, T);
930
+ p = x.onSnapshot(m, T);
931
931
  } catch (d) {
932
932
  R(d);
933
933
  }
934
934
  return () => {
935
935
  r.current = false, p?.();
936
936
  };
937
- }, [s, i, n]), c;
937
+ }, [a, i, n]), c;
938
938
  }
939
939
  function Ae(e, t) {
940
- let i = t?.intervalMs ?? q, n = t?.poll ?? false, s = e && e.id ? `${e.collection}/${e.id}` : null, [c, o] = l__namespace.useState({
940
+ let i = t?.intervalMs ?? q, n = t?.poll ?? false, a = e && e.id ? `${e.collection}/${e.id}` : null, [c, o] = l__namespace.useState({
941
941
  data: null,
942
- isLoading: s !== null,
942
+ isLoading: a !== null,
943
943
  error: null,
944
944
  isStale: false,
945
945
  lastUpdated: null
@@ -947,12 +947,12 @@ function Ae(e, t) {
947
947
  return b.current = e, l__namespace.useEffect(() => {
948
948
  r.current = true;
949
949
  let u = b.current;
950
- if (!u || s === null)
950
+ if (!u || a === null)
951
951
  return o({ data: null, isLoading: false, error: null, isStale: false, lastUpdated: null }), () => {
952
952
  r.current = false;
953
953
  };
954
954
  o((p) => ({ ...p, isLoading: p.data === null }));
955
- let f = u.db.collection(u.collection).doc(u.id), m = u.id, w = (p) => {
955
+ let f = u.db.collection(u.collection).doc(u.id), m = u.id, x = (p) => {
956
956
  r.current && o({
957
957
  data: ye(p, m),
958
958
  isLoading: false,
@@ -972,10 +972,10 @@ function Ae(e, t) {
972
972
  let p = false, d = async () => {
973
973
  if (!(p || z()))
974
974
  try {
975
- let C = await f.get();
976
- p || w(C);
977
- } catch (C) {
978
- p || T(C);
975
+ let S = await f.get();
976
+ p || x(S);
977
+ } catch (S) {
978
+ p || T(S);
979
979
  }
980
980
  };
981
981
  d();
@@ -986,21 +986,21 @@ function Ae(e, t) {
986
986
  }
987
987
  let R;
988
988
  try {
989
- R = f.onSnapshot(w);
989
+ R = f.onSnapshot(x);
990
990
  } catch (p) {
991
991
  T(p);
992
992
  }
993
993
  return () => {
994
994
  r.current = false, R?.();
995
995
  };
996
- }, [s, i, n]), c;
996
+ }, [a, i, n]), c;
997
997
  }
998
998
  function he(e) {
999
999
  let t = e;
1000
1000
  return t.auth && typeof t.auth.onAuthStateChanged == "function" ? t.auth : e;
1001
1001
  }
1002
1002
  function Le(e, t) {
1003
- let i = t?.timeoutMs ?? 8e3, n = he(e), [s, c] = l__namespace.useState(() => {
1003
+ let i = t?.timeoutMs ?? 8e3, n = he(e), [a, c] = l__namespace.useState(() => {
1004
1004
  let r = null;
1005
1005
  try {
1006
1006
  r = n.getUser();
@@ -1028,7 +1028,7 @@ function Le(e, t) {
1028
1028
  return () => {
1029
1029
  o.current = false, clearTimeout(b), u?.();
1030
1030
  };
1031
- }, [n, i]), s;
1031
+ }, [n, i]), a;
1032
1032
  }
1033
1033
 
1034
1034
  exports.CheckoutLink = Ee;
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { X as NeetruClient, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-yv3EDKg2.cjs';
2
+ import { X as NeetruClient, am as SignOutResult, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-Bl_4HROd.cjs';
3
3
  import { CollectionReference, Query, DocumentReference } from './firestore-compat.cjs';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.cjs';
@@ -83,7 +83,13 @@ interface NeetruAccountBarProps {
83
83
  /** Link "Configurações da conta" DESTE produto (rota interna do app). Omite o item se ausente. */
84
84
  settingsUrl?: string;
85
85
  /** Chamado após `signOut` concluir (ex.: redirecionar pro login). */
86
- onSignOut?: () => void;
86
+ /**
87
+ * Chamado depois do signOut. 3.9.0: recebe o `SignOutResult` — quando
88
+ * `remoteRevocation` é `'failed'`/`'not_configured'`, a sessão do servidor
89
+ * pode seguir viva e o produto deve avisar (terminal compartilhado).
90
+ * `undefined` quando o signOut lançou.
91
+ */
92
+ onSignOut?: (result?: SignOutResult) => void;
87
93
  /** Override do fetcher — default `fetchNeetruAccountBar(client)`. Útil em teste/SSR. */
88
94
  fetchBar?: (client: NeetruClient) => Promise<AccountBarData | null>;
89
95
  /** Override parcial dos textos (default PT-BR). */
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { X as NeetruClient, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-BYPk_3HR.js';
2
+ import { X as NeetruClient, am as SignOutResult, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-Bqnsqvow.js';
3
3
  import { CollectionReference, Query, DocumentReference } from './firestore-compat.js';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.js';
@@ -83,7 +83,13 @@ interface NeetruAccountBarProps {
83
83
  /** Link "Configurações da conta" DESTE produto (rota interna do app). Omite o item se ausente. */
84
84
  settingsUrl?: string;
85
85
  /** Chamado após `signOut` concluir (ex.: redirecionar pro login). */
86
- onSignOut?: () => void;
86
+ /**
87
+ * Chamado depois do signOut. 3.9.0: recebe o `SignOutResult` — quando
88
+ * `remoteRevocation` é `'failed'`/`'not_configured'`, a sessão do servidor
89
+ * pode seguir viva e o produto deve avisar (terminal compartilhado).
90
+ * `undefined` quando o signOut lançou.
91
+ */
92
+ onSignOut?: (result?: SignOutResult) => void;
87
93
  /** Override do fetcher — default `fetchNeetruAccountBar(client)`. Útil em teste/SSR. */
88
94
  fetchBar?: (client: NeetruClient) => Promise<AccountBarData | null>;
89
95
  /** Override parcial dos textos (default PT-BR). */