add referral code to embed links
This commit is contained in:
parent
d677468fe8
commit
85e2ee28a3
3 changed files with 15 additions and 5 deletions
|
@ -13,14 +13,15 @@ type Props = {
|
||||||
claim: Claim,
|
claim: Claim,
|
||||||
includeStartTime: boolean,
|
includeStartTime: boolean,
|
||||||
startTime: number,
|
startTime: number,
|
||||||
|
referralCode: ?string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function EmbedTextArea(props: Props) {
|
export default function EmbedTextArea(props: Props) {
|
||||||
const { doToast, snackMessage, label, claim, includeStartTime, startTime } = props;
|
const { doToast, snackMessage, label, claim, includeStartTime, startTime, referralCode } = props;
|
||||||
const { claim_id: claimId, name } = claim;
|
const { claim_id: claimId, name } = claim;
|
||||||
const input = useRef();
|
const input = useRef();
|
||||||
|
|
||||||
const streamUrl = generateEmbedUrl(name, claimId, includeStartTime, startTime);
|
const streamUrl = generateEmbedUrl(name, claimId, includeStartTime, startTime, referralCode);
|
||||||
let embedText = `<iframe id="lbry-iframe" width="560" height="315" src="${streamUrl}" allowfullscreen></iframe>`;
|
let embedText = `<iframe id="lbry-iframe" width="560" height="315" src="${streamUrl}" allowfullscreen></iframe>`;
|
||||||
|
|
||||||
function copyToClipboard() {
|
function copyToClipboard() {
|
||||||
|
|
|
@ -162,6 +162,7 @@ function SocialShare(props: Props) {
|
||||||
claim={claim}
|
claim={claim}
|
||||||
includeStartTime={includeStartTime}
|
includeStartTime={includeStartTime}
|
||||||
startTime={startTimeSeconds}
|
startTime={startTimeSeconds}
|
||||||
|
referralCode={referralCode}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showClaimLinks && (
|
{showClaimLinks && (
|
||||||
|
|
|
@ -6,9 +6,17 @@ function generateStreamUrl(claimName, claimId) {
|
||||||
return `${LBRY_WEB_STREAMING_API}/content/claims/${claimName}/${claimId}/stream`;
|
return `${LBRY_WEB_STREAMING_API}/content/claims/${claimName}/${claimId}/stream`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateEmbedUrl(claimName, claimId, includeStartTime, startTime) {
|
function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, referralLink) {
|
||||||
const queryParam = includeStartTime ? `?t=${startTime}` : '';
|
let urlParams = new URLSearchParams();
|
||||||
return `${URL}/$/embed/${claimName}/${claimId}${queryParam}`;
|
if (includeStartTime && startTime) {
|
||||||
|
urlParams.append('t', startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (referralLink) {
|
||||||
|
urlParams.append('r', referralLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${URL}/$/embed/${claimName}/${claimId}?${urlParams.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateDownloadUrl(claimName, claimId) {
|
function generateDownloadUrl(claimName, claimId) {
|
||||||
|
|
Loading…
Reference in a new issue