@neetru/sdk 3.4.3 → 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 +40 -0
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/auth.cjs +33 -11
- 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 +33 -11
- package/dist/auth.mjs.map +1 -1
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/checkout.cjs +17 -7
- package/dist/checkout.cjs.map +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/checkout.mjs +17 -7
- package/dist/checkout.mjs.map +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 +34 -12
- 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 +34 -12
- 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 +62 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +38 -7
- package/dist/react.d.ts +38 -7
- package/dist/react.mjs +62 -3
- 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-D-QdG502.d.cts → types-DIVZl7nO.d.cts} +29 -8
- package/dist/{types-BlOLDMR0.d.ts → types-nnztVk7G.d.ts} +29 -8
- 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/dist/mocks.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a5 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, aj as SignInOptions, m as AuthStateListener, ae as RedirectCallbackResult, v as CompleteSignInResult, Y as NeetruDb, E as DbCollectionRef, a4 as NeetruSqlClient, aq as SyncState, av as Unsubscribe, w as ConflictRecord, O as EntitlementCheck, al as SupportNamespace, y as CreateTicketInput, ao as SupportTicket, ax as UsageNamespace, ay as UsageQuota } from './types-
|
|
1
|
+
import { a5 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, aj as SignInOptions, m as AuthStateListener, ae as RedirectCallbackResult, v as CompleteSignInResult, Y as NeetruDb, E as DbCollectionRef, a4 as NeetruSqlClient, aq as SyncState, av as Unsubscribe, w as ConflictRecord, O as EntitlementCheck, al as SupportNamespace, y as CreateTicketInput, ao as SupportTicket, ax as UsageNamespace, ay as UsageQuota } from './types-DIVZl7nO.cjs';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.cjs';
|
|
4
4
|
|
package/dist/mocks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a5 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, aj as SignInOptions, m as AuthStateListener, ae as RedirectCallbackResult, v as CompleteSignInResult, Y as NeetruDb, E as DbCollectionRef, a4 as NeetruSqlClient, aq as SyncState, av as Unsubscribe, w as ConflictRecord, O as EntitlementCheck, al as SupportNamespace, y as CreateTicketInput, ao as SupportTicket, ax as UsageNamespace, ay as UsageQuota } from './types-
|
|
1
|
+
import { a5 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, aj as SignInOptions, m as AuthStateListener, ae as RedirectCallbackResult, v as CompleteSignInResult, Y as NeetruDb, E as DbCollectionRef, a4 as NeetruSqlClient, aq as SyncState, av as Unsubscribe, w as ConflictRecord, O as EntitlementCheck, al as SupportNamespace, y as CreateTicketInput, ao as SupportTicket, ax as UsageNamespace, ay as UsageQuota } from './types-nnztVk7G.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
|
4
4
|
|
package/dist/notifications.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { R as ListNotificationsOptions, T as MockNotifications, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a9 as ProductNotification, aa as ProductNotificationSeverity, ah as SendNotificationInput, aM as createNotificationsNamespace } from './types-
|
|
1
|
+
export { R as ListNotificationsOptions, T as MockNotifications, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a9 as ProductNotification, aa as ProductNotificationSeverity, ah as SendNotificationInput, aM as createNotificationsNamespace } from './types-DIVZl7nO.cjs';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.cjs';
|
package/dist/notifications.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { R as ListNotificationsOptions, T as MockNotifications, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a9 as ProductNotification, aa as ProductNotificationSeverity, ah as SendNotificationInput, aM as createNotificationsNamespace } from './types-
|
|
1
|
+
export { R as ListNotificationsOptions, T as MockNotifications, a6 as NotificationScopeOptions, a7 as NotificationsNamespace, a9 as ProductNotification, aa as ProductNotificationSeverity, ah as SendNotificationInput, aM as createNotificationsNamespace } from './types-nnztVk7G.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
package/dist/react.cjs
CHANGED
|
@@ -610,8 +610,44 @@ function normalizeOp(op) {
|
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
// src/react.ts
|
|
613
|
+
async function startCheckoutViaBff(startPath, input) {
|
|
614
|
+
const res = await fetch(startPath, {
|
|
615
|
+
method: "POST",
|
|
616
|
+
headers: { "content-type": "application/json", accept: "application/json" },
|
|
617
|
+
credentials: "include",
|
|
618
|
+
body: JSON.stringify(input)
|
|
619
|
+
});
|
|
620
|
+
let payload = null;
|
|
621
|
+
try {
|
|
622
|
+
payload = await res.json();
|
|
623
|
+
} catch {
|
|
624
|
+
payload = null;
|
|
625
|
+
}
|
|
626
|
+
if (!res.ok) {
|
|
627
|
+
const p = payload;
|
|
628
|
+
const msg = p && (typeof p.error === "object" && p.error?.message || typeof p.error === "string" && p.error || typeof p.message === "string" && p.message) || `Checkout BFF respondeu HTTP ${res.status}`;
|
|
629
|
+
throw new Error(typeof msg === "string" ? msg : `Checkout BFF respondeu HTTP ${res.status}`);
|
|
630
|
+
}
|
|
631
|
+
const intent = payload?.intent ?? payload ?? {};
|
|
632
|
+
const redirectUrl = payload?.redirectUrl ?? intent.redirectUrl;
|
|
633
|
+
if (!redirectUrl || typeof redirectUrl !== "string") {
|
|
634
|
+
throw new Error("Resposta do route BFF de checkout sem `redirectUrl`.");
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
intentId: String(payload?.intentId ?? intent.intentId ?? ""),
|
|
638
|
+
redirectUrl,
|
|
639
|
+
status: payload?.status ?? intent.status ?? "pending",
|
|
640
|
+
expiresAt: typeof payload?.expiresAt === "string" ? payload.expiresAt : typeof intent.expiresAt === "string" ? intent.expiresAt : "",
|
|
641
|
+
requiresKyc: payload?.requiresKyc === true || intent.requiresKyc === true
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function checkoutRedirect(url) {
|
|
645
|
+
const loc = globalThis.location;
|
|
646
|
+
if (loc && typeof loc.assign === "function") loc.assign(url);
|
|
647
|
+
}
|
|
613
648
|
function CheckoutLink({
|
|
614
649
|
client,
|
|
650
|
+
startPath,
|
|
615
651
|
productId,
|
|
616
652
|
planId,
|
|
617
653
|
callbackUrl,
|
|
@@ -624,13 +660,36 @@ function CheckoutLink({
|
|
|
624
660
|
...rest
|
|
625
661
|
}) {
|
|
626
662
|
const [submitting, setSubmitting] = React2__namespace.useState(false);
|
|
627
|
-
const checkout = client
|
|
663
|
+
const checkout = client?.checkout;
|
|
628
664
|
const handleClick = React2__namespace.useCallback(
|
|
629
665
|
async (event) => {
|
|
630
666
|
event.preventDefault();
|
|
631
667
|
if (submitting) return;
|
|
668
|
+
if (startPath) {
|
|
669
|
+
setSubmitting(true);
|
|
670
|
+
try {
|
|
671
|
+
const result = await startCheckoutViaBff(startPath, {
|
|
672
|
+
productId,
|
|
673
|
+
planId,
|
|
674
|
+
callbackUrl,
|
|
675
|
+
tenantType,
|
|
676
|
+
tenantId
|
|
677
|
+
});
|
|
678
|
+
onIntentCreated?.(result);
|
|
679
|
+
if (!noAutoRedirect) checkoutRedirect(result.redirectUrl);
|
|
680
|
+
} catch (err) {
|
|
681
|
+
onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
682
|
+
} finally {
|
|
683
|
+
setSubmitting(false);
|
|
684
|
+
}
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
632
687
|
if (!checkout || typeof checkout.start !== "function") {
|
|
633
|
-
onError?.(
|
|
688
|
+
onError?.(
|
|
689
|
+
new Error(
|
|
690
|
+
"CheckoutLink: passe `startPath` (padr\xE3o BFF/cookie recomendado) OU um `client` com o namespace `checkout` (SDK 1.1+)."
|
|
691
|
+
)
|
|
692
|
+
);
|
|
634
693
|
return;
|
|
635
694
|
}
|
|
636
695
|
setSubmitting(true);
|
|
@@ -650,7 +709,7 @@ function CheckoutLink({
|
|
|
650
709
|
setSubmitting(false);
|
|
651
710
|
}
|
|
652
711
|
},
|
|
653
|
-
[submitting, checkout, productId, planId, callbackUrl, tenantType, tenantId, noAutoRedirect, onIntentCreated, onError]
|
|
712
|
+
[submitting, checkout, startPath, productId, planId, callbackUrl, tenantType, tenantId, noAutoRedirect, onIntentCreated, onError]
|
|
654
713
|
);
|
|
655
714
|
return React2__namespace.createElement(
|
|
656
715
|
"a",
|