@forgeroute/ui 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/forgeroute-ui-quickbooks.mjs +20 -3
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs +20 -3
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +42 -16
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-ui-labels.es-C1Meg25h.mjs → forgeroute-ui-ui-labels.es-OIkNyhI5.mjs} +7 -1
- package/fesm2022/{forgeroute-ui-ui-labels.es-C1Meg25h.mjs.map → forgeroute-ui-ui-labels.es-OIkNyhI5.mjs.map} +1 -1
- package/fesm2022/forgeroute-ui.mjs +49 -4
- package/fesm2022/forgeroute-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui.d.ts +26 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, Injector, PLATFORM_ID, ViewEncapsulation, afterNextRender, computed, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
-
import { AlertComponent, BadgeComponent, ButtonComponent, CheckboxComponent, DetailCardComponent, HintComponent, KpiCardComponent, LiveRegionComponent, ModalComponent, PAYMENT_AUTH_TIMEOUT_MS, PAYMENT_HOST_SILENCE_MS, PAYMENT_METHOD_PLUGIN, PAYMENT_READINESS_EVERY_MS, PAYMENT_READINESS_TIMEOUT_MS, PAYMENT_REQUEST_TIMEOUT_MS, PAYMENT_STATUS_CHECK_TIMEOUT_MS, PAYMENT_STATUS_FAIL_GRACE_MS, PAYMENT_STATUS_POLL_MAX_MS, PAYMENT_STATUS_POLL_MS, PaymentAttemptStatusComponent, PaymentMethodPlugin, PillTabsComponent, SkeletonComponent, StackComponent, TextComponent, TextInputComponent, UiLabelsService, callHost, classifyHostError, createPaymentProtection, formatCurrency, hostErrorMessage, isDarkPage, refusalLabelKey, uiText, warnQueuedPayment, wasQueuedOffline } from "@forgeroute/ui";
|
|
3
|
+
import { AlertComponent, BadgeComponent, ButtonComponent, CheckboxComponent, DetailCardComponent, HintComponent, KpiCardComponent, LiveRegionComponent, ModalComponent, PAYMENT_AUTH_TIMEOUT_MS, PAYMENT_HOST_SILENCE_MS, PAYMENT_METHOD_PLUGIN, PAYMENT_READINESS_EVERY_MS, PAYMENT_READINESS_TIMEOUT_MS, PAYMENT_REQUEST_TIMEOUT_MS, PAYMENT_STATUS_CHECK_TIMEOUT_MS, PAYMENT_STATUS_FAIL_GRACE_MS, PAYMENT_STATUS_POLL_MAX_MS, PAYMENT_STATUS_POLL_MS, PaymentAttemptStatusComponent, PaymentMethodPlugin, PillTabsComponent, SkeletonComponent, StackComponent, TextComponent, TextInputComponent, UiLabelsService, callHost, classifyHostError, createPaymentProtection, formatCurrency, hostErrorMessage, isDarkPage, isFinalPaymentRefusal, paymentErrorLabelKey, refusalLabelKey, uiText, warnQueuedPayment, wasQueuedOffline } from "@forgeroute/ui";
|
|
4
4
|
import { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
|
|
5
5
|
import * as i1 from "@angular/forms";
|
|
6
6
|
import { FormsModule } from "@angular/forms";
|
|
@@ -2946,6 +2946,7 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
|
|
|
2946
2946
|
this.processing = signal(false, ...ngDevMode ? [{ debugName: "processing" }] : /* istanbul ignore next */ []);
|
|
2947
2947
|
this.done = signal(false, ...ngDevMode ? [{ debugName: "done" }] : /* istanbul ignore next */ []);
|
|
2948
2948
|
this.error = signal("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
2949
|
+
this.finalRefusal = signal(null, ...ngDevMode ? [{ debugName: "finalRefusal" }] : /* istanbul ignore next */ []);
|
|
2949
2950
|
this.estimate = signal(null, ...ngDevMode ? [{ debugName: "estimate" }] : /* istanbul ignore next */ []);
|
|
2950
2951
|
this.estimating = signal(false, ...ngDevMode ? [{ debugName: "estimating" }] : /* istanbul ignore next */ []);
|
|
2951
2952
|
this.estimateError = signal("", ...ngDevMode ? [{ debugName: "estimateError" }] : /* istanbul ignore next */ []);
|
|
@@ -3050,6 +3051,15 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
|
|
|
3050
3051
|
const amount = this.amountValue();
|
|
3051
3052
|
if (amount != null) untracked(() => this.lastAmount.set(amount));
|
|
3052
3053
|
});
|
|
3054
|
+
effect(() => {
|
|
3055
|
+
const scope = this.finalRefusal();
|
|
3056
|
+
if (!scope) return;
|
|
3057
|
+
const ctx = this.ctx();
|
|
3058
|
+
if (ctx.method !== scope.method || ctx.amount !== scope.amount || this.config().payableRef() !== scope.ref) untracked(() => {
|
|
3059
|
+
this.finalRefusal.set(null);
|
|
3060
|
+
this.error.set("");
|
|
3061
|
+
});
|
|
3062
|
+
});
|
|
3053
3063
|
effect(() => {
|
|
3054
3064
|
const ctx = this.ctx();
|
|
3055
3065
|
const processing = this.processing();
|
|
@@ -3060,12 +3070,13 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
|
|
|
3060
3070
|
const estimateFailed = !!this.estimateError();
|
|
3061
3071
|
const unknown = this.attempt.unknown();
|
|
3062
3072
|
const paidLocked = this.attempt.paidLocked();
|
|
3073
|
+
const finalRefusal = !!this.finalRefusal();
|
|
3063
3074
|
const gateReady = this.readiness.ready();
|
|
3064
3075
|
const label = notice ? this.labels.t("common.done") : ctx.amount != null ? `${this.labels.t("squarePaymentMethod.pay")} ${formatCurrency(this.total(), { currency: ctx.currency })}` : this.labels.t("squarePaymentMethod.pay");
|
|
3065
3076
|
untracked(() => ctx.setPrimary({
|
|
3066
3077
|
label,
|
|
3067
3078
|
loading: processing && !notice,
|
|
3068
|
-
disabled: notice ? done : !ready || processing || estimating || estimateFailed || ctx.amount == null || done || unknown || paidLocked || !gateReady,
|
|
3079
|
+
disabled: notice ? done : !ready || processing || estimating || estimateFailed || ctx.amount == null || done || unknown || paidLocked || finalRefusal || !gateReady,
|
|
3069
3080
|
onClick: () => notice ? this.finish() : void this.pay()
|
|
3070
3081
|
}));
|
|
3071
3082
|
});
|
|
@@ -3223,7 +3234,13 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
|
|
|
3223
3234
|
kind: "unknown",
|
|
3224
3235
|
reason: "host_error"
|
|
3225
3236
|
};
|
|
3226
|
-
const
|
|
3237
|
+
const labelKey = paymentErrorLabelKey(err);
|
|
3238
|
+
const message = labelKey ? this.labels.t(labelKey) : hostErrorMessage(err, this.labels.t("squarePaymentMethod.paymentFailed"));
|
|
3239
|
+
if (live() && isFinalPaymentRefusal(err)) this.finalRefusal.set({
|
|
3240
|
+
method: attemptMethod,
|
|
3241
|
+
ref: this.config().payableRef(),
|
|
3242
|
+
amount: attemptAmount
|
|
3243
|
+
});
|
|
3227
3244
|
if (kind === "not_sent") {
|
|
3228
3245
|
if (live()) {
|
|
3229
3246
|
this.error.set(message);
|