diff --git a/apps/web/actions/api/server/subscriptions.ts b/apps/web/actions/api/server/subscriptions.ts new file mode 100644 index 0000000..1c32aa9 --- /dev/null +++ b/apps/web/actions/api/server/subscriptions.ts @@ -0,0 +1,71 @@ +'use server'; + +import { useService } from '../lib/service'; +import { wrapServerAction } from '@/utils/actions'; +import { SubscriptionsService } from '@repo/graphql/api/subscriptions'; + +const getService = useService(SubscriptionsService); + +export async function createSubscription( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.createSubscription(...variables)); +} + +export async function createSubscriptionHistory( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.createSubscriptionHistory(...variables)); +} + +export async function getSubscription( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.getSubscription(...variables)); +} + +export async function getSubscriptionHistory( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.getSubscriptionHistory(...variables)); +} + +export async function getSubscriptionPrices( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.getSubscriptionPrices(...variables)); +} + +export async function getSubscriptionSettings( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.getSubscriptionSettings(...variables)); +} + +export async function updateSubscription( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.updateSubscription(...variables)); +} + +export async function updateSubscriptionHistory( + ...variables: Parameters +) { + const service = await getService(); + + return wrapServerAction(() => service.updateSubscriptionHistory(...variables)); +} diff --git a/apps/web/actions/api/subscriptions.ts b/apps/web/actions/api/subscriptions.ts new file mode 100644 index 0000000..c30a2cd --- /dev/null +++ b/apps/web/actions/api/subscriptions.ts @@ -0,0 +1,11 @@ +import * as subscriptions from './server/subscriptions'; +import { wrapClientAction } from '@/utils/actions'; + +export const getSubscription = wrapClientAction(subscriptions.getSubscription); +export const getSubscriptionSettings = wrapClientAction(subscriptions.getSubscriptionSettings); +export const getSubscriptionPrices = wrapClientAction(subscriptions.getSubscriptionPrices); +export const getSubscriptionHistory = wrapClientAction(subscriptions.getSubscriptionHistory); +export const createSubscription = wrapClientAction(subscriptions.createSubscription); +export const updateSubscription = wrapClientAction(subscriptions.updateSubscription); +export const createSubscriptionHistory = wrapClientAction(subscriptions.createSubscriptionHistory); +export const updateSubscriptionHistory = wrapClientAction(subscriptions.updateSubscriptionHistory); diff --git a/apps/web/app/(main)/profile/page.tsx b/apps/web/app/(main)/profile/page.tsx index 83d9f02..a03039b 100644 --- a/apps/web/app/(main)/profile/page.tsx +++ b/apps/web/app/(main)/profile/page.tsx @@ -1,12 +1,11 @@ import { getCustomer } from '@/actions/api/customers'; import { getSessionUser } from '@/actions/session'; import { Container } from '@/components/layout'; -import { LinksCard, PersonCard, ProfileDataCard } from '@/components/profile'; +import { LinksCard, PersonCard, ProfileDataCard, SubscriptionInfoBar } from '@/components/profile'; import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'; export default async function ProfilePage() { const queryClient = new QueryClient(); - const { telegramId } = await getSessionUser(); await queryClient.prefetchQuery({ @@ -18,6 +17,7 @@ export default async function ProfilePage() { + diff --git a/apps/web/components/profile/index.ts b/apps/web/components/profile/index.ts index f65ac5c..0727ebf 100644 --- a/apps/web/components/profile/index.ts +++ b/apps/web/components/profile/index.ts @@ -2,3 +2,4 @@ export * from './data-card'; export * from './links-card'; export * from './orders-list'; export * from './person-card'; +export * from './subscription-bar'; diff --git a/apps/web/components/profile/subscription-bar.tsx b/apps/web/components/profile/subscription-bar.tsx new file mode 100644 index 0000000..8546dcb --- /dev/null +++ b/apps/web/components/profile/subscription-bar.tsx @@ -0,0 +1,47 @@ +'use client'; + +import { useSubscriptionQuery } from '@/hooks/api/subscriptions'; +import { getRemainingDays } from '@repo/utils/datetime-format'; +import { ChevronRight } from 'lucide-react'; +import Link from 'next/link'; + +export function SubscriptionInfoBar() { + const { data, error, isLoading } = useSubscriptionQuery(); + + const isActive = data?.subscription?.isActive; + const remainingOrdersCount = data?.remainingOrdersCount; + const maxOrdersPerMonth = data?.maxOrdersPerMonth; + const expiresAt = data?.subscription?.expiresAt; + + if (error) return null; + + const title = isActive ? 'Подписка Pro активна' : 'Подписка неактивна'; + + let description = 'Попробуйте бесплатно'; + + if (isActive && expiresAt) { + description = `Осталось ${getRemainingDays(expiresAt)} дней`; + } + + if (!isLoading && remainingOrdersCount && maxOrdersPerMonth) { + description = `Осталось ${remainingOrdersCount} из ${maxOrdersPerMonth} записей в этом месяце`; + } + + return ( + +
+
+
+
+

