@carlonicora/nextjs-jsonapi 2.2.1 → 2.2.2
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/dist/{BlockNoteEditor-2LGNETXD.mjs → BlockNoteEditor-ADT6II2V.mjs} +5 -5
- package/dist/{BlockNoteEditor-EAEGUVFI.js → BlockNoteEditor-QTIDATPF.js} +20 -20
- package/dist/{BlockNoteEditor-EAEGUVFI.js.map → BlockNoteEditor-QTIDATPF.js.map} +1 -1
- package/dist/{JsonApiRequest-F5LBESSA.mjs → JsonApiRequest-3UWVIIFL.mjs} +2 -2
- package/dist/JsonApiRequest-QRU3IPIU.js +26 -0
- package/dist/{JsonApiRequest-YAPUG4ND.js.map → JsonApiRequest-QRU3IPIU.js.map} +1 -1
- package/dist/billing/index.js +447 -447
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +62 -62
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-B34NBMKV.mjs → chunk-7DJOQTNN.mjs} +3 -3
- package/dist/{chunk-R57FRJ6H.mjs → chunk-DLTMYGLR.mjs} +5 -5
- package/dist/{chunk-Z2CB63VG.mjs → chunk-E5YA5Z5X.mjs} +2 -2
- package/dist/chunk-E5YA5Z5X.mjs.map +1 -0
- package/dist/{chunk-4I2W336O.js → chunk-F3BPNQDB.js} +737 -737
- package/dist/{chunk-4I2W336O.js.map → chunk-F3BPNQDB.js.map} +1 -1
- package/dist/{chunk-QWCAOLBD.js → chunk-FPO4DLZN.js} +12 -12
- package/dist/{chunk-QWCAOLBD.js.map → chunk-FPO4DLZN.js.map} +1 -1
- package/dist/{chunk-DQJ5C5TV.js → chunk-KSU6CCW6.js} +30 -30
- package/dist/{chunk-DQJ5C5TV.js.map → chunk-KSU6CCW6.js.map} +1 -1
- package/dist/{chunk-BLKR2Q7F.js → chunk-LANOKEFZ.js} +9 -9
- package/dist/{chunk-BLKR2Q7F.js.map → chunk-LANOKEFZ.js.map} +1 -1
- package/dist/{chunk-OC7F4L7K.mjs → chunk-YEPE2HT6.mjs} +6 -6
- package/dist/client/index.js +5 -5
- package/dist/client/index.mjs +4 -4
- package/dist/components/index.js +5 -5
- package/dist/components/index.mjs +4 -4
- package/dist/contexts/index.js +5 -5
- package/dist/contexts/index.mjs +4 -4
- package/dist/core/index.js +3 -3
- package/dist/core/index.mjs +2 -2
- package/dist/features/help/index.js +38 -38
- package/dist/features/help/index.mjs +4 -4
- package/dist/features/tokenusage/index.js +72 -72
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/dist/server/index.js +12 -12
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
- package/src/core/utils/__tests__/translateResponse.test.ts +64 -0
- package/src/core/utils/translateResponse.ts +4 -1
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +71 -68
- package/dist/JsonApiRequest-YAPUG4ND.js +0 -26
- package/dist/chunk-Z2CB63VG.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-2LGNETXD.mjs.map → BlockNoteEditor-ADT6II2V.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-F5LBESSA.mjs.map → JsonApiRequest-3UWVIIFL.mjs.map} +0 -0
- /package/dist/{chunk-B34NBMKV.mjs.map → chunk-7DJOQTNN.mjs.map} +0 -0
- /package/dist/{chunk-R57FRJ6H.mjs.map → chunk-DLTMYGLR.mjs.map} +0 -0
- /package/dist/{chunk-OC7F4L7K.mjs.map → chunk-YEPE2HT6.mjs.map} +0 -0
package/dist/billing/index.mjs
CHANGED
|
@@ -48,11 +48,11 @@ import {
|
|
|
48
48
|
TabsList,
|
|
49
49
|
TabsTrigger,
|
|
50
50
|
useCurrentUserContext
|
|
51
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-YEPE2HT6.mjs";
|
|
52
52
|
import {
|
|
53
53
|
getRoleId,
|
|
54
54
|
getStripePublishableKey
|
|
55
|
-
} from "../chunk-
|
|
55
|
+
} from "../chunk-7DJOQTNN.mjs";
|
|
56
56
|
import {
|
|
57
57
|
FeatureService,
|
|
58
58
|
StripeCustomerService,
|
|
@@ -63,10 +63,10 @@ import {
|
|
|
63
63
|
StripeSubscriptionService,
|
|
64
64
|
StripeUsageService,
|
|
65
65
|
cn
|
|
66
|
-
} from "../chunk-
|
|
66
|
+
} from "../chunk-DLTMYGLR.mjs";
|
|
67
67
|
import "../chunk-AUXK7QSA.mjs";
|
|
68
68
|
import "../chunk-C7C7VY4F.mjs";
|
|
69
|
-
import "../chunk-
|
|
69
|
+
import "../chunk-E5YA5Z5X.mjs";
|
|
70
70
|
import "../chunk-VOXD3ZLY.mjs";
|
|
71
71
|
import {
|
|
72
72
|
__name
|
|
@@ -2766,70 +2766,70 @@ function BillingDashboardContainer() {
|
|
|
2766
2766
|
setNoCustomerExists(false);
|
|
2767
2767
|
} catch (error) {
|
|
2768
2768
|
console.error("[BillingDashboard] Failed to load customer:", error);
|
|
2769
|
-
|
|
2770
|
-
if (errorMessage.includes("Not Found") || errorMessage.includes("not found")) {
|
|
2769
|
+
if (error?.status === 404) {
|
|
2771
2770
|
setNoCustomerExists(true);
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
subscriptions: false,
|
|
2775
|
-
paymentMethods: false,
|
|
2776
|
-
invoices: false,
|
|
2777
|
-
usage: false
|
|
2778
|
-
});
|
|
2779
|
-
return;
|
|
2771
|
+
} else {
|
|
2772
|
+
setErrors((prev) => ({ ...prev, customer: "Failed to load billing account" }));
|
|
2780
2773
|
}
|
|
2781
|
-
setErrors((prev) => ({ ...prev, customer: "Failed to load billing account" }));
|
|
2782
2774
|
} finally {
|
|
2783
2775
|
setLoading((prev) => ({ ...prev, customer: false }));
|
|
2784
2776
|
}
|
|
2785
|
-
if (customer) {
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
setErrors((prev) => ({ ...prev, paymentMethods: "Failed to load payment methods" }));
|
|
2808
|
-
} finally {
|
|
2809
|
-
setLoading((prev) => ({ ...prev, paymentMethods: false }));
|
|
2810
|
-
}
|
|
2811
|
-
}, "fetchPaymentMethods");
|
|
2812
|
-
const fetchInvoices = /* @__PURE__ */ __name(async () => {
|
|
2813
|
-
try {
|
|
2814
|
-
const invoices = await StripeInvoiceService.listInvoices();
|
|
2815
|
-
setData((prev) => ({ ...prev, invoices }));
|
|
2816
|
-
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2817
|
-
} catch (error) {
|
|
2818
|
-
console.error("[BillingDashboard] Failed to load invoices:", error);
|
|
2819
|
-
setErrors((prev) => ({ ...prev, invoices: "Failed to load invoices" }));
|
|
2820
|
-
} finally {
|
|
2821
|
-
setLoading((prev) => ({ ...prev, invoices: false }));
|
|
2822
|
-
}
|
|
2823
|
-
}, "fetchInvoices");
|
|
2824
|
-
const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
|
|
2825
|
-
const hasMetered = subscriptions.some(
|
|
2826
|
-
(sub) => sub.price?.recurring?.usageType === "metered"
|
|
2827
|
-
);
|
|
2828
|
-
if (hasMetered) {
|
|
2829
|
-
await fetchUsageData();
|
|
2830
|
-
} else {
|
|
2831
|
-
setLoading((prev) => ({ ...prev, usage: false }));
|
|
2777
|
+
if (!customer) {
|
|
2778
|
+
setLoading({
|
|
2779
|
+
customer: false,
|
|
2780
|
+
subscriptions: false,
|
|
2781
|
+
paymentMethods: false,
|
|
2782
|
+
invoices: false,
|
|
2783
|
+
usage: false
|
|
2784
|
+
});
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
const fetchSubscriptions = /* @__PURE__ */ __name(async () => {
|
|
2788
|
+
try {
|
|
2789
|
+
const subscriptions2 = await StripeSubscriptionService.listSubscriptions();
|
|
2790
|
+
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2791
|
+
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2792
|
+
return subscriptions2;
|
|
2793
|
+
} catch (error) {
|
|
2794
|
+
console.error("[BillingDashboard] Failed to load subscriptions:", error);
|
|
2795
|
+
setErrors((prev) => ({ ...prev, subscriptions: "Failed to load subscriptions" }));
|
|
2796
|
+
return [];
|
|
2797
|
+
} finally {
|
|
2798
|
+
setLoading((prev) => ({ ...prev, subscriptions: false }));
|
|
2832
2799
|
}
|
|
2800
|
+
}, "fetchSubscriptions");
|
|
2801
|
+
const fetchPaymentMethods = /* @__PURE__ */ __name(async () => {
|
|
2802
|
+
try {
|
|
2803
|
+
const paymentMethods = await StripeCustomerService.listPaymentMethods();
|
|
2804
|
+
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2805
|
+
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2806
|
+
} catch (error) {
|
|
2807
|
+
console.error("[BillingDashboard] Failed to load payment methods:", error);
|
|
2808
|
+
setErrors((prev) => ({ ...prev, paymentMethods: "Failed to load payment methods" }));
|
|
2809
|
+
} finally {
|
|
2810
|
+
setLoading((prev) => ({ ...prev, paymentMethods: false }));
|
|
2811
|
+
}
|
|
2812
|
+
}, "fetchPaymentMethods");
|
|
2813
|
+
const fetchInvoices = /* @__PURE__ */ __name(async () => {
|
|
2814
|
+
try {
|
|
2815
|
+
const invoices = await StripeInvoiceService.listInvoices();
|
|
2816
|
+
setData((prev) => ({ ...prev, invoices }));
|
|
2817
|
+
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2818
|
+
} catch (error) {
|
|
2819
|
+
console.error("[BillingDashboard] Failed to load invoices:", error);
|
|
2820
|
+
setErrors((prev) => ({ ...prev, invoices: "Failed to load invoices" }));
|
|
2821
|
+
} finally {
|
|
2822
|
+
setLoading((prev) => ({ ...prev, invoices: false }));
|
|
2823
|
+
}
|
|
2824
|
+
}, "fetchInvoices");
|
|
2825
|
+
const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
|
|
2826
|
+
const hasMetered = subscriptions.some(
|
|
2827
|
+
(sub) => sub.price?.recurring?.usageType === "metered"
|
|
2828
|
+
);
|
|
2829
|
+
if (hasMetered) {
|
|
2830
|
+
await fetchUsageData();
|
|
2831
|
+
} else {
|
|
2832
|
+
setLoading((prev) => ({ ...prev, usage: false }));
|
|
2833
2833
|
}
|
|
2834
2834
|
}, []);
|
|
2835
2835
|
const handleCreateCustomer = /* @__PURE__ */ __name(async () => {
|