[acclerator] load square for prepaid acceleration

This commit is contained in:
nymkappa 2024-04-05 11:16:48 +09:00
parent aac76d68b0
commit bcbd21b922
No known key found for this signature in database
GPG Key ID: 92358FC85D9645DE

View File

@ -80,6 +80,7 @@ export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
private cd: ChangeDetectorRef
) {
if (window.document.referrer === 'cash.app') {
this.insertSquare();
this.paymentType = 'cashapp';
} else {
this.paymentType = 'bitcoin';
@ -345,4 +346,17 @@ export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
}
);
}
insertSquare(): void {
let statsUrl = 'https://sandbox.web.squarecdn.com/v1/square.js';
if (document.location.hostname === 'mempool-staging.tk7.mempool.space' || document.location.hostname === 'mempool.space') {
statsUrl = 'https://web.squarecdn.com/v1/square.js';
}
(function() {
const d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
// @ts-ignore
g.type='text/javascript'; g.src=statsUrl; s.parentNode.insertBefore(g, s);
})();
}
}