{title}

+ {description} +
+ +
+
+
+ + ); +} diff --git a/apps/web/hooks/api/subscriptions.ts b/apps/web/hooks/api/subscriptions.ts new file mode 100644 index 0000000..a17bd50 --- /dev/null +++ b/apps/web/hooks/api/subscriptions.ts @@ -0,0 +1,128 @@ +/* eslint-disable sonarjs/no-identical-functions */ +'use client'; + +import { + createSubscription, + createSubscriptionHistory, + getSubscription, + getSubscriptionHistory, + getSubscriptionPrices, + getSubscriptionSettings, + updateSubscription, + updateSubscriptionHistory, +} from '@/actions/api/subscriptions'; +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; +import { useSession } from 'next-auth/react'; + +export const useSubscriptionQuery = (variables?: Parameters[0]) => { + const { data: session } = useSession(); + const telegramId = variables?.telegramId || session?.user?.telegramId; + + return useQuery({ + enabled: Boolean(telegramId), + queryFn: () => getSubscription({ telegramId }), + queryKey: ['subscription', telegramId], + }); +}; + +export const useSubscriptionSettingQuery = () => { + return useQuery({ + queryFn: getSubscriptionSettings, + queryKey: ['subscriptionSetting'], + }); +}; + +export const useSubscriptionPricesQuery = ( + variables?: Parameters[0], +) => { + return useQuery({ + queryFn: () => getSubscriptionPrices(variables), + queryKey: ['subscriptionPrices', variables], + }); +}; + +export const useSubscriptionHistoryQuery = ( + variables: Parameters[0], +) => { + return useQuery({ + enabled: Boolean(variables.subscriptionId), + queryFn: () => getSubscriptionHistory(variables), + queryKey: ['subscriptionHistory', variables.subscriptionId], + }); +}; + +export const useSubscriptionMutation = () => { + const { data: session } = useSession(); + const telegramId = session?.user?.telegramId; + const queryClient = useQueryClient(); + + const handleOnSuccess = () => { + if (!telegramId) return; + + queryClient.invalidateQueries({ + queryKey: ['subscription', telegramId], + }); + }; + + return useMutation({ + mutationFn: updateSubscription, + onSuccess: handleOnSuccess, + }); +}; + +export const useSubscriptionCreate = () => { + const { data: session } = useSession(); + const telegramId = session?.user?.telegramId; + const queryClient = useQueryClient(); + + const handleOnSuccess = () => { + if (!telegramId) return; + + queryClient.refetchQueries({ + queryKey: ['subscription', telegramId], + }); + }; + + return useMutation({ + mutationFn: createSubscription, + onSuccess: handleOnSuccess, + }); +}; + +export const useSubscriptionHistoryMutation = () => { + const { data: session } = useSession(); + const telegramId = session?.user?.telegramId; + const queryClient = useQueryClient(); + + const handleOnSuccess = () => { + if (!telegramId) return; + + queryClient.invalidateQueries({ + queryKey: ['subscription', telegramId], + }); + }; + + return useMutation({ + mutationFn: updateSubscriptionHistory, + onSuccess: handleOnSuccess, + }); +}; + +export const useSubscriptionHistoryCreate = () => { + const { data: session } = useSession(); + const telegramId = session?.user?.telegramId; + const queryClient = useQueryClient(); + + const handleOnSuccess = () => { + if (!telegramId) return; + + queryClient.refetchQueries({ + queryKey: ['subscription', telegramId], + }); + }; + + return useMutation({ + mutationFn: createSubscriptionHistory, + onSuccess: handleOnSuccess, + }); +}; diff --git a/packages/graphql/api/subscriptions.ts b/packages/graphql/api/subscriptions.ts new file mode 100644 index 0000000..1031a22 --- /dev/null +++ b/packages/graphql/api/subscriptions.ts @@ -0,0 +1,164 @@ +import { getClientWithToken } from '../apollo/client'; +import * as GQL from '../types'; +import { BaseService } from './base'; +import { OrdersService } from './orders'; +import { type VariablesOf } from '@graphql-typed-document-node/core'; +import dayjs from 'dayjs'; + +export class SubscriptionsService extends BaseService { + async createSubscription(variables: VariablesOf) { + await this.checkIsBanned(); + + const { mutate } = await getClientWithToken(); + + const mutationResult = await mutate({ + mutation: GQL.CreateSubscriptionDocument, + variables, + }); + + const error = mutationResult.errors?.at(0); + if (error) throw new Error(error.message); + + return mutationResult.data; + } + + async createSubscriptionHistory( + variables: VariablesOf, + ) { + await this.checkIsBanned(); + + const { mutate } = await getClientWithToken(); + + const mutationResult = await mutate({ + mutation: GQL.CreateSubscriptionHistoryDocument, + variables, + }); + + const error = mutationResult.errors?.at(0); + if (error) throw new Error(error.message); + + return mutationResult.data; + } + + async getSubscription(variables: VariablesOf) { + await this.checkIsBanned(); + + const { query } = await getClientWithToken(); + + const result = await query({ + query: GQL.GetSubscriptionDocument, + variables, + }); + + const subscription = result.data.subscriptions.at(0); + + const { maxOrdersPerMonth, remainingOrdersCount } = await this.getRemainingOrdersCount(); + + return { maxOrdersPerMonth, remainingOrdersCount, subscription }; + } + + async getSubscriptionHistory(variables: VariablesOf) { + await this.checkIsBanned(); + + const { query } = await getClientWithToken(); + + const result = await query({ + query: GQL.GetSubscriptionHistoryDocument, + variables, + }); + + const subscriptionHistories = result.data.subscriptionHistories; + + return { subscriptionHistories }; + } + + async getSubscriptionPrices(variables?: VariablesOf) { + await this.checkIsBanned(); + + const { query } = await getClientWithToken(); + + const result = await query({ + query: GQL.GetSubscriptionPricesDocument, + variables, + }); + + return result.data; + } + + async getSubscriptionSettings() { + await this.checkIsBanned(); + + const { query } = await getClientWithToken(); + + const result = await query({ + query: GQL.GetSubscriptionSettingsDocument, + }); + + return result.data; + } + + async updateSubscription(variables: VariablesOf) { + await this.checkIsBanned(); + + const { mutate } = await getClientWithToken(); + + const mutationResult = await mutate({ + mutation: GQL.UpdateSubscriptionDocument, + variables, + }); + + const error = mutationResult.errors?.at(0); + if (error) throw new Error(error.message); + + return mutationResult.data; + } + + async updateSubscriptionHistory( + variables: VariablesOf, + ) { + await this.checkIsBanned(); + + const { mutate } = await getClientWithToken(); + + const mutationResult = await mutate({ + mutation: GQL.UpdateSubscriptionHistoryDocument, + variables, + }); + + const error = mutationResult.errors?.at(0); + if (error) throw new Error(error.message); + + return mutationResult.data; + } + + private async getRemainingOrdersCount() { + const ordersService = new OrdersService(this._user); + + const now = dayjs(); + + const { orders } = await ordersService.getOrders({ + filters: { + datetime_end: { + lte: now.endOf('month').toISOString(), + }, + datetime_start: { + gte: now.startOf('month').toISOString(), + }, + + state: { + eq: GQL.Enum_Order_State.Completed, + }, + }, + }); + + const { subscriptionSetting } = await this.getSubscriptionSettings(); + + if (!subscriptionSetting) throw new Error('Subscription setting not found'); + + const { maxOrdersPerMonth } = subscriptionSetting; + + const remainingOrdersCount = maxOrdersPerMonth - (orders?.length ?? 0); + + return { maxOrdersPerMonth, remainingOrdersCount }; + } +} diff --git a/packages/graphql/operations/subscriptions.graphql b/packages/graphql/operations/subscriptions.graphql new file mode 100644 index 0000000..97ab23a --- /dev/null +++ b/packages/graphql/operations/subscriptions.graphql @@ -0,0 +1,95 @@ +fragment SubscriptionFields on Subscription { + documentId + isActive + expiresAt + autoRenew + customer { + ...CustomerFields + } + subscriptionHistories { + ...SubscriptionHistoryFields + } +} + +fragment SubscriptionHistoryFields on SubscriptionHistory { + documentId + period + startDate + endDate + amount + currency + state + paymentId + source + description +} + +fragment SubscriptionSettingFields on SubscriptionSetting { + documentId + maxOrdersPerMonth + referralRewardDays + referralBonusDays + description + trialPeriodDays + trialEnabled +} + +fragment SubscriptionPriceFields on SubscriptionPrice { + documentId + period + price + currency + isActive + description +} + +query GetSubscription($telegramId: Long) { + subscriptions(filters: { customer: { telegramId: { eq: $telegramId } } }) { + ...SubscriptionFields + } +} + +query getSubscriptionSettings { + subscriptionSetting { + ...SubscriptionSettingFields + } +} + +query GetSubscriptionPrices($isActive: Boolean) { + subscriptionPrices(filters: { isActive: { eq: $isActive } }, sort: "price:asc") { + ...SubscriptionPriceFields + } +} + +query GetSubscriptionHistory($subscriptionId: ID!) { + subscriptionHistories( + filters: { subscription: { documentId: { eq: $subscriptionId } } } + sort: "startDate:desc" + ) { + ...SubscriptionHistoryFields + } +} + +mutation CreateSubscription($input: SubscriptionInput!) { + createSubscription(data: $input) { + ...SubscriptionFields + } +} + +mutation UpdateSubscription($documentId: ID!, $data: SubscriptionInput!) { + updateSubscription(documentId: $documentId, data: $data) { + ...SubscriptionFields + } +} + +mutation CreateSubscriptionHistory($input: SubscriptionHistoryInput!) { + createSubscriptionHistory(data: $input) { + ...SubscriptionHistoryFields + } +} + +mutation UpdateSubscriptionHistory($documentId: ID!, $data: SubscriptionHistoryInput!) { + updateSubscriptionHistory(documentId: $documentId, data: $data) { + ...SubscriptionHistoryFields + } +} diff --git a/packages/graphql/types/operations.generated.ts b/packages/graphql/types/operations.generated.ts index 2c16615..2591981 100644 --- a/packages/graphql/types/operations.generated.ts +++ b/packages/graphql/types/operations.generated.ts @@ -93,6 +93,7 @@ export type CustomerFiltersInput = { role?: InputMaybe; services?: InputMaybe; slots?: InputMaybe; + subscription?: InputMaybe; telegramId?: InputMaybe; updatedAt?: InputMaybe; }; @@ -111,6 +112,7 @@ export type CustomerInput = { role?: InputMaybe; services?: InputMaybe>>; slots?: InputMaybe>>; + subscription?: InputMaybe; telegramId?: InputMaybe; }; @@ -165,6 +167,35 @@ export enum Enum_Slot_State { Reserved = 'reserved' } +export enum Enum_Subscriptionhistory_Period { + HalfYear = 'half_year', + Month = 'month', + Trial = 'trial', + Week = 'week', + Year = 'year' +} + +export enum Enum_Subscriptionhistory_Source { + Admin = 'admin', + Payment = 'payment', + Promo = 'promo', + Referral = 'referral' +} + +export enum Enum_Subscriptionhistory_State { + Failed = 'failed', + Pending = 'pending', + Success = 'success' +} + +export enum Enum_Subscriptionprice_Period { + HalfYear = 'half_year', + Month = 'month', + Trial = 'trial', + Week = 'week', + Year = 'year' +} + export type FileInfoInput = { alternativeText?: InputMaybe; caption?: InputMaybe; @@ -485,6 +516,98 @@ export type StringFilterInput = { startsWith?: InputMaybe; }; +export type SubscriptionFiltersInput = { + and?: InputMaybe>>; + autoRenew?: InputMaybe; + createdAt?: InputMaybe; + customer?: InputMaybe; + documentId?: InputMaybe; + expiresAt?: InputMaybe; + isActive?: InputMaybe; + not?: InputMaybe; + or?: InputMaybe>>; + publishedAt?: InputMaybe; + subscriptionHistories?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type SubscriptionHistoryFiltersInput = { + amount?: InputMaybe; + and?: InputMaybe>>; + createdAt?: InputMaybe; + currency?: InputMaybe; + description?: InputMaybe; + documentId?: InputMaybe; + endDate?: InputMaybe; + not?: InputMaybe; + or?: InputMaybe>>; + paymentId?: InputMaybe; + period?: InputMaybe; + publishedAt?: InputMaybe; + source?: InputMaybe; + startDate?: InputMaybe; + state?: InputMaybe; + subscription?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type SubscriptionHistoryInput = { + amount?: InputMaybe; + currency?: InputMaybe; + description?: InputMaybe; + endDate?: InputMaybe; + paymentId?: InputMaybe; + period?: InputMaybe; + publishedAt?: InputMaybe; + source?: InputMaybe; + startDate?: InputMaybe; + state?: InputMaybe; + subscription?: InputMaybe; +}; + +export type SubscriptionInput = { + autoRenew?: InputMaybe; + customer?: InputMaybe; + expiresAt?: InputMaybe; + isActive?: InputMaybe; + publishedAt?: InputMaybe; + subscriptionHistories?: InputMaybe>>; +}; + +export type SubscriptionPriceFiltersInput = { + and?: InputMaybe>>; + createdAt?: InputMaybe; + currency?: InputMaybe; + description?: InputMaybe; + documentId?: InputMaybe; + isActive?: InputMaybe; + not?: InputMaybe; + or?: InputMaybe>>; + period?: InputMaybe; + price?: InputMaybe; + publishedAt?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type SubscriptionPriceInput = { + currency?: InputMaybe; + description?: InputMaybe; + isActive?: InputMaybe; + period?: InputMaybe; + price?: InputMaybe; + publishedAt?: InputMaybe; +}; + +export type SubscriptionSettingInput = { + description?: InputMaybe; + maxOrdersPerMonth?: InputMaybe; + publishedAt?: InputMaybe; + referralBonusDays?: InputMaybe; + referralRewardDays?: InputMaybe; + trialEnabled?: InputMaybe; + trialPeriodDays?: InputMaybe; +}; + export type TimeFilterInput = { and?: InputMaybe>>; between?: InputMaybe>>; @@ -780,10 +903,78 @@ export type DeleteSlotMutationVariables = Exact<{ export type DeleteSlotMutation = { __typename?: 'Mutation', deleteSlot?: { __typename?: 'DeleteMutationResponse', documentId: string } | null | undefined }; +export type SubscriptionFieldsFragment = { __typename?: 'Subscription', documentId: string, isActive: boolean, expiresAt?: string | null | undefined, autoRenew: boolean, customer?: { __typename?: 'Customer', active?: boolean | null | undefined, bannedUntil?: string | null | undefined, documentId: string, name: string, phone: string, photoUrl?: string | null | undefined, role: Enum_Customer_Role, telegramId?: number | null | undefined } | null | undefined, subscriptionHistories: Array<{ __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined> }; + +export type SubscriptionHistoryFieldsFragment = { __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined }; + +export type SubscriptionSettingFieldsFragment = { __typename?: 'SubscriptionSetting', documentId: string, maxOrdersPerMonth: number, referralRewardDays: number, referralBonusDays: number, description?: string | null | undefined, trialPeriodDays: number, trialEnabled: boolean }; + +export type SubscriptionPriceFieldsFragment = { __typename?: 'SubscriptionPrice', documentId: string, period: Enum_Subscriptionprice_Period, price: number, currency?: string | null | undefined, isActive?: boolean | null | undefined, description?: string | null | undefined }; + +export type GetSubscriptionQueryVariables = Exact<{ + telegramId?: InputMaybe; +}>; + + +export type GetSubscriptionQuery = { __typename?: 'Query', subscriptions: Array<{ __typename?: 'Subscription', documentId: string, isActive: boolean, expiresAt?: string | null | undefined, autoRenew: boolean, customer?: { __typename?: 'Customer', active?: boolean | null | undefined, bannedUntil?: string | null | undefined, documentId: string, name: string, phone: string, photoUrl?: string | null | undefined, role: Enum_Customer_Role, telegramId?: number | null | undefined } | null | undefined, subscriptionHistories: Array<{ __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined> } | null | undefined> }; + +export type GetSubscriptionSettingsQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetSubscriptionSettingsQuery = { __typename?: 'Query', subscriptionSetting?: { __typename?: 'SubscriptionSetting', documentId: string, maxOrdersPerMonth: number, referralRewardDays: number, referralBonusDays: number, description?: string | null | undefined, trialPeriodDays: number, trialEnabled: boolean } | null | undefined }; + +export type GetSubscriptionPricesQueryVariables = Exact<{ + isActive?: InputMaybe; +}>; + + +export type GetSubscriptionPricesQuery = { __typename?: 'Query', subscriptionPrices: Array<{ __typename?: 'SubscriptionPrice', documentId: string, period: Enum_Subscriptionprice_Period, price: number, currency?: string | null | undefined, isActive?: boolean | null | undefined, description?: string | null | undefined } | null | undefined> }; + +export type GetSubscriptionHistoryQueryVariables = Exact<{ + subscriptionId: Scalars['ID']['input']; +}>; + + +export type GetSubscriptionHistoryQuery = { __typename?: 'Query', subscriptionHistories: Array<{ __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined> }; + +export type CreateSubscriptionMutationVariables = Exact<{ + input: SubscriptionInput; +}>; + + +export type CreateSubscriptionMutation = { __typename?: 'Mutation', createSubscription?: { __typename?: 'Subscription', documentId: string, isActive: boolean, expiresAt?: string | null | undefined, autoRenew: boolean, customer?: { __typename?: 'Customer', active?: boolean | null | undefined, bannedUntil?: string | null | undefined, documentId: string, name: string, phone: string, photoUrl?: string | null | undefined, role: Enum_Customer_Role, telegramId?: number | null | undefined } | null | undefined, subscriptionHistories: Array<{ __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined> } | null | undefined }; + +export type UpdateSubscriptionMutationVariables = Exact<{ + documentId: Scalars['ID']['input']; + data: SubscriptionInput; +}>; + + +export type UpdateSubscriptionMutation = { __typename?: 'Mutation', updateSubscription?: { __typename?: 'Subscription', documentId: string, isActive: boolean, expiresAt?: string | null | undefined, autoRenew: boolean, customer?: { __typename?: 'Customer', active?: boolean | null | undefined, bannedUntil?: string | null | undefined, documentId: string, name: string, phone: string, photoUrl?: string | null | undefined, role: Enum_Customer_Role, telegramId?: number | null | undefined } | null | undefined, subscriptionHistories: Array<{ __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined> } | null | undefined }; + +export type CreateSubscriptionHistoryMutationVariables = Exact<{ + input: SubscriptionHistoryInput; +}>; + + +export type CreateSubscriptionHistoryMutation = { __typename?: 'Mutation', createSubscriptionHistory?: { __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined }; + +export type UpdateSubscriptionHistoryMutationVariables = Exact<{ + documentId: Scalars['ID']['input']; + data: SubscriptionHistoryInput; +}>; + + +export type UpdateSubscriptionHistoryMutation = { __typename?: 'Mutation', updateSubscriptionHistory?: { __typename?: 'SubscriptionHistory', documentId: string, period: Enum_Subscriptionhistory_Period, startDate: string, endDate: string, amount: number, currency?: string | null | undefined, state: Enum_Subscriptionhistory_State, paymentId?: string | null | undefined, source: Enum_Subscriptionhistory_Source, description?: string | null | undefined } | null | undefined }; + export const CustomerFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}}]} as unknown as DocumentNode; export const ServiceFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"duration"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}}]} as unknown as DocumentNode; export const SlotFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}}]} as unknown as DocumentNode; export const OrderFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"order_number"}},{"kind":"Field","name":{"kind":"Name","value":"services"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ServiceFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"slot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"duration"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}}]} as unknown as DocumentNode; +export const SubscriptionHistoryFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; +export const SubscriptionFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Subscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}},{"kind":"Field","name":{"kind":"Name","value":"autoRenew"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subscriptionHistories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; +export const SubscriptionSettingFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionSettingFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionSetting"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"maxOrdersPerMonth"}},{"kind":"Field","name":{"kind":"Name","value":"referralRewardDays"}},{"kind":"Field","name":{"kind":"Name","value":"referralBonusDays"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"trialPeriodDays"}},{"kind":"Field","name":{"kind":"Name","value":"trialEnabled"}}]}}]} as unknown as DocumentNode; +export const SubscriptionPriceFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionPriceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionPrice"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; export const RegisterDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Register"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"email"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"register"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"username"},"value":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"email"},"value":{"kind":"Variable","name":{"kind":"Name","value":"email"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"jwt"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"username"}}]}}]}}]}}]} as unknown as DocumentNode; export const LoginDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Login"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"identifier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"jwt"}}]}}]}}]} as unknown as DocumentNode; export const CreateCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"telegramId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Long"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"phone"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"name"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"telegramId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"telegramId"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"phone"},"value":{"kind":"Variable","name":{"kind":"Name","value":"phone"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"role"},"value":{"kind":"EnumValue","value":"client"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}}]}}]}}]} as unknown as DocumentNode; @@ -804,4 +995,12 @@ export const GetSlotsDocument = {"kind":"Document","definitions":[{"kind":"Opera export const GetSlotsOrdersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSlotsOrders"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SlotFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"slots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}},{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"datetime_start:asc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}},{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"datetime_start:asc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"duration"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"order_number"}},{"kind":"Field","name":{"kind":"Name","value":"services"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ServiceFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"slot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}}]} as unknown as DocumentNode; export const GetSlotDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSlot"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"slot"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"datetime_start:asc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ServiceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Service"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"duration"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"order_number"}},{"kind":"Field","name":{"kind":"Name","value":"services"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ServiceFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"client"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"slot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}}]} as unknown as DocumentNode; export const UpdateSlotDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSlot"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SlotInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSlot"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SlotFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SlotFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Slot"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_start"}},{"kind":"Field","name":{"kind":"Name","value":"datetime_end"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"master"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}}]}}]} as unknown as DocumentNode; -export const DeleteSlotDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteSlot"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteSlot"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const DeleteSlotDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteSlot"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteSlot"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}}]}}]}}]} as unknown as DocumentNode; +export const GetSubscriptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubscription"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"telegramId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Long"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"customer"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"telegramId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"telegramId"}}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Subscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}},{"kind":"Field","name":{"kind":"Name","value":"autoRenew"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subscriptionHistories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}}]} as unknown as DocumentNode; +export const GetSubscriptionSettingsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getSubscriptionSettings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionSetting"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionSettingFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionSettingFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionSetting"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"maxOrdersPerMonth"}},{"kind":"Field","name":{"kind":"Name","value":"referralRewardDays"}},{"kind":"Field","name":{"kind":"Name","value":"referralBonusDays"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"trialPeriodDays"}},{"kind":"Field","name":{"kind":"Name","value":"trialEnabled"}}]}}]} as unknown as DocumentNode; +export const GetSubscriptionPricesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubscriptionPrices"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"isActive"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionPrices"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"isActive"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"isActive"}}}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"price:asc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionPriceFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionPriceFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionPrice"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; +export const GetSubscriptionHistoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubscriptionHistory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subscriptionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionHistories"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"subscription"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"documentId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"subscriptionId"}}}]}}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"StringValue","value":"startDate:desc","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; +export const CreateSubscriptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateSubscription"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createSubscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Subscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}},{"kind":"Field","name":{"kind":"Name","value":"autoRenew"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subscriptionHistories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}}]} as unknown as DocumentNode; +export const UpdateSubscriptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSubscription"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSubscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"bannedUntil"}},{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"phone"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"telegramId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Subscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}},{"kind":"Field","name":{"kind":"Name","value":"autoRenew"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subscriptionHistories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}}]} as unknown as DocumentNode; +export const CreateSubscriptionHistoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateSubscriptionHistory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistoryInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createSubscriptionHistory"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; +export const UpdateSubscriptionHistoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSubscriptionHistory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistoryInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSubscriptionHistory"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"documentId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"documentId"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SubscriptionHistoryFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SubscriptionHistoryFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriptionHistory"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"documentId"}},{"kind":"Field","name":{"kind":"Name","value":"period"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/packages/ui/src/components/ui/spinner.tsx b/packages/ui/src/components/ui/spinner.tsx index dbb582f..afa250f 100644 --- a/packages/ui/src/components/ui/spinner.tsx +++ b/packages/ui/src/components/ui/spinner.tsx @@ -15,7 +15,7 @@ export function LoadingSpinner({ className, size = 'md', ...props }: LoadingSpin 'h-12 w-12': size === 'lg', })} /> - Loading... + Загрузка... ); } diff --git a/packages/utils/src/datetime-format.ts b/packages/utils/src/datetime-format.ts index 7be0d27..a75b2fa 100644 --- a/packages/utils/src/datetime-format.ts +++ b/packages/utils/src/datetime-format.ts @@ -85,6 +85,10 @@ export function getMinutes(time: string) { return Number.parseInt(hours, 10) * 60 + Number.parseInt(minutes, 10); } +export function getRemainingDays(date: DateTime) { + return dayjs(date).diff(dayjs(), 'day'); +} + export function getTimeZoneLabel(tz: string = DEFAULT_TZ): string { if (tz === DEFAULT_TZ) return 'МСК'; const offset = dayjs().tz(tz).format('Z');