1
1
import React from 'react' ;
2
2
3
3
// Colors
4
- import { AnalyticsComponent , AnalyticsEvents , AnalyticsComponentType } from '../../analytics' ;
5
4
import colors from '../../theme/colors' ;
6
5
7
6
// Types
8
7
import Branding from '../types/branding' ;
9
8
10
9
// Components
10
+ import { AnalyticsComponent , AnalyticsEvents , AnalyticsComponentType } from '../../analytics' ;
11
11
import FooterText from '../shared/FooterText' ;
12
+ import PreviewText from '../shared/PreviewText' ;
12
13
import {
13
14
OverlayLabel ,
14
- RestrictedAssetContainer ,
15
15
RestrictedAssetIcon ,
16
+ StyledRestrictedAssetContainer ,
16
17
} from '../shared/PreviewComponents' ;
17
- import PreviewText from '../shared/PreviewText' ;
18
18
import {
19
19
InPlayerPreviewBox ,
20
20
LockIcon ,
21
21
ImageHolder ,
22
22
PaywallExplain ,
23
23
InplayerWhiteLogo ,
24
+ InplayerPremiumLabel ,
24
25
ItemDetails ,
25
26
BuyButtonWrapper ,
26
27
BuyButton ,
@@ -38,10 +39,10 @@ type Props = {
38
39
premiumContentLabel ?: string ;
39
40
isRestrictedAsset ?: boolean ;
40
41
isAuthenticated ?: boolean ;
42
+ restrictedMessage ?: string ;
41
43
} ;
42
44
43
45
const previewImg = 'https://assets.inplayer.com/images/preview-premium.jpg' ;
44
- const restrictedAssetImg = 'https://assets.inplayer.com/images/restricted-asset.png' ;
45
46
46
47
const Preview1 = ( {
47
48
branding : {
@@ -61,25 +62,27 @@ const Preview1 = ({
61
62
premiumContentLabel = 'Premium content' ,
62
63
isRestrictedAsset = false ,
63
64
isAuthenticated = false ,
65
+ restrictedMessage = 'This content is not available.' ,
64
66
} : Props ) => (
65
67
< AnalyticsComponent >
66
68
{ ( { pages, tracker, merchantId, ip } ) => (
67
69
< InPlayerPreviewBox className = "inplayer-preview-box" >
68
70
{ previewUnavailable && < OverlayLabel variant = "h5" > Preview not available yet</ OverlayLabel > }
69
71
< ImageHolder className = "inplayer-imageholder" onClick = { handleOpenModal } >
72
+ { isRestrictedAsset && (
73
+ // Call handleOpenModal here because this div element will be
74
+ // on the top of all image elements in case of restricted asset
75
+ < StyledRestrictedAssetContainer onClick = { handleOpenModal } >
76
+ < RestrictedAssetIcon />
77
+ { restrictedMessage }
78
+ </ StyledRestrictedAssetContainer >
79
+ ) }
70
80
< PreviewImage
71
81
alt = "coverPhoto"
72
82
src = { imageUrl }
73
83
role = "presentation"
74
84
className = "inplayer-paywall"
75
- isRestrictedAsset = { isRestrictedAsset }
76
85
/>
77
- { isRestrictedAsset && (
78
- < RestrictedAssetContainer >
79
- < RestrictedAssetIcon />
80
- { premiumContentLabel }
81
- </ RestrictedAssetContainer >
82
- ) }
83
86
< PaywallExplain
84
87
hasProtectedByLabel = { hasProtectedByLabel }
85
88
className = "inplayer-paywallexplain"
@@ -102,8 +105,10 @@ const Preview1 = ({
102
105
InPlayer Paywall
103
106
</ a >
104
107
</ InplayerWhiteLogo >
105
- < LockIcon className = "inplayer-lock" />
106
- < span > { ! isRestrictedAsset && premiumContentLabel } </ span >
108
+ < InplayerPremiumLabel >
109
+ < LockIcon className = "inplayer-lock" />
110
+ < div > { premiumContentLabel } </ div >
111
+ </ InplayerPremiumLabel >
107
112
</ PaywallExplain >
108
113
</ ImageHolder >
109
114
< ItemDetails className = "inplayer-itemdetails" >
0 commit comments