@kittycad/react-shared 1.1.0 → 1.1.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.
- package/README.md +33 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +12 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25846,11 +25846,20 @@ async function getBillingInfo(client) {
|
|
|
25846
25846
|
}
|
|
25847
25847
|
const subscriptions = await fetchBilling(j.get_user_subscription, { client });
|
|
25848
25848
|
const org = await fetchBilling(L.get_user_org, { client });
|
|
25849
|
-
const
|
|
25850
|
-
|
|
25849
|
+
const hasOrgError = BillingError.from(org);
|
|
25850
|
+
let paymentMethods = await fetchBilling(j.list_payment_methods_for_user, { client });
|
|
25851
|
+
const isOrgUserWithoutPaymentMethod = !hasOrgError &&
|
|
25852
|
+
BillingError.from(paymentMethods) &&
|
|
25853
|
+
paymentMethods.error.type === EBillingError.NotOk &&
|
|
25854
|
+
'status' in paymentMethods.error.response &&
|
|
25855
|
+
paymentMethods.error.response.status === 404;
|
|
25856
|
+
if (isOrgUserWithoutPaymentMethod) {
|
|
25857
|
+
paymentMethods = [];
|
|
25858
|
+
}
|
|
25859
|
+
else if (BillingError.from(paymentMethods)) {
|
|
25851
25860
|
return paymentMethods;
|
|
25852
25861
|
}
|
|
25853
|
-
if (!
|
|
25862
|
+
if (!hasOrgError) {
|
|
25854
25863
|
// Org override here. TODO for api: remove the need for this
|
|
25855
25864
|
// If the user is part of an org, they get infinite balance.
|
|
25856
25865
|
return {
|