11import { GeneralRecord } from "@instill-ai/toolkit" ;
2+ import { Nullable } from "../types" ;
23
34export type User = {
45 name : string ;
@@ -52,7 +53,7 @@ export type AuthLoginActionResponse = {
5253} ;
5354
5455export type UpdateUserResponse = {
55- user : User ;
56+ user : AuthenticatedUser ;
5657} ;
5758
5859export type CreateApiTokenPayload = {
@@ -69,6 +70,9 @@ export type ChangePasswordPayload = {
6970 new_password : string ;
7071} ;
7172
73+ export type GetAuthenticatedResponse = {
74+ user : AuthenticatedUser ;
75+ } ;
7276export type GetUserResponse = {
7377 user : User ;
7478} ;
@@ -96,3 +100,72 @@ export type ListUsersResponse = {
96100export type CheckNamespaceResponse = {
97101 type : NamespaceType ;
98102} ;
103+
104+ export type UserProfile = {
105+ display_name ?: string ;
106+ bio ?: string ;
107+ public_email ?: string ;
108+ company_name ?: string ;
109+ avatar ?: string ;
110+ social_profiles_links ?: {
111+ webiste ?: string ;
112+ x ?: string ;
113+ github ?: string ;
114+ } ;
115+ } ;
116+
117+ export type OnboardingStatus =
118+ | "ONBOARDING_STATUS_UNSPECIFIED"
119+ | "ONBOARDING_STATUS_IN_PROGRESS"
120+ | "ONBOARDING_STATUS_COMPLETED" ;
121+
122+ export type AuthenticatedUser = {
123+ name : string ;
124+ uid : string ;
125+ id : string ;
126+ create_time : string ;
127+ update_time : string ;
128+ customer_id : string ;
129+ email : string ;
130+ newsletter_subscription : boolean ;
131+ role : string ;
132+ onboarding_status : OnboardingStatus ;
133+ cookie_token ?: string ;
134+ profile ?: UserProfile ;
135+ } ;
136+
137+ export type StripeSubscriptionStatus =
138+ | "STATUS_UNSPECIFIED"
139+ | "STATUS_INCOMPLETE"
140+ | "STATUS_INCOMPLETE_EXPIRED"
141+ | "STATUS_TRIALING"
142+ | "STATUS_ACTIVE"
143+ | "STATUS_PAST_DUE"
144+ | "STATUS_CANCELED"
145+ | "STATUS_UNPAID"
146+ | "STATUS_PAUSED" ;
147+
148+ export type StripeSubscriptionDetail = {
149+ product_name : string ;
150+ id : string ;
151+ item_id : string ;
152+ price : number ;
153+ canceled_at ?: number ;
154+ trial_end ?: number ;
155+ status : StripeSubscriptionStatus ;
156+ description : string ;
157+ } ;
158+
159+ export type UserSubscriptionPlan =
160+ | "PLAN_UNSPECIFIED"
161+ | "PLAN_FREEMIUM"
162+ | "PLAN_PRO" ;
163+
164+ export type UserSubscription = {
165+ plan : UserSubscriptionPlan ;
166+ detail : Nullable < StripeSubscriptionDetail > ;
167+ } ;
168+
169+ export type GetAuthenticatedUserSubscriptionsResponse = {
170+ subscription : UserSubscription ;
171+ } ;
0 commit comments