Skip to content

Commit 301d829

Browse files
committed
Merge branch 'release-candidate' into release
2 parents 635abf6 + 1ff6fdd commit 301d829

File tree

166 files changed

+3417
-2854
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+3417
-2854
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [6.1.2](https://github.com/jwplayer/ott-web-app/compare/v6.1.1...v6.1.2) (2024-05-21)
2+
3+
4+
### Bug Fixes
5+
6+
* **a11y:** improve accessibility of offers modal ([af654ec](https://github.com/jwplayer/ott-web-app/commit/af654ecc9b481353522b8e08a2d8078a7b91aa2a))
7+
* **home:** broken home skeleton ([#523](https://github.com/jwplayer/ott-web-app/issues/523)) ([35cd2db](https://github.com/jwplayer/ott-web-app/commit/35cd2db26ed3ffee65a6e2edf38447bce7957c7f))
8+
* **menu:** reintroduce profile menu styling ([39fd840](https://github.com/jwplayer/ott-web-app/commit/39fd840019405797069e84f7dbfd9d10a746b534))
9+
* **project:** alignment of password toggle button ([642068d](https://github.com/jwplayer/ott-web-app/commit/642068dc4babba8e9660e9bfee6acf16931aa8aa))
10+
* **project:** favicon paths ([7acf234](https://github.com/jwplayer/ott-web-app/commit/7acf234446d8dc62e3f43b13f49c3b2ad3c72a8a))
11+
* remove simultaneous logins ([9aa4a71](https://github.com/jwplayer/ott-web-app/commit/9aa4a71d8c12865bdf13fadf3d93b420343bd672))
12+
113
## [6.1.1](https://github.com/jwplayer/ott-web-app/compare/v6.1.0...v6.1.1) (2024-04-23)
214

315

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jwp/ott",
3-
"version": "6.1.1",
3+
"version": "6.1.2",
44
"private": true,
55
"license": "Apache-2.0",
66
"repository": "https://github.com/jwplayer/ott-web-app.git",

packages/common/src/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ export const DEFAULT_FEATURES = {
7575
watchListSizeLimit: MAX_WATCHLIST_ITEMS_COUNT,
7676
};
7777

78-
export const simultaneousLoginWarningKey = 'simultaneous_logins';
79-
8078
export const EPG_TYPE = {
8179
jwp: 'jwp',
8280
viewNexa: 'viewnexa',

packages/common/src/controllers/AccountController.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export default class AccountController {
334334

335335
if (response.errors.length > 0) throw new Error(response.errors[0]);
336336

337-
await this.reloadSubscriptions({ delay: 2000 });
337+
await this.reloadSubscriptions({ retry: 10 });
338338

339339
return response?.responseData;
340340
};
@@ -386,7 +386,7 @@ export default class AccountController {
386386
return !!responseData?.accessGranted;
387387
};
388388

389-
reloadSubscriptions = async ({ delay }: { delay: number } = { delay: 0 }): Promise<unknown> => {
389+
reloadSubscriptions = async ({ delay, retry }: { delay?: number; retry?: number } = { delay: 0, retry: 0 }): Promise<unknown> => {
390390
useAccountStore.setState({ loading: true });
391391

392392
const { getAccountInfo } = useAccountStore.getState();
@@ -395,10 +395,10 @@ export default class AccountController {
395395

396396
// The subscription data takes a few seconds to load after it's purchased,
397397
// so here's a delay mechanism to give it time to process
398-
if (delay > 0) {
398+
if (delay && delay > 0) {
399399
return new Promise((resolve: (value?: unknown) => void) => {
400400
setTimeout(() => {
401-
this.reloadSubscriptions().finally(resolve);
401+
this.reloadSubscriptions({ retry }).finally(resolve);
402402
}, delay);
403403
});
404404
}
@@ -418,6 +418,12 @@ export default class AccountController {
418418

419419
let pendingOffer: Offer | null = null;
420420

421+
if (!activeSubscription && !!retry && retry > 0) {
422+
const retryDelay = 1500; // Any initial delay has already occured, so we can set this to a fixed value
423+
424+
return await this.reloadSubscriptions({ delay: retryDelay, retry: retry - 1 });
425+
}
426+
421427
// resolve and fetch the pending offer after upgrade/downgrade
422428
try {
423429
if (activeSubscription?.pendingSwitchId) {

packages/common/src/stores/UIStore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type UIState = {
44
searchQuery: string;
55
searchActive: boolean;
66
userMenuOpen: boolean;
7+
sideBarOpen: boolean;
78
languageMenuOpen: boolean;
89
preSearchPage?: string;
910
};
@@ -12,5 +13,6 @@ export const useUIStore = createStore<UIState>('UIStore', () => ({
1213
searchQuery: '',
1314
searchActive: false,
1415
userMenuOpen: false,
16+
sideBarOpen: false,
1517
languageMenuOpen: false,
1618
}));

packages/common/types/form.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export type UseFormChangeHandler = React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
2-
export type UseFormBlurHandler = React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
1+
export type UseFormChangeHandler = React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
2+
export type UseFormBlurHandler = React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
33
export type UseFormSubmitHandler = React.FormEventHandler<HTMLFormElement>;
44

55
export type GenericFormErrors = { form: string };

packages/hooks-react/src/useCheckAccess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const useCheckAccess = () => {
3131
const hasAccess = await accountController.checkEntitlements(offerId);
3232

3333
if (hasAccess) {
34-
await accountController.reloadSubscriptions({ delay: 2000 }); // Delay needed for backend processing (Cleeng API returns empty subscription, even after accessGranted from entitlements call
34+
await accountController.reloadSubscriptions({ retry: 10, delay: 2000 });
3535
callback?.(true);
3636
} else if (--iterations === 0) {
3737
window.clearInterval(intervalRef.current);

packages/hooks-react/src/useCheckout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const useCheckout = ({ onUpdateOrderSuccess, onSubmitPaymentWithoutDetailsSucces
4747
mutationKey: ['submitPaymentWithoutDetails'],
4848
mutationFn: checkoutController.paymentWithoutDetails,
4949
onSuccess: async () => {
50-
await accountController.reloadSubscriptions({ delay: 1000 });
50+
await accountController.reloadSubscriptions({ retry: 10 });
5151
onSubmitPaymentWithoutDetailsSuccess();
5252
},
5353
});

packages/hooks-react/src/useOffers.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { useMutation } from 'react-query';
2-
import { useEffect } from 'react';
1+
import { useMutation, useQuery } from 'react-query';
32
import { shallow } from '@jwp/ott-common/src/utils/compare';
43
import { getModule } from '@jwp/ott-common/src/modules/container';
54
import { useCheckoutStore } from '@jwp/ott-common/src/stores/CheckoutStore';
@@ -21,9 +20,9 @@ const useOffers = () => {
2120
shallow,
2221
);
2322

24-
const { mutate: initialise, isLoading: isInitialisationLoading } = useMutation<void>({
25-
mutationKey: ['initialiseOffers', requestedMediaOffers],
26-
mutationFn: checkoutController.initialiseOffers,
23+
const { isLoading: isInitialisationLoading } = useQuery<void>({
24+
queryKey: ['initialiseOffers', requestedMediaOffers],
25+
queryFn: checkoutController.initialiseOffers,
2726
});
2827

2928
const chooseOffer = useMutation({
@@ -34,13 +33,9 @@ const useOffers = () => {
3433
const switchSubscription = useMutation({
3534
mutationKey: ['switchSubscription'],
3635
mutationFn: checkoutController.switchSubscription,
37-
onSuccess: () => accountController.reloadSubscriptions({ delay: 7500 }), // @todo: Is there a better way to wait?
36+
onSuccess: () => accountController.reloadSubscriptions({ delay: 3000, retry: 10 }), // A subscription switch usually takes at least 3 secs
3837
});
3938

40-
useEffect(() => {
41-
initialise();
42-
}, [requestedMediaOffers, initialise]);
43-
4439
const hasMediaOffers = mediaOffers.length > 0;
4540
const hasSubscriptionOffers = subscriptionOffers.length > 0;
4641
const hasPremierOffers = requestedMediaOffers.some((mediaOffer) => mediaOffer.premier);

packages/hooks-react/src/usePlaylists.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const placeholderData = generatePlaylistPlaceholder(30);
1414

1515
type UsePlaylistResult = {
1616
data: Playlist | undefined;
17-
isLoading: boolean;
1817
isSuccess?: boolean;
1918
error?: unknown;
19+
isPlaceholderData?: boolean;
2020
}[];
2121

2222
const usePlaylists = (content: Content[], rowsToLoad: number | undefined = undefined) => {
@@ -57,13 +57,13 @@ const usePlaylists = (content: Content[], rowsToLoad: number | undefined = undef
5757
if (type === PersonalShelf.Favorites) return { data: favorites, isLoading: false, isSuccess: true };
5858
if (type === PersonalShelf.ContinueWatching) return { data: watchHistory, isLoading: false, isSuccess: true };
5959

60-
const { data, isLoading, isSuccess, error } = playlistQueries[index];
60+
const { data, isSuccess, error, isPlaceholderData } = playlistQueries[index];
6161

6262
return {
6363
data,
64-
isLoading,
6564
isSuccess,
6665
error,
66+
isPlaceholderData,
6767
};
6868
});
6969

0 commit comments

Comments
 (0)