Files
YouTube.js/src/parser/classes/SubscribeButton.ts
LuanRT dcf2b720a0 fix: minor parsing issues and other improvements (#194)
* feat: add `ConfirmDialog`

This usually appears in the `playability_status` object.

* fix(PlayerErrorMessage): check if `iconType` exists before parsing

* chore(parser): fix a few inconsistencies

* feat(ytmusic): add `MetadataScreen`

TODO: Check TrackInfo, YouTube Music is probably getting some minor UI updates.
2022-09-17 19:14:46 -03:00

36 lines
1.3 KiB
TypeScript

import Parser from '../index';
import Text from './misc/Text';
import NavigationEndpoint from './NavigationEndpoint';
import SubscriptionNotificationToggleButton from './SubscriptionNotificationToggleButton';
import { YTNode } from '../helpers';
class SubscribeButton extends YTNode {
static type = 'SubscribeButton';
title: Text;
subscribed: boolean;
enabled: boolean;
item_type: string;
channel_id: string;
show_preferences: boolean;
subscribed_text: Text;
unsubscribed_text: Text;
notification_preference_button: SubscriptionNotificationToggleButton | null;
endpoint: NavigationEndpoint;
constructor(data: any) {
super();
this.title = new Text(data.buttonText);
this.subscribed = data.subscribed;
this.enabled = data.enabled;
this.item_type = data.type;
this.channel_id = data.channelId;
this.show_preferences = data.showPreferences;
this.subscribed_text = new Text(data.subscribedButtonText);
this.unsubscribed_text = new Text(data.unsubscribedButtonText);
this.notification_preference_button = Parser.parseItem<SubscriptionNotificationToggleButton>(data.notificationPreferenceButton, SubscriptionNotificationToggleButton);
this.endpoint = new NavigationEndpoint(data.serviceEndpoints?.[0] || data.onSubscribeEndpoints?.[0]);
}
}
export default SubscribeButton;