@forgeroute/ui 0.4.71 → 0.4.72

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,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
- import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injectable, InjectionToken, Injector, PLATFORM_ID, ViewEncapsulation, afterNextRender, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injectable, InjectionToken, Injector, PLATFORM_ID, ViewEncapsulation, afterNextRender, computed, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
3
3
  import { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
4
- import { AlertComponent, BadgeComponent, ButtonComponent, DetailCardComponent, FormRowComponent, FormSectionComponent, ModalComponent, SkeletonComponent, StackComponent, TextComponent, TextInputComponent } from "@forgeroute/ui";
4
+ import { AlertComponent, BadgeComponent, ButtonComponent, DetailCardComponent, FormRowComponent, FormSectionComponent, HintComponent, KpiCardComponent, ModalComponent, PAYMENT_METHOD_PLUGIN, PaymentMethodPlugin, SkeletonComponent, StackComponent, TextComponent, TextInputComponent, callHost, formatCurrency } from "@forgeroute/ui";
5
5
  import * as i1 from "@angular/forms";
6
6
  import { FormsModule } from "@angular/forms";
7
7
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
@@ -2511,6 +2511,7 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
2511
2511
  "label",
2512
2512
  "ariaLabel",
2513
2513
  "inputTestId",
2514
+ "inputName",
2514
2515
  "placeholder",
2515
2516
  "prefix",
2516
2517
  "revealable",
@@ -3650,6 +3651,893 @@ i0.ɵɵngDeclareClassMetadata({
3650
3651
  }]
3651
3652
  }
3652
3653
  });
