Skip to content

Commit 0097951

Browse files
chore: rename AdSchedule to AdConfig
1 parent e7e3e67 commit 0097951

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

packages/common/src/services/ApiService.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { filterMediaOffers } from '../utils/entitlements';
88
import { useConfigStore as ConfigStore } from '../stores/ConfigStore';
99
import type { GetPlaylistParams, Playlist, PlaylistItem } from '../../types/playlist';
1010
import type { ContentList, GetContentSearchParams } from '../../types/content-list';
11-
import type { DeliveryAdSchedule } from '../../types/ad-schedule';
11+
import type { AdSchedule } from '../../types/ad-schedule';
1212
import type { EpisodeInSeries, EpisodesRes, EpisodesWithPagination, GetSeriesParams, Series } from '../../types/series';
1313
import env from '../env';
1414
import { logError } from '../logger';
@@ -255,15 +255,15 @@ export default class ApiService {
255255
return this.transformEpisodes(episodesRes, seasonNumber);
256256
};
257257

258-
getAdSchedule = async (id: string | undefined | null): Promise<DeliveryAdSchedule | undefined> => {
258+
getAdSchedule = async (id: string | undefined | null): Promise<AdSchedule | undefined> => {
259259
if (!id) {
260260
throw new Error('Ad Schedule ID is required');
261261
}
262262

263263
const url = env.APP_API_BASE_URL + `/v2/advertising/schedules/${id}.json`;
264264
const response = await fetch(url, { credentials: 'omit' });
265265

266-
return (await getDataOrThrow(response)) as DeliveryAdSchedule;
266+
return (await getDataOrThrow(response)) as AdSchedule;
267267
};
268268

269269
/**

packages/common/types/ad-schedule.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export type AdSchedule = {
2-
adscheduleid?: string;
1+
export type AdConfig = {
32
client: string;
43
schedule: string;
54
};
@@ -11,21 +10,21 @@ export type AdScheduleUrls = {
1110

1211
export type AdDeliveryMethod = 'csai' | 'ssai';
1312

14-
type DeliverySchedule = {
13+
type Schedule = {
1514
tag: string[];
1615
type: 'linear' | 'nonlinear';
1716
offset: 'pre' | 'post' | string; // seconds, timestamp, percentage
1817
skipoffset?: number;
1918
};
2019

21-
type DeliveryRules = {
20+
type Rules = {
2221
startOnSeek: 'pre' | 'none' | 'mid';
2322
timeBetweenAds: number;
2423
startOn?: number;
2524
frequency?: number;
2625
};
2726

28-
type DeliveryBids = {
27+
type Bids = {
2928
settings: {
3029
bidTimeout: number;
3130
floorPriceCents: number;
@@ -57,10 +56,10 @@ type DeliveryBids = {
5756
};
5857
};
5958

60-
export type DeliveryAdSchedule = {
61-
rules: DeliveryRules;
62-
schedule: DeliverySchedule[];
63-
bids: DeliveryBids;
59+
export type AdSchedule = {
60+
rules: Rules;
61+
schedule: Schedule[];
62+
bids: Bids;
6463
client: 'vast' | 'googima';
6564
vpaidmode?: 'enabled' | 'disabled' | 'insecure';
6665
adscheduleid: string;

packages/hooks-react/src/useAds.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useConfigStore } from '@jwp/ott-common/src/stores/ConfigStore';
33
import ApiService from '@jwp/ott-common/src/services/ApiService';
44
import { getModule } from '@jwp/ott-common/src/modules/container';
55
import { createURL } from '@jwp/ott-common/src/utils/urlFormatting';
6-
import type { AdSchedule } from '@jwp/ott-common/types/ad-schedule';
6+
import type { AdConfig } from '@jwp/ott-common/types/ad-schedule';
77

88
const CACHE_TIME = 60 * 1000 * 20;
99

@@ -39,7 +39,7 @@ export const useAds = ({ mediaId }: { mediaId: string }) => {
3939
schedule: createURL(adScheduleUrls?.xml || '', {
4040
media_id: mediaId,
4141
}),
42-
} as AdSchedule)
42+
} as AdConfig)
4343
: undefined;
4444

4545
return {

packages/ui-react/src/components/Player/Player.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useEffect, useRef, useState } from 'react';
2-
import type { AdSchedule, DeliveryAdSchedule } from '@jwp/ott-common/types/ad-schedule';
2+
import type { AdConfig, AdSchedule } from '@jwp/ott-common/types/ad-schedule';
33
import type { PlaylistItem } from '@jwp/ott-common/types/playlist';
44
import { useConfigStore } from '@jwp/ott-common/src/stores/ConfigStore';
55
import { deepCopy } from '@jwp/ott-common/src/utils/collection';
@@ -20,7 +20,7 @@ type Props = {
2020
item: PlaylistItem;
2121
startTime?: number;
2222
autostart?: boolean;
23-
adsData?: AdSchedule | DeliveryAdSchedule;
23+
adsData?: AdConfig | AdSchedule;
2424
onReady?: (player?: JWPlayer) => void;
2525
onPlay?: () => void;
2626
onPause?: () => void;

0 commit comments

Comments
 (0)