chore:little fixes and formating and linting and patches
This commit is contained in:
@@ -31,13 +31,15 @@ async function promptForInput(polar: Polar) {
|
||||
sorting: ['price_amount'],
|
||||
});
|
||||
products = productsResponse.result.items;
|
||||
|
||||
|
||||
if (products.length === 0) {
|
||||
console.warn('Warning: No products found in Polar');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching products from Polar:', error);
|
||||
throw new Error('Failed to fetch products. Please check your API key and try again.');
|
||||
throw new Error(
|
||||
'Failed to fetch products. Please check your API key and try again.'
|
||||
);
|
||||
}
|
||||
|
||||
const answers = await inquirer.prompt<Answers>([
|
||||
@@ -50,7 +52,7 @@ async function promptForInput(polar: Polar) {
|
||||
.filter(
|
||||
(product) =>
|
||||
product.name.toLowerCase().includes(input.toLowerCase()) ||
|
||||
product.id.toLowerCase().includes(input.toLowerCase()),
|
||||
product.id.toLowerCase().includes(input.toLowerCase())
|
||||
)
|
||||
.map((product) => {
|
||||
const price = product.prices[0];
|
||||
@@ -73,7 +75,7 @@ async function promptForInput(polar: Polar) {
|
||||
.filter(
|
||||
(org) =>
|
||||
org.name.toLowerCase().includes(input.toLowerCase()) ||
|
||||
org.id.toLowerCase().includes(input.toLowerCase()),
|
||||
org.id.toLowerCase().includes(input.toLowerCase())
|
||||
)
|
||||
.map((org) => ({
|
||||
name: `${org.name} (${org.id})`,
|
||||
@@ -103,11 +105,11 @@ async function promptForInput(polar: Polar) {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!org || !org.members || org.members.length === 0) {
|
||||
|
||||
if (!(org && org.members) || org.members.length === 0) {
|
||||
return [{ name: 'No members found', value: '', disabled: true }];
|
||||
}
|
||||
|
||||
|
||||
return org.members
|
||||
.filter(
|
||||
(member) =>
|
||||
@@ -116,7 +118,7 @@ async function promptForInput(polar: Polar) {
|
||||
.includes(input.toLowerCase()) ||
|
||||
member.user?.firstName
|
||||
?.toLowerCase()
|
||||
.includes(input.toLowerCase()),
|
||||
.includes(input.toLowerCase())
|
||||
)
|
||||
.map((member) => ({
|
||||
name: `${
|
||||
@@ -158,7 +160,9 @@ async function main() {
|
||||
name: 'polarApiKey',
|
||||
message: 'Enter your Polar API key:',
|
||||
validate: (input: string) => {
|
||||
if (!input) return 'API key is required';
|
||||
if (!input) {
|
||||
return 'API key is required';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
@@ -220,7 +224,7 @@ async function main() {
|
||||
isProduction
|
||||
? 'https://dashboard.openpanel.dev'
|
||||
: 'http://localhost:3000',
|
||||
organization.id,
|
||||
organization.id
|
||||
),
|
||||
customerEmail: user.email,
|
||||
customerName: [user.firstName, user.lastName].filter(Boolean).join(' '),
|
||||
|
||||
Reference in New Issue
Block a user