UNPKG

@wscsports/blaze-rtn-sdk

Version:
155 lines (150 loc) 6.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BlazeSDK = void 0; var _reactNative = require("react-native"); var _globalDelegate = require("./classes/global-delegate"); var _entryPointDelegate = require("./classes/entry-point-delegate"); var _blazeError = require("./interfaces/blaze-error.interface"); var _followEntitiesDelegate = require("./classes/follow-entities-delegate"); var _castingDelegate = require("./classes/casting-delegate"); var _pipDelegate = require("./classes/pip-delegate"); const { RTNBlazeSdk } = _reactNative.NativeModules; const BlazeSDKNativeModule = RTNBlazeSdk; // This wrapper is hiding the internal interface that works with the native module, and serves as additional layer to add custom logic. class BlazeSdkWrapper { init(options) { this.setEntryPointDelegate(options.playerEntryPointDelegate); this.setGlobalDelegate(options.globalDelegate); return BlazeSDKNativeModule.init(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } isInitialized() { return BlazeSDKNativeModule.isInitialized(); } playStory(options) { return BlazeSDKNativeModule.playStory(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } prepareStories(options) { return BlazeSDKNativeModule.prepareStories(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } playStories(options) { return BlazeSDKNativeModule.playStories(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } playMoment(options) { return BlazeSDKNativeModule.playMoment(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } prepareMoments(options) { return BlazeSDKNativeModule.prepareMoments(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } playMoments(options) { return BlazeSDKNativeModule.playMoments(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } playVideo(options) { return BlazeSDKNativeModule.playVideo(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } prepareVideos(options) { return BlazeSDKNativeModule.prepareVideos(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } playVideos(options) { return BlazeSDKNativeModule.playVideos(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } appendMomentsToPlayer(options) { return BlazeSDKNativeModule.appendMomentsToPlayer(options).catch(_blazeError.mapToBlazeErrorOrRethrow); } dismissPlayer() { return BlazeSDKNativeModule.dismissPlayer(); } setExternalUserId(externalUserId) { return BlazeSDKNativeModule.setExternalUserId(externalUserId).catch(_blazeError.mapToBlazeErrorOrRethrow); } setDoNotTrack(doNotTrackUser) { return BlazeSDKNativeModule.setDoNotTrack(doNotTrackUser); } setDisableAnalytics(disableAnalytics) { return BlazeSDKNativeModule.setDisableAnalytics(disableAnalytics); } handleUniversalLink(link) { return BlazeSDKNativeModule.handleUniversalLink(link).catch(_blazeError.mapToBlazeErrorOrRethrow); } canHandleUniversalLink(link) { return BlazeSDKNativeModule.canHandleUniversalLink(link); } updateGeoRestriction(geoLocation) { return BlazeSDKNativeModule.updateGeoRestriction(geoLocation).catch(_blazeError.mapToBlazeErrorOrRethrow); } setGlobalDelegate(globalDelegate) { _globalDelegate.BlazeGlobalDelegateHelper.registerGlobalDelegate(globalDelegate); } setEntryPointDelegate(playerEntryPointDelegate) { _entryPointDelegate.BlazeEntryPointDelegateHelper.registerEntryPointDelegate(playerEntryPointDelegate); } setDefaultVideosPlaybackConfiguration(config) { return BlazeSDKNativeModule.setDefaultVideosPlaybackConfiguration(config).catch(_blazeError.mapToBlazeErrorOrRethrow); } getDefaultVideosPlaybackConfiguration() { return BlazeSDKNativeModule.getDefaultVideosPlaybackConfiguration().catch(_blazeError.mapToBlazeErrorOrRethrow); } setDefaultMomentsPlaybackConfiguration(config) { return BlazeSDKNativeModule.setDefaultMomentsPlaybackConfiguration(config).catch(_blazeError.mapToBlazeErrorOrRethrow); } getDefaultMomentsPlaybackConfiguration() { return BlazeSDKNativeModule.getDefaultMomentsPlaybackConfiguration().catch(_blazeError.mapToBlazeErrorOrRethrow); } canHandlePushNotification(payload) { return BlazeSDKNativeModule.canHandlePushNotification(payload); } handleNotificationPayload(payload) { return BlazeSDKNativeModule.handleNotificationPayload(payload).catch(_blazeError.mapToBlazeErrorOrRethrow); } setFollowEntitiesDelegate(delegate) { _followEntitiesDelegate.BlazeFollowEntitiesDelegateHelper.registerFollowEntitiesDelegate(delegate); } setFollowedEntities(entityIds) { return BlazeSDKNativeModule.setFollowedEntities(entityIds).catch(_blazeError.mapToBlazeErrorOrRethrow); } insertFollowedEntities(entityIds) { return BlazeSDKNativeModule.insertFollowedEntities(entityIds).catch(_blazeError.mapToBlazeErrorOrRethrow); } removeFollowedEntities(entityIds) { return BlazeSDKNativeModule.removeFollowedEntities(entityIds).catch(_blazeError.mapToBlazeErrorOrRethrow); } getFollowedEntities() { return BlazeSDKNativeModule.getFollowedEntities().catch(_blazeError.mapToBlazeErrorOrRethrow); } setPreferredLanguage(language) { return BlazeSDKNativeModule.setPreferredLanguage(language); } showSearchScreen(options) { return BlazeSDKNativeModule.showSearchScreen(options ?? {}).catch(_blazeError.mapToBlazeErrorOrRethrow); } stopActiveCastingSession() { return BlazeSDKNativeModule.stopActiveCastingSession(); } setCastingDelegate(delegate) { _castingDelegate.BlazeCastingDelegateHelper.registerCastingDelegate(delegate); } stopActivePiPSession() { return BlazeSDKNativeModule.stopActivePiPSession(); } isPiPActive() { return BlazeSDKNativeModule.isPiPActive(); } setPipDelegate(delegate) { _pipDelegate.BlazePipDelegateHelper.registerPipDelegate(delegate); } // Singleton instance // Private constructor for singleton constructor() {} // Method to get singleton instance static getInstance() { if (!this.instance) { this.instance = new BlazeSdkWrapper(); } return this.instance; } } const BlazeSDK = exports.BlazeSDK = BlazeSdkWrapper.getInstance(); //# sourceMappingURL=NativeBlazeSdk.js.map