@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/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 paymentMethods = await fetchBilling(j.list_payment_methods_for_user, { client });
25850
- if (BillingError.from(paymentMethods)) {
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 (!BillingError.from(org)) {
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 {