From 96d85dcacd865d96c609ea870c76ade820172216 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Tue, 16 Apr 2024 16:56:37 +0900 Subject: [PATCH] [accelerator] polish pizza accel x2 --- .../accelerate-checkout.component.html | 2 +- .../accelerate-checkout.component.ts | 26 +++++++++---------- .../components/tracker/tracker.component.html | 4 +-- .../components/tracker/tracker.component.ts | 3 +-- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html index cd19e2809..552e64d1e 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html @@ -104,7 +104,7 @@
Changed your mind? - +
} diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts index 961afdae7..cc5d0f821 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts @@ -62,7 +62,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy { this.estimate(); } }); - } ngOnDestroy() { @@ -97,7 +96,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy { } } - /** + /** * Accelerator */ estimate() { @@ -173,8 +172,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy { this.payments = window.Square.payments(this.square.appId, this.square.locationId) await this.requestCashAppPayment(); } catch (e) { - console.error(e); - this.error = 'Error loading Square Payments'; + console.debug('Error loading Square Payments', e); return; } } @@ -189,7 +187,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy { this.conversionsSubscription = this.stateService.conversions$.subscribe( async (conversions) => { if (this.cashAppPay) { - await this.cashAppPay.destroy(); + this.cashAppPay.destroy(); } const redirectHostname = document.location.hostname === 'localhost' ? `http://localhost:4200`: `https://${document.location.hostname}`; @@ -231,13 +229,22 @@ export class AccelerateCheckout implements OnInit, OnDestroy { ).subscribe({ next: () => { that.audioService.playSound('ascend-chime-cartoon'); - that.closeModal(); + if (that.cashAppPay) { + that.cashAppPay.destroy(); + } + setTimeout(() => { + that.closeModal(); + }, 1000); }, error: (response) => { if (response.status === 403 && response.error === 'not_available') { that.error = 'waitlisted'; } else { 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) { this.choosenOption = event.target.id; } - restart() { - this.step = 'cta'; - this.choosenOption = 'wait'; - } closeModal(): void { - if (this.cashAppPay) { - this.cashAppPay.destroy(); - } this.close.emit(); } } diff --git a/frontend/src/app/components/tracker/tracker.component.html b/frontend/src/app/components/tracker/tracker.component.html index 73a1800db..c75e6fec6 100644 --- a/frontend/src/app/components/tracker/tracker.component.html +++ b/frontend/src/app/components/tracker/tracker.component.html @@ -84,8 +84,8 @@
- @if (showAccelerationSummary) { - + @if (showAccelerationSummary && !accelerationFlowCompleted) { + } @else { @if (tx?.acceleration && !tx.status?.confirmed) {
diff --git a/frontend/src/app/components/tracker/tracker.component.ts b/frontend/src/app/components/tracker/tracker.component.ts index 05bb0d097..484aa0070 100644 --- a/frontend/src/app/components/tracker/tracker.component.ts +++ b/frontend/src/app/components/tracker/tracker.component.ts @@ -19,11 +19,9 @@ import { WebsocketService } from '../../services/websocket.service'; import { AudioService } from '../../services/audio.service'; import { ApiService } from '../../services/api.service'; import { SeoService } from '../../services/seo.service'; -import { StorageService } from '../../services/storage.service'; import { seoDescriptionNetwork } from '../../shared/common.utils'; import { Filter } from '../../shared/filters.utils'; 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 { ServicesApiServices } from '../../services/services-api.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 === ''; accelerationEligible: boolean = false; showAccelerationSummary = false; + accelerationFlowCompleted = false; scrollIntoAccelPreview = false; auditEnabled: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true;