Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvdm committed Mar 12, 2024
1 parent a47d4e8 commit 82ba5d6
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files.trimTrailingWhitespace": true,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"[prisma]": {
"editor.formatOnSave": true
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@redwoodjs-stripe/api": "^0.1.0-rc.14",
"@redwoodjs-stripe/api": "^1.0.1",
"@redwoodjs/api": "5.4.2",
"@redwoodjs/auth-dbauth-api": "5.4.2",
"@redwoodjs/graphql-server": "5.4.2",
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"@radix-ui/react-dialog": "1.0.4",
"@redwoodjs-stripe/web": "^0.1.0-rc.14",
"@redwoodjs-stripe/web": "^1.0.1",
"@redwoodjs/auth": "5.4.2",
"@redwoodjs/auth-dbauth-web": "5.4.2",
"@redwoodjs/forms": "5.4.2",
Expand Down
44 changes: 43 additions & 1 deletion web/src/components/AuthButton/AuthButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { useStripeCustomerPortal } from '@redwoodjs-stripe/web'
import { useEffect } from 'react'

import {
useStripeCustomerPortal,
useStripeCustomer,
useStripeSubscriptions,

Check failure on line 6 in web/src/components/AuthButton/AuthButton.js

View workflow job for this annotation

GitHub Actions / 🌲 Redwood CI

'useStripeSubscriptions' is defined but never used. Allowed unused vars must match /^_/u
} from '@redwoodjs-stripe/web'
import { User } from 'react-feather'

import { routes } from '@redwoodjs/router'
Expand All @@ -8,13 +14,49 @@ import { useAuth } from 'src/auth'
import Button from 'src/components/Button'

const AuthButton = (props) => {
// const { listStripeSubscriptions } = useStripeSubscriptions()
const { customer, retrieveStripeCustomer } = useStripeCustomer({
retrieveFragment: gql`
fragment CustomerSubscriptionFragment on StripeCustomer {
id
subscriptions {
id
}
cash_balance {
object
}
}
`,
})

const { isAuthenticated, logOut } = useAuth()
const {
redirectToStripeCustomerPortal,
createStripeCustomerPortalConfig,
defaultConfig,
} = useStripeCustomerPortal()

// useEffect(() => {
// if (customer?.id) {
// listStripeSubscriptions({
// customer: customer.id,
// }).then((r) => {
// console.log(r)
// })
// }
// }, [listStripeSubscriptions, customer?.id])

useEffect(() => {
// can use isAuthenticated
if (customer?.id) {
retrieveStripeCustomer(null, {
expand: ['subscriptions', 'cash_balance'],
}).then((r) => {
console.log(r)
})
}
}, [customer?.id, retrieveStripeCustomer])

const onLogoutButtonClick = async () => {
await logOut()
toast.success("You've been successfully logged out")
Expand Down
47 changes: 16 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4654,29 +4654,23 @@ __metadata:
languageName: node
linkType: hard

"@redwoodjs-stripe/api@npm:^0.1.0-rc.14":
version: 0.1.0-rc.15
resolution: "@redwoodjs-stripe/api@npm:0.1.0-rc.15"
"@redwoodjs-stripe/api@npm:^1.0.1":
version: 1.0.1
resolution: "@redwoodjs-stripe/api@npm:1.0.1"
dependencies:
fs-extra: ^10.1.0
stripe: ^11.9.1
checksum: 007d7d90599f582d8669e64ee19dba6e864d1a549277dc9348c656f0351a6b62e1d25cd96c99131a8ea48bbae388a9ab4d6dd16042d981f67885a4b248a8b2b6
stripe: ^11.18.0
checksum: 8d5384572569ee1283fc1a84ccfab49a7a47a52ec25e713a2ad01b26e9d764c8eacd74ee3b7bb92ced9f89c3af16af415e538356358ffcec1f37f3f6a67be361
languageName: node
linkType: hard

"@redwoodjs-stripe/web@npm:^0.1.0-rc.14":
version: 0.1.0-rc.14
resolution: "@redwoodjs-stripe/web@npm:0.1.0-rc.14"
dependencies:
tmp-promise: ^3.0.3
"@redwoodjs-stripe/web@npm:^1.0.1":
version: 1.0.1
resolution: "@redwoodjs-stripe/web@npm:1.0.1"
peerDependencies:
"@apollo/client": 3.x
"@redwoodjs/core": 4.x
"@redwoodjs/web": 4.x
graphql-tag: 2.x
react: 17.0.2
react-dom: 17.0.2
checksum: ec09cdddbff855b77318f1e2aae042b4fde62356b5009b9054e4f70f66f2de1e05bac8e35b28d22ec230fb4550935c793b06cc74a3ae0ef57ea7b1e4bd581546
"@redwoodjs/web": ^5.4.3
react: ^18.2.0
react-dom: ^18.2.0
checksum: c8a3ec0f3c8344e78af78e521130bb7d578fadbb72969a1d8024ebf1fe97b11e5f3af489936eaa546321ae7665fe4b2ba8fa328d1b51a3a13ecd0252593ffe2a
languageName: node
linkType: hard

Expand Down Expand Up @@ -8655,7 +8649,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "api@workspace:api"
dependencies:
"@redwoodjs-stripe/api": ^0.1.0-rc.14
"@redwoodjs-stripe/api": ^1.0.1
"@redwoodjs/api": 5.4.2
"@redwoodjs/auth-dbauth-api": 5.4.2
"@redwoodjs/graphql-server": 5.4.2
Expand Down Expand Up @@ -23299,7 +23293,7 @@ __metadata:
languageName: node
linkType: hard

"stripe@npm:^11.9.1":
"stripe@npm:^11.18.0":
version: 11.18.0
resolution: "stripe@npm:11.18.0"
dependencies:
Expand Down Expand Up @@ -23812,16 +23806,7 @@ __metadata:
languageName: node
linkType: hard

"tmp-promise@npm:^3.0.3":
version: 3.0.3
resolution: "tmp-promise@npm:3.0.3"
dependencies:
tmp: ^0.2.0
checksum: 23b47dcb2e82b14bbd8f61ed7a9d9353cdb6a6f09d7716616cfd27d0087040cd40152965a518e598d7aabe1489b9569bf1eebde0c5fadeaf3ec8098adcebea4e
languageName: node
linkType: hard

"tmp@npm:0.2.1, tmp@npm:^0.2.0":
"tmp@npm:0.2.1":
version: 0.2.1
resolution: "tmp@npm:0.2.1"
dependencies:
Expand Down Expand Up @@ -25098,7 +25083,7 @@ __metadata:
resolution: "web@workspace:web"
dependencies:
"@radix-ui/react-dialog": 1.0.4
"@redwoodjs-stripe/web": ^0.1.0-rc.14
"@redwoodjs-stripe/web": ^1.0.1
"@redwoodjs/auth": 5.4.2
"@redwoodjs/auth-dbauth-web": 5.4.2
"@redwoodjs/forms": 5.4.2
Expand Down

0 comments on commit 82ba5d6

Please sign in to comment.