Skip to content

Commit b5ec1e7

Browse files
authored
Merge pull request #1467 from AppQuality/UN-2040
Un 2040
2 parents acc19d8 + 6849c97 commit b5ec1e7

File tree

17 files changed

+501
-201
lines changed

17 files changed

+501
-201
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@analytics/google-tag-manager": "^0.6.0",
77
"@analytics/hubspot": "^0.5.1",
88
"@appquality/languages": "1.4.3",
9-
"@appquality/unguess-design-system": "4.0.50",
9+
"@appquality/unguess-design-system": "4.0.51",
1010
"@atlaskit/pragmatic-drag-and-drop": "^1.7.4",
1111
"@atlaskit/pragmatic-drag-and-drop-flourish": "^2.0.3",
1212
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",

src/common/schema.ts

Lines changed: 164 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export interface paths {
2424
};
2525
"/buy": {
2626
/**
27-
* Stripe webhook destination, listen three event types:
28-
* - charge.failed,
29-
* - checkout.session.completed
30-
* - checkout.session.expired
27+
* Stripe webhook destination, listen following event types:
28+
* - checkout.session.completed (Occurs when a Checkout Session has been successfully completed)
29+
* - checkout.session.expired (Occurs when a Checkout Session is expired)
30+
* - checkout.session.async_payment_failed (Occurs when a payment intent using a delayed payment method fails)
31+
* - checkout.session.async_payment_succeeded (Occurs when a payment intent using a delayed payment method finally succeeds)
32+
* - charge.refunded (Occurs whenever a charge is refunded, including partial refunds. Listen to refund.created for information about the refund)
3133
*/
3234
post: operations["post-buy"];
3335
};
@@ -475,6 +477,10 @@ export interface paths {
475477
};
476478
};
477479
};
480+
"/users/me/watched/plans": {
481+
get: operations["get-users-me-watched-plans"];
482+
parameters: {};
483+
};
478484
"/users/roles": {
479485
get: operations["get-users-roles"];
480486
parameters: {};
@@ -622,6 +628,17 @@ export interface paths {
622628
};
623629
};
624630
};
631+
"/plans/{pid}/watchers": {
632+
/** Returns all the watcher added to a plan. It always returns at least one item. */
633+
get: operations["get-plans-pid-watchers"];
634+
put: operations["put-plans-pid-watchers"];
635+
post: operations["post-plans-pid-watchers"];
636+
parameters: {
637+
path: {
638+
pid: string;
639+
};
640+
};
641+
};
625642
"/workspaces/{wid}/templates": {
626643
get: operations["get-workspaces-templates"];
627644
post: operations["post-workspaces-wid-templates"];
@@ -656,6 +673,15 @@ export interface paths {
656673
};
657674
};
658675
};
676+
"/plans/{pid}/watchers/{profile_id}": {
677+
delete: operations["delete-plans-pid-watchers-profile_id"];
678+
parameters: {
679+
path: {
680+
pid: string;
681+
profile_id: string;
682+
};
683+
};
684+
};
659685
}
660686

