[accelerator] polish pizza accel x2

This commit is contained in:
nymkappa 2024-04-16 16:56:37 +09:00
parent 64ba033602
commit 96d85dcacd
No known key found for this signature in database
GPG Key ID: 92358FC85D9645DE
4 changed files with 17 additions and 18 deletions

View File

@ -104,7 +104,7 @@
<div class="row mt-2 mb-2 text-center"> <div class="row mt-2 mb-2 text-center">
<div class="col-sm d-flex flex-column"> <div class="col-sm d-flex flex-column">
<small>Changed your mind?</small> <small>Changed your mind?</small>
<button type="button" class="mt-1 btn btn-secondary btn-sm rounded-pill align-self-center" style="width: 200px" (click)="restart()">Go Back</button> <button type="button" class="mt-1 btn btn-secondary btn-sm rounded-pill align-self-center" style="width: 200px" (click)="step = 'cta'">Go Back</button>
</div> </div>
</div> </div>
} }

View File

@ -62,7 +62,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.estimate(); this.estimate();
} }
}); });
} }
ngOnDestroy() { ngOnDestroy() {
@ -97,7 +96,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
} }
} }
/** /**
* Accelerator * Accelerator
*/ */
estimate() { estimate() {
@ -173,8 +172,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.payments = window.Square.payments(this.square.appId, this.square.locationId) this.payments = window.Square.payments(this.square.appId, this.square.locationId)
await this.requestCashAppPayment(); await this.requestCashAppPayment();
} catch (e) { } catch (e) {
console.error(e); console.debug('Error loading Square Payments', e);
this.error = 'Error loading Square Payments';
return; return;
} }
} }
@ -189,7 +187,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.conversionsSubscription = this.stateService.conversions$.subscribe( this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => { async (conversions) => {
if (this.cashAppPay) { if (this.cashAppPay) {
await this.cashAppPay.destroy(); this.cashAppPay.destroy();
} }
const redirectHostname = document.location.hostname === 'localhost' ? `http://localhost:4200`: `https://${document.location.hostname}`; const redirectHostname = document.location.hostname === 'localhost' ? `http://localhost:4200`: `https://${document.location.hostname}`;
@ -231,13 +229,22 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
).subscribe({ ).subscribe({
next: () => { next: () => {
that.audioService.playSound('ascend-chime-cartoon'); that.audioService.playSound('ascend-chime-cartoon');
that.closeModal(); if (that.cashAppPay) {
that.cashAppPay.destroy();
}
setTimeout(() => {
that.closeModal();
}, 1000);
}, },
error: (response) => { error: (response) => {
if (response.status === 403 && response.error === 'not_available') { if (response.status === 403 && response.error === 'not_available') {
that.error = 'waitlisted'; that.error = 'waitlisted';
} else { } else {
that.error = response.error; that.error = response.error;
setTimeout(() => {
const urlParams = new URLSearchParams(window.location.search);
window.location.assign(window.location.toString().replace(`?cash_request_id=${urlParams.get('cash_request_id')}`, ``));
}, 3000);
} }
} }
}); });
@ -259,14 +266,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
selectedOptionChanged(event) { selectedOptionChanged(event) {
this.choosenOption = event.target.id; this.choosenOption = event.target.id;
} }
restart() {
this.step = 'cta';
this.choosenOption = 'wait';
}
closeModal(): void { closeModal(): void {
if (this.cashAppPay) {
this.cashAppPay.destroy();
}
this.close.emit(); this.close.emit();
} }
} }

View File

@ -84,8 +84,8 @@
</div> </div>
<div class="bottom-panel"> <div class="bottom-panel">
@if (showAccelerationSummary) { @if (showAccelerationSummary && !accelerationFlowCompleted) {
<app-accelerate-checkout *ngIf="(da$ | async) as da;" [txid]="tx.txid" [eta]="mempoolPosition?.block >= 7 ? null : da.adjustedTimeAvg * (mempoolPosition.block + 1) + now + da.timeOffset" (close)="showAccelerationSummary = false" [scrollEvent]="scrollIntoAccelPreview" class="h-100 w-100"></app-accelerate-checkout> <app-accelerate-checkout *ngIf="(da$ | async) as da;" [txid]="tx.txid" [eta]="mempoolPosition?.block >= 7 ? null : da.adjustedTimeAvg * (mempoolPosition.block + 1) + now + da.timeOffset" (close)="accelerationFlowCompleted = true" [scrollEvent]="scrollIntoAccelPreview" class="h-100 w-100"></app-accelerate-checkout>
} @else { } @else {
@if (tx?.acceleration && !tx.status?.confirmed) { @if (tx?.acceleration && !tx.status?.confirmed) {
<div class="progress-icon"> <div class="progress-icon">

View File

@ -19,11 +19,9 @@ import { WebsocketService } from '../../services/websocket.service';
import { AudioService } from '../../services/audio.service'; import { AudioService } from '../../services/audio.service';
import { ApiService } from '../../services/api.service'; import { ApiService } from '../../services/api.service';
import { SeoService } from '../../services/seo.service'; import { SeoService } from '../../services/seo.service';
import { StorageService } from '../../services/storage.service';
import { seoDescriptionNetwork } from '../../shared/common.utils'; import { seoDescriptionNetwork } from '../../shared/common.utils';
import { Filter } from '../../shared/filters.utils'; import { Filter } from '../../shared/filters.utils';
import { BlockExtended, CpfpInfo, RbfTree, MempoolPosition, DifficultyAdjustment, Acceleration } from '../../interfaces/node-api.interface'; import { BlockExtended, CpfpInfo, RbfTree, MempoolPosition, DifficultyAdjustment, Acceleration } from '../../interfaces/node-api.interface';
import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pipe';
import { PriceService } from '../../services/price.service'; import { PriceService } from '../../services/price.service';
import { ServicesApiServices } from '../../services/services-api.service'; import { ServicesApiServices } from '../../services/services-api.service';
import { EnterpriseService } from '../../services/enterprise.service'; import { EnterpriseService } from '../../services/enterprise.service';
@ -111,6 +109,7 @@ export class TrackerComponent implements OnInit, OnDestroy {
acceleratorAvailable: boolean = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === ''; acceleratorAvailable: boolean = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === '';
accelerationEligible: boolean = false; accelerationEligible: boolean = false;
showAccelerationSummary = false; showAccelerationSummary = false;
accelerationFlowCompleted = false;
scrollIntoAccelPreview = false; scrollIntoAccelPreview = false;
auditEnabled: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true; auditEnabled: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true;