mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
feat(core): impl subscription plans setting
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
mutation cancelSubscription {
|
||||
cancelSubscription {
|
||||
id
|
||||
status
|
||||
nextBillAt
|
||||
canceledAt
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
mutation checkout($recurring: SubscriptionRecurring!) {
|
||||
checkout(recurring: $recurring)
|
||||
}
|
||||
@@ -79,6 +79,22 @@ query allBlobSizes {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const cancelSubscriptionMutation = {
|
||||
id: 'cancelSubscriptionMutation' as const,
|
||||
operationName: 'cancelSubscription',
|
||||
definitionName: 'cancelSubscription',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation cancelSubscription {
|
||||
cancelSubscription {
|
||||
id
|
||||
status
|
||||
nextBillAt
|
||||
canceledAt
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const changeEmailMutation = {
|
||||
id: 'changeEmailMutation' as const,
|
||||
operationName: 'changeEmail',
|
||||
@@ -111,6 +127,17 @@ mutation changePassword($token: String!, $newPassword: String!) {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const checkoutMutation = {
|
||||
id: 'checkoutMutation' as const,
|
||||
operationName: 'checkout',
|
||||
definitionName: 'checkout',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation checkout($recurring: SubscriptionRecurring!) {
|
||||
checkout(recurring: $recurring)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const createWorkspaceMutation = {
|
||||
id: 'createWorkspaceMutation' as const,
|
||||
operationName: 'createWorkspace',
|
||||
@@ -321,6 +348,29 @@ query getWorkspaces {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const invoicesQuery = {
|
||||
id: 'invoicesQuery' as const,
|
||||
operationName: 'invoices',
|
||||
definitionName: 'currentUser',
|
||||
containsFile: false,
|
||||
query: `
|
||||
query invoices($take: Int!, $skip: Int!) {
|
||||
currentUser {
|
||||
invoices(take: $take, skip: $skip) {
|
||||
id
|
||||
status
|
||||
plan
|
||||
recurring
|
||||
currency
|
||||
amount
|
||||
reason
|
||||
lastPaymentError
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const leaveWorkspaceMutation = {
|
||||
id: 'leaveWorkspaceMutation' as const,
|
||||
operationName: 'leaveWorkspace',
|
||||
@@ -336,6 +386,23 @@ mutation leaveWorkspace($workspaceId: String!, $workspaceName: String!, $sendLea
|
||||
}`,
|
||||
};
|
||||
|
||||
export const pricesQuery = {
|
||||
id: 'pricesQuery' as const,
|
||||
operationName: 'prices',
|
||||
definitionName: 'prices',
|
||||
containsFile: false,
|
||||
query: `
|
||||
query prices {
|
||||
prices {
|
||||
type
|
||||
plan
|
||||
currency
|
||||
amount
|
||||
yearlyAmount
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const removeAvatarMutation = {
|
||||
id: 'removeAvatarMutation' as const,
|
||||
operationName: 'removeAvatar',
|
||||
@@ -469,6 +536,44 @@ mutation signUp($name: String!, $email: String!, $password: String!) {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const subscriptionQuery = {
|
||||
id: 'subscriptionQuery' as const,
|
||||
operationName: 'subscription',
|
||||
definitionName: 'currentUser',
|
||||
containsFile: false,
|
||||
query: `
|
||||
query subscription {
|
||||
currentUser {
|
||||
subscription {
|
||||
id
|
||||
status
|
||||
plan
|
||||
recurring
|
||||
start
|
||||
end
|
||||
nextBillAt
|
||||
canceledAt
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const updateSubscriptionMutation = {
|
||||
id: 'updateSubscriptionMutation' as const,
|
||||
operationName: 'updateSubscription',
|
||||
definitionName: 'updateSubscriptionRecurring',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation updateSubscription($recurring: SubscriptionRecurring!) {
|
||||
updateSubscriptionRecurring(recurring: $recurring) {
|
||||
id
|
||||
plan
|
||||
recurring
|
||||
nextBillAt
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const uploadAvatarMutation = {
|
||||
id: 'uploadAvatarMutation' as const,
|
||||
operationName: 'uploadAvatar',
|
||||
|
||||
15
packages/frontend/graphql/src/graphql/invoices.gql
Normal file
15
packages/frontend/graphql/src/graphql/invoices.gql
Normal file
@@ -0,0 +1,15 @@
|
||||
query invoices($take: Int!, $skip: Int!) {
|
||||
currentUser {
|
||||
invoices(take: $take, skip: $skip) {
|
||||
id
|
||||
status
|
||||
plan
|
||||
recurring
|
||||
currency
|
||||
amount
|
||||
reason
|
||||
lastPaymentError
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
9
packages/frontend/graphql/src/graphql/prices.gql
Normal file
9
packages/frontend/graphql/src/graphql/prices.gql
Normal file
@@ -0,0 +1,9 @@
|
||||
query prices {
|
||||
prices {
|
||||
type
|
||||
plan
|
||||
currency
|
||||
amount
|
||||
yearlyAmount
|
||||
}
|
||||
}
|
||||
14
packages/frontend/graphql/src/graphql/subscription.gql
Normal file
14
packages/frontend/graphql/src/graphql/subscription.gql
Normal file
@@ -0,0 +1,14 @@
|
||||
query subscription {
|
||||
currentUser {
|
||||
subscription {
|
||||
id
|
||||
status
|
||||
plan
|
||||
recurring
|
||||
start
|
||||
end
|
||||
nextBillAt
|
||||
canceledAt
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
mutation updateSubscription($recurring: SubscriptionRecurring!) {
|
||||
updateSubscriptionRecurring(recurring: $recurring) {
|
||||
id
|
||||
plan
|
||||
recurring
|
||||
nextBillAt
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,21 @@ export type AllBlobSizesQuery = {
|
||||
collectAllBlobSizes: { __typename?: 'WorkspaceBlobSizes'; size: number };
|
||||
};
|
||||
|
||||
export type CancelSubscriptionMutationVariables = Exact<{
|
||||
[key: string]: never;
|
||||
}>;
|
||||
|
||||
export type CancelSubscriptionMutation = {
|
||||
__typename?: 'Mutation';
|
||||
cancelSubscription: {
|
||||
__typename?: 'UserSubscription';
|
||||
id: string;
|
||||
status: SubscriptionStatus;
|
||||
nextBillAt: string | null;
|
||||
canceledAt: string | null;
|
||||
};
|
||||
};
|
||||
|
||||
export type ChangeEmailMutationVariables = Exact<{
|
||||
token: Scalars['String']['input'];
|
||||
}>;
|
||||
@@ -161,6 +176,12 @@ export type ChangePasswordMutation = {
|
||||
};
|
||||
};
|
||||
|
||||
export type CheckoutMutationVariables = Exact<{
|
||||
recurring: SubscriptionRecurring;
|
||||
}>;
|
||||
|
||||
export type CheckoutMutation = { __typename?: 'Mutation'; checkout: string };
|
||||
|
||||
export type CreateWorkspaceMutationVariables = Exact<{
|
||||
init: Scalars['Upload']['input'];
|
||||
}>;
|
||||
@@ -328,6 +349,30 @@ export type GetWorkspacesQuery = {
|
||||
workspaces: Array<{ __typename?: 'WorkspaceType'; id: string }>;
|
||||
};
|
||||
|
||||
export type InvoicesQueryVariables = Exact<{
|
||||
take: Scalars['Int']['input'];
|
||||
skip: Scalars['Int']['input'];
|
||||
}>;
|
||||
|
||||
export type InvoicesQuery = {
|
||||
__typename?: 'Query';
|
||||
currentUser: {
|
||||
__typename?: 'UserType';
|
||||
invoices: Array<{
|
||||
__typename?: 'UserInvoice';
|
||||
id: string;
|
||||
status: InvoiceStatus;
|
||||
plan: SubscriptionPlan;
|
||||
recurring: SubscriptionRecurring;
|
||||
currency: string;
|
||||
amount: number;
|
||||
reason: string;
|
||||
lastPaymentError: string | null;
|
||||
createdAt: string;
|
||||
}>;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type LeaveWorkspaceMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
workspaceName: Scalars['String']['input'];
|
||||
@@ -339,6 +384,20 @@ export type LeaveWorkspaceMutation = {
|
||||
leaveWorkspace: boolean;
|
||||
};
|
||||
|
||||
export type PricesQueryVariables = Exact<{ [key: string]: never }>;
|
||||
|
||||
export type PricesQuery = {
|
||||
__typename?: 'Query';
|
||||
prices: Array<{
|
||||
__typename?: 'SubscriptionPrice';
|
||||
type: string;
|
||||
plan: SubscriptionPlan;
|
||||
currency: string;
|
||||
amount: number;
|
||||
yearlyAmount: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type RemoveAvatarMutationVariables = Exact<{ [key: string]: never }>;
|
||||
|
||||
export type RemoveAvatarMutation = {
|
||||
@@ -451,6 +510,41 @@ export type SignUpMutation = {
|
||||
};
|
||||
};
|
||||
|
||||
export type SubscriptionQueryVariables = Exact<{ [key: string]: never }>;
|
||||
|
||||
export type SubscriptionQuery = {
|
||||
__typename?: 'Query';
|
||||
currentUser: {
|
||||
__typename?: 'UserType';
|
||||
subscription: {
|
||||
__typename?: 'UserSubscription';
|
||||
id: string;
|
||||
status: SubscriptionStatus;
|
||||
plan: SubscriptionPlan;
|
||||
recurring: SubscriptionRecurring;
|
||||
start: string;
|
||||
end: string;
|
||||
nextBillAt: string | null;
|
||||
canceledAt: string | null;
|
||||
} | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type UpdateSubscriptionMutationVariables = Exact<{
|
||||
recurring: SubscriptionRecurring;
|
||||
}>;
|
||||
|
||||
export type UpdateSubscriptionMutation = {
|
||||
__typename?: 'Mutation';
|
||||
updateSubscriptionRecurring: {
|
||||
__typename?: 'UserSubscription';
|
||||
id: string;
|
||||
plan: SubscriptionPlan;
|
||||
recurring: SubscriptionRecurring;
|
||||
nextBillAt: string | null;
|
||||
};
|
||||
};
|
||||
|
||||
export type UploadAvatarMutationVariables = Exact<{
|
||||
avatar: Scalars['Upload']['input'];
|
||||
}>;
|
||||
@@ -570,6 +664,21 @@ export type Queries =
|
||||
name: 'getWorkspacesQuery';
|
||||
variables: GetWorkspacesQueryVariables;
|
||||
response: GetWorkspacesQuery;
|
||||
}
|
||||
| {
|
||||
name: 'invoicesQuery';
|
||||
variables: InvoicesQueryVariables;
|
||||
response: InvoicesQuery;
|
||||
}
|
||||
| {
|
||||
name: 'pricesQuery';
|
||||
variables: PricesQueryVariables;
|
||||
response: PricesQuery;
|
||||
}
|
||||
| {
|
||||
name: 'subscriptionQuery';
|
||||
variables: SubscriptionQueryVariables;
|
||||
response: SubscriptionQuery;
|
||||
};
|
||||
|
||||
export type Mutations =
|
||||
@@ -583,6 +692,11 @@ export type Mutations =
|
||||
variables: SetBlobMutationVariables;
|
||||
response: SetBlobMutation;
|
||||
}
|
||||
| {
|
||||
name: 'cancelSubscriptionMutation';
|
||||
variables: CancelSubscriptionMutationVariables;
|
||||
response: CancelSubscriptionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'changeEmailMutation';
|
||||
variables: ChangeEmailMutationVariables;
|
||||
@@ -593,6 +707,11 @@ export type Mutations =
|
||||
variables: ChangePasswordMutationVariables;
|
||||
response: ChangePasswordMutation;
|
||||
}
|
||||
| {
|
||||
name: 'checkoutMutation';
|
||||
variables: CheckoutMutationVariables;
|
||||
response: CheckoutMutation;
|
||||
}
|
||||
| {
|
||||
name: 'createWorkspaceMutation';
|
||||
variables: CreateWorkspaceMutationVariables;
|
||||
@@ -668,6 +787,11 @@ export type Mutations =
|
||||
variables: SignUpMutationVariables;
|
||||
response: SignUpMutation;
|
||||
}
|
||||
| {
|
||||
name: 'updateSubscriptionMutation';
|
||||
variables: UpdateSubscriptionMutationVariables;
|
||||
response: UpdateSubscriptionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'uploadAvatarMutation';
|
||||
variables: UploadAvatarMutationVariables;
|
||||
|
||||
Reference in New Issue
Block a user