From dc1a5af77afe961155f251a35ba15d3e8eb7d266 Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 15 Oct 2022 09:55:37 +0500 Subject: [PATCH] save whole subscription object --- website/package.json | 1 + website/src/types/account-types.ts | 6 ++++-- website/yarn.lock | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/website/package.json b/website/package.json index 42e93cb..cde5a43 100644 --- a/website/package.json +++ b/website/package.json @@ -39,6 +39,7 @@ "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", "relevancy": "^0.2.0", + "stripe": "^10.14.0", "supermemo": "^2.0.17", "typescript": "^4.2.3", "web-vitals": "^0.2.4", diff --git a/website/src/types/account-types.ts b/website/src/types/account-types.ts index c12c956..9fc9c69 100644 --- a/website/src/types/account-types.ts +++ b/website/src/types/account-types.ts @@ -15,7 +15,7 @@ export type GoogleProfile = WoutRJ & { export type GitHubProfile = WoutRJ & { accessToken: string }; export type TwitterProfile = WoutRJ & { token: string, tokenSecret: string }; export type ProviderProfile = GoogleProfile | GitHubProfile | TwitterProfile; -export type UserLevel = "basic" | "student" | "editor"; +export type UserLevel = "basic" | "student" | "editor"; export type UserTextOptions = Omit; @@ -30,6 +30,8 @@ export type TestResult = { id: string, } +export type StripeSubscription = import("stripe").Stripe.Subscription; + // TODO: TYPE GUARDING SO WE NEVER HAVE A USER WITH NO Id or Password export type LingdocsUser = { userId: UUID, @@ -56,7 +58,7 @@ export type LingdocsUser = { level: "student" | "editor", couchDbPassword: UserDbPassword, wordlistDbName: WordlistDbName, - subscriptionId: string | undefined, + subscription?: StripeSubscription, } ) & import("nano").MaybeDocument; diff --git a/website/yarn.lock b/website/yarn.lock index f5d276e..c81e873 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -2856,6 +2856,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.1.tgz#aee62c7b966f55fc66c7b6dfa1d58db2a616da61" integrity sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw== +"@types/node@>=8.1.0": + version "18.11.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.0.tgz#f38c7139247a1d619f6cc6f27b072606af7c289d" + integrity sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w== + "@types/node@^14.14.33": version "14.17.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.9.tgz#b97c057e6138adb7b720df2bd0264b03c9f504fd" @@ -11148,6 +11153,13 @@ qs@6.10.3: dependencies: side-channel "^1.0.4" +qs@^6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" + integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== + dependencies: + side-channel "^1.0.4" + qs@^6.9.4: version "6.10.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a" @@ -12808,6 +12820,14 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +stripe@^10.14.0: + version "10.14.0" + resolved "https://registry.yarnpkg.com/stripe/-/stripe-10.14.0.tgz#3db35b434321bb1f1231267c6c960bfa442573ac" + integrity sha512-cXqUdZvrU20KElhLjzw/kW5t2SLLUENqeEftaiQXLogkUdNHyz/L12S4WHmQ8h0KHHFhxO39I7Q9GkJO1MMzzw== + dependencies: + "@types/node" ">=8.1.0" + qs "^6.11.0" + style-loader@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.3.0.tgz#828b4a3b3b7e7aa5847ce7bae9e874512114249e"