661687
export interface components {
@@ -1332,8 +1358,7 @@ export interface components {
13321358
kind: "app";
13331359
os: {
13341360
ios?: string;
1335-
linux?: string;
1336-
windows?: string;
1361+
android?: string;
13371362
};
13381363
};
13391364
/** OutputModuleTouchpointsWebDesktop */
@@ -1442,7 +1467,8 @@ export interface components {
14421467
| "module_type"
14431468
| "number_of_testers"
14441469
| "number_of_tasks"
1445-
| "task_type";
1470+
| "task_type"
1471+
| "duplicate_touchpoint_form_factors";
14461472
/** Report */
14471473
Report: {
14481474
creation_date?: string;
@@ -1999,10 +2025,12 @@ export interface operations {
19992025
requestBody: components["requestBodies"]["Credentials"];
20002026
};
20012027
/**
2002-
* Stripe webhook destination, listen three event types:
2003-
* - charge.failed,
2004-
* - checkout.session.completed
2005-
* - checkout.session.expired
2028+
* Stripe webhook destination, listen following event types:
2029+
* - checkout.session.completed (Occurs when a Checkout Session has been successfully completed)
2030+
* - checkout.session.expired (Occurs when a Checkout Session is expired)
2031+
* - checkout.session.async_payment_failed (Occurs when a payment intent using a delayed payment method fails)
2032+
* - checkout.session.async_payment_succeeded (Occurs when a payment intent using a delayed payment method finally succeeds)
2033+
* - charge.refunded (Occurs whenever a charge is refunded, including partial refunds. Listen to refund.created for information about the refund)
20062034
*/
20072035
"post-buy": {
20082036
responses: {
@@ -2027,13 +2055,17 @@ export interface operations {
20272055
key: string;
20282056
tag: string;
20292057
};
2058+
/** @enum {string} */
2059+
payment_status?: "paid" | "unpaid";
20302060
};
20312061
};
20322062
/** @enum {undefined} */
20332063
type:
2034-
| "checkout.session.completed"
2064+
| "checkout.session.async_payment_succeeded"
20352065
| "checkout.session.async_payment_failed"
2036-
| "checkout.session.expired";
2066+
| "checkout.session.completed"
2067+
| "checkout.session.expired"
2068+
| "charge.refunded";
20372069
};
20382070
};
20392071
};
@@ -3864,6 +3896,31 @@ export interface operations {
38643896
};
38653897
};
38663898
};
3899+
"get-users-me-watched-plans": {
3900+
parameters: {};
3901+
responses: {
3902+
200: {
3903+
content: {
3904+
"application/json": {
3905+
items: {
3906+
id?: number;
3907+
name?: string;
3908+
project?: {
3909+
name?: string;
3910+
id?: number;
3911+
};
3912+
isLast?: boolean;
3913+
}[];
3914+
allItems: number;
3915+
};
3916+
};
3917+
};
3918+
400: components["responses"]["Error"];
3919+
403: components["responses"]["Error"];
3920+
404: components["responses"]["Error"];
3921+
500: components["responses"]["Error"];
3922+
};
3923+
};
38673924
"get-users-roles": {
38683925
parameters: {};
38693926
responses: {
@@ -4393,6 +4450,81 @@ export interface operations {
43934450
500: components["responses"]["Error"];
43944451
};
43954452
};
4453+
/** Returns all the watcher added to a plan. It always returns at least one item. */
4454+
"get-plans-pid-watchers": {
4455+
parameters: {
4456+
path: {
4457+
pid: string;
4458+
};
4459+
};
4460+
responses: {
4461+
/** OK */
4462+
200: {
4463+
content: {
4464+
"application/json": {
4465+
items: {
4466+
id: number;
4467+
name: string;
4468+
surname: string;
4469+
email: string;
4470+
image?: string;
4471+
isInternal: boolean;
4472+
}[];
4473+
};
4474+
};
4475+
};
4476+
403: components["responses"]["Error"];
4477+
404: components["responses"]["Error"];
4478+
500: components["responses"]["Error"];
4479+
};
4480+
};
4481+
"put-plans-pid-watchers": {
4482+
parameters: {
4483+
path: {
4484+
pid: string;
4485+
};
4486+
};
4487+
responses: {
4488+
/** OK */
4489+
200: unknown;
4490+
400: components["responses"]["Error"];
4491+
403: components["responses"]["Error"];
4492+
404: components["responses"]["Error"];
4493+
500: components["responses"]["Error"];
4494+
};
4495+
requestBody: {
4496+
content: {
4497+
"application/json": {
4498+
users: {
4499+
id: number;
4500+
}[];
4501+
};
4502+
};
4503+
};
4504+
};
4505+
"post-plans-pid-watchers": {
4506+
parameters: {
4507+
path: {
4508+
pid: string;
4509+
};
4510+
};
4511+
responses: {
4512+
/** OK */
4513+
200: unknown;
4514+
403: components["responses"]["Error"];
4515+
404: components["responses"]["Error"];
4516+
500: components["responses"]["Error"];
4517+
};
4518+
requestBody: {
4519+
content: {
4520+
"application/json": {
4521+
users: {
4522+
id: number;
4523+
}[];
4524+
};
4525+
};
4526+
};
4527+
};
43964528
"get-workspaces-templates": {
43974529
parameters: {
43984530
path: {
@@ -4596,6 +4728,25 @@ export interface operations {
45964728
};
45974729
};
45984730
};
4731+
"delete-plans-pid-watchers-profile_id": {
4732+
parameters: {
4733+
path: {
4734+
pid: string;
4735+
profile_id: string;
4736+
};
4737+
};
4738+
responses: {
4739+
/** OK */
4740+
200: {
4741+
content: {
4742+
"application/json": {
4743+
success?: boolean;
4744+
};
4745+
};
4746+
};
4747+
403: components["responses"]["Error"];
4748+
};
4749+
};
45994750
}
46004751

46014752
export interface external {}

src/features/api/apiTags.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ unguessApi.enhanceEndpoints({
340340
invalidatesTags: ['PlanWatchers'],
341341
},
342342
deletePlansByPidWatchersAndProfileId: {
343-
invalidatesTags: ['PlanWatchers'],
343+
invalidatesTags: ['PlanWatchers', 'Plans'],
344+
},
345+
getUsersMeWatchedPlans: {
346+
providesTags: ['Plans', 'PlanWatchers'],
344347
},
345348
},
346349
});

