2018-09-26 13:48:07 -04:00
|
|
|
// @flow
|
2017-12-21 18:08:54 -03:00
|
|
|
import React from 'react';
|
|
|
|
import FilePrice from 'component/filePrice';
|
|
|
|
import { Modal } from 'modal/modal';
|
2017-09-07 17:18:33 -04:00
|
|
|
|
2018-09-26 13:48:07 -04:00
|
|
|
type Props = {
|
|
|
|
closeModal: () => void,
|
|
|
|
loadVideo: string => void,
|
|
|
|
uri: string,
|
|
|
|
cancelPurchase: () => void,
|
2019-04-24 10:02:08 -04:00
|
|
|
metadata: StreamMetadata,
|
2018-09-26 13:48:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class ModalAffirmPurchase extends React.PureComponent<Props> {
|
2018-05-31 00:32:31 -04:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
2019-01-07 21:46:33 -05:00
|
|
|
(this: any).onAffirmPurchase = this.onAffirmPurchase.bind(this);
|
2018-05-31 00:32:31 -04:00
|
|
|
}
|
|
|
|
|
2017-09-07 23:15:05 -04:00
|
|
|
onAffirmPurchase() {
|
|
|
|
this.props.closeModal();
|
|
|
|
this.props.loadVideo(this.props.uri);
|
|
|
|
}
|
|
|
|
|
2017-09-07 17:18:33 -04:00
|
|
|
render() {
|
2018-05-03 11:22:10 -06:00
|
|
|
const {
|
|
|
|
cancelPurchase,
|
|
|
|
metadata: { title },
|
|
|
|
uri,
|
|
|
|
} = this.props;
|
2017-09-07 17:18:33 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
type="confirm"
|
2017-12-21 18:08:54 -03:00
|
|
|
isOpen
|
2018-09-26 13:48:07 -04:00
|
|
|
title={__('Confirm Purchase')}
|
2017-12-21 18:08:54 -03:00
|
|
|
contentLabel={__('Confirm Purchase')}
|
2018-05-31 00:32:31 -04:00
|
|
|
onConfirmed={this.onAffirmPurchase}
|
2017-09-17 22:08:43 -04:00
|
|
|
onAborted={cancelPurchase}
|
2017-09-07 17:18:33 -04:00
|
|
|
>
|
2019-11-22 16:13:00 -05:00
|
|
|
<p className="section__subtitle">
|
2019-07-21 17:31:22 -04:00
|
|
|
{__('This will purchase')} <strong>{title ? `"${title}"` : uri}</strong> {__('for')}{' '}
|
|
|
|
<strong>
|
|
|
|
<FilePrice uri={uri} showFullPrice inheritStyle showLBC={false} />
|
|
|
|
</strong>{' '}
|
|
|
|
{__('credits')}.
|
|
|
|
</p>
|
2017-09-07 17:18:33 -04:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ModalAffirmPurchase;
|