@forgeroute/ui 0.5.2 → 0.5.4

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.
@@ -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, isFinalPaymentRefusal, paymentErrorLabelKey, 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, isAwaitingVerificationError, isDarkPage, isFinalPaymentRefusal, paymentErrorLabelKey, 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";
@@ -664,7 +664,7 @@ var SquarePaymentComponent = class SquarePaymentComponent {
664
664
  attemptKey: this.attempt.key(),
665
665
  reason
666
666
  });
667
- this.fail(squareFailure(reason, this.labels.t(refusalLabelKey(reason)), "validate"));
667
+ this.fail(squareFailure(reason, this.labels.t(this.readiness.labelKeyFor(reason)), "validate"));
668
668
  return true;
669
669
  }
670
670
  if (this.attempt.inFlight()) return true;
@@ -3232,7 +3232,7 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
3232
3232
  const kind = classifyHostError(err);
3233
3233
  if (kind === "unknown") return {
3234
3234
  kind: "unknown",
3235
- reason: "host_error"
3235
+ reason: isAwaitingVerificationError(err) ? "microdeposits" : "host_error"
3236
3236
  };
3237
3237
  const labelKey = paymentErrorLabelKey(err);
3238
3238
  const message = labelKey ? this.labels.t(labelKey) : hostErrorMessage(err, this.labels.t("squarePaymentMethod.paymentFailed"));
@@ -3298,7 +3298,7 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
3298
3298
  refused(ctx) {
3299
3299
  if (!this.readiness.passSync()) {
3300
3300
  const reason = this.readiness.reasons()[0] ?? "checking";
3301
- const message = this.labels.t(refusalLabelKey(reason));
3301
+ const message = this.labels.t(this.readiness.labelKeyFor(reason));
3302
3302
  this.error.set(message);
3303
3303
  ctx.report("refused", { message });
3304
3304
  ctx.announce(message);
@@ -3323,11 +3323,14 @@ var PaymentSquareBodyComponent = class PaymentSquareBodyComponent {
3323
3323
  } else if (outcome.kind === "unknown") {
3324
3324
  this.payAmount = this.attempt.pinnedAmount() ?? this.payAmount;
3325
3325
  this.payMethod = this.attempt.pinnedMethod() ?? this.payMethod;
3326
- const message = this.labels.t(outcome.reason === "offline" ? "paymentAttempt.offlineInFlight" : outcome.reason === "timeout" ? "paymentAttempt.timeout" : "paymentAttempt.checking");
3326
+ const message = this.labels.t(outcome.reason === "offline" ? "paymentAttempt.offlineInFlight" : outcome.reason === "timeout" ? "paymentAttempt.timeout" : outcome.reason === "microdeposits" || this.attempt.awaitingVerification() ? "paymentAttempt.awaitingVerification" : "paymentAttempt.checking");
3327
3327
  ctx.report("unknown", { message });
3328
3328
  ctx.announce(message);
3329
- } else if (outcome.kind === "refused") ctx.report("refused", { message: this.labels.t(refusalLabelKey(outcome.reason ?? "")) });
3330
- else if (outcome.kind === "succeeded" && outcome.reason === "other_tab") ctx.report("paid_elsewhere", {
3329
+ } else if (outcome.kind === "refused") {
3330
+ const refusedReason = outcome.reason ?? "";
3331
+ const refusedKey = refusedReason === "unknown" && this.attempt.awaitingVerification() ? "paymentAttempt.awaitingVerification" : this.readiness.labelKeyFor(refusedReason);
3332
+ ctx.report("refused", { message: this.labels.t(refusedKey) });
3333
+ } else if (outcome.kind === "succeeded" && outcome.reason === "other_tab") ctx.report("paid_elsewhere", {
3331
3334
  message: this.labels.t("paymentAttempt.paid"),
3332
3335
  attemptKey: outcome.attemptKey,
3333
3336
  ...outcome.method !== void 0 ? { paid: {