Skip to content

Commit

Permalink
Merge pull request tone-row#564 from tone-row/dev
Browse files Browse the repository at this point in the history
v1.38.0
  • Loading branch information
rob-gordon authored Jul 27, 2023
2 parents eeb044b + 7d81c0a commit 0b64faa
Show file tree
Hide file tree
Showing 83 changed files with 6,964 additions and 8,400 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
touch app/.env
echo RAPID_API_KEY=${{ secrets.RAPID_API_KEY }} >> app/.env
echo STRIPE_KEY_TEST_ENV=${{ secrets.STRIPE_KEY_TEST_ENV }} >> app/.env
echo SUPABASE_TEST_URL=${{ secrets.SUPABASE_TEST_URL }} >> app/.env
echo SUPABASE_TEST_ANON_KEY=${{ secrets.SUPABASE_TEST_ANON_KEY }} >> app/.env
echo TESTING_EMAIL=${{ secrets.TESTING_EMAIL }} >> app/.env
echo TESTING_PASS=${{ secrets.TESTING_PASS }} >> app/.env
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -42,7 +42,7 @@ jobs:
version: 8
- name: Install Playwright
run: |
pnpm add -g playwright@1.29.0
pnpm add -g playwright@1.36.2
playwright install
- name: Install Deps
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged
pnpm lint-staged && pnpm -F app typecheck
16 changes: 8 additions & 8 deletions api/customer-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export default async function customerInfo(
status: "all",
});

const subscription = subscriptions.length ? subscriptions[0] : undefined;
const priceId = subscription?.items.data[0].plan.id;

if (!subscription || !priceId) throw new Error("No Subscription Found");
// find the first valid subscription
const validSubscriptions = subscriptions.filter((subscription) => {
const priceId = subscription.items.data[0].plan.id;
return validStripePrices.includes(priceId);
});

// make sure priceId is valid
if (!validStripePrices.includes(priceId)) {
throw new Error("Invalid Subscription");
}
const subscription = validSubscriptions.length
? validSubscriptions[0]
: undefined;

res.json({ customerId: customer.id, subscription });
} catch (error) {
Expand Down
6 changes: 4 additions & 2 deletions api/get-signup-client-secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {

// If they already have a subscription in validStripePrices, return error
if (
subscriptions.some((sub) =>
validStripePrices.includes(sub.items.data[0].price.id)
subscriptions.some(
(sub) =>
validStripePrices.includes(sub.items.data[0].price.id) &&
sub.status !== "incomplete"
)
) {
return res.status(402).json({
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"@vercel/node": "^2.8.15",
"eslint": "^8.3.0",
"jest": "^29.4.3",
"typescript": "^4.8.4"
"typescript": "^5.1.6"
}
}
26 changes: 26 additions & 0 deletions app/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/strict",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["jsx-a11y", "simple-import-sort", "react-refresh"],
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"no-debugger": "warn",
"prefer-const": "off",
},
};
70 changes: 0 additions & 70 deletions app/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 0b64faa

Please sign in to comment.