src/features/api/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,12 @@ const injectedRtkApi = api.injectEndpoints({
611611
body: queryArg.body,
612612
}),
613613
}),
614+
getUsersMeWatchedPlans: build.query<
615+
GetUsersMeWatchedPlansApiResponse,
616+
GetUsersMeWatchedPlansApiArg
617+
>({
618+
query: () => ({ url: `/users/me/watched/plans` }),
619+
}),
614620
getUsersRoles: build.query<GetUsersRolesApiResponse, GetUsersRolesApiArg>({
615621
query: () => ({ url: `/users/roles` }),
616622
}),
@@ -1816,6 +1822,19 @@ export type PutUsersMePreferencesBySlugApiArg = {
18161822
value: string;
18171823
};
18181824
};
1825+
export type GetUsersMeWatchedPlansApiResponse = /** status 200 */ {
1826+
items: {
1827+
id?: number;
1828+
name?: string;
1829+
project?: {
1830+
name?: string;
1831+
id?: number;
1832+
};
1833+
isLast?: boolean;
1834+
}[];
1835+
allItems: number;
1836+
};
1837+
export type GetUsersMeWatchedPlansApiArg = void;
18191838
export type GetUsersRolesApiResponse = /** status 200 OK */ {
18201839
id: number;
18211840
name: string;
@@ -3108,6 +3127,7 @@ export const {
31083127
usePatchUsersMeMutation,
31093128
useGetUsersMePreferencesQuery,
31103129
usePutUsersMePreferencesBySlugMutation,
3130+
useGetUsersMeWatchedPlansQuery,
31113131
useGetUsersRolesQuery,
31123132
useGetVideosByVidQuery,
31133133
useGetVideosByVidObservationsQuery,

src/features/navigation/Navigation/NavigationProfileModal.tsx

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ import { useAppDispatch, useAppSelector } from 'src/app/hooks';
99
import { isDev } from 'src/common/isDevEnvironment';
1010
import { prepareGravatar } from 'src/common/utils';
1111
import WPAPI from 'src/common/wpapi';
12-
import {
13-
useGetUsersMePreferencesQuery,
14-
useGetUsersMeQuery,
15-
usePutUsersMePreferencesBySlugMutation,
16-
} from 'src/features/api';
12+
import { useGetUsersMeQuery } from 'src/features/api';
1713
import { useActiveWorkspace } from 'src/hooks/useActiveWorkspace';
1814
import { setProfileModalOpen } from '../navigationSlice';
1915
import { usePathWithoutLocale } from '../usePathWithoutLocale';
@@ -31,41 +27,12 @@ export const NavigationProfileModal = () => {
3127
const dispatch = useAppDispatch();
3228
const navigate = useNavigate();
3329

34-
const { data: preferences } = useGetUsersMePreferencesQuery();
35-
36-
const notificationsPreference = preferences?.items?.find(
37-
(preference) => preference?.name === 'notifications_enabled'
38-
);
3930
const pathWithoutLocale = usePathWithoutLocale();
4031

41-
const [updatePreference] = usePutUsersMePreferencesBySlugMutation();
42-
4332
const onProfileModalClose = () => {
4433
dispatch(setProfileModalOpen(false));
4534
};
4635

47-
const onSetSettings = async (value: string) => {
48-
await updatePreference({
49-
slug: `${notificationsPreference?.name}`,
50-
body: { value },
51-
})
52-
.unwrap()
53-
.then(() => {
54-
addToast(
55-
({ close }) => (
56-
<Notification
57-
onClose={close}
58-
type="success"
59-
message={t('__PROFILE_MODAL_NOTIFICATIONS_UPDATED')}
60-
closeText={t('__TOAST_CLOSE_TEXT')}
61-
isPrimary
62-
/>
63-
),
64-
{ placement: 'top' }
65-
);
66-
});
67-
};
68-
6936
if (dataError || !user || isLoading) return null;
7037

7138
const profileModal = {
@@ -114,22 +81,6 @@ export const NavigationProfileModal = () => {
11481
title: t('__PROFILE_MODAL_PRIVACY_ITEM_LABEL'),
11582
url: 'https://www.iubenda.com/privacy-policy/833252/full-legal',
11683
},
117-
settingValue: notificationsPreference?.value ?? '0',
118-
i18n: {
119-
settingsTitle: t('__PROFILE_MODAL_NOTIFICATIONS_TITLE'),
120-
settingsIntroText: t('__PROFILE_MODAL_NOTIFICATIONS_INTRO'),
121-
settingsOutroText: {
122-
paragraph_1: t('__PROFILE_MODAL_NOTIFICATIONS_OUTRO_P_1'),
123-
paragraph_2: t('__PROFILE_MODAL_NOTIFICATIONS_OUTRO_P_2'),
124-
paragraph_3: t('__PROFILE_MODAL_NOTIFICATIONS_OUTRO_P_3'),
125-
},
126-
settingsToggle: {
127-
title: t('__PROFILE_MODAL_NOTIFICATIONS_TOGGLE_TITLE'),
128-
on: t('__PROFILE_MODAL_NOTIFICATIONS_TOGGLE_ON'),
129-
off: t('__PROFILE_MODAL_NOTIFICATIONS_TOGGLE_OFF'),
130-
},
131-
},
132-
onSetSettings,
13384
onSelectLanguage: (lang: string) => {
13485
if (pathWithoutLocale === false) return;
13586
if (lang === i18n.language) return;

0 commit comments

Comments
 (0)