3653
- export { MICRODEPOSIT_COPY, MicrodepositVerifyComponent, STRIPE_A11Y_MESSAGES, STRIPE_ACH_NOTICE, STRIPE_DEFAULT_ERROR_MESSAGE, STRIPE_ERROR_MESSAGES, STRIPE_LOADER, STRIPE_PAYMENT_DEFAULTS, STRIPE_TECHNICAL_ERROR_MESSAGES, StripeConnectComponent, StripeConnectFlow, StripePaymentComponent, StripePaymentService, buildLoadOptions, defaultStripeLoader, depositAmountError, descriptorCodeError, getStripeErrorMessage, isDarkPage, isStripeUrl, microdepositArrivalText, microdepositCancelMessage, microdepositKeepsActiveText, microdepositProcessingText, microdepositStepsText, normalizeDescriptorCode, normalizeIntent, outcomeOf, paymentMethodIdOf, provideStripePayment, readStripeAppearance, readStripeReturnParams, retrieveIntent, stripeConnectNotice, verificationOf, verifyMicrodeposits };
3654
+ const STRIPE_PAYMENT_METHODS = [{
3655
+ value: "CARD",
3656
+ label: "Card"
3657
+ }, {
3658
+ value: "ACH",
3659
+ label: "ACH / Bank Transfer"
3660
+ }];
3661
+ const stripeMethodType = (method) => method === "ACH" ? "us_bank_account" : "card";
3662
+ const STRIPE_METHOD_TEXTS = {
3663
+ amountNeeded: "Enter an amount to continue.",
3664
+ notCompleted: "Payment was not completed. Please try again or choose another method.",
3665
+ achTitle: "ACH Payment Submitted",
3666
+ achMessage: (amount) => `Your bank payment of ${amount} has been submitted for processing. ACH payments typically take 3–5 business days to complete.`,
3667
+ verificationTitle: "Bank Verification Needed",
3668
+ verificationMessage: (amount) => `Your bank payment of ${amount} was submitted. The bank account must be verified with the small deposits Stripe sends, then the payment completes.`,
3669
+ receiptNote: "A receipt is sent once the payment has been fully processed and settled."
3670
+ };
3671
+ const WALLETS = {
3672
+ applePay: "never",
3673
+ googlePay: "never"
3674
+ };
3675
+ const FIELDS = { billingDetails: { address: {
3676
+ country: "auto",
3677
+ postalCode: "auto"
3678
+ } } };
3679
+ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
3680
+ constructor() {
3681
+ this.injector = inject(Injector);
3682
+ this.host = inject(ElementRef);
3683
+ this.ctx = input.required(...ngDevMode ? [{ debugName: "ctx" }] : /* istanbul ignore next */ []);
3684
+ this.config = input.required(...ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []);
3685
+ this.payment = viewChild(StripePaymentComponent, ...ngDevMode ? [{ debugName: "payment" }] : /* istanbul ignore next */ []);
3686
+ this.texts = STRIPE_METHOD_TEXTS;
3687
+ this.wallets = WALLETS;
3688
+ this.fields = FIELDS;
3689
+ this.complete = signal(false, ...ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []);
3690
+ this.processing = signal(false, ...ngDevMode ? [{ debugName: "processing" }] : /* istanbul ignore next */ []);
3691
+ this.done = signal(false, ...ngDevMode ? [{ debugName: "done" }] : /* istanbul ignore next */ []);
3692
+ this.error = signal("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
3693
+ this.estimate = signal(null, ...ngDevMode ? [{ debugName: "estimate" }] : /* istanbul ignore next */ []);
3694
+ this.estimating = signal(false, ...ngDevMode ? [{ debugName: "estimating" }] : /* istanbul ignore next */ []);
3695
+ this.estimateError = signal("", ...ngDevMode ? [{ debugName: "estimateError" }] : /* istanbul ignore next */ []);
3696
+ this.estimateTick = signal(0, ...ngDevMode ? [{ debugName: "estimateTick" }] : /* istanbul ignore next */ []);
3697
+ this.intentFees = signal(null, ...ngDevMode ? [{ debugName: "intentFees" }] : /* istanbul ignore next */ []);
3698
+ this.confirmation = signal(null, ...ngDevMode ? [{ debugName: "confirmation" }] : /* istanbul ignore next */ []);
3699
+ this.lastAmount = signal(null, ...ngDevMode ? [{ debugName: "lastAmount" }] : /* istanbul ignore next */ []);
3700
+ this.intent = null;
3701
+ this.estimateRun = 0;
3702
+ this.estimateStale = false;
3703
+ this.amountValue = computed(() => this.ctx().amount, ...ngDevMode ? [{ debugName: "amountValue" }] : /* istanbul ignore next */ []);
3704
+ this.methodValue = computed(() => this.ctx().method, ...ngDevMode ? [{ debugName: "methodValue" }] : /* istanbul ignore next */ []);
3705
+ this.methodType = computed(() => stripeMethodType(this.ctx().method), ...ngDevMode ? [{ debugName: "methodType" }] : /* istanbul ignore next */ []);
3706
+ this.total = computed(() => this.estimate()?.totalAmount ?? this.lastAmount() ?? 0, ...ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []);
3707
+ this.receiptNote = computed(() => this.config().receiptNote(), ...ngDevMode ? [{ debugName: "receiptNote" }] : /* istanbul ignore next */ []);
3708
+ this.deferred = computed(() => ({
3709
+ mode: "payment",
3710
+ amount: Math.round(this.total() * 100),
3711
+ currency: this.ctx().currency.toLowerCase()
3712
+ }), ...ngDevMode ? [{ debugName: "deferred" }] : /* istanbul ignore next */ []);
3713
+ this.defaultValues = computed(() => {
3714
+ const b = this.config().billingDetails();
3715
+ return b ? { billingDetails: b } : null;
3716
+ }, ...ngDevMode ? [{ debugName: "defaultValues" }] : /* istanbul ignore next */ []);
3717
+ this.feeRows = computed(() => {
3718
+ const fees = this.intentFees() ?? this.estimate();
3719
+ const amount = this.lastAmount();
3720
+ if (!fees || amount == null || fees.stripeFee === void 0 && fees.platformFee === void 0) return [];
3721
+ const money = (n) => formatCurrency(n, { currency: this.ctx().currency });
3722
+ const rows = [{
3723
+ key: "amount",
3724
+ label: "Payment amount",
3725
+ value: money(amount)
3726
+ }];
3727
+ if (fees.stripeFee !== void 0) rows.push({
3728
+ key: "processing",
3729
+ label: `Processing fee${fees.stripeFeeLabel ? ` (${fees.stripeFeeLabel})` : ""}`,
3730
+ value: money(fees.stripeFee)
3731
+ });
3732
+ if (fees.platformFee !== void 0) rows.push({
3733
+ key: "platform",
3734
+ label: `Platform fee${fees.platformFeeLabel ? ` (${fees.platformFeeLabel})` : ""}`,
3735
+ value: money(fees.platformFee)
3736
+ });
3737
+ return rows;
3738
+ }, ...ngDevMode ? [{ debugName: "feeRows" }] : /* istanbul ignore next */ []);
3739
+ this.totalCard = computed(() => {
3740
+ const fees = this.intentFees() ?? this.estimate();
3741
+ if (!fees || this.lastAmount() == null || fees.totalAmount === void 0) return null;
3742
+ return {
3743
+ value: formatCurrency(fees.totalAmount, { currency: this.ctx().currency }),
3744
+ subtitle: "Payment amount plus fees"
3745
+ };
3746
+ }, ...ngDevMode ? [{ debugName: "totalCard" }] : /* istanbul ignore next */ []);
3747
+ this.createIntentFn = async () => {
3748
+ const create = this.config().createIntent();
3749
+ const ctx = this.ctx();
3750
+ if (!create || ctx.amount == null) throw new Error("Card payments are not available right now.");
3751
+ this.cancelIntent(true);
3752
+ const info = await callHost(() => create({
3753
+ amount: ctx.amount,
3754
+ paymentMethod: ctx.method,
3755
+ paymentMethodType: this.methodType(),
3756
+ receivedDate: ctx.receivedDate,
3757
+ notes: ctx.note || null,
3758
+ ...ctx.allocation
3759
+ }));
3760
+ if (!info?.clientSecret) throw new Error("Failed to initialize payment. Please try again.");
3761
+ this.intent = info;
3762
+ this.intentFees.set({
3763
+ stripeFee: info.stripeFee,
3764
+ platformFee: info.platformFee,
3765
+ totalAmount: info.totalAmount,
3766
+ stripeFeeLabel: info.stripeFeeLabel,
3767
+ platformFeeLabel: info.platformFeeLabel
3768
+ });
3769
+ return info.clientSecret;
3770
+ };
3771
+ effect(() => {
3772
+ const amount = this.amountValue();
3773
+ if (amount != null) untracked(() => this.lastAmount.set(amount));
3774
+ });
3775
+ effect(() => {
3776
+ const ctx = this.ctx();
3777
+ const processing = this.processing();
3778
+ const notice = this.confirmation();
3779
+ const complete = this.complete();
3780
+ const estimating = this.estimating();
3781
+ const done = this.done();
3782
+ const estimateFailed = !!this.estimateError();
3783
+ const label = notice ? "Done" : ctx.amount != null ? `Pay ${formatCurrency(this.total(), { currency: ctx.currency })}` : "Pay";
3784
+ untracked(() => ctx.setPrimary({
3785
+ label,
3786
+ loading: processing && !notice,
3787
+ disabled: notice ? done : !complete || processing || estimating || estimateFailed || ctx.amount == null || done,
3788
+ onClick: () => notice ? this.finish() : void this.pay()
3789
+ }));
3790
+ });
3791
+ effect((onCleanup) => {
3792
+ const estimate = this.config().estimateFees();
3793
+ const amount = this.amountValue();
3794
+ const method = this.methodValue();
3795
+ this.estimateTick();
3796
+ const run = ++this.estimateRun;
3797
+ untracked(() => {
3798
+ this.estimate.set(null);
3799
+ this.intentFees.set(null);
3800
+ this.estimateError.set("");
3801
+ });
3802
+ if (!estimate || amount == null) {
3803
+ untracked(() => this.estimating.set(false));
3804
+ return;
3805
+ }
3806
+ untracked(() => this.estimating.set(true));
3807
+ let hung = null;
3808
+ const failure = "Could not calculate the fees. Please try again.";
3809
+ const timer = setTimeout(async () => {
3810
+ hung = setTimeout(() => {
3811
+ if (run !== this.estimateRun) return;
3812
+ this.estimating.set(false);
3813
+ this.estimateError.set(failure);
3814
+ }, Math.max(1, this.config().estimateTimeoutMs()));
3815
+ let fees = null;
3816
+ try {
3817
+ fees = await callHost(() => estimate({
3818
+ amount,
3819
+ paymentMethod: method,
3820
+ paymentMethodType: stripeMethodType(method)
3821
+ })) ?? null;
3822
+ } catch {
3823
+ fees = null;
3824
+ }
3825
+ if (hung) {
3826
+ clearTimeout(hung);
3827
+ hung = null;
3828
+ }
3829
+ if (run !== this.estimateRun) return;
3830
+ this.estimating.set(false);
3831
+ if (this.processing()) {
3832
+ this.estimateStale = true;
3833
+ return;
3834
+ }
3835
+ if (fees) {
3836
+ this.estimate.set(fees);
3837
+ this.estimateError.set("");
3838
+ } else {
3839
+ this.estimate.set(null);
3840
+ this.estimateError.set(this.config().feesRequired() ? failure : "");
3841
+ }
3842
+ }, 300);
3843
+ onCleanup(() => {
3844
+ clearTimeout(timer);
3845
+ if (hung) clearTimeout(hung);
3846
+ });
3847
+ });
3848
+ effect(() => {
3849
+ if (this.processing()) return;
3850
+ untracked(() => {
3851
+ if (!this.estimateStale) return;
3852
+ this.estimateStale = false;
3853
+ if (!this.done() && !this.confirmation()) this.estimateTick.update((n) => n + 1);
3854
+ });
3855
+ });
3856
+ effect(() => {
3857
+ this.methodValue();
3858
+ untracked(() => {
3859
+ this.complete.set(false);
3860
+ this.error.set("");
3861
+ });
3862
+ });
3863
+ effect(() => {
3864
+ const ctx = this.ctx();
3865
+ untracked(() => ctx.onCancel(() => this.confirmation() ? this.finish() : this.cancelIntent()));
3866
+ });
3867
+ inject(DestroyRef).onDestroy(() => {
3868
+ this.estimateRun++;
3869
+ this.cancelIntent();
3870
+ });
3871
+ }
3872
+ retryEstimate() {
3873
+ this.estimateTick.update((n) => n + 1);
3874
+ }
3875
+ onReady() {
3876
+ this.complete.set(false);
3877
+ this.ctx().announce("Payment form ready");
3878
+ }
3879
+ onFailed(failure) {
3880
+ this.error.set(failure.message);
3881
+ this.processing.set(false);
3882
+ this.ctx().report("failed", { message: failure.message });
3883
+ }
3884
+ async pay() {
3885
+ const ctx = this.ctx();
3886
+ const payment = this.payment();
3887
+ if (this.processing() || this.estimating() || this.done() || !payment) return;
3888
+ if (!ctx.validate() || ctx.amount == null) return;
3889
+ this.error.set("");
3890
+ this.processing.set(true);
3891
+ ctx.setBusy(true);
3892
+ ctx.announce("Processing payment");
3893
+ let finished = false;
3894
+ try {
3895
+ const event = await payment.confirm();
3896
+ if (event) finished = await this.afterConfirm(event, ctx);
3897
+ } finally {
3898
+ this.processing.set(false);
3899
+ if (!finished) ctx.setBusy(false);
3900
+ }
3901
+ }
3902
+ async afterConfirm(event, ctx) {
3903
+ const amount = ctx.amount;
3904
+ const money = formatCurrency(amount, { currency: ctx.currency });
3905
+ if (event.outcome !== "succeeded" && event.outcome !== "processing" && event.outcome !== "requires_verification") {
3906
+ this.error.set(this.texts.notCompleted);
3907
+ return false;
3908
+ }
3909
+ const info = this.intent;
3910
+ this.intent = null;
3911
+ let finalizeFailed = false;
3912
+ const finalize = this.config().finalize();
3913
+ if (finalize && info) try {
3914
+ await callHost(() => finalize(info));
3915
+ } catch {
3916
+ finalizeFailed = true;
3917
+ }
3918
+ const result = {
3919
+ type: "stripe",
3920
+ paymentMethod: ctx.method,
3921
+ amount
3922
+ };
3923
+ if (event.outcome === "succeeded") {
3924
+ ctx.report(finalizeFailed ? "finalize-failed" : "paid", { result });
3925
+ this.done.set(true);
3926
+ ctx.complete(result);
3927
+ return true;
3928
+ }
3929
+ const verification = event.outcome === "requires_verification";
3930
+ ctx.report(finalizeFailed ? "finalize-failed" : verification ? "verification" : "processing", { result });
3931
+ this.confirmation.set(verification ? {
3932
+ title: this.texts.verificationTitle,
3933
+ message: this.texts.verificationMessage(money)
3934
+ } : {
3935
+ title: this.texts.achTitle,
3936
+ message: this.texts.achMessage(money)
3937
+ });
3938
+ ctx.setExclusive(true);
3939
+ ctx.setBusy(false);
3940
+ afterNextRender(() => this.host.nativeElement.querySelector(".psm-notice")?.focus(), { injector: this.injector });
3941
+ return true;
3942
+ }
3943
+ finish() {
3944
+ const ctx = this.ctx();
3945
+ if (this.done()) return;
3946
+ this.done.set(true);
3947
+ ctx.complete({
3948
+ type: "stripe",
3949
+ paymentMethod: ctx.method,
3950
+ amount: ctx.amount ?? this.lastAmount() ?? 0
3951
+ });
3952
+ }
3953
+ cancelIntent(force = false) {
3954
+ const info = this.intent;
3955
+ if (!info || this.processing() && !force) return;
3956
+ this.intent = null;
3957
+ const cancel = this.config().cancel();
3958
+ if (cancel) callHost(() => cancel(info)).catch(() => {});
3959
+ }
3960
+ static {
3961
+ this.ɵfac = i0.ɵɵngDeclareFactory({
3962
+ minVersion: "12.0.0",
3963
+ version: "22.2.2",
3964
+ ngImport: i0,
3965
+ type: PaymentStripeBodyComponent,
3966
+ deps: [],
3967
+ target: i0.ɵɵFactoryTarget.Component
3968
+ });
3969
+ }
3970
+ static {
3971
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
3972
+ minVersion: "17.0.0",
3973
+ version: "22.2.2",
3974
+ type: PaymentStripeBodyComponent,
3975
+ isStandalone: true,
3976
+ selector: "ui-payment-stripe-body",
3977
+ inputs: {
3978
+ ctx: {
3979
+ classPropertyName: "ctx",
3980
+ publicName: "ctx",
3981
+ isSignal: true,
3982
+ isRequired: true,
3983
+ transformFunction: null
3984
+ },
3985
+ config: {
3986
+ classPropertyName: "config",
3987
+ publicName: "config",
3988
+ isSignal: true,
3989
+ isRequired: true,
3990
+ transformFunction: null
3991
+ }
3992
+ },
3993
+ viewQueries: [{
3994
+ propertyName: "payment",
3995
+ first: true,
3996
+ predicate: StripePaymentComponent,
3997
+ descendants: true,
3998
+ isSignal: true
3999
+ }],
4000
+ ngImport: i0,
4001
+ template: `
4002
+ <div class="psm">
4003
+ @if (confirmation(); as notice) {
4004
+ <ui-alert variant="success" [title]="notice.title" tabindex="-1" class="psm-notice" data-testid="stripe-method-confirmation">
4005
+ <p>{{ notice.message }}</p>
4006
+ <p>{{ receiptNote() }}</p>
4007
+ </ui-alert>
4008
+ } @else {
4009
+ @if (ctx().amount == null) {
4010
+ <ui-hint data-testid="stripe-method-amount-needed">{{ texts.amountNeeded }}</ui-hint>
4011
+ }
4012
+ @if (estimateError()) {
4013
+ <div class="psm-error">
4014
+ <ui-alert variant="warning" data-testid="stripe-method-estimate-error">{{ estimateError() }}
4015
+ <ui-button variant="secondary" size="sm" data-testid="stripe-method-estimate-retry" (click)="retryEstimate()">Try again</ui-button>
4016
+ </ui-alert>
4017
+ </div>
4018
+ }
4019
+ @if (lastAmount() != null) {
4020
+ <ui-stripe-payment #payment mode="payment" [publishableKey]="config().publishableKey()" [stripeAccount]="config().stripeAccount()" [deferred]="deferred()"
4021
+ [createIntent]="createIntentFn" [paymentMethodTypes]="[methodType()]" [showSubmit]="false" [showErrors]="false" [autoHandleCardAction]="true"
4022
+ [wallets]="wallets" [fields]="fields" [defaultValues]="defaultValues()" [appearance]="$any(config().appearance())" [appearanceFromTokens]="true" label="Payment details"
4023
+ (ready)="onReady()" (elementChange)="complete.set($event.complete)" (failed)="onFailed($event)" (loadError)="onFailed($event)" />
4024
+ @if (totalCard(); as card) {
4025
+ <ui-kpi-card class="psm-total" data-testid="stripe-method-total" label="Total charged" [value]="card.value" [subtitle]="card.subtitle" icon="dollar" color="blue" valueColor="blue" />
4026
+ }
4027
+ @if (feeRows().length) {
4028
+ <dl class="psm-fees" data-testid="stripe-method-fees" aria-label="Payment total">
4029
+ @for (row of feeRows(); track row.key) {
4030
+ <div class="psm-fee" [attr.data-testid]="'stripe-fee-' + row.key"><dt>{{ row.label }}</dt><dd>{{ row.value }}</dd></div>
4031
+ }
4032
+ </dl>
4033
+ }
4034
+ @if (error()) { <div class="psm-error"><ui-alert variant="danger" data-testid="stripe-method-error">{{ error() }}</ui-alert></div> }
4035
+ }
4036
+ }
4037
+ </div>
4038
+ `,
4039
+ isInline: true,
4040
+ styles: ["ui-payment-stripe-body{display:block;min-width:0}ui-payment-stripe-body .psm-error{margin-top:12px}ui-payment-stripe-body .psm-total{display:block;margin-top:16px}ui-payment-stripe-body .psm-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-stripe-body .psm-fee{display:flex;justify-content:space-between;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-stripe-body .psm-fee dt,ui-payment-stripe-body .psm-fee dd{margin:0}ui-payment-stripe-body .psm-notice:focus{outline:none}ui-payment-stripe-body .psm-notice p{margin:0 0 6px}\n"],
4041
+ dependencies: [
4042
+ {
4043
+ kind: "component",
4044
+ type: AlertComponent,
4045
+ selector: "ui-alert",
4046
+ inputs: [
4047
+ "variant",
4048
+ "title",
4049
+ "dismissible",
4050
+ "dismissAriaLabel",
4051
+ "quiet",
4052
+ "compact",
4053
+ "inline",
4054
+ "fill"
4055
+ ],
4056
+ outputs: ["dismissed"]
4057
+ },
4058
+ {
4059
+ kind: "component",
4060
+ type: ButtonComponent,
4061
+ selector: "ui-button",
4062
+ inputs: [
4063
+ "variant",
4064
+ "routerLink",
4065
+ "queryParams",
4066
+ "fragment",
4067
+ "state",
4068
+ "href",
4069
+ "target",
4070
+ "rel",
4071
+ "shortLabel",
4072
+ "shortBelow",
4073
+ "color",
4074
+ "active",
4075
+ "size",
4076
+ "type",
4077
+ "disabled",
4078
+ "loading",
4079
+ "fullWidth",
4080
+ "ariaLabel",
4081
+ "ariaExpanded",
4082
+ "ariaPressed",
4083
+ "ariaDescribedBy",
4084
+ "modal-footer-left",
4085
+ "modal-footer-right"
4086
+ ]
4087
+ },
4088
+ {
4089
+ kind: "component",
4090
+ type: HintComponent,
4091
+ selector: "ui-hint"
4092
+ },
4093
+ {
4094
+ kind: "component",
4095
+ type: KpiCardComponent,
4096
+ selector: "ui-kpi-card",
4097
+ inputs: [
4098
+ "label",
4099
+ "value",
4100
+ "subtitle",
4101
+ "icon",
4102
+ "color",
4103
+ "highlight",
4104
+ "clickable",
4105
+ "valueColor",
4106
+ "background",
4107
+ "progress",
4108
+ "progressMax",
4109
+ "progressSize",
4110
+ "progressStrokeWidth",
4111
+ "progressVariant",
4112
+ "progressAriaLabel",
4113
+ "progressValueText"
4114
+ ]
4115
+ },
4116
+ {
4117
+ kind: "component",
4118
+ type: StripePaymentComponent,
4119
+ selector: "ui-stripe-payment",
4120
+ inputs: [
4121
+ "mountOnly",
4122
+ "mode",
4123
+ "publishableKey",
4124
+ "clientSecret",
4125
+ "deferred",
4126
+ "createIntent",
4127
+ "stripeAccount",
4128
+ "locale",
4129
+ "stripeOptions",
4130
+ "paymentMethodTypes",
4131
+ "elementsOptions",
4132
+ "layout",
4133
+ "paymentMethodOrder",
4134
+ "wallets",
4135
+ "fields",
4136
+ "defaultValues",
4137
+ "business",
4138
+ "terms",
4139
+ "paymentElementOptions",
4140
+ "appearance",
4141
+ "appearanceFromTokens",
4142
+ "returnUrl",
4143
+ "billingDetails",
4144
+ "confirmParams",
4145
+ "redirect",
4146
+ "submitBeforeConfirm",
4147
+ "autoHandleCardAction",
4148
+ "submitLabel",
4149
+ "showSubmit",
4150
+ "disabled",
4151
+ "pending",
4152
+ "label",
4153
+ "required",
4154
+ "mountId",
4155
+ "mountClass",
4156
+ "showAchNotice",
4157
+ "achNotice",
4158
+ "achNoticeTestId",
4159
+ "initialPaymentMethodType",
4160
+ "showErrors",
4161
+ "errorDisplay",
4162
+ "errorDisplayByStage",
4163
+ "errorFallback",
4164
+ "errorFallbackByStage",
4165
+ "errorMessages",
4166
+ "loadErrorMessage",
4167
+ "a11yMessages"
4168
+ ],
4169
+ outputs: [
4170
+ "stripeReady",
4171
+ "ready",
4172
+ "paymentMethodTypeChange",
4173
+ "elementChange",
4174
+ "confirmed",
4175
+ "failed",
4176
+ "loadError"
4177
+ ]
4178
+ }
4179
+ ],
4180
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
4181
+ encapsulation: i0.ViewEncapsulation.None
4182
+ });
4183
+ }
4184
+ };
4185
+ i0.ɵɵngDeclareClassMetadata({
4186
+ minVersion: "12.0.0",
4187
+ version: "22.2.2",
4188
+ ngImport: i0,
4189
+ type: PaymentStripeBodyComponent,
4190
+ decorators: [{
4191
+ type: Component,
4192
+ args: [{
4193
+ selector: "ui-payment-stripe-body",
4194
+ standalone: true,
4195
+ changeDetection: ChangeDetectionStrategy.OnPush,
4196
+ encapsulation: ViewEncapsulation.None,
4197
+ imports: [
4198
+ AlertComponent,
4199
+ ButtonComponent,
4200
+ HintComponent,
4201
+ KpiCardComponent,
4202
+ StripePaymentComponent
4203
+ ],
4204
+ template: `
4205
+ <div class="psm">
4206
+ @if (confirmation(); as notice) {
4207
+ <ui-alert variant="success" [title]="notice.title" tabindex="-1" class="psm-notice" data-testid="stripe-method-confirmation">
4208
+ <p>{{ notice.message }}</p>
4209
+ <p>{{ receiptNote() }}</p>
4210
+ </ui-alert>
4211
+ } @else {
4212
+ @if (ctx().amount == null) {
4213
+ <ui-hint data-testid="stripe-method-amount-needed">{{ texts.amountNeeded }}</ui-hint>
4214
+ }
4215
+ @if (estimateError()) {
4216
+ <div class="psm-error">
4217
+ <ui-alert variant="warning" data-testid="stripe-method-estimate-error">{{ estimateError() }}
4218
+ <ui-button variant="secondary" size="sm" data-testid="stripe-method-estimate-retry" (click)="retryEstimate()">Try again</ui-button>
4219
+ </ui-alert>
4220
+ </div>
4221
+ }
4222
+ @if (lastAmount() != null) {
4223
+ <ui-stripe-payment #payment mode="payment" [publishableKey]="config().publishableKey()" [stripeAccount]="config().stripeAccount()" [deferred]="deferred()"
4224
+ [createIntent]="createIntentFn" [paymentMethodTypes]="[methodType()]" [showSubmit]="false" [showErrors]="false" [autoHandleCardAction]="true"
4225
+ [wallets]="wallets" [fields]="fields" [defaultValues]="defaultValues()" [appearance]="$any(config().appearance())" [appearanceFromTokens]="true" label="Payment details"
4226
+ (ready)="onReady()" (elementChange)="complete.set($event.complete)" (failed)="onFailed($event)" (loadError)="onFailed($event)" />
4227
+ @if (totalCard(); as card) {
4228
+ <ui-kpi-card class="psm-total" data-testid="stripe-method-total" label="Total charged" [value]="card.value" [subtitle]="card.subtitle" icon="dollar" color="blue" valueColor="blue" />
4229
+ }
4230
+ @if (feeRows().length) {
4231
+ <dl class="psm-fees" data-testid="stripe-method-fees" aria-label="Payment total">
4232
+ @for (row of feeRows(); track row.key) {
4233
+ <div class="psm-fee" [attr.data-testid]="'stripe-fee-' + row.key"><dt>{{ row.label }}</dt><dd>{{ row.value }}</dd></div>
4234
+ }
4235
+ </dl>
4236
+ }
4237
+ @if (error()) { <div class="psm-error"><ui-alert variant="danger" data-testid="stripe-method-error">{{ error() }}</ui-alert></div> }
4238
+ }
4239
+ }
4240
+ </div>
4241
+ `,
4242
+ styles: ["ui-payment-stripe-body{display:block;min-width:0}ui-payment-stripe-body .psm-error{margin-top:12px}ui-payment-stripe-body .psm-total{display:block;margin-top:16px}ui-payment-stripe-body .psm-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-stripe-body .psm-fee{display:flex;justify-content:space-between;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-stripe-body .psm-fee dt,ui-payment-stripe-body .psm-fee dd{margin:0}ui-payment-stripe-body .psm-notice:focus{outline:none}ui-payment-stripe-body .psm-notice p{margin:0 0 6px}\n"]
4243
+ }]
4244
+ }],
4245
+ ctorParameters: () => [],
4246
+ propDecorators: {
4247
+ ctx: [{
4248
+ type: i0.Input,
4249
+ args: [{
4250
+ isSignal: true,
4251
+ alias: "ctx",
4252
+ required: true
4253
+ }]
4254
+ }],
4255
+ config: [{
4256
+ type: i0.Input,
4257
+ args: [{
4258
+ isSignal: true,
4259
+ alias: "config",
4260
+ required: true
4261
+ }]
4262
+ }],
4263
+ payment: [{
4264
+ type: i0.ViewChild,
4265
+ args: [i0.forwardRef(() => StripePaymentComponent), { isSignal: true }]
4266
+ }]
4267
+ }
4268
+ });
4269
+ var StripePaymentMethodComponent = class StripePaymentMethodComponent extends PaymentMethodPlugin {
4270
+ constructor() {
4271
+ super(...arguments);
4272
+ this.self = this;
4273
+ this.createIntent = input(null, ...ngDevMode ? [{ debugName: "createIntent" }] : /* istanbul ignore next */ []);
4274
+ this.finalize = input(null, ...ngDevMode ? [{ debugName: "finalize" }] : /* istanbul ignore next */ []);
4275
+ this.cancel = input(null, ...ngDevMode ? [{ debugName: "cancel" }] : /* istanbul ignore next */ []);
4276
+ this.estimateFees = input(null, ...ngDevMode ? [{ debugName: "estimateFees" }] : /* istanbul ignore next */ []);
4277
+ this.publishableKey = input(null, ...ngDevMode ? [{ debugName: "publishableKey" }] : /* istanbul ignore next */ []);
4278
+ this.stripeAccount = input(null, ...ngDevMode ? [{ debugName: "stripeAccount" }] : /* istanbul ignore next */ []);
4279
+ this.billingDetails = input(null, ...ngDevMode ? [{ debugName: "billingDetails" }] : /* istanbul ignore next */ []);
4280
+ this.appearance = input(null, ...ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []);
4281
+ this.methodList = input(STRIPE_PAYMENT_METHODS, ...ngDevMode ? [{ debugName: "methodList" }] : /* istanbul ignore next */ []);
4282
+ this.estimateTimeoutMs = input(1e4, ...ngDevMode ? [{ debugName: "estimateTimeoutMs" }] : /* istanbul ignore next */ []);
4283
+ this.feesRequired = input(false, ...ngDevMode ? [{ debugName: "feesRequired" }] : /* istanbul ignore next */ []);
4284
+ this.receiptNote = input(STRIPE_METHOD_TEXTS.receiptNote, ...ngDevMode ? [{ debugName: "receiptNote" }] : /* istanbul ignore next */ []);
4285
+ this.body = viewChild("body", ...ngDevMode ? [{ debugName: "body" }] : /* istanbul ignore next */ []);
4286
+ this.methods = this.methodList;
4287
+ this.template = this.body;
4288
+ }
4289
+ static {
4290
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4291
+ minVersion: "12.0.0",
4292
+ version: "22.2.2",
4293
+ ngImport: i0,
4294
+ type: StripePaymentMethodComponent,
4295
+ deps: null,
4296
+ target: i0.ɵɵFactoryTarget.Component
4297
+ });
4298
+ }
4299
+ static {
4300
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
4301
+ minVersion: "17.2.0",
4302
+ version: "22.2.2",
4303
+ type: StripePaymentMethodComponent,
4304
+ isStandalone: true,
4305
+ selector: "ui-payment-stripe-method",
4306
+ inputs: {
4307
+ createIntent: {
4308
+ classPropertyName: "createIntent",
4309
+ publicName: "createIntent",
4310
+ isSignal: true,
4311
+ isRequired: false,
4312
+ transformFunction: null
4313
+ },
4314
+ finalize: {
4315
+ classPropertyName: "finalize",
4316
+ publicName: "finalize",
4317
+ isSignal: true,
4318
+ isRequired: false,
4319
+ transformFunction: null
4320
+ },
4321
+ cancel: {
4322
+ classPropertyName: "cancel",
4323
+ publicName: "cancel",
4324
+ isSignal: true,
4325
+ isRequired: false,
4326
+ transformFunction: null
4327
+ },
4328
+ estimateFees: {
4329
+ classPropertyName: "estimateFees",
4330
+ publicName: "estimateFees",
4331
+ isSignal: true,
4332
+ isRequired: false,
4333
+ transformFunction: null
4334
+ },
4335
+ publishableKey: {
4336
+ classPropertyName: "publishableKey",
4337
+ publicName: "publishableKey",
4338
+ isSignal: true,
4339
+ isRequired: false,
4340
+ transformFunction: null
4341
+ },
4342
+ stripeAccount: {
4343
+ classPropertyName: "stripeAccount",
4344
+ publicName: "stripeAccount",
4345
+ isSignal: true,
4346
+ isRequired: false,
4347
+ transformFunction: null
4348
+ },
4349
+ billingDetails: {
4350
+ classPropertyName: "billingDetails",
4351
+ publicName: "billingDetails",
4352
+ isSignal: true,
4353
+ isRequired: false,
4354
+ transformFunction: null
4355
+ },
4356
+ appearance: {
4357
+ classPropertyName: "appearance",
4358
+ publicName: "appearance",
4359
+ isSignal: true,
4360
+ isRequired: false,
4361
+ transformFunction: null
4362
+ },
4363
+ methodList: {
4364
+ classPropertyName: "methodList",
4365
+ publicName: "methodList",
4366
+ isSignal: true,
4367
+ isRequired: false,
4368
+ transformFunction: null
4369
+ },
4370
+ estimateTimeoutMs: {
4371
+ classPropertyName: "estimateTimeoutMs",
4372
+ publicName: "estimateTimeoutMs",
4373
+ isSignal: true,
4374
+ isRequired: false,
4375
+ transformFunction: null
4376
+ },
4377
+ feesRequired: {
4378
+ classPropertyName: "feesRequired",
4379
+ publicName: "feesRequired",
4380
+ isSignal: true,
4381
+ isRequired: false,
4382
+ transformFunction: null
4383
+ },
4384
+ receiptNote: {
4385
+ classPropertyName: "receiptNote",
4386
+ publicName: "receiptNote",
4387
+ isSignal: true,
4388
+ isRequired: false,
4389
+ transformFunction: null
4390
+ }
4391
+ },
4392
+ host: { styleAttribute: "display: none" },
4393
+ providers: [{
4394
+ provide: PAYMENT_METHOD_PLUGIN,
4395
+ useExisting: forwardRef(() => StripePaymentMethodComponent)
4396
+ }],
4397
+ viewQueries: [{
4398
+ propertyName: "body",
4399
+ first: true,
4400
+ predicate: ["body"],
4401
+ descendants: true,
4402
+ isSignal: true
4403
+ }],
4404
+ usesInheritance: true,
4405
+ ngImport: i0,
4406
+ template: `<ng-template #body let-ctx><ui-payment-stripe-body [ctx]="ctx" [config]="self" /></ng-template>`,
4407
+ isInline: true,
4408
+ dependencies: [{
4409
+ kind: "component",
4410
+ type: PaymentStripeBodyComponent,
4411
+ selector: "ui-payment-stripe-body",
4412
+ inputs: ["ctx", "config"]
4413
+ }],
4414
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
4415
+ });
4416
+ }
4417
+ };
4418
+ i0.ɵɵngDeclareClassMetadata({
4419
+ minVersion: "12.0.0",
4420
+ version: "22.2.2",
4421
+ ngImport: i0,
4422
+ type: StripePaymentMethodComponent,
4423
+ decorators: [{
4424
+ type: Component,
4425
+ args: [{
4426
+ selector: "ui-payment-stripe-method",
4427
+ standalone: true,
4428
+ changeDetection: ChangeDetectionStrategy.OnPush,
4429
+ imports: [PaymentStripeBodyComponent],
4430
+ providers: [{
4431
+ provide: PAYMENT_METHOD_PLUGIN,
4432
+ useExisting: forwardRef(() => StripePaymentMethodComponent)
4433
+ }],
4434
+ host: { style: "display: none" },
4435
+ template: `<ng-template #body let-ctx><ui-payment-stripe-body [ctx]="ctx" [config]="self" /></ng-template>`
4436
+ }]
4437
+ }],
4438
+ propDecorators: {
4439
+ createIntent: [{
4440
+ type: i0.Input,
4441
+ args: [{
4442
+ isSignal: true,
4443
+ alias: "createIntent",
4444
+ required: false
4445
+ }]
4446
+ }],
4447
+ finalize: [{
4448
+ type: i0.Input,
4449
+ args: [{
4450
+ isSignal: true,
4451
+ alias: "finalize",
4452
+ required: false
4453
+ }]
4454
+ }],
4455
+ cancel: [{
4456
+ type: i0.Input,
4457
+ args: [{
4458
+ isSignal: true,
4459
+ alias: "cancel",
4460
+ required: false
4461
+ }]
4462
+ }],
4463
+ estimateFees: [{
4464
+ type: i0.Input,
4465
+ args: [{
4466
+ isSignal: true,
4467
+ alias: "estimateFees",
4468
+ required: false
4469
+ }]
4470
+ }],
4471
+ publishableKey: [{
4472
+ type: i0.Input,
4473
+ args: [{
4474
+ isSignal: true,
4475
+ alias: "publishableKey",
4476
+ required: false
4477
+ }]
4478
+ }],
4479
+ stripeAccount: [{
4480
+ type: i0.Input,
4481
+ args: [{
4482
+ isSignal: true,
4483
+ alias: "stripeAccount",
4484
+ required: false
4485
+ }]
4486
+ }],
4487
+ billingDetails: [{
4488
+ type: i0.Input,
4489
+ args: [{
4490
+ isSignal: true,
4491
+ alias: "billingDetails",
4492
+ required: false
4493
+ }]
4494
+ }],
4495
+ appearance: [{
4496
+ type: i0.Input,
4497
+ args: [{
4498
+ isSignal: true,
4499
+ alias: "appearance",
4500
+ required: false
4501
+ }]
4502
+ }],
4503
+ methodList: [{
4504
+ type: i0.Input,
4505
+ args: [{
4506
+ isSignal: true,
4507
+ alias: "methodList",
4508
+ required: false
4509
+ }]
4510
+ }],
4511
+ estimateTimeoutMs: [{
4512
+ type: i0.Input,
4513
+ args: [{
4514
+ isSignal: true,
4515
+ alias: "estimateTimeoutMs",
4516
+ required: false
4517
+ }]
4518
+ }],
4519
+ feesRequired: [{
4520
+ type: i0.Input,
4521
+ args: [{
4522
+ isSignal: true,
4523
+ alias: "feesRequired",
4524
+ required: false
4525
+ }]
4526
+ }],
4527
+ receiptNote: [{
4528
+ type: i0.Input,
4529
+ args: [{
4530
+ isSignal: true,
4531
+ alias: "receiptNote",
4532
+ required: false
4533
+ }]
4534
+ }],
4535
+ body: [{
4536
+ type: i0.ViewChild,
4537
+ args: ["body", { isSignal: true }]
4538
+ }]
4539
+ }
4540
+ });
4541
+ export { MICRODEPOSIT_COPY, MicrodepositVerifyComponent, STRIPE_A11Y_MESSAGES, STRIPE_ACH_NOTICE, STRIPE_DEFAULT_ERROR_MESSAGE, STRIPE_ERROR_MESSAGES, STRIPE_LOADER, STRIPE_METHOD_TEXTS, STRIPE_PAYMENT_DEFAULTS, STRIPE_PAYMENT_METHODS, STRIPE_TECHNICAL_ERROR_MESSAGES, StripeConnectComponent, StripeConnectFlow, StripePaymentComponent, StripePaymentMethodComponent, StripePaymentService, buildLoadOptions, defaultStripeLoader, depositAmountError, descriptorCodeError, getStripeErrorMessage, isDarkPage, isStripeUrl, microdepositArrivalText, microdepositCancelMessage, microdepositKeepsActiveText, microdepositProcessingText, microdepositStepsText, normalizeDescriptorCode, normalizeIntent, outcomeOf, paymentMethodIdOf, provideStripePayment, readStripeAppearance, readStripeReturnParams, retrieveIntent, stripeConnectNotice, verificationOf, verifyMicrodeposits };
3654
4542
 
3655
4543
  //# sourceMappingURL=forgeroute-ui-stripe.mjs.map