@forgeroute/ui 0.5.2 → 0.5.3

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.
@@ -453,6 +453,9 @@ const STRIPE_A11Y_MESSAGES = {
453
453
  get verificationNeeded() {
454
454
  return uiText("stripePayment.a11y.verificationNeeded");
455
455
  },
456
+ get verificationNeededSetup() {
457
+ return uiText("stripePayment.a11y.verificationNeededSetup");
458
+ },
456
459
  get actionRequired() {
457
460
  return uiText("stripePayment.a11y.actionRequired");
458
461
  }
@@ -728,7 +731,7 @@ var StripePaymentComponent = class StripePaymentComponent {
728
731
  attemptKey: this.attempt.key(),
729
732
  reason
730
733
  });
731
- this.fail(failure(reason, this.labels.t(refusalLabelKey(reason)), "submit"));
734
+ this.fail(failure(reason, this.labels.t(this.readiness.labelKeyFor(reason)), "submit"));
732
735
  return null;
733
736
  }
734
737
  if (this.attempt.paidLocked() || this.attempt.unknown()) {
@@ -768,6 +771,11 @@ var StripePaymentComponent = class StripePaymentComponent {
768
771
  reason: "auth_required"
769
772
  };
770
773
  }
774
+ if (event.outcome === "requires_verification") return {
775
+ kind: "unknown",
776
+ value: event,
777
+ reason: "microdeposits"
778
+ };
771
779
  return {
772
780
  kind: "success",
773
781
  value: event
@@ -1144,7 +1152,7 @@ var StripePaymentComponent = class StripePaymentComponent {
1144
1152
  case "succeeded": return event.kind === "setup" ? m.methodSaved : m.paymentReceived;
1145
1153
  case "processing": return m.paymentProcessing;
1146
1154
  case "requires_capture": return m.paymentAuthorized;
1147
- case "requires_verification": return m.verificationNeeded;
1155
+ case "requires_verification": return event.kind === "setup" ? m.verificationNeededSetup : m.verificationNeeded;
1148
1156
  default: return m.actionRequired;
1149
1157
  }
1150
1158
  }
@@ -2750,6 +2758,7 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
2750
2758
  this.stripeError = signal("", ...ngDevMode ? [{ debugName: "stripeError" }] : /* istanbul ignore next */ []);
2751
2759
  this.failedAttempts = 0;
2752
2760
  this.formHidden = computed(() => this.readOnly() || this.statusOnly(), ...ngDevMode ? [{ debugName: "formHidden" }] : /* istanbul ignore next */ []);
2761
+ this.paymentNotStarted = computed(() => !!this.clientSecret() && this.flow() === "payment" && !this.stepsText().trim(), ...ngDevMode ? [{ debugName: "paymentNotStarted" }] : /* istanbul ignore next */ []);
2753
2762
  this.heading = computed(() => this.title() || (this.isProcessing() ? this.copy.processingTitle : this.copy.title), ...ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []);
2754
2763
  this.bankLine = computed(() => {
2755
2764
  const bank = this.bankName().trim();
@@ -3029,6 +3038,9 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
3029
3038
  @if (bankLine(); as line) { <strong data-testid="bank-pending-bank">{{ line }}</strong> }
3030
3039
  <ui-badge [label]="labels.t('stripeMicrodepositVerify.pending')" variant="yellow" data-testid="bank-pending-badge" />
3031
3040
  </div>
3041
+ @if (paymentNotStarted()) {
3042
+ <ui-text size="sm" data-testid="bank-pending-not-started" [text]="labels.t('stripeMicrodepositVerify.paymentNotStarted')" />
3043
+ }
3032
3044
  @if (stepsText().trim()) {
3033
3045
  <ui-text size="sm" [text]="stepsText()" data-testid="bank-pending-steps" />
3034
3046
  } @else if (isProcessing()) {
@@ -3291,6 +3303,9 @@ i0.ɵɵngDeclareClassMetadata({
3291
3303
  @if (bankLine(); as line) { <strong data-testid="bank-pending-bank">{{ line }}</strong> }
3292
3304
  <ui-badge [label]="labels.t('stripeMicrodepositVerify.pending')" variant="yellow" data-testid="bank-pending-badge" />
3293
3305
  </div>
3306
+ @if (paymentNotStarted()) {
3307
+ <ui-text size="sm" data-testid="bank-pending-not-started" [text]="labels.t('stripeMicrodepositVerify.paymentNotStarted')" />
3308
+ }
3294
3309
  @if (stepsText().trim()) {
3295
3310
  <ui-text size="sm" [text]="stepsText()" data-testid="bank-pending-steps" />
3296
3311
  } @else if (isProcessing()) {
@@ -4406,9 +4421,6 @@ const STRIPE_METHOD_TEXTS = {
4406
4421
  return uiText("stripePaymentMethod.achTitle");
4407
4422
  },
4408
4423
  achMessage: (amount) => uiText("stripePaymentMethod.achMessage", { amount }),
4409
- get verificationTitle() {
4410
- return uiText("stripePaymentMethod.verificationTitle");
4411
- },
4412
4424
  verificationMessage: (amount) => uiText("stripePaymentMethod.verificationMessage", { amount }),
4413
4425
  get receiptNote() {
4414
4426
  return uiText("stripePaymentMethod.receiptNote");
@@ -4533,7 +4545,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
4533
4545
  }));
4534
4546
  } catch (err) {
4535
4547
  const labelKey = paymentErrorLabelKey(err);
4536
- if (isFinalPaymentRefusal(err)) this.finalRefusal.set({
4548
+ if (isFinalPaymentRefusal(err) && (!context?.attemptKey || attempt?.isLive(context.attemptKey))) this.finalRefusal.set({
4537
4549
  method: ctx.method,
4538
4550
  ref: this.config().payableRef(),
4539
4551
  amount
@@ -4775,11 +4787,15 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
4775
4787
  } else if (outcome.kind === "unknown") {
4776
4788
  this.payAmount = this.payment()?.attempt.pinnedAmount() ?? this.payAmount;
4777
4789
  this.payMethod = this.payment()?.attempt.pinnedMethod() ?? this.payMethod;
4778
- const message = this.labels.t(outcome.reason === "offline" ? "paymentAttempt.offlineInFlight" : outcome.reason === "auth_abandoned" ? "paymentAttempt.authAbandoned" : outcome.reason === "timeout" ? "paymentAttempt.timeout" : "paymentAttempt.checking");
4790
+ if (outcome.reason === "microdeposits") return;
4791
+ const message = this.labels.t(outcome.reason === "offline" ? "paymentAttempt.offlineInFlight" : outcome.reason === "auth_abandoned" ? "paymentAttempt.authAbandoned" : outcome.reason === "timeout" ? "paymentAttempt.timeout" : this.payment()?.attempt.awaitingVerification() ? "paymentAttempt.awaitingVerification" : "paymentAttempt.checking");
4779
4792
  ctx.report("unknown", { message });
4780
4793
  ctx.announce(message);
4781
- } else if (outcome.kind === "refused") ctx.report("refused", { message: this.labels.t(refusalLabelKey(outcome.reason ?? "")) });
4782
- else if (outcome.kind === "succeeded" && outcome.reason === "other_tab") ctx.report("paid_elsewhere", {
4794
+ } else if (outcome.kind === "refused") {
4795
+ const refusedReason = outcome.reason ?? "";
4796
+ const refusedKey = refusedReason === "unknown" && this.payment()?.attempt.awaitingVerification() ? "paymentAttempt.awaitingVerification" : this.payment()?.readiness.labelKeyFor(refusedReason) ?? refusalLabelKey(refusedReason);
4797
+ ctx.report("refused", { message: this.labels.t(refusedKey) });
4798
+ } else if (outcome.kind === "succeeded" && outcome.reason === "other_tab") ctx.report("paid_elsewhere", {
4783
4799
  message: this.labels.t("paymentAttempt.paid"),
4784
4800
  attemptKey: outcome.attemptKey,
4785
4801
  ...outcome.method !== void 0 ? { paid: {
@@ -4879,8 +4895,9 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
4879
4895
  const verification = event.outcome === "requires_verification";
4880
4896
  ctx.report(finalizeFailed ? "finalize-failed" : verification ? "verification" : "processing", { result });
4881
4897
  this.confirmation.set(verification ? {
4882
- title: this.texts.verificationTitle,
4883
- message: this.texts.verificationMessage(money)
4898
+ title: "",
4899
+ message: this.texts.verificationMessage(money),
4900
+ verification: true
4884
4901
  } : {
4885
4902
  title: this.texts.achTitle,
4886
4903
  message: this.texts.achMessage(money)
@@ -4952,9 +4969,11 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
4952
4969
  template: `
4953
4970
  <div class="psm">
4954
4971
  @if (confirmation(); as notice) {
4955
- <ui-alert variant="success" [title]="notice.title" tabindex="-1" class="psm-notice" data-testid="stripe-method-confirmation">
4972
+ <ui-alert [variant]="notice.verification ? 'warning' : 'success'" [title]="notice.title" tabindex="-1" class="psm-notice" data-testid="stripe-method-confirmation">
4956
4973
  <p>{{ notice.message }}</p>
4957
- <p>{{ receiptNote() }}</p>
4974
+ @if (!notice.verification) {
4975
+ <p>{{ receiptNote() }}</p>
4976
+ }
4958
4977
  </ui-alert>
4959
4978
  } @else {
4960
4979
  @if (ctx().amount == null) {
@@ -5185,9 +5204,11 @@ i0.ɵɵngDeclareClassMetadata({
5185
5204
  template: `
5186
5205
  <div class="psm">
5187
5206
  @if (confirmation(); as notice) {
5188
- <ui-alert variant="success" [title]="notice.title" tabindex="-1" class="psm-notice" data-testid="stripe-method-confirmation">
5207
+ <ui-alert [variant]="notice.verification ? 'warning' : 'success'" [title]="notice.title" tabindex="-1" class="psm-notice" data-testid="stripe-method-confirmation">
5189
5208
  <p>{{ notice.message }}</p>
5190
- <p>{{ receiptNote() }}</p>
5209
+ @if (!notice.verification) {
5210
+ <p>{{ receiptNote() }}</p>
5211
+ }
5191
5212
  </ui-alert>
5192
5213
  } @else {
5193
5214
  @if (ctx().amount == null) {