diff --git a/app/composables/graphql/generated.ts b/app/composables/graphql/generated.ts index dec2654..8b1bd3b 100644 --- a/app/composables/graphql/generated.ts +++ b/app/composables/graphql/generated.ts @@ -282,6 +282,7 @@ export type Mutation = { createMyDeliveryAddress: DeliveryAddress; createReferral: ReferralLink; deleteMyDeliveryAddress: Scalars['Boolean']['output']; + deleteMyMessengerConnection: Scalars['Boolean']['output']; managerSetOrderOffer: Order; managerSetOrderStatus: Order; registerSelf: RegistrationRequest; @@ -352,6 +353,11 @@ export type MutationDeleteMyDeliveryAddressArgs = { }; +export type MutationDeleteMyMessengerConnectionArgs = { + connectionId: Scalars['ID']['input']; +}; + + export type MutationManagerSetOrderOfferArgs = { input: SetOrderOfferInput; }; @@ -1043,6 +1049,13 @@ export type DeleteMyDeliveryAddressMutationVariables = Exact<{ export type DeleteMyDeliveryAddressMutation = { __typename?: 'Mutation', deleteMyDeliveryAddress: boolean }; +export type DeleteMyMessengerConnectionMutationVariables = Exact<{ + connectionId: Scalars['ID']['input']; +}>; + + +export type DeleteMyMessengerConnectionMutation = { __typename?: 'Mutation', deleteMyMessengerConnection: boolean }; + export type MyCounterpartyProfileQueryVariables = Exact<{ [key: string]: never; }>; @@ -2650,6 +2663,33 @@ export function useDeleteMyDeliveryAddressMutation(options: VueApolloComposable. return VueApolloComposable.useMutation(DeleteMyDeliveryAddressDocument, options); } export type DeleteMyDeliveryAddressMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn; +export const DeleteMyMessengerConnectionDocument = gql` + mutation DeleteMyMessengerConnection($connectionId: ID!) { + deleteMyMessengerConnection(connectionId: $connectionId) +} + `; + +/** + * __useDeleteMyMessengerConnectionMutation__ + * + * To run a mutation, you first call `useDeleteMyMessengerConnectionMutation` within a Vue component and pass it any options that fit your needs. + * When your component renders, `useDeleteMyMessengerConnectionMutation` returns an object that includes: + * - A mutate function that you can call at any time to execute the mutation + * - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return + * + * @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options; + * + * @example + * const { mutate, loading, error, onDone } = useDeleteMyMessengerConnectionMutation({ + * variables: { + * connectionId: // value for 'connectionId' + * }, + * }); + */ +export function useDeleteMyMessengerConnectionMutation(options: VueApolloComposable.UseMutationOptions | ReactiveFunction> = {}) { + return VueApolloComposable.useMutation(DeleteMyMessengerConnectionDocument, options); +} +export type DeleteMyMessengerConnectionMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn; export const MyCounterpartyProfileDocument = gql` query MyCounterpartyProfile { myCounterpartyProfile { diff --git a/app/composables/useMessengerStart.ts b/app/composables/useMessengerStart.ts index f40b1b4..e85103b 100644 --- a/app/composables/useMessengerStart.ts +++ b/app/composables/useMessengerStart.ts @@ -18,6 +18,7 @@ type MessengerStartInput = { export function useMessengerStart() { const pendingChannel = ref(null); + const maxMiniApp = useMaxMiniApp(); async function openMessengerBot({ channel, baseUrl, email, redirectPath }: MessengerStartInput) { pendingChannel.value = channel; @@ -38,7 +39,17 @@ export function useMessengerStart() { const startUrl = buildMessengerBotStartUrl(baseUrl, payload.startToken); if (import.meta.client) { - window.open(startUrl, '_blank', 'noopener,noreferrer'); + if ( + channel === 'MAX' + && maxMiniApp.isAvailable.value + && startUrl.startsWith('https://max.ru/') + && typeof maxMiniApp.webApp.value?.openMaxLink === 'function' + ) { + maxMiniApp.webApp.value.openMaxLink(startUrl); + } + else { + window.open(startUrl, '_blank', 'noopener,noreferrer'); + } } return payload; diff --git a/app/pages/profile/notifications.vue b/app/pages/profile/notifications.vue index b9159c1..92a6ce1 100644 --- a/app/pages/profile/notifications.vue +++ b/app/pages/profile/notifications.vue @@ -1,6 +1,7 @@ diff --git a/app/pages/profile/notifications/success.vue b/app/pages/profile/notifications/success.vue index 522bc57..f971be5 100644 --- a/app/pages/profile/notifications/success.vue +++ b/app/pages/profile/notifications/success.vue @@ -48,12 +48,12 @@ const successConnection = computed(() => const profileName = computed(() => meQuery.result.value?.me?.fullName?.trim() || meQuery.result.value?.me?.email || 'Пользователь'); const successTitle = computed(() => - connectedChannel.value === 'telegram' ? 'Telegram успешно подключен' : 'Канал успешно подключен', + connectedChannel.value === 'telegram' ? 'Telegram успешно подключен' : 'MAX успешно подключен', ); const successText = computed(() => connectedChannel.value === 'telegram' ? 'Теперь этот Telegram привязан к вашему личному кабинету. Все важные уведомления и статусы заказов будут приходить сюда.' - : 'Канал успешно привязан к вашему личному кабинету.', + : 'Теперь этот MAX привязан к вашему личному кабинету. Все важные уведомления и статусы заказов будут приходить сюда.', ); const successAvatarSrc = computed(() => messengerConnectionAvatarSrc(successConnection.value)); const successAvatarInitials = computed(() => diff --git a/graphql/operations/profile/delete-my-messenger-connection.graphql b/graphql/operations/profile/delete-my-messenger-connection.graphql new file mode 100644 index 0000000..1cf3cfd --- /dev/null +++ b/graphql/operations/profile/delete-my-messenger-connection.graphql @@ -0,0 +1,3 @@ +mutation DeleteMyMessengerConnection($connectionId: ID!) { + deleteMyMessengerConnection(connectionId: $connectionId) +} diff --git a/graphql/schema.graphql b/graphql/schema.graphql index db87ebd..767f2f9 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -523,6 +523,7 @@ type Mutation { createInvitation(input: CreateInvitationInput!): Invitation! acceptInvitation(input: AcceptInvitationInput!): User! connectMessenger(input: ConnectMessengerInput!): MessengerConnection! + deleteMyMessengerConnection(connectionId: ID!): Boolean! upsertMyCounterpartyProfile(input: UpsertMyCounterpartyProfileInput!): CounterpartyProfile! addProductToCart(productId: ID!): Cart! updateCartItemQuantity(input: UpdateCartItemQuantityInput!): Cart!