@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, ViewEncapsulation, afterNextRender, computed, effect, forwardRef, inject, input, isDevMode, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
-
import { AlertComponent, BadgeComponent, ButtonComponent, CheckboxComponent, DetailCardComponent, FormRowComponent, FormSectionComponent, HintComponent, KpiCardComponent, LiveRegionComponent, ModalComponent, 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, SelectComponent, SkeletonComponent, StackComponent, TextComponent, TextInputComponent, UiLabelsService, callHost, classifyHostError, createPaymentProtection, formatCurrency, hostErrorMessage, refusalLabelKey, uiText, warnQueuedPayment, wasQueuedOffline } from "@forgeroute/ui";
|
|
3
|
+
import { AlertComponent, BadgeComponent, ButtonComponent, CheckboxComponent, DetailCardComponent, FormRowComponent, FormSectionComponent, HintComponent, KpiCardComponent, LiveRegionComponent, ModalComponent, 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, SelectComponent, SkeletonComponent, StackComponent, TextComponent, TextInputComponent, UiLabelsService, callHost, classifyHostError, createPaymentProtection, formatCurrency, hostErrorMessage, isFinalPaymentRefusal, paymentErrorLabelKey, refusalLabelKey, uiText, warnQueuedPayment, wasQueuedOffline } from "@forgeroute/ui";
|
|
4
4
|
import * as i1 from "@angular/forms";
|
|
5
5
|
import { FormsModule } from "@angular/forms";
|
|
6
6
|
import { NgTemplateOutlet } from "@angular/common";
|
|
@@ -2719,6 +2719,7 @@ var PaymentQboBodyComponent = class PaymentQboBodyComponent {
|
|
|
2719
2719
|
this.processing = signal(false, ...ngDevMode ? [{ debugName: "processing" }] : /* istanbul ignore next */ []);
|
|
2720
2720
|
this.done = signal(false, ...ngDevMode ? [{ debugName: "done" }] : /* istanbul ignore next */ []);
|
|
2721
2721
|
this.error = signal("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
2722
|
+
this.finalRefusal = signal(null, ...ngDevMode ? [{ debugName: "finalRefusal" }] : /* istanbul ignore next */ []);
|
|
2722
2723
|
this.estimate = signal(null, ...ngDevMode ? [{ debugName: "estimate" }] : /* istanbul ignore next */ []);
|
|
2723
2724
|
this.estimating = signal(false, ...ngDevMode ? [{ debugName: "estimating" }] : /* istanbul ignore next */ []);
|
|
2724
2725
|
this.estimateError = signal("", ...ngDevMode ? [{ debugName: "estimateError" }] : /* istanbul ignore next */ []);
|
|
@@ -2820,6 +2821,15 @@ var PaymentQboBodyComponent = class PaymentQboBodyComponent {
|
|
|
2820
2821
|
const amount = this.amountValue();
|
|
2821
2822
|
if (amount != null) untracked(() => this.lastAmount.set(amount));
|
|
2822
2823
|
});
|
|
2824
|
+
effect(() => {
|
|
2825
|
+
const scope = this.finalRefusal();
|
|
2826
|
+
if (!scope) return;
|
|
2827
|
+
const ctx = this.ctx();
|
|
2828
|
+
if (ctx.method !== scope.method || ctx.amount !== scope.amount || this.config().payableRef() !== scope.ref) untracked(() => {
|
|
2829
|
+
this.finalRefusal.set(null);
|
|
2830
|
+
this.error.set("");
|
|
2831
|
+
});
|
|
2832
|
+
});
|
|
2823
2833
|
effect(() => {
|
|
2824
2834
|
const ctx = this.ctx();
|
|
2825
2835
|
const processing = this.processing();
|
|
@@ -2829,12 +2839,13 @@ var PaymentQboBodyComponent = class PaymentQboBodyComponent {
|
|
|
2829
2839
|
const estimateFailed = !!this.estimateError();
|
|
2830
2840
|
const unknown = this.attempt.unknown();
|
|
2831
2841
|
const paidLocked = this.attempt.paidLocked();
|
|
2842
|
+
const finalRefusal = !!this.finalRefusal();
|
|
2832
2843
|
const gateReady = this.readiness.ready();
|
|
2833
2844
|
const label = notice ? this.labels.t("common.done") : ctx.amount != null ? `${this.labels.t("qboPaymentMethod.pay")} ${formatCurrency(this.total(), { currency: ctx.currency })}` : this.labels.t("qboPaymentMethod.pay");
|
|
2834
2845
|
untracked(() => ctx.setPrimary({
|
|
2835
2846
|
label,
|
|
2836
2847
|
loading: processing && !notice,
|
|
2837
|
-
disabled: notice ? done : processing || estimating || estimateFailed || ctx.amount == null || done || unknown || paidLocked || !gateReady,
|
|
2848
|
+
disabled: notice ? done : processing || estimating || estimateFailed || ctx.amount == null || done || unknown || paidLocked || finalRefusal || !gateReady,
|
|
2838
2849
|
onClick: () => notice ? this.finish() : void this.pay()
|
|
2839
2850
|
}));
|
|
2840
2851
|
});
|
|
@@ -2968,7 +2979,13 @@ var PaymentQboBodyComponent = class PaymentQboBodyComponent {
|
|
|
2968
2979
|
kind: "unknown",
|
|
2969
2980
|
reason: "host_error"
|
|
2970
2981
|
};
|
|
2971
|
-
const
|
|
2982
|
+
const labelKey = paymentErrorLabelKey(err);
|
|
2983
|
+
const message = labelKey ? this.labels.t(labelKey) : hostErrorMessage(err, this.labels.t("qboPaymentMethod.paymentFailed"));
|
|
2984
|
+
if (live() && isFinalPaymentRefusal(err)) this.finalRefusal.set({
|
|
2985
|
+
method: attemptMethod,
|
|
2986
|
+
ref: this.config().payableRef(),
|
|
2987
|
+
amount: attemptAmount
|
|
2988
|
+
});
|
|
2972
2989
|
if (kind === "not_sent") {
|
|
2973
2990
|
if (live()) {
|
|
2974
2991
|
this.error.set(message);
|