@forgeroute/ui 0.5.17 → 0.5.18
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-core-ui-labels.es-Dzj_XJJM.mjs → forgeroute-ui-core-ui-labels.es-Woi3az70.mjs} +186 -2
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Dzj_XJJM.mjs.map → forgeroute-ui-core-ui-labels.es-Woi3az70.mjs.map} +1 -1
- package/fesm2022/forgeroute-ui-core.mjs +186 -2
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +15 -0
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +6242 -1189
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/package.json +6 -2
- package/types/forgeroute-ui-core.d.ts +188 -4
- package/types/forgeroute-ui-messaging.d.ts +5 -5
- package/types/forgeroute-ui-payments.d.ts +9 -1
- package/types/forgeroute-ui-quickbooks.d.ts +2 -2
- package/types/forgeroute-ui-square.d.ts +2 -2
- package/types/forgeroute-ui-stripe.d.ts +1456 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-payments.mjs","names":[],"sources":["../../../projects/forgeroute-ui/payments/src/lib/bank-account-form/bank-account-form.component.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-side-panel.models.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-method-plugin.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-custom-method.component.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-side-panel.component.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/queued-payment-warning.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-attempt.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-readiness.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-protection.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-setup-labels.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-attempt-status.component.ts","../../../projects/forgeroute-ui/payments/src/lib/charge-form/charge-form.component.ts","../../../projects/forgeroute-ui/payments/src/lib/refund-panel/refund-panel.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, forwardRef, input, output, signal, untracked, viewChildren, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { FormRowComponent } from '@forgeroute/ui/form-row';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { SelectComponent, SelectOption } from '@forgeroute/ui/select';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { UiFieldValidity } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** Default ACH debit authorization text (same wording the contractor bank-account kiosk used). */\nexport const DEFAULT_BANK_MANDATE_TEXT =\n 'By checking this box, I authorize the above business to initiate ACH debit entries to my bank account for agreed-upon payments. ' +\n 'I understand I may revoke this authorization at any time by contacting the business.';\n\nexport type BankAccountType = 'checking' | 'savings';\nexport type BankHolderType = 'individual' | 'company';\n\n/** What `(submitted)` emits: every text value trimmed, `mandateAccepted` always `true`. */\nexport interface BankAccountFormValue {\n routingNumber: string;\n accountNumber: string;\n accountType: BankAccountType;\n accountHolderName: string;\n holderType: BankHolderType;\n mandateAccepted: true;\n}\n\nexport const DEFAULT_BANK_ACCOUNT_TYPE_OPTIONS: SelectOption[] = [{ value: 'checking', label: 'Checking' }, { value: 'savings', label: 'Savings' }];\nexport const DEFAULT_BANK_HOLDER_TYPE_OPTIONS: SelectOption[] = [{ value: 'individual', label: 'Individual' }, { value: 'company', label: 'Business' }];\n\nconst digitsOnly = (max: number) => (raw: string) => raw.replace(/\\D/g, '').slice(0, max);\n\n/**\n * `ui-bank-account-form` - the US bank-account entry form (routing number, account number + confirmation, account type, holder name + type,\n * ACH debit authorization). Built only from library inputs; it holds NO HTTP and no provider logic: the host listens to `(submitted)` and talks to\n * its payment provider (Stripe `confirmUsBankAccountSetup`, Square, ...). See docs/modal-kiosk-and-bank-account-form.md.\n *\n * - Validation is inline through the inputs' own `[error]` / built-in rules. The routing number is only checked for 9 digits (no ABA checksum: the\n * provider validates the real number, and a client checksum would reject test numbers). Account numbers are 4-17 digits.\n * - Every message (the built-in ones and the form's own routing / account / confirm messages, which are passed to the inputs as `[error]`) shows after the user left THAT field (blur), or at once on every field while `[showErrors]` is true or after a failed `submit()`. Switching the reveal flag from true back to false (the host's `showErrors` going false, or `reset()`) clears every field's touched state.\n * - The form provides `UiFieldValidity` (`invalid` = not submittable), so a host can gate its own button with `viewChildren(UiFieldValidity)`,\n * or use `(validChange)`.\n * - The host's footer button calls `form.submit()` (via `viewChild`); Enter in a text field submits too.\n */\n@Component({\n selector: 'ui-bank-account-form',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, CheckboxComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent],\n providers: [{ provide: UiFieldValidity, useExisting: forwardRef(() => BankAccountFormComponent) }],\n host: { '[attr.aria-busy]': 'busy() ? \"true\" : null' },\n template: `\n <form novalidate (submit)=\"$event.preventDefault(); submit()\" (keydown.enter)=\"onEnter($event)\">\n <ui-form-section>\n <ui-text-input [label]=\"labels.t('bankAccountForm.accountHolderName')\" [inputTestId]=\"id('holder-name')\" autocomplete=\"name\" [required]=\"true\" [maxlength]=\"100\"\n [showErrors]=\"reveal()\" [disabled]=\"locked()\" [ngModel]=\"accountHolderName()\" (ngModelChange)=\"accountHolderName.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-text-input [label]=\"labels.t('bankAccountForm.routingNumber')\" [inputTestId]=\"id('routing')\" inputmode=\"numeric\" [placeholder]=\"labels.t('bankAccountForm.9DigitRoutingNumber')\" [required]=\"true\"\n [maxlength]=\"9\" [formatter]=\"routingFormatter\" [error]=\"routingError()\" [showErrors]=\"reveal()\" [disabled]=\"locked()\"\n [ngModel]=\"routingNumber()\" (ngModelChange)=\"routingNumber.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-text-input [label]=\"labels.t('bankAccountForm.accountNumber')\" [inputTestId]=\"id('account')\" inputmode=\"numeric\" [placeholder]=\"labels.t('bankAccountForm.accountNumber')\" [required]=\"true\"\n [maxlength]=\"17\" [formatter]=\"accountFormatter\" [error]=\"accountError()\" [showErrors]=\"reveal()\" [disabled]=\"locked()\"\n [ngModel]=\"accountNumber()\" (ngModelChange)=\"accountNumber.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-text-input [label]=\"labels.t('bankAccountForm.confirmAccountNumber')\" [inputTestId]=\"id('confirm')\" inputmode=\"numeric\" [placeholder]=\"labels.t('bankAccountForm.reEnterAccountNumber')\" [required]=\"true\"\n [maxlength]=\"17\" [formatter]=\"accountFormatter\" [error]=\"confirmError()\" [showErrors]=\"reveal()\" [disabled]=\"locked()\"\n [ngModel]=\"confirmAccount()\" (ngModelChange)=\"confirmAccount.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-form-row>\n <ui-select [label]=\"labels.t('bankAccountForm.accountType')\" [attr.data-testid]=\"id('account-type')\" [options]=\"accountTypeOptions()\" [required]=\"true\" [showErrors]=\"reveal()\"\n [disabled]=\"locked()\" [ngModel]=\"accountType()\" (ngModelChange)=\"accountType.set($event)\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-select [label]=\"labels.t('bankAccountForm.holderType')\" [attr.data-testid]=\"id('holder-type')\" [options]=\"holderTypeOptions()\" [required]=\"true\" [showErrors]=\"reveal()\"\n [disabled]=\"locked()\" [ngModel]=\"holderType()\" (ngModelChange)=\"holderType.set($event)\" [ngModelOptions]=\"{ standalone: true }\" />\n </ui-form-row>\n <ui-checkbox [testId]=\"id('mandate')\" [label]=\"mandateText()\" [required]=\"true\" [requiredMessage]=\"labels.t('bankAccountForm.mandateRequired')\"\n [showErrors]=\"reveal()\" [disabled]=\"locked()\" [ngModel]=\"mandateAccepted()\" (ngModelChange)=\"mandateAccepted.set(!!$event)\" [ngModelOptions]=\"{ standalone: true }\" />\n </ui-form-section>\n </form>\n `,\n styles: [`:host { display: block; }`],\n})\nexport class BankAccountFormComponent implements UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n /** The host's \"tried to submit\" flag (e.g. a panel's `touched()`). `true` reveals every field's message at once and blocks submitting; switching it from true back to false clears every field's touched state. */\n readonly showErrors = input(false);\n /** Disables every field and blocks `submit()`. */\n readonly disabled = input(false);\n /** Like `disabled`, plus `aria-busy` on the host: a provider call is running. */\n readonly busy = input(false);\n /** The authorization text next to the checkbox (it is the checkbox label). The unticked default is never changed by the form. */\n readonly mandateTextInput = input<string | null>(null, { alias: 'mandateText' });\n readonly mandateText = computed(() => this.mandateTextInput() ?? this.labels.t('bankAccountForm.mandate'));\n /** Account type choices; values must stay `checking` / `savings`. */\n readonly accountTypeOptionsInput = input<SelectOption[] | null>(null, { alias: 'accountTypeOptions' });\n readonly accountTypeOptions = computed((): SelectOption[] => this.accountTypeOptionsInput() ?? [{ value: 'checking', label: this.labels.t('bankAccountForm.accountType.checking') }, { value: 'savings', label: this.labels.t('bankAccountForm.accountType.savings') }]);\n /** Holder type choices; values must stay `individual` / `company`. */\n readonly holderTypeOptionsInput = input<SelectOption[] | null>(null, { alias: 'holderTypeOptions' });\n readonly holderTypeOptions = computed((): SelectOption[] => this.holderTypeOptionsInput() ?? [{ value: 'individual', label: this.labels.t('bankAccountForm.holderType.individual') }, { value: 'company', label: this.labels.t('bankAccountForm.holderType.company') }]);\n /** Pre-fills the account holder name (e.g. the customer's name) whenever it changes; the user can edit it. */\n readonly accountHolderNameDefault = input('');\n /** Prefix of the inner test ids: `<prefix>-routing`, `-account`, `-confirm`, `-holder-name`, `-account-type`, `-holder-type`, `-mandate`. */\n readonly testIdPrefix = input('bank');\n\n /** Emits the typed payload when `submit()` runs on a valid form. */\n readonly submitted = output<BankAccountFormValue>();\n /** Emits `true` / `false` whenever the form becomes submittable / not (also once on init). */\n readonly validChange = output<boolean>();\n\n protected readonly routingNumber = signal('');\n protected readonly accountNumber = signal('');\n protected readonly confirmAccount = signal('');\n protected readonly accountHolderName = signal('');\n protected readonly accountType = signal('checking');\n protected readonly holderType = signal('individual');\n protected readonly mandateAccepted = signal(false);\n private readonly _touched = signal(false);\n\n protected readonly routingFormatter = digitsOnly(9);\n protected readonly accountFormatter = digitsOnly(17);\n\n protected readonly locked = computed(() => this.disabled() || this.busy());\n /** Handed to the inputs as `[showErrors]`. `true` reveals each input's message at once; true -> false (host flag off, or `reset()` after a failed `submit()`) clears each input's touched state. */\n protected readonly reveal = computed(() => this.showErrors() || this._touched());\n\n protected readonly routingError = computed(() => {\n const v = this.routingNumber().trim();\n return v && v.length !== 9 ? this.labels.t('bankAccountForm.routingMustBe9') : '';\n });\n protected readonly accountError = computed(() => {\n const v = this.accountNumber().trim();\n return v && v.length < 4 ? this.labels.t('bankAccountForm.accountMin4') : '';\n });\n protected readonly confirmError = computed(() => {\n const v = this.confirmAccount().trim();\n return v && v !== this.accountNumber().trim() ? this.labels.t('bankAccountForm.accountsDoNotMatch') : '';\n });\n\n /** First reason the form cannot be submitted ('' when it can). */\n readonly errorMessage = computed(() => {\n if (!this.accountHolderName().trim()) return this.labels.t('bankAccountForm.holderRequired');\n if (!this.routingNumber().trim()) return this.labels.t('bankAccountForm.routingRequired');\n if (this.routingError()) return this.routingError();\n if (!this.accountNumber().trim()) return this.labels.t('bankAccountForm.accountRequired');\n if (this.accountError()) return this.accountError();\n if (!this.confirmAccount().trim()) return this.labels.t('bankAccountForm.confirmRequired');\n if (this.confirmError()) return this.confirmError();\n if (!this.accountTypeOptions().some(o => String(o.value) === this.accountType())) return this.labels.t('bankAccountForm.selectValidAccountType');\n if (!this.holderTypeOptions().some(o => String(o.value) === this.holderType())) return this.labels.t('bankAccountForm.selectValidHolderType');\n if (!this.mandateAccepted()) return this.labels.t('bankAccountForm.mandateRequired');\n return '';\n });\n /** True while the form cannot be submitted (`UiFieldValidity`). */\n readonly invalid = computed(() => this.errorMessage() !== '');\n /** True when the form can be submitted (ignores `disabled` / `busy`). */\n readonly valid = computed(() => !this.invalid());\n\n private readonly _fields = viewChildren(UiFieldValidity);\n\n constructor() {\n effect(() => { const d = this.accountHolderNameDefault(); untracked(() => this.accountHolderName.set(d)); });\n effect(() => { const v = this.valid(); untracked(() => this.validChange.emit(v)); });\n }\n\n protected id(name: string): string { return `${this.testIdPrefix()}-${name}`; }\n\n protected onEnter(event: Event) {\n const t = event.target as HTMLElement | null;\n if (t instanceof HTMLInputElement && t.type === 'text') { event.preventDefault(); this.submit(); }\n }\n\n /** Validates and, when valid, emits `submitted`. An invalid form emits nothing and reveals no message on a field the user never left. Ignored while `disabled` / `busy`. */\n submit(): void {\n if (this.locked()) return;\n if (this.invalid() || this._fields().some(f => f.invalid())) { this._touched.set(true); return; }\n this.submitted.emit({\n routingNumber: this.routingNumber().trim(),\n accountNumber: this.accountNumber().trim(),\n accountType: this.accountType() as BankAccountType,\n accountHolderName: this.accountHolderName().trim(),\n holderType: this.holderType() as BankHolderType,\n mandateAccepted: true,\n });\n }\n\n /** Clears every field back to the defaults (checking, individual, authorization unticked, holder name = `accountHolderNameDefault`). */\n reset(): void {\n this.routingNumber.set('');\n this.accountNumber.set('');\n this.confirmAccount.set('');\n this.accountHolderName.set(this.accountHolderNameDefault());\n this.accountType.set('checking');\n this.holderType.set('individual');\n this.mandateAccepted.set(false);\n this._touched.set(false);\n }\n}\n","import { isObservable, firstValueFrom, type Observable } from 'rxjs';\nimport { UiLabelKey, uiText } from '@forgeroute/ui/core';\n\n/**\n * Types and pure helpers of `ui-payment-side-panel`. Nothing here knows a payment processor: Stripe / Square arrive as plugins\n * (`PaymentMethodPlugin`), the card-present terminal as host callbacks.\n */\n\n/** Well-known method values the panel gives behaviour to. Hosts may list any other value (it is recorded like Cash). */\nexport const PAYMENT_METHOD = {\n CARD: 'CARD',\n ACH: 'ACH',\n CASH: 'CASH',\n CHECK: 'CHECK',\n MONEY_ORDER: 'MONEY_ORDER',\n CARD_PRESENT: 'CARD_PRESENT',\n} as const;\n\nexport interface PaymentMethodOption {\n value: string;\n label: string;\n /** `'terminal'`: listed only while the host gave the terminal callbacks (`listReaders` + `startTerminalPayment`). */\n requires?: 'terminal';\n}\n\n/** The methods listed when the host gives none: Card and ACH are record-only until a processor plugin takes them over. */\nexport const DEFAULT_PAYMENT_METHODS: readonly PaymentMethodOption[] = [\n { value: PAYMENT_METHOD.CARD, label: 'Card' },\n { value: PAYMENT_METHOD.ACH, label: 'ACH / Bank Transfer' },\n { value: PAYMENT_METHOD.CASH, label: 'Cash' },\n { value: PAYMENT_METHOD.CHECK, label: 'Check' },\n { value: PAYMENT_METHOD.MONEY_ORDER, label: 'Money Order' },\n { value: PAYMENT_METHOD.CARD_PRESENT, label: 'Card Present (Terminal)', requires: 'terminal' },\n];\n\n/** The default methods with their names in the app's active language (what the panel lists when the host gives none). */\nexport function localizedPaymentMethods(): PaymentMethodOption[] {\n return DEFAULT_PAYMENT_METHODS.map(m => ({ ...m, label: uiText(`paymentSidePanel.method.${m.value}` as UiLabelKey) }));\n}\n\nexport interface PayableCharge {\n id: string;\n chargeType: string;\n description: string;\n /** ISO date `YYYY-MM-DD`. */\n dueDate: string;\n balanceDue: number;\n}\n\nexport interface SavedPaymentMethod {\n method: string;\n last4: string;\n label?: string;\n}\n\nexport interface AllocationModeOption {\n value: string;\n label: string;\n}\n\nexport const ALLOCATION_CUSTOM = 'custom';\n\nexport const DEFAULT_ALLOCATION_MODES: readonly AllocationModeOption[] = [\n { value: 'oldest', label: 'Oldest charges first' },\n { value: 'newest', label: 'Newest charges first' },\n { value: ALLOCATION_CUSTOM, label: 'Choose charges' },\n];\n\n/** The default allocation modes with their names in the app's active language. */\nexport function localizedAllocationModes(): AllocationModeOption[] {\n return DEFAULT_ALLOCATION_MODES.map(m => ({ ...m, label: uiText(`paymentSidePanel.allocation.${m.value}` as UiLabelKey) }));\n}\n\nexport interface ChargeAllocation {\n chargeId: string;\n amount: number;\n}\n\n/**\n * How the payment is applied to charges. A non-custom mode sends `{ allocationMode }`. \"Choose charges\" sends `{ allocationChargeIds, allocations }`\n * (no `allocationMode`, like the old drawer); `allocations` carries the amount per charge.\n */\nexport interface PaymentAllocation {\n allocationMode?: string;\n allocationChargeIds?: string[];\n allocations?: ChargeAllocation[];\n}\n\nexport interface PaymentEntry {\n paymentMethod: string;\n amount: number;\n /** Check number / last 4 digits; `null` when the method has none. */\n reference: string | null;\n /** The receipt checkbox applies to the LAST entry only (like the old drawer); earlier split entries are `false`. */\n sendReceipt: boolean;\n}\n\nexport interface RecordPaymentPayload extends PaymentAllocation {\n /** Total of all entries. */\n amount: number;\n /** The method of a single payment, `'SPLIT'` when `split`. */\n paymentMethod: string;\n receivedDate: string;\n /** Reference of the single payment (`null` for a split: see `entries`). */\n reference: string | null;\n notes: string | null;\n sendReceipt: boolean;\n /** One per payment to create (the host posts one request per entry, or one request with all). */\n entries: PaymentEntry[];\n split: boolean;\n}\n\nexport interface RecordPaymentResult {\n type: 'manual' | 'stripe' | 'split';\n paymentMethod: string;\n amount: number;\n /**\n * Which online processor took the payment, set by a payment plugin that is not Stripe (`'square'`, `'quickbooks'`): `type` stays `'stripe'` for every live card / bank\n * payment (\"online\", kept for existing hosts), `processor` says which one. Absent for a manual record and for the Stripe plugin.\n */\n processor?: string;\n}\n\n/** What the panel reports for the host to word (toasts, analytics). It never toasts itself. */\nexport type PaymentPanelOutcome =\n | { kind: 'recorded'; result: RecordPaymentResult }\n | { kind: 'split-recorded'; result: RecordPaymentResult }\n | { kind: 'terminal-paid'; result: RecordPaymentResult }\n | { kind: 'plugin'; method: string; code: string; result?: RecordPaymentResult; message?: string; attemptKey?: string; paid?: { amount: number | null; method: string } }\n | { kind: 'failed'; stage: 'record' | 'readers' | 'terminal'; message: string };\n\nexport type HostResult<T> = Observable<T> | Promise<T> | T;\nexport type RecordPaymentFn = (payload: RecordPaymentPayload) => HostResult<unknown>;\n\n// ── Terminal (card present), generic callbacks ──\nexport interface TerminalReader {\n id: string;\n label?: string;\n status: string;\n deviceType?: string;\n}\nexport interface TerminalStartContext extends PaymentAllocation {\n readerId: string;\n amount: number;\n receivedDate: string;\n notes: string | null;\n}\nexport interface TerminalStartResult { paymentIntentId: string }\nexport interface TerminalStatusResult { status: string }\nexport interface TerminalConfirmContext extends TerminalStartContext { paymentIntentId: string }\n\nexport type TerminalPhase = 'idle' | 'waiting' | 'confirming' | 'success';\n\n/** Reader statuses that end the wait. */\nexport function terminalVerdict(status: string | null | undefined): 'succeeded' | 'canceled' | 'declined' | 'pending' {\n if (status === 'succeeded') return 'succeeded';\n if (status === 'canceled') return 'canceled';\n if (status === 'requires_payment_method') return 'declined';\n return 'pending';\n}\n\nexport function terminalTimeoutText(ms: number): string {\n const seconds = Math.max(1, Math.round(ms / 1000));\n const span = seconds >= 60 && seconds % 60 === 0\n ? uiText(seconds === 60 ? 'paymentSidePanel.span.minute_one' : 'paymentSidePanel.span.minute_other', { count: seconds / 60 })\n : uiText(seconds === 1 ? 'paymentSidePanel.span.second_one' : 'paymentSidePanel.span.second_other', { count: seconds });\n return uiText('paymentSidePanel.readerTimeout', { span });\n}\n\n// ── Money ──\nexport const MIN_PAYMENT_AMOUNT = 0.01;\nexport const MAX_PAYMENT_AMOUNT = 99999.99;\n\nexport const toCents = (value: number): number => Math.round(value * 100);\nexport const fromCents = (cents: number): number => cents / 100;\nexport const roundMoney = (value: number): number => fromCents(toCents(value));\n\n/** A payable amount: a finite number from 0.01 to `max` with at most two decimals. */\nexport function isValidAmount(value: unknown, max = MAX_PAYMENT_AMOUNT): value is number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return false;\n if (value < MIN_PAYMENT_AMOUNT || value > max) return false;\n return Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;\n}\n\nexport function sumMoney(values: readonly number[]): number {\n return fromCents(values.reduce((sum, v) => sum + toCents(v), 0));\n}\n\n// ── Reference ──\nexport function referenceKind(method: string, live: boolean): 'check' | 'last4-card' | 'last4-account' | null {\n if (method === PAYMENT_METHOD.CHECK) return 'check';\n if (live) return null;\n if (method === PAYMENT_METHOD.CARD) return 'last4-card';\n if (method === PAYMENT_METHOD.ACH) return 'last4-account';\n return null;\n}\n\n/** The last-4 box accepts digits only (blank is fine). */\nexport function last4Error(value: string): string {\n if (!value) return '';\n return /^\\d{4}$/.test(value) ? '' : uiText('paymentSidePanel.exactly4Digits');\n}\n\nexport function last4Digits(value: string, max = 4): string {\n return value.replace(/\\D/g, '').slice(0, max);\n}\n\n// ── Allocation ──\nexport interface AllocationCheck {\n general: string;\n perCharge: Record<string, string>;\n}\n\nexport type SelectedCharges = Record<string, number | null>;\n\nexport function allocationCheck(\n charges: readonly PayableCharge[], selected: SelectedCharges, totalPayment: number | null, format: (n: number) => string,\n): AllocationCheck {\n const check: AllocationCheck = { general: '', perCharge: {} };\n const ticked = charges.filter(c => c.id in selected);\n if (!ticked.length) { check.general = uiText('paymentSidePanel.selectAtLeastOneCharge'); return check; }\n let sum = 0;\n for (const charge of ticked) {\n const amount = selected[charge.id];\n if (amount == null || !(amount > 0)) { check.perCharge[charge.id] = uiText('paymentSidePanel.enterAnAmount'); continue; }\n if (Math.abs(amount * 100 - Math.round(amount * 100)) > 1e-6) { check.perCharge[charge.id] = uiText('paymentSidePanel.atMost2Decimals'); continue; }\n if (toCents(amount) > toCents(charge.balanceDue)) { check.perCharge[charge.id] = uiText('paymentSidePanel.cannotExceedBalance', { amount: format(charge.balanceDue) }); continue; }\n sum += toCents(amount);\n }\n if (!check.general && totalPayment != null && sum > toCents(totalPayment)) {\n check.general = uiText('paymentSidePanel.allocatedExceeds', { allocated: format(fromCents(sum)), payment: format(totalPayment) });\n }\n return check;\n}\n\n/** The amount to propose when a charge is ticked: its balance, capped by what is left of the payment. */\nexport function defaultChargeAmount(charge: PayableCharge, selected: SelectedCharges, totalPayment: number | null): number | null {\n const balance = roundMoney(charge.balanceDue);\n if (totalPayment == null) return balance > 0 ? balance : null;\n const used = Object.entries(selected).reduce((s, [, v]) => s + (v ? toCents(v) : 0), 0);\n const left = toCents(totalPayment) - used;\n const cents = Math.min(toCents(balance), left);\n return cents > 0 ? fromCents(cents) : null;\n}\n\nexport function buildAllocation(mode: string, charges: readonly PayableCharge[], selected: SelectedCharges): PaymentAllocation {\n if (mode !== ALLOCATION_CUSTOM) return { allocationMode: mode };\n const ticked = charges.filter(c => c.id in selected);\n return {\n allocationChargeIds: ticked.map(c => c.id),\n allocations: ticked.map(c => ({ chargeId: c.id, amount: roundMoney(selected[c.id] ?? 0) })),\n };\n}\n\n/** \"2026-11-03\" -> \"Nov 3, 2026\" without `Date` string parsing (Safari-safe, time-zone independent). */\nexport function formatDueDate(iso: string, locale = 'en-US'): string {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(iso ?? '');\n if (!m) return iso ?? '';\n const date = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));\n return new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' }).format(date);\n}\n\n/** Runs a host callback that may return an Observable, a Promise or a value; a synchronous throw becomes a rejection. */\nexport async function callHost<T>(thunk: () => HostResult<T>): Promise<T> {\n const result = thunk();\n if (isObservable(result)) return firstValueFrom(result, { defaultValue: undefined as T });\n return result;\n}\n\n/** The text of a failed host call: its HTTP body message, its message, else the fallback. */\nexport function hostErrorMessage(err: unknown, fallback: string): string {\n const e = err as { error?: { message?: unknown }; message?: unknown } | null | undefined;\n if (typeof e?.error?.message === 'string' && e.error.message) return e.error.message;\n if (typeof e?.message === 'string' && e.message) return e.message;\n return fallback;\n}\n","import { InjectionToken, type Signal, type TemplateRef } from '@angular/core';\nimport type { PaymentAllocation, RecordPaymentResult } from './payment-side-panel.models';\n\n/** A method a plugin contributes to the panel's method select (while the plugin is rendered inside the panel). */\nexport interface PaymentPluginMethod {\n value: string;\n label: string;\n}\n\n/** The footer button a plugin body may ask the panel to show instead of the panel's own (the panel's own button is hidden for plugin methods). */\nexport interface PaymentPluginPrimary {\n label: string;\n disabled?: boolean;\n loading?: boolean;\n onClick: () => void;\n}\n\n/**\n * What the panel hands to a plugin body (`<ng-template let-ctx>`). The values are a snapshot that is replaced whenever the form changes (read them in the\n * template or in an `input()` of a child component); the functions are stable.\n */\nexport interface PaymentMethodContext {\n /** The selected method value (one of the plugin's `methods`). */\n readonly method: string;\n /** The entered amount, or `null` while it is empty or invalid (a plugin should not start a charge without it). */\n readonly amount: number | null;\n /** ISO date the payment was received. */\n readonly receivedDate: string;\n readonly note: string;\n /** How the payment is applied to charges (same shape the manual payload carries). */\n readonly allocation: PaymentAllocation;\n /** ISO 4217 code of the panel (`'USD'`). */\n readonly currency: string;\n /** Every field of the panel is valid (amount, date, note, allocation). */\n readonly valid: boolean;\n /** Marks the panel as submit-attempted (as a failed Save click does; it reveals no message on a field the user never left) and returns whether the form is valid. Call it before starting a charge. */\n validate(): boolean;\n /** Clears the whole form (method, amount, note, split, allocation; the date returns to today). */\n reset(): void;\n /** The payment is done: the panel reports it (`outcome` kind `'plugin'`, code `'complete'`, then `recorded`). Defaults: type `'manual'`, the selected method, the entered amount. Runs once. */\n complete(result?: Partial<RecordPaymentResult>): void;\n /** A flow is running: the fields are locked and the method cannot be changed. */\n setBusy(busy: boolean): void;\n /** The plugin's own footer button (e.g. \"Pay $120.00\"); `null` removes it. The panel's own Save button never shows for a plugin method. */\n setPrimary(button: PaymentPluginPrimary | null): void;\n /** Hide the panel's fields and show only the plugin body (e.g. a \"payment submitted\" notice). */\n setExclusive(on: boolean): void;\n /** Called when the body is about to go away unfinished: the panel closes, the method changes, or the plugin is removed. Not called after `complete()`. */\n onCancel(fn: (() => void) | null): void;\n /** Tell the host something happened (`outcome` kind `'plugin'`) so it can word a toast. `attemptKey` names the attempt a report is about (the second payment of a `duplicate_suspected`, the payment another tab made in `paid_elsewhere`); `paid` is the amount (major units) and method that payment was made with, for a host that reconciles it. */\n report(code: string, extra?: { result?: RecordPaymentResult; message?: string; attemptKey?: string; paid?: { amount: number | null; method: string } }): void;\n /** Text for the panel's screen-reader status region. */\n announce(text: string): void;\n}\n\nexport interface PaymentMethodBodyContext {\n $implicit: PaymentMethodContext;\n}\n\n/**\n * The contract of a payment plugin: a child element of `<ui-payment-side-panel>` that contributes live methods (Stripe, Square, ...).\n * The panel finds plugins with `contentChildren(PAYMENT_METHOD_PLUGIN)`, so presence IS the opt-in; remove the element and its methods leave the select.\n * A plugin whose method value is `CARD` or `ACH` replaces the record-only behaviour (last 4 digits) of that value while it is rendered.\n */\nexport abstract class PaymentMethodPlugin {\n abstract readonly methods: Signal<readonly PaymentPluginMethod[]>;\n /** The body shown under the form while one of the plugin's methods is selected. */\n abstract readonly template: Signal<TemplateRef<PaymentMethodBodyContext> | undefined>;\n}\n\nexport const PAYMENT_METHOD_PLUGIN = new InjectionToken<PaymentMethodPlugin>('PAYMENT_METHOD_PLUGIN');\n","import { ChangeDetectionStrategy, Component, TemplateRef, computed, contentChild, forwardRef, input } from '@angular/core';\nimport { PAYMENT_METHOD_PLUGIN, PaymentMethodPlugin, type PaymentMethodBodyContext, type PaymentPluginMethod } from './payment-method-plugin';\n\n/**\n * The generic payment plugin: the host renders the body of a method it built itself (Square Web SDK, a gateway widget, ...).\n *\n * <ui-payment-side-panel ...>\n * <ui-payment-custom-method value=\"CARD\" label=\"Card\">\n * <ng-template let-ctx> <my-square-card [amount]=\"ctx.amount\" (paid)=\"ctx.complete({ type: 'stripe' })\" /> </ng-template>\n * </ui-payment-custom-method>\n * </ui-payment-side-panel>\n */\n@Component({\n selector: 'ui-payment-custom-method',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: PAYMENT_METHOD_PLUGIN, useExisting: forwardRef(() => PaymentCustomMethodComponent) }],\n template: ``,\n host: { style: 'display: none' },\n})\nexport class PaymentCustomMethodComponent extends PaymentMethodPlugin {\n readonly value = input.required<string>();\n readonly label = input.required<string>();\n private readonly body = contentChild(TemplateRef<PaymentMethodBodyContext>);\n\n readonly methods = computed((): readonly PaymentPluginMethod[] => [{ value: this.value(), label: this.label() }]);\n readonly template = computed(() => this.body() as TemplateRef<PaymentMethodBodyContext> | undefined);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injector, ViewEncapsulation, afterNextRender, computed, contentChildren, effect, inject, input, isDevMode, output, signal, untracked, viewChildren } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { AlertComponent } from '@forgeroute/ui/alert';\nimport { ButtonComponent } from '@forgeroute/ui/core';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { ChipComponent } from '@forgeroute/ui/chip';\nimport { ChipGroupComponent } from '@forgeroute/ui/chip';\nimport { DateInputComponent } from '@forgeroute/ui/date-input';\nimport { ErrorComponent } from '@forgeroute/ui/error';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { KpiCardComponent } from '@forgeroute/ui/kpi-card';\nimport { SelectComponent } from '@forgeroute/ui/select';\nimport { SidePanelComponent } from '@forgeroute/ui/core';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { TextareaInputComponent } from '@forgeroute/ui/textarea-input';\nimport { formatCurrency } from '@forgeroute/ui/utils';\nimport { UiFieldValidity } from '@forgeroute/ui/core';\nimport { PAYMENT_METHOD_PLUGIN, type PaymentMethodBodyContext, type PaymentMethodContext, type PaymentMethodPlugin, type PaymentPluginPrimary } from './payment-method-plugin';\nimport {\n ALLOCATION_CUSTOM, localizedAllocationModes, localizedPaymentMethods, MAX_PAYMENT_AMOUNT, PAYMENT_METHOD, allocationCheck, buildAllocation, callHost, defaultChargeAmount,\n last4Digits, formatDueDate, hostErrorMessage, isValidAmount, last4Error, referenceKind, roundMoney, sumMoney, terminalTimeoutText, terminalVerdict,\n type AllocationModeOption, type HostResult, type PayableCharge, type PaymentAllocation, type PaymentEntry, type PaymentMethodOption, type PaymentPanelOutcome,\n type RecordPaymentFn, type RecordPaymentPayload, type RecordPaymentResult, type SavedPaymentMethod, type SelectedCharges, type TerminalConfirmContext,\n type TerminalPhase, type TerminalReader, type TerminalStartContext, type TerminalStartResult, type TerminalStatusResult,\n} from './payment-side-panel.models';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { safeLocale } from '@forgeroute/ui/core';\n\nlet nextId = 0;\n\ninterface SplitEntry { method: string; amount: number; reference: string }\n\n/**\n * Side panel for staff to RECORD or COLLECT a payment. Works on its own (record-only: Cash, Check, Money Order, Card and ACH with the last 4 digits) and grows\n * by PLUGINS the host drops in as child elements (`ui-payment-stripe-method` from `@forgeroute/ui/stripe`, `ui-payment-custom-method` for Square or any widget):\n * a plugin's presence IS the opt-in, and a plugin method with the value `CARD` / `ACH` replaces the record-only behaviour while it is rendered.\n * The panel has no HTTP and no processor knowledge: the host gives callbacks (`recordPayment`, the terminal calls) and words the `outcome` events.\n *\n * <ui-payment-side-panel [open]=\"open()\" [today]=\"today()\" [outstandingBalance]=\"due()\" [charges]=\"charges()\"\n * [recordPayment]=\"record\" (recorded)=\"onRecorded($event)\" (closed)=\"open.set(false)\" />\n *\n * See docs/payment-side-panel.md.\n */\n@Component({\n selector: 'ui-payment-side-panel',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n FormsModule, NgTemplateOutlet, AlertComponent, ButtonComponent, CheckboxComponent, ChipComponent, ChipGroupComponent, DateInputComponent, ErrorComponent,\n KpiCardComponent, FormSectionComponent, SelectComponent, SidePanelComponent, TextInputComponent, TextareaInputComponent,\n ],\n template: `\n <ui-side-panel [open]=\"open()\" [title]=\"title()\" [subtitle]=\"subtitle()\" [primaryLabel]=\"primaryLabel()\" [primaryLoading]=\"primaryLoading()\"\n [primaryDisabled]=\"primaryDisabled()\" primaryTestId=\"psp-primary\" cancelTestId=\"psp-cancel\" (closed)=\"onClose()\" (primaryClick)=\"onPrimary()\">\n @if (open()) {\n <div class=\"psp-sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" data-testid=\"psp-live\">{{ announcement() }}</div>\n <div class=\"psp\" [attr.aria-busy]=\"busy() || submitting() ? 'true' : null\">\n @if (!exclusive()) {\n @if (outstandingBalance() != null && outstandingBalance()! > 0) {\n <ui-kpi-card class=\"psp-balance\" data-testid=\"psp-balance\" [label]=\"labels.t('paymentSidePanel.outstandingBalance')\" [value]=\"money(outstandingBalance()!)\" icon=\"alert-circle\" color=\"red\" valueColor=\"red\" />\n }\n\n @if (splitEntries().length > 0) {\n <div class=\"psp-split\" data-testid=\"psp-split\" role=\"group\" [attr.aria-labelledby]=\"ids + '-split'\">\n <ui-kpi-card class=\"psp-split-total\" data-testid=\"psp-split-total\" [label]=\"labels.t('paymentSidePanel.recordedSoFar')\" [value]=\"money(splitTotal())\"\n [subtitle]=\"labels.t(splitEntries().length === 1 ? 'paymentSidePanel.splitPayments_one' : 'paymentSidePanel.splitPayments_other', { count: splitEntries().length })\" icon=\"check-circle\" color=\"blue\" valueColor=\"blue\" />\n <span class=\"psp-split-title\" [id]=\"ids + '-split'\">{{ labels.t('paymentSidePanel.splitPayment') }}</span>\n @for (entry of splitEntries(); track $index) {\n <div class=\"psp-split-entry\" data-testid=\"psp-split-entry\">\n <span>{{ methodLabel(entry.method) }}@if (entry.reference) { <span class=\"psp-muted\"> •••• {{ entry.reference }}</span> }</span>\n <span>{{ money(entry.amount) }}</span>\n <ui-button variant=\"icon\" size=\"sm\" [disabled]=\"busy() || submitting()\" [ariaLabel]=\"labels.t('paymentSidePanel.removeEntry', { method: methodLabel(entry.method), amount: money(entry.amount) })\" data-testid=\"psp-split-remove\" (click)=\"removeSplit($index)\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M18 6L6 18\"/><path d=\"M6 6l12 12\"/></svg>\n </ui-button>\n </div>\n }\n </div>\n }\n\n @if (savedChips().length > 0) {\n <div class=\"psp-saved\" data-testid=\"psp-saved\" role=\"group\" [attr.aria-labelledby]=\"ids + '-saved'\">\n <span class=\"psp-saved-label\" [id]=\"ids + '-saved'\">{{ labels.t('paymentSidePanel.previouslyUsed') }}</span>\n <ui-chip-group gap=\"sm\" spaceAbove=\"none\" spaceBelow=\"sm\">\n @for (saved of savedChips(); track saved.method + saved.last4) {\n <ui-chip size=\"sm\" [label]=\"chipLabel(saved)\" [active]=\"method() === saved.method && reference() === saved.last4\" data-testid=\"psp-saved-chip\" (select)=\"selectSaved(saved)\" />\n }\n </ui-chip-group>\n </div>\n }\n\n <ui-form-section>\n <div class=\"psp-method-row\">\n <ui-select class=\"psp-method\" [label]=\"labels.t('paymentSidePanel.paymentMethod')\" [placeholder]=\"labels.t('paymentSidePanel.selectPaymentMethod')\" [required]=\"methodRequired()\" [options]=\"methodOptions()\"\n [disabled]=\"busy() || submitting() || !!retryIntentId()\" [showErrors]=\"touched()\" [ngModel]=\"method()\" (ngModelChange)=\"onMethodChange($event)\" data-testid=\"psp-method\" />\n @if (method()) {\n <ui-button variant=\"icon\" size=\"sm\" [disabled]=\"busy() || submitting() || !!retryIntentId()\" [ariaLabel]=\"labels.t('paymentSidePanel.clearPaymentMethod')\" data-testid=\"psp-method-clear\" (click)=\"onMethodChange('')\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M18 6L6 18\"/><path d=\"M6 6l12 12\"/></svg>\n </ui-button>\n }\n </div>\n\n <ui-text-input [label]=\"splitEntries().length > 0 ? labels.t('paymentSidePanel.additionalAmountLabel', { symbol: currencySymbol() }) : labels.t('paymentSidePanel.amountLabel', { symbol: currencySymbol() })\" type=\"number\" valueType=\"number\"\n [required]=\"splitEntries().length === 0\" [min]=\"0.01\" [max]=\"maxAmount()\" [maxDecimals]=\"2\" [step]=\"0.01\" inputmode=\"decimal\" [placeholder]=\"labels.t('paymentSidePanel.enterAmount')\"\n [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"amount()\" (ngModelChange)=\"amount.set($event)\" inputTestId=\"psp-amount\" />\n\n <ui-date-input [label]=\"labels.t('paymentSidePanel.receivedDate')\" [required]=\"true\" [max]=\"dateMax()\" [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"receivedDate()\" (ngModelChange)=\"receivedDate.set($event ?? '')\" data-testid=\"psp-date\" />\n\n @switch (refKind()) {\n @case ('check') {\n <ui-text-input [label]=\"labels.t('paymentSidePanel.check')\" [placeholder]=\"labels.t('common.example', { value: '1234' })\" [maxlength]=\"50\" [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"reference()\" (ngModelChange)=\"reference.set($event ?? '')\" inputTestId=\"psp-reference\" />\n }\n @case ('last4-card') {\n <ui-text-input [label]=\"labels.t('paymentSidePanel.last4DigitsOfCard')\" [placeholder]=\"labels.t('common.example', { value: '4242' })\" [maxlength]=\"4\" inputmode=\"numeric\" [disabled]=\"locked()\" [error]=\"touched() ? referenceError() : ''\"\n [ngModel]=\"reference()\" (ngModelChange)=\"onLast4($event)\" inputTestId=\"psp-reference\" />\n }\n @case ('last4-account') {\n <ui-text-input [label]=\"labels.t('paymentSidePanel.last4DigitsOfAccount')\" [placeholder]=\"labels.t('common.example', { value: '6789' })\" [maxlength]=\"4\" inputmode=\"numeric\" [disabled]=\"locked()\" [error]=\"touched() ? referenceError() : ''\"\n [ngModel]=\"reference()\" (ngModelChange)=\"onLast4($event)\" inputTestId=\"psp-reference\" />\n }\n }\n\n <ui-textarea-input [label]=\"labels.t('common.note')\" [placeholder]=\"labels.t('paymentSidePanel.optionalNote')\" [rows]=\"2\" [maxlength]=\"500\" [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"note()\" (ngModelChange)=\"note.set($event ?? '')\" data-testid=\"psp-note\" />\n\n @if (charges().length > 0) {\n <div class=\"psp-allocation\" data-testid=\"psp-allocation\" role=\"group\" [attr.aria-labelledby]=\"ids + '-alloc'\">\n <span class=\"psp-saved-label\" [id]=\"ids + '-alloc'\">{{ labels.t('paymentSidePanel.applyPaymentTo') }}</span>\n <ui-select [ariaLabel]=\"labels.t('paymentSidePanel.applyPaymentTo')\" [ariaDescribedBy]=\"allocationMessage() ? ids + '-alloc-error' : ''\" [options]=\"allocationOptions()\" [disabled]=\"locked()\" [ngModel]=\"allocationMode()\" (ngModelChange)=\"onAllocationMode($event)\" data-testid=\"psp-allocation-mode\" />\n @if (allocationMode() === customMode) {\n <div class=\"psp-charges\" data-testid=\"psp-charges\" (focusout)=\"allocationTouched.set(true)\">\n @for (charge of charges(); track charge.id) {\n <div class=\"psp-charge\" data-testid=\"psp-charge\">\n <ui-checkbox [label]=\"charge.chargeType\" [description]=\"chargeDescription(charge)\" [disabled]=\"locked()\" [ngModel]=\"isTicked(charge.id)\" (ngModelChange)=\"toggleCharge(charge, $event)\" [testId]=\"'psp-charge-' + charge.id\" />\n @if (isTicked(charge.id)) {\n <ui-text-input class=\"psp-charge-amount\" type=\"number\" valueType=\"number\" [ariaLabel]=\"labels.t('paymentSidePanel.amountFor', { name: charge.chargeType })\" [min]=\"0.01\" [maxDecimals]=\"2\" [step]=\"0.01\" inputmode=\"decimal\"\n [disabled]=\"locked()\" [error]=\"allocation().perCharge[charge.id] ?? ''\" [ngModel]=\"selectedCharges()[charge.id]\" (ngModelChange)=\"setChargeAmount(charge.id, $event)\" [inputTestId]=\"'psp-charge-amount-' + charge.id\" />\n }\n </div>\n }\n </div>\n <ui-error [errorId]=\"ids + '-alloc-error'\" [message]=\"allocationMessage()\" data-testid=\"psp-allocation-error\" />\n }\n </div>\n }\n\n @if (kind() === 'manual' && method() && canSplit()) {\n <div>\n <ui-button variant=\"secondary\" size=\"sm\" [disabled]=\"locked() || submitting()\" data-testid=\"psp-add-split\" (click)=\"addSplit()\">{{ labels.t('paymentSidePanel.addAsSplitPayment') }}</ui-button>\n </div>\n }\n @if (receiptLabel() && ((kind() === 'manual' && method()) || splitEntries().length > 0)) {\n <ui-checkbox [label]=\"receiptLabel()\" [disabled]=\"locked()\" [ngModel]=\"sendReceipt()\" (ngModelChange)=\"sendReceipt.set(!!$event)\" testId=\"psp-receipt\" />\n }\n </ui-form-section>\n }\n\n @if (kind() === 'terminal' && !exclusive()) {\n <div class=\"psp-terminal\" data-testid=\"psp-terminal\">\n <div class=\"psp-reader-row\">\n <ui-select class=\"psp-reader\" [label]=\"labels.t('paymentSidePanel.selectReader')\" [placeholder]=\"labels.t('paymentSidePanel.chooseAReader')\" [required]=\"true\" [options]=\"readerOptions()\" [disabled]=\"terminalPhase() !== 'idle' || sendingToReader() || !!retryIntentId()\"\n [ngModel]=\"readerId()\" (ngModelChange)=\"readerId.set($event ?? '')\" data-testid=\"psp-reader\" />\n <ui-button variant=\"icon\" size=\"sm\" [ariaLabel]=\"labels.t('paymentSidePanel.refreshReaderStatus')\" [disabled]=\"loadingReaders()\" data-testid=\"psp-reader-refresh\" (click)=\"refreshReaders()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"23 4 23 10 17 10\"/><polyline points=\"1 20 1 14 7 14\"/><path d=\"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15\"/></svg>\n </ui-button>\n </div>\n @if (readers().length === 0 && readersLoaded() && !loadingReaders() && !readersError()) {\n <ui-alert variant=\"warning\" data-testid=\"psp-no-readers\">{{ noReadersText() }}</ui-alert>\n }\n @if (readersError()) { <ui-alert variant=\"danger\" data-testid=\"psp-readers-error\">{{ readersError() }}</ui-alert> }\n @if (readerId() && selectedReader()) {\n @if (selectedReader()!.status === 'online') {\n <ui-alert variant=\"success\" [compact]=\"true\" data-testid=\"psp-reader-online\">{{ labels.t('paymentSidePanel.deviceConnected', { provider: terminalProvider() }) }}</ui-alert>\n } @else {\n <ui-alert variant=\"danger\" [compact]=\"true\" data-testid=\"psp-reader-offline\">{{ labels.t('paymentSidePanel.deviceNotConnected', { provider: terminalProvider() }) }}</ui-alert>\n }\n }\n @switch (terminalPhase()) {\n @case ('idle') {\n @if (retryIntentId()) {\n <ui-button variant=\"primary\" [loading]=\"retrying()\" [disabled]=\"retrying()\" data-testid=\"psp-terminal-retry\" (click)=\"retryRecording()\">{{ labels.t('paymentSidePanel.retryRecording') }}</ui-button>\n } @else {\n <ui-button variant=\"primary\" [loading]=\"sendingToReader()\" [disabled]=\"!canSendToReader()\" data-testid=\"psp-terminal-send\" (click)=\"sendToReader()\">{{ sendingToReader() ? labels.t('paymentSidePanel.sending') : labels.t('paymentSidePanel.sendToReader') }}</ui-button>\n }\n }\n @case ('waiting') {\n <div class=\"psp-waiting\" data-testid=\"psp-terminal-waiting\">\n <span>{{ labels.t('paymentSidePanel.waitingForCustomerToTap') }}</span>\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"psp-terminal-cancel\" (click)=\"cancelTerminalPayment()\">{{ labels.t('common.cancel') }}</ui-button>\n </div>\n }\n @case ('confirming') { <div class=\"psp-waiting\" data-testid=\"psp-terminal-confirming\">{{ labels.t('paymentSidePanel.recordingPayment') }}</div> }\n @case ('success') { <ui-alert variant=\"success\" data-testid=\"psp-terminal-success\">{{ labels.t('paymentSidePanel.paymentSuccessful', { amount: money(terminalAmount()) }) }}</ui-alert> }\n }\n @if (terminalError()) { <div class=\"psp-terminal-error\" tabindex=\"-1\" data-testid=\"psp-terminal-error-wrap\"><ui-alert variant=\"danger\" data-testid=\"psp-terminal-error\">{{ terminalError() }}</ui-alert></div> }\n </div>\n }\n\n @if (kind() === 'live') {\n @if (pluginTemplate(); as tpl) {\n <div class=\"psp-plugin\" data-testid=\"psp-plugin\">\n <ng-container *ngTemplateOutlet=\"tpl; context: pluginContext()\" />\n </div>\n }\n }\n\n @if (submitError()) { <div class=\"psp-alert\"><ui-alert variant=\"danger\" data-testid=\"psp-submit-error\">{{ submitError() }}</ui-alert></div> }\n </div>\n }\n </ui-side-panel>\n `,\n styles: [`\n ui-payment-side-panel { display: contents; }\n ui-payment-side-panel .psp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n ui-payment-side-panel .psp { --psp-sunken: var(--ui-psp-sunken, #f8fafc); --psp-border: var(--ui-psp-border, #e2e8f0); --psp-text: var(--ui-psp-text, #1e293b); --psp-muted: var(--ui-psp-muted, #475569); --psp-danger: var(--ui-psp-danger, #b91c1c); display: flex; flex-direction: column; gap: 14px; color: var(--psp-text); }\n ui-payment-side-panel .psp-split { font-size: 0.8125rem; }\n ui-payment-side-panel .psp-split-title { display: block; margin: 12px 0 4px; font-weight: 600; }\n ui-payment-side-panel .psp-split-entry { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--psp-muted); border-bottom: 1px solid var(--psp-border); }\n ui-payment-side-panel .psp-split-entry:last-child { border-bottom: none; }\n ui-payment-side-panel .psp-split-entry > span:first-child { flex: 1; min-width: 0; }\n ui-payment-side-panel .psp-muted { color: var(--psp-muted); }\n ui-payment-side-panel .psp-saved-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--psp-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }\n ui-payment-side-panel .psp-method-row, ui-payment-side-panel .psp-reader-row { display: flex; align-items: flex-end; gap: 8px; }\n ui-payment-side-panel .psp-method, ui-payment-side-panel .psp-reader { flex: 1; min-width: 0; }\n ui-payment-side-panel .psp-allocation { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--psp-border); }\n ui-payment-side-panel .psp-charges { max-height: 260px; overflow-y: auto; border: 1px solid var(--psp-border); border-radius: 8px; }\n ui-payment-side-panel .psp-charge { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--psp-border); }\n ui-payment-side-panel .psp-charge:last-child { border-bottom: none; }\n ui-payment-side-panel .psp-terminal { display: flex; flex-direction: column; gap: 12px; }\n ui-payment-side-panel .psp-waiting { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 16px; background: var(--psp-sunken); border-radius: 10px; text-align: center; font-size: 0.875rem; font-weight: 500; color: var(--psp-muted); }\n ui-payment-side-panel .psp-plugin { min-width: 0; }\n ui-payment-side-panel .psp-terminal-error:focus { outline: none; }\n `],\n})\nexport class PaymentSidePanelComponent {\n protected readonly labels = inject(UiLabelsService);\n private readonly injector = inject(Injector);\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n protected readonly ids = `psp-${nextId++}`;\n protected readonly customMode = ALLOCATION_CUSTOM;\n\n // ── Inputs ──\n readonly open = input(false);\n readonly titleInput = input<string | null>(null, { alias: 'title' });\n readonly title = computed(() => this.titleInput() ?? this.labels.t('paymentSidePanel.title'));\n readonly subtitle = input('');\n /** Today as `YYYY-MM-DD` (the host's clock/time zone): the default Received Date. The panel never builds dates itself. */\n readonly today = input('');\n /** When > 0 a banner shows it and the amount starts at this balance. */\n readonly outstandingBalance = input<number | null>(null);\n /** ISO 4217 code used for every amount shown. */\n readonly currency = input('USD');\n readonly maxAmount = input(MAX_PAYMENT_AMOUNT);\n /** Latest Received Date (ISO). Default: `today`, because a payment cannot be received in the future. */\n readonly maxDate = input('');\n /** The methods listed (value/label). Default: Card, ACH / Bank Transfer, Cash, Check, Money Order, Card Present (terminal callbacks given). */\n readonly methodsInput = input<readonly PaymentMethodOption[] | null>(null, { alias: 'methods' });\n readonly methods = computed((): readonly PaymentMethodOption[] => this.methodsInput() ?? localizedPaymentMethods());\n readonly savedMethods = input<readonly SavedPaymentMethod[]>([]);\n readonly charges = input<readonly PayableCharge[]>([]);\n readonly allocationModesInput = input<readonly AllocationModeOption[] | null>(null, { alias: 'allocationModes' });\n readonly allocationModes = computed((): readonly AllocationModeOption[] => this.allocationModesInput() ?? localizedAllocationModes());\n readonly defaultAllocationMode = input('oldest');\n /** Text of the \"send receipt\" checkbox (e.g. \"Email receipt to resident\"); empty hides it. */\n readonly receiptLabel = input('');\n readonly submitLabelInput = input<string | null>(null, { alias: 'submitLabel' });\n readonly submitLabel = computed(() => this.submitLabelInput() ?? this.labels.t('paymentSidePanel.submitLabel'));\n readonly splitSubmitLabelInput = input<string | null>(null, { alias: 'splitSubmitLabel' });\n readonly splitSubmitLabel = computed(() => this.splitSubmitLabelInput() ?? this.labels.t('paymentSidePanel.splitSubmitLabel'));\n /** Records the payment. Returns an Observable / Promise; a rejection is shown in the panel and it stays open. */\n readonly recordPayment = input<RecordPaymentFn | null>(null);\n\n // Card-present terminal (generic callbacks; the method is listed while `listReaders` and `startTerminalPayment` are given)\n readonly listReaders = input<(() => HostResult<readonly TerminalReader[]>) | null>(null);\n readonly startTerminalPayment = input<((ctx: TerminalStartContext) => HostResult<TerminalStartResult>) | null>(null);\n readonly terminalStatus = input<((paymentIntentId: string) => HostResult<TerminalStatusResult>) | null>(null);\n readonly confirmTerminalPayment = input<((ctx: TerminalConfirmContext) => HostResult<unknown>) | null>(null);\n readonly cancelTerminal = input<((readerId: string) => HostResult<unknown>) | null>(null);\n readonly terminalProviderInput = input<string | null>(null, { alias: 'terminalProvider' });\n readonly terminalProvider = computed(() => this.terminalProviderInput() ?? this.labels.t('paymentSidePanel.terminalProvider'));\n readonly noReadersTextInput = input<string | null>(null, { alias: 'noReadersText' });\n readonly noReadersText = computed(() => this.noReadersTextInput() ?? this.labels.t('paymentSidePanel.noReadersText'));\n readonly terminalPollMs = input(2000);\n readonly terminalTimeoutMs = input(120000);\n readonly readerRefreshMs = input(15000);\n readonly terminalSuccessDelayMs = input(1500);\n\n // ── Outputs ──\n readonly closed = output<void>();\n /** The payment is done (any flow). The host closes the panel. */\n readonly recorded = output<RecordPaymentResult>();\n /** What happened, for the host to word (the panel never toasts). */\n readonly outcome = output<PaymentPanelOutcome>();\n\n // ── Plugins ──\n private readonly plugins = contentChildren<PaymentMethodPlugin>(PAYMENT_METHOD_PLUGIN, { descendants: true });\n private readonly fields = viewChildren(UiFieldValidity);\n\n // ── Form state ──\n readonly method = signal('');\n readonly amount = signal<number | null>(null);\n readonly receivedDate = signal('');\n readonly reference = signal('');\n readonly note = signal('');\n readonly sendReceipt = signal(false);\n readonly splitEntries = signal<SplitEntry[]>([]);\n readonly allocationMode = signal('oldest');\n readonly selectedCharges = signal<SelectedCharges>({});\n readonly touched = signal(false);\n /** The user ticked / unticked a charge, edited a charge amount or left the charge list. Only then is the allocation message (\"Select at least one charge\") shown; a failed Save does not reveal it (it still blocks Save via `hasInvalid`). */\n readonly allocationTouched = signal(false);\n readonly submitting = signal(false);\n readonly submitError = signal('');\n readonly announcement = signal('');\n\n // Plugin state\n private readonly pluginBusy = signal(false);\n protected readonly exclusive = signal(false);\n private readonly pluginPrimary = signal<PaymentPluginPrimary | null>(null);\n private cancelHook: (() => void) | null = null;\n /** The method value that was a live plugin method when last checked ('' = none), to notice the plugin disappearing under a selected method. */\n private liveMethodValue = '';\n private completed = false;\n /** The plugin's last report was `verification` (a bank payment that has NOT started): its \"Done\" is announced as \"payment not started\", never as \"Payment recorded\". */\n private verificationReported = false;\n\n // Terminal state\n readonly readers = signal<readonly TerminalReader[]>([]);\n readonly readersLoaded = signal(false);\n readonly loadingReaders = signal(false);\n readonly readersError = signal('');\n readonly readerId = signal('');\n readonly terminalPhase = signal<TerminalPhase>('idle');\n readonly terminalError = signal('');\n readonly sendingToReader = signal(false);\n readonly retryIntentId = signal('');\n readonly retrying = signal(false);\n readonly terminalAmount = signal(0);\n /** Bumped when the form is reset or the panel closes: an async terminal step that finishes later must not touch the new state. */\n private session = 0;\n private retryContext: TerminalConfirmContext | null = null;\n private pollTimer: ReturnType<typeof setTimeout> | null = null;\n private pollToken = 0;\n private refreshTimer: ReturnType<typeof setTimeout> | null = null;\n private successTimer: ReturnType<typeof setTimeout> | null = null;\n private pendingTerminalResult: RecordPaymentResult | null = null;\n private terminalContext: TerminalConfirmContext | null = null;\n\n protected readonly busy = computed(() => this.pluginBusy() || this.terminalPhase() !== 'idle' || this.sendingToReader() || this.retrying());\n /** Fields are read-only while something runs, and while a taken terminal payment still has to be recorded (its amount must not change). */\n protected readonly locked = computed(() => this.busy() || this.submitting() || !!this.retryIntentId());\n protected readonly dateMax = computed(() => this.maxDate() || this.today());\n protected readonly money = (value: number): string => formatCurrency(value, { currency: this.currency(), locale: this.labels.locale() });\n protected readonly currencySymbol = computed(() => {\n try { return new Intl.NumberFormat(safeLocale(this.labels.locale()), { style: 'currency', currency: this.currency() }).formatToParts(0).find(p => p.type === 'currency')?.value ?? this.currency(); } catch { return this.currency(); }\n });\n\n private readonly terminalAvailable = computed(() => !!this.listReaders() && !!this.startTerminalPayment());\n /** value -> label of every live method the rendered plugins contribute (the first plugin wins a duplicate value). */\n private readonly liveMethods = computed(() => {\n const map = new Map<string, { label: string; plugin: PaymentMethodPlugin }>();\n for (const plugin of this.plugins()) for (const m of plugin.methods()) if (!map.has(m.value)) map.set(m.value, { label: m.label, plugin });\n return map;\n });\n protected readonly kind = computed((): 'none' | 'manual' | 'live' | 'terminal' => this.kindOf(this.method()));\n private kindOf(value: string): 'none' | 'manual' | 'live' | 'terminal' {\n if (!value) return 'none';\n if (this.liveMethods().has(value)) return 'live';\n if (value === PAYMENT_METHOD.CARD_PRESENT && this.terminalAvailable()) return 'terminal';\n return 'manual';\n }\n\n /** The method list as shown: record-only built-ins (a plugin takes over its own values), plugin extras, and only manual ones while a split is being built. */\n readonly methodList = computed((): PaymentMethodOption[] => {\n const live = this.liveMethods();\n const terminal = this.terminalAvailable();\n const listed = this.methods();\n const base = listed.filter(o => o.requires !== 'terminal' || terminal).map(o => ({ value: o.value, label: live.get(o.value)?.label ?? o.label }));\n const extra = [...live.entries()].filter(([value]) => !listed.some(o => o.value === value)).map(([value, v]) => ({ value, label: v.label }));\n const all = [...base, ...extra];\n return this.splitEntries().length > 0 ? all.filter(o => this.kindOf(o.value) === 'manual') : all;\n });\n protected readonly methodOptions = computed(() => this.methodList().map(o => ({ value: o.value, label: o.label })));\n protected readonly methodRequired = computed(() => this.splitEntries().length === 0 || this.amount() != null);\n protected readonly allocationOptions = computed(() => this.allocationModes().map(o => ({ value: o.value, label: o.label })));\n\n /** Hidden while a taken terminal payment still has to be recorded: the method cannot change then. */\n protected readonly savedChips = computed(() => this.retryIntentId() ? [] : this.savedMethods().filter(s => this.methodList().some(o => o.value === s.method)));\n protected readonly refKind = computed(() => (this.kind() === 'manual' || this.kind() === 'none' ? referenceKind(this.method(), false) : null));\n protected readonly referenceError = computed(() => (this.refKind() === 'last4-card' || this.refKind() === 'last4-account' ? last4Error(this.reference()) : ''));\n\n private readonly amountValid = computed(() => isValidAmount(this.amount(), this.maxAmount()));\n protected readonly splitTotal = computed(() => sumMoney(this.splitEntries().map(e => e.amount)));\n private readonly totalPayment = computed((): number | null => {\n const total = sumMoney([...this.splitEntries().map(e => e.amount), ...(this.amountValid() ? [this.amount() as number] : [])]);\n return total > 0 ? total : null;\n });\n protected readonly allocation = computed(() => (this.allocationMode() === ALLOCATION_CUSTOM && this.charges().length\n ? allocationCheck(this.charges(), this.selectedCharges(), this.totalPayment(), this.money)\n : { general: '', perCharge: {} as Record<string, string> }));\n private readonly allocationPayload = computed((): PaymentAllocation => {\n // \"Choose charges\" needs a charge list; without one the payment goes by the default mode (never \"custom\").\n let mode = this.allocationMode();\n if (mode === ALLOCATION_CUSTOM && !this.charges().length) mode = this.defaultAllocationMode() === ALLOCATION_CUSTOM ? 'oldest' : this.defaultAllocationMode();\n return buildAllocation(mode, this.charges(), this.selectedCharges());\n });\n\n /** `allocation().general` limited to what the user has interacted with. */\n protected readonly allocationMessage = computed(() => this.allocationTouched() ? this.allocation().general : '');\n protected readonly hasInvalid = computed(() => this.fields().some(f => f.invalid()) || !!this.allocation().general || !!this.referenceError());\n protected readonly canSplit = computed(() => this.kind() === 'manual' && !this.busy());\n protected readonly readerOptions = computed(() => this.readers().map(r => ({ value: r.id, label: `${r.label || r.deviceType || r.id} (${r.status})` })));\n protected readonly selectedReader = computed(() => this.readers().find(r => r.id === this.readerId()) ?? null);\n protected readonly canSendToReader = computed(() => !!this.readerId() && this.selectedReader()?.status === 'online' && this.amountValid() && !!this.receivedDate()\n && !this.sendingToReader() && !this.hasInvalid());\n\n protected readonly pluginTemplate = computed(() => this.liveMethods().get(this.method())?.plugin.template());\n protected readonly pluginContext = computed((): PaymentMethodBodyContext => ({ $implicit: this.buildContext() }));\n\n protected readonly primaryLabel = computed(() => {\n if (!this.open()) return '';\n switch (this.kind()) {\n case 'live': return this.pluginPrimary()?.label ?? '';\n case 'terminal': return '';\n default: return this.splitEntries().length > 0 ? this.splitSubmitLabel() : this.submitLabel();\n }\n });\n protected readonly primaryLoading = computed(() => (this.kind() === 'live' ? !!this.pluginPrimary()?.loading : this.submitting()));\n protected readonly primaryDisabled = computed(() => {\n if (this.kind() === 'live') return !!this.pluginPrimary()?.disabled;\n return this.submitting() || (this.touched() && this.hasInvalid());\n });\n\n constructor() {\n effect(() => {\n const isOpen = this.open();\n untracked(() => (isOpen ? this.init() : this.teardown()));\n });\n effect(() => {\n const today = this.today();\n untracked(() => { if (!this.receivedDate() && today) this.receivedDate.set(today); });\n });\n // The selected method left the list (a plugin was removed, the split filter): back to \"no method\", the plugin gets its cancel hook.\n effect(() => {\n const list = this.methodList();\n const method = this.method();\n untracked(() => { if (method && !list.some(o => o.value === method)) this.onMethodChange(''); });\n });\n // The selected value stays in the list but stops being a live method (the plugin was removed and the record-only Card / ACH takes its place):\n // the unfinished live flow is told to stop and the choice is cleared, like any other method change.\n effect(() => {\n const kind = this.kind();\n const method = this.method();\n untracked(() => {\n if (this.liveMethodValue && this.liveMethodValue === method && kind !== 'live') this.onMethodChange('');\n this.liveMethodValue = kind === 'live' ? method : '';\n });\n });\n effect(() => {\n const visible = this.kind() === 'terminal';\n untracked(() => (visible ? this.startTerminalSession() : this.stopReaderRefresh()));\n });\n inject(DestroyRef).onDestroy(() => { this.destroyed = true; this.cleanup(); });\n }\n\n /** The panel is gone: a late answer of a plugin (its confirmation came after the panel closed) must not emit on outputs nobody listens to any more (Angular NG0953). */\n private destroyed = false;\n\n // ── Lifecycle ──\n private init(): void {\n this.resetForm();\n if (!this.today() && isDevMode()) console.warn('ui-payment-side-panel: the `today` input is empty, so Received Date has no default. Pass today as YYYY-MM-DD.');\n const due = this.outstandingBalance();\n if (due != null && due > 0) this.amount.set(roundMoney(due));\n }\n\n private teardown(): void {\n this.cleanup();\n this.resetForm();\n }\n\n private resetForm(): void {\n this.session++;\n this.method.set('');\n this.amount.set(null);\n this.receivedDate.set(this.today());\n this.reference.set('');\n this.note.set('');\n this.sendReceipt.set(false);\n this.splitEntries.set([]);\n this.allocationMode.set(this.defaultAllocationMode());\n this.selectedCharges.set({});\n this.touched.set(false);\n this.allocationTouched.set(false);\n this.submitting.set(false);\n this.submitError.set('');\n this.announcement.set('');\n this.pluginBusy.set(false);\n this.exclusive.set(false);\n this.pluginPrimary.set(null);\n this.completed = false;\n this.verificationReported = false;\n this.resetTerminal();\n }\n\n /** A card payment the reader took but that was never recorded is being abandoned: the host must hear about it. */\n private dropPendingRetry(): void {\n const context = this.retryContext;\n if (!this.retryIntentId() || !context) { this.retryIntentId.set(''); this.retryContext = null; return; }\n this.retryIntentId.set('');\n this.retryContext = null;\n // A retry that is in flight reports its own (single) result; announcing \"not recorded\" now would contradict it.\n if (this.retrying()) return;\n this.outcome.emit({\n kind: 'failed', stage: 'terminal',\n message: this.labels.t('paymentSidePanel.terminalNotRecorded', { amount: this.money(context.amount), id: context.paymentIntentId }),\n });\n }\n\n private cleanup(): void {\n this.session++;\n this.dropPendingRetry();\n this.runCancelHook();\n this.sendingToReader.set(false);\n if (this.terminalPhase() === 'confirming') this.terminalPhase.set('idle');\n if (this.terminalPhase() === 'waiting') {\n if (this.readerId()) this.fireCancelReader(this.readerId());\n this.terminalPhase.set('idle');\n }\n this.stopPolling();\n this.stopReaderRefresh();\n if (this.successTimer) { clearTimeout(this.successTimer); this.successTimer = null; }\n this.finishTerminal();\n }\n\n protected onClose(): void {\n this.cleanup();\n this.closed.emit();\n }\n\n private runCancelHook(): void {\n const hook = this.cancelHook;\n this.cancelHook = null;\n if (hook) { try { hook(); } catch { /* a plugin's cancel must not block closing */ } }\n }\n\n // ── Method ──\n protected onMethodChange(value: string | null): void {\n const next = value ?? '';\n if (next === this.method()) return;\n this.runCancelHook();\n this.cancelTerminalIfWaiting();\n this.pluginBusy.set(false);\n this.exclusive.set(false);\n this.pluginPrimary.set(null);\n this.terminalError.set('');\n this.dropPendingRetry();\n this.submitError.set('');\n this.reference.set('');\n this.method.set(next);\n }\n\n protected selectSaved(saved: SavedPaymentMethod): void {\n this.onMethodChange(saved.method);\n this.reference.set(saved.last4);\n }\n\n protected chipLabel(saved: SavedPaymentMethod): string {\n return `${saved.label || this.methodLabel(saved.method)} •••• ${saved.last4}`;\n }\n\n protected methodLabel(value: string): string {\n return this.methodList().find(o => o.value === value)?.label ?? this.methods().find(o => o.value === value)?.label ?? value;\n }\n\n protected onLast4(value: string | null): void {\n this.reference.set(last4Digits(value ?? ''));\n }\n\n // ── Split ──\n protected addSplit(): void {\n const method = this.method();\n const amount = this.amount();\n if (this.kind() !== 'manual' || !method || !this.amountValid() || this.referenceError()) { this.touched.set(true); return; }\n const entry: SplitEntry = { method, amount: roundMoney(amount as number), reference: this.referenceFor(method) ?? '' };\n this.splitEntries.update(list => [...list, entry]);\n this.amount.set(null);\n this.method.set('');\n this.reference.set('');\n this.touched.set(false);\n this.allocationTouched.set(false);\n this.announcement.set(this.labels.t('paymentSidePanel.addedToSplit', { method: this.methodLabel(entry.method), amount: this.money(entry.amount), total: this.money(this.splitTotal()) }));\n }\n\n protected removeSplit(index: number): void {\n const removed = this.splitEntries()[index];\n this.splitEntries.update(list => list.filter((_, i) => i !== index));\n if (removed) this.announcement.set(this.labels.t('paymentSidePanel.removedFromSplit', { method: this.methodLabel(removed.method), amount: this.money(removed.amount) }));\n }\n\n // ── Allocation ──\n protected onAllocationMode(value: string | null): void {\n this.allocationMode.set(value ?? this.defaultAllocationMode());\n }\n protected isTicked(id: string): boolean { return id in this.selectedCharges(); }\n protected toggleCharge(charge: PayableCharge, checked: boolean): void {\n this.allocationTouched.set(true);\n this.selectedCharges.update(current => {\n const next = { ...current };\n if (checked) next[charge.id] = defaultChargeAmount(charge, current, this.totalPayment());\n else delete next[charge.id];\n return next;\n });\n }\n protected setChargeAmount(id: string, value: number | string | null): void {\n this.allocationTouched.set(true);\n this.selectedCharges.update(current => ({ ...current, [id]: typeof value === 'number' ? value : null }));\n }\n protected chargeDescription(charge: PayableCharge): string {\n return [charge.description, charge.dueDate ? this.labels.t('paymentSidePanel.dueOn', { date: formatDueDate(charge.dueDate, this.labels.locale()) }) : '', this.labels.t('paymentSidePanel.balanceAmount', { amount: this.money(charge.balanceDue) })].filter(Boolean).join(' · ');\n }\n\n // ── Manual submit ──\n private referenceFor(method: string): string | null {\n const kind = referenceKind(method, false);\n if (!kind) return null;\n const value = this.reference().trim();\n return value || null;\n }\n\n private buildEntries(): PaymentEntry[] {\n const entries: PaymentEntry[] = this.splitEntries().map(e => ({ paymentMethod: e.method, amount: e.amount, reference: e.reference || null, sendReceipt: false }));\n if (this.amountValid() && this.method()) {\n entries.push({ paymentMethod: this.method(), amount: roundMoney(this.amount() as number), reference: this.referenceFor(this.method()), sendReceipt: this.sendReceipt() });\n }\n return entries;\n }\n\n /** The payload the host receives, or `null` when there is nothing valid to record. */\n buildPayload(): RecordPaymentPayload | null {\n const entries = this.buildEntries();\n if (!entries.length || !this.receivedDate()) return null;\n entries.forEach((e, i) => { e.sendReceipt = i === entries.length - 1 && this.sendReceipt(); });\n const split = entries.length > 1;\n return {\n amount: sumMoney(entries.map(e => e.amount)),\n paymentMethod: split ? 'SPLIT' : entries[0].paymentMethod,\n receivedDate: this.receivedDate(),\n reference: split ? null : entries[0].reference,\n notes: this.note().trim() || null,\n sendReceipt: this.sendReceipt(),\n entries,\n split,\n ...this.allocationPayload(),\n };\n }\n\n protected onPrimary(): void {\n if (this.kind() === 'live') this.pluginPrimary()?.onClick();\n else void this.submit();\n }\n\n async submit(): Promise<void> {\n if (this.submitting() || this.busy() || this.kind() === 'live' || this.kind() === 'terminal') return;\n this.touched.set(true);\n if (this.hasInvalid()) return;\n const payload = this.buildPayload();\n const record = this.recordPayment();\n if (!record || !payload) {\n const message = !record ? this.labels.t('paymentSidePanel.notConfigured') : this.labels.t('paymentSidePanel.enterAmountToRecord');\n this.submitError.set(message);\n this.outcome.emit({ kind: 'failed', stage: 'record', message });\n return;\n }\n this.submitting.set(true);\n this.submitError.set('');\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecording'));\n try {\n await callHost(() => record(payload));\n } catch (err) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.recordFailed'));\n this.dropPostedEntries(err, payload);\n this.submitError.set(message);\n this.submitting.set(false);\n this.outcome.emit({ kind: 'failed', stage: 'record', message });\n return;\n }\n this.submitting.set(false);\n const result: RecordPaymentResult = { type: payload.split ? 'split' : 'manual', paymentMethod: payload.paymentMethod, amount: payload.amount };\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecorded'));\n this.outcome.emit({ kind: payload.split ? 'split-recorded' : 'recorded', result });\n this.recorded.emit(result);\n }\n\n /**\n * A host that posts the entries one by one can tell the panel how many went through before a failure: `throw { message, postedEntries: 1 }`.\n * Those first entries are removed, so a retry does not post them again.\n */\n private dropPostedEntries(err: unknown, payload: RecordPaymentPayload): void {\n const posted = (err as { postedEntries?: unknown } | null)?.postedEntries;\n if (typeof posted !== 'number' || !Number.isInteger(posted) || posted < 1) return;\n const count = Math.min(posted, payload.entries.length);\n const splitCount = this.splitEntries().length;\n this.splitEntries.update(list => list.slice(Math.min(count, splitCount)));\n if (count > splitCount) { this.amount.set(null); this.method.set(''); this.reference.set(''); this.touched.set(false); }\n }\n\n // ── Plugin context ──\n private buildContext(): PaymentMethodContext {\n const amount = this.amountValid() ? (this.amount() as number) : null;\n const method = this.method();\n return {\n method, amount, receivedDate: this.receivedDate(), note: this.note().trim(), allocation: this.allocationPayload(), currency: this.currency(),\n valid: !this.hasInvalid() && !!this.receivedDate() && amount != null,\n validate: () => { this.touched.set(true); return !this.hasInvalid() && !!this.receivedDate() && this.amountValid(); },\n reset: () => { this.runCancelHook(); this.init(); },\n complete: result => this.completeFromPlugin(method, amount, result),\n setBusy: busy => this.pluginBusy.set(busy),\n setPrimary: button => this.pluginPrimary.set(button),\n setExclusive: on => this.exclusive.set(on),\n onCancel: fn => { this.cancelHook = fn; },\n report: (code, extra) => { if (this.destroyed) return; this.verificationReported = code === 'verification'; this.outcome.emit({ kind: 'plugin', method, code, ...(extra?.result ? { result: extra.result } : {}), ...(extra?.message ? { message: extra.message } : {}), ...(extra?.attemptKey ? { attemptKey: extra.attemptKey } : {}), ...(extra?.paid ? { paid: extra.paid } : {}) }); },\n announce: text => this.announcement.set(text),\n };\n }\n\n private completeFromPlugin(method: string, snapshotAmount: number | null, partial?: Partial<RecordPaymentResult>): void {\n if (this.completed || this.destroyed) return;\n this.completed = true;\n this.cancelHook = null;\n this.pluginBusy.set(false);\n const result: RecordPaymentResult = { type: partial?.type ?? 'manual', paymentMethod: partial?.paymentMethod ?? method, amount: partial?.amount ?? snapshotAmount ?? 0, ...(partial?.processor ? { processor: partial.processor } : {}) };\n // `recorded` is still emitted (the host closes its panel and refreshes on it), but a bank payment waiting for the payer's verification has NOT started: it is announced as such, never as recorded.\n this.announcement.set(this.labels.t(this.verificationReported ? 'paymentSidePanel.verificationRecorded' : 'paymentSidePanel.announceRecorded'));\n this.outcome.emit({ kind: 'plugin', method, code: 'complete', result });\n this.recorded.emit(result);\n }\n\n // ── Terminal ──\n private resetTerminal(): void {\n this.stopPolling();\n this.stopReaderRefresh();\n if (this.successTimer) { clearTimeout(this.successTimer); this.successTimer = null; }\n this.pendingTerminalResult = null;\n this.terminalContext = null;\n this.retryContext = null;\n this.readers.set([]);\n this.readersLoaded.set(false);\n this.loadingReaders.set(false);\n this.readersError.set('');\n this.readerId.set('');\n this.terminalPhase.set('idle');\n this.terminalError.set('');\n this.sendingToReader.set(false);\n this.retryIntentId.set('');\n this.retrying.set(false);\n }\n\n private startTerminalSession(): void {\n void this.loadReaders(false);\n }\n\n protected refreshReaders(): void { void this.loadReaders(false); }\n\n private async loadReaders(silent: boolean): Promise<void> {\n const list = this.listReaders();\n if (!list) return;\n const session = this.session;\n if (!silent) { this.loadingReaders.set(true); this.readersError.set(''); }\n try {\n const readers = (await callHost(() => list())) ?? [];\n if (session !== this.session) return;\n this.readers.set(readers);\n this.readersLoaded.set(true);\n if (readers.length === 1 && !this.readerId()) this.readerId.set(readers[0].id);\n if (this.readerId() && !readers.some(r => r.id === this.readerId()) && this.terminalPhase() === 'idle') this.readerId.set('');\n } catch (err) {\n if (!silent && session === this.session) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.couldNotLoadReaders'));\n this.readersError.set(message);\n this.outcome.emit({ kind: 'failed', stage: 'readers', message });\n }\n } finally {\n if (!silent && session === this.session) this.loadingReaders.set(false);\n }\n if (session === this.session && this.kind() === 'terminal') this.scheduleReaderRefresh();\n }\n\n private scheduleReaderRefresh(): void {\n this.stopReaderRefresh();\n this.refreshTimer = setTimeout(() => {\n this.refreshTimer = null;\n if (this.kind() === 'terminal' && this.open()) void this.loadReaders(true);\n }, this.readerRefreshMs());\n }\n\n private stopReaderRefresh(): void {\n if (this.refreshTimer) { clearTimeout(this.refreshTimer); this.refreshTimer = null; }\n }\n\n private terminalBase(): TerminalStartContext | null {\n const amount = this.amount();\n if (!this.amountValid() || !this.readerId() || !this.receivedDate()) return null;\n return { readerId: this.readerId(), amount: amount as number, receivedDate: this.receivedDate(), notes: this.note().trim() || null, ...this.allocationPayload() };\n }\n\n async sendToReader(): Promise<void> {\n const start = this.startTerminalPayment();\n if (!start || this.sendingToReader() || this.terminalPhase() !== 'idle') return;\n this.touched.set(true);\n const base = this.terminalBase();\n if (!base || this.hasInvalid() || this.selectedReader()?.status !== 'online') return;\n const session = this.session;\n this.sendingToReader.set(true);\n this.terminalError.set('');\n let started: TerminalStartResult;\n try {\n started = await callHost(() => start(base));\n } catch (err) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.failedSendToReader'));\n if (session !== this.session) return;\n this.sendingToReader.set(false);\n this.terminalError.set(message);\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n this.outcome.emit({ kind: 'failed', stage: 'terminal', message });\n return;\n }\n if (session !== this.session) {\n // The panel was closed or reset while the reader was being armed: disarm it again.\n if (started?.paymentIntentId) this.fireCancelReader(base.readerId);\n return;\n }\n this.sendingToReader.set(false);\n if (!started?.paymentIntentId) {\n this.terminalError.set(this.labels.t('paymentSidePanel.readerDidNotAccept'));\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n return;\n }\n this.terminalAmount.set(base.amount);\n this.terminalContext = { ...base, paymentIntentId: started.paymentIntentId };\n this.terminalPhase.set('waiting');\n this.announcement.set(this.labels.t('paymentSidePanel.announceWaiting'));\n this.focusLater('[data-testid=\"psp-terminal-cancel\"] button');\n this.startPolling(started.paymentIntentId);\n }\n\n private startPolling(paymentIntentId: string): void {\n this.stopPolling();\n const token = ++this.pollToken;\n const every = Math.max(1, this.terminalPollMs());\n const maxPolls = Math.max(1, Math.ceil(this.terminalTimeoutMs() / every));\n let polls = 0;\n const step = (): void => {\n this.pollTimer = setTimeout(async () => {\n this.pollTimer = null;\n if (token !== this.pollToken) return;\n polls++;\n let status: string | null = null;\n const fetchStatus = this.terminalStatus();\n if (fetchStatus) {\n try { status = (await callHost(() => fetchStatus(paymentIntentId)))?.status ?? null; } catch { /* keep trying until the timeout */ }\n }\n if (token !== this.pollToken) return;\n const verdict = terminalVerdict(status);\n if (verdict === 'succeeded') {\n this.stopPolling();\n if (this.terminalContext) await this.confirmTerminal(this.terminalContext);\n return;\n }\n if (verdict === 'canceled' || verdict === 'declined') {\n this.stopPolling();\n this.endWaiting(verdict === 'canceled' ? this.labels.t('paymentSidePanel.paymentCancelled') : this.labels.t('paymentSidePanel.cardDeclined'));\n return;\n }\n if (polls >= maxPolls) {\n this.stopPolling();\n const readerId = this.terminalContext?.readerId;\n if (readerId) this.fireCancelReader(readerId);\n this.endWaiting(terminalTimeoutText(this.terminalTimeoutMs()));\n return;\n }\n step();\n }, every);\n };\n step();\n }\n\n private stopPolling(): void {\n this.pollToken++;\n if (this.pollTimer) { clearTimeout(this.pollTimer); this.pollTimer = null; }\n }\n\n private endWaiting(message: string): void {\n this.terminalPhase.set('idle');\n this.terminalContext = null;\n this.terminalError.set(message);\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n }\n\n private async confirmTerminal(context: TerminalConfirmContext): Promise<void> {\n const session = this.session;\n this.terminalPhase.set('confirming');\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecording'));\n const confirm = this.confirmTerminalPayment();\n const result: RecordPaymentResult = { type: 'manual', paymentMethod: PAYMENT_METHOD.CARD_PRESENT, amount: context.amount };\n try {\n if (confirm) await callHost(() => confirm(context));\n } catch (err) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.succeededNotRecorded'));\n this.outcome.emit({ kind: 'failed', stage: 'terminal', message });\n if (session !== this.session) return; // closed meanwhile: the failure was reported, there is no screen to update\n this.terminalPhase.set('idle');\n // The terminal method left the list while the retry ran (already reported as failed): nothing to retry on screen, so nothing stays locked.\n if (this.kind() !== 'terminal') return;\n this.retryIntentId.set(context.paymentIntentId);\n this.retryContext = context;\n this.terminalError.set(message);\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n return;\n }\n if (session !== this.session) {\n // Closed while the payment was being recorded: it IS recorded, so the host hears about it now (no screen state, no timer).\n this.outcome.emit({ kind: 'terminal-paid', result });\n this.recorded.emit(result);\n return;\n }\n this.retryIntentId.set('');\n this.retryContext = null;\n this.terminalPhase.set('success');\n this.pendingTerminalResult = result;\n const delay = this.terminalSuccessDelayMs();\n if (delay > 0) this.successTimer = setTimeout(() => { this.successTimer = null; this.finishTerminal(); }, delay);\n else this.finishTerminal();\n }\n\n /** Repeats the recording for the payment the reader already took, with the amount that was charged (not the form's current values). */\n protected async retryRecording(): Promise<void> {\n const context = this.retryContext;\n if (this.retrying() || !context) return;\n const session = this.session;\n this.retrying.set(true);\n this.terminalError.set('');\n await this.confirmTerminal(context);\n if (session === this.session) this.retrying.set(false); // a retry of a closed session must not clear the flag of the reopened session's own retry\n }\n\n private finishTerminal(): void {\n const result = this.pendingTerminalResult;\n if (!result) return;\n this.pendingTerminalResult = null;\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecorded'));\n this.outcome.emit({ kind: 'terminal-paid', result });\n this.recorded.emit(result);\n }\n\n protected cancelTerminalPayment(): void {\n const readerId = this.readerId();\n this.stopPolling();\n this.terminalPhase.set('idle');\n this.terminalContext = null;\n this.announcement.set(this.labels.t('paymentSidePanel.readerPaymentCancelled'));\n this.focusLater('[data-testid=\"psp-terminal-send\"] button');\n if (readerId) this.fireCancelReader(readerId);\n }\n\n private cancelTerminalIfWaiting(): void {\n if (this.terminalPhase() === 'waiting') this.cancelTerminalPayment();\n else { this.stopPolling(); }\n }\n\n /** Moves focus after the next render (the control that had it was just removed from the DOM). */\n private focusLater(selector: string): void {\n afterNextRender(() => this.hostEl.nativeElement.querySelector<HTMLElement>(selector)?.focus(), { injector: this.injector });\n }\n\n private fireCancelReader(readerId: string): void {\n const cancel = this.cancelTerminal();\n if (!cancel) return;\n callHost(() => cancel(readerId)).catch(() => { /* best effort */ });\n }\n}\n","import { isDevMode } from '@angular/core';\n\n/**\n * Development help for the payment components: the offline layer answered a charge request with its synthetic \"queued\" 202, so the request is STILL SAVED on the device and would be replayed after\n * reconnecting (with the old token). Payment routes belong in `blockOffline` (`blockPaymentsOffline`); the backend also dedupes a replay by `attemptKey`. Logs once per page, in development mode only.\n */\nlet queuedPaymentWarned = false;\nexport function warnQueuedPayment(): void {\n if (!isDevMode() || queuedPaymentWarned) return;\n queuedPaymentWarned = true;\n console.error('A payment request was QUEUED by the offline layer and may be replayed after reconnecting: list your payment routes in blockOffline with blockPaymentsOffline().');\n}\n\n/** Specs only: warn again. This file is NOT re-exported by the public entry (only `warnQueuedPayment` is). */\nexport function resetQueuedPaymentWarning(): void { queuedPaymentWarned = false; }\n\n","import { DestroyRef, InjectionToken, computed, effect, isDevMode, signal, untracked } from '@angular/core';\nimport { callHost, type HostResult } from '../payment-side-panel/payment-side-panel.models';\nimport type { UiLabelKey } from '@forgeroute/ui/core';\n\n/**\n * Duplicate-payment protection shared by every payment form of the library (Stripe, Square, QuickBooks forms and the payment-panel plugins).\n *\n * One `PaymentAttempt` per form instance holds, in signals: the SYNCHRONOUS in-flight lock, the ATTEMPT KEY (an opaque idempotency key the host sends to its backend with the charge),\n * the UNKNOWN state (timeouts, going offline mid-flight, host-reported ambiguity) with bounded status polling through the host's `checkStatus`, the OFFLINE state and the PAID lock.\n * It never charges and never retries by itself: it only decides whether the form may start an attempt and what the screen says.\n */\nexport type PaymentStatusAnswer = 'succeeded' | 'failed' | 'not_found' | 'unknown' | 'in_flight' | 'awaiting_verification';\n\n/**\n * The host's status check: asks ITS backend for the state of the attempt with this key (`GET /payments/attempts/{key}`). A rejection or an answer slower than `statusCheckTimeoutMs` counts as\n * `'unknown'`. `'awaiting_verification'` = a bank payment that has NOT started because the payer still has to verify the micro-deposits (stays locked and unknown, shows the verification text, sets `awaitingVerification`);\n * `'in_flight'` = the payment IS processing (after the verification, or any other running request: clears `awaitingVerification` and shows the \"Checking your payment\" text). **A key whose request may still be running must answer `'unknown'` / `'in_flight'`, never `'failed'`**: a `'failed'` answer unlocks the form with a NEW key, so a late-landing original\n * request would become a second charge. `'not_found'` means \"the backend has definitively never seen this key\": the library only believes it once the attempt is older than the request timeout\n * plus the fail grace (a slow original request may still be on its way), then unlocks with a new key. While the attempt's own request is unsettled `'failed'` / `'not_found'` are ignored for a hard\n * maximum counted from the moment it became unknown; an attempt whose host charge may still be running (`host_silent`, `host`) is given the request timeout plus the grace counted from that\n * moment too, and an attempt adopted from a reload or another tab the request timeout plus the grace counted from the START of the attempt. The request timeout is the one of the form's own request.\n */\nexport type CheckPaymentStatusFn = (attemptKey: string) => HostResult<PaymentStatusAnswer>;\n\n/** Why a new attempt was not started: another one is running (`locked`), the payable is paid (`paid`), the outcome of an earlier attempt is unknown (`unknown`), no connection (`offline`). */\nexport type PaymentAttemptRefusal = 'locked' | 'paid' | 'unknown' | 'offline';\n\nexport type PaymentAttemptOutcomeKind = 'succeeded' | 'failed' | 'unknown' | 'refused' | 'pending';\n\n/**\n * The unified outcome event of a payment form: `reason` is `timeout`, `microdeposits` (a bank payment waits for the payer to verify micro-deposits: unknown-until-verified, never paid), `offline`, `host`, `host_error`, `host_silent`, `status_check`, `error`, `auth_abandoned`, `paid`, `reload`, `other_tab`, `token`,\n * `duplicate_suspected` (an attempt that started after an older one turned out paid ALSO produced a payment: the host must resolve the duplicate),\n * `setup_action` (a SetupIntent that still `requires_action` after `confirmSetup`: the status check decides), `unexpected_status` (an intent state that proves nothing: no intent, an unexpected status, a SetupIntent without a payment method id; the status check decides),\n * `setup_processing` (a protected SetupIntent that is `processing`, e.g. a bank debit: it can still fail, so it is unknown until the status check says it was saved), `return` (the intent a redirect brought back decided the attempt: `succeeded` /\n * `failed`), `return_action` (the redirect brought back an intent that proves nothing, e.g. an unknown status: unknown, the status check decides), `start_over` (the payer chose \"Start over\": a `failed` outcome with a new key), `no_result`, ...\n */\nexport interface PaymentAttemptOutcome {\n kind: PaymentAttemptOutcomeKind;\n attemptKey: string;\n reason?: string;\n /**\n * Only on a `succeeded` outcome that the form did NOT see happen itself (`other_tab`: another tab / page load paid; a late success of an older attempt; a status check that found it paid after the\n * form had moved on): the amount (major units) and method the PAID attempt was started with, so a host that wants to reconcile it can read them. Absent otherwise.\n */\n amount?: number | null;\n method?: string;\n}\n\n/** What a step of an attempt reports: `success` (money moved / payment exists), `failure` (a DEFINITIVE refusal: new key), `unknown` (ambiguous: key kept, locked), `pending` (a challenge / the host's charge is in progress: lock stays), `released` (failed BEFORE any charge request: unlock, key kept). */\nexport type PaymentAttemptKind = 'success' | 'failure' | 'unknown' | 'pending' | 'released';\nexport interface PaymentAttemptResult<T> { kind: PaymentAttemptKind; value?: T; reason?: string }\n\n/** The payments service answers a replay of a FAILED attempt with this code (409): nothing was charged, the attempt can never complete, a NEW attempt key is needed. A definitive failure that moves the epoch. */\nconst FAILED_REPLAY_CODE = 'attempt_failed_use_new_key';\n\n/**\n * Every machine-readable code of the payments service's money endpoints, mapped explicitly (three groups below). SOURCE: host-kit/contract/payment-errors.json of the forgeroute-payments service (the library\n * cannot import it: these tables repeat its codes, and `payment-errors.contract.spec.ts` embeds a verbatim copy and fails when a code has no row; a new code there must be added here).\n * - NO CHARGE was made (`not_sent`: release, the key is kept): `events_backlog` (new payments are paused), `exceeds_amount_due`, `already_charged_today`, `merchant_not_ready`, `reconnect_required` and\n * `processor_account_changed` (the merchant's processor connection needs attention), `reference_changed` (the balance changed since the link was made), `link_in_use` and `link_already_paid` (payment links),\n * `reader_busy` (a card reader that still holds a payment: the DELETE of the reader was refused, nothing charged);\n * - the attempt exists or runs (`unknown`: look it up by its key, never start another): `payment_in_flight`, `request_in_progress`, `duplicate_suspected` (an identical payment was made moments ago),\n * `idempotency_in_progress`, `idempotency_key_reused`, `idempotency_error`, `payment_intent_unexpected_state`;\n * - the request FAILED for good (`failure`, see {@link PAYMENT_FAILURE_CODES}): `attempt_failed_use_new_key` (a replay of a FAILED attempt, the epoch moves), the capture codes, `link_expired`, `link_cancelled`,\n * `not_supported_by_processor`, `location_required` (Square connect: the seller has several locations, a definitive 400), and four of the six verify-microdeposits codes (`verification_amounts_mismatch`,\n * `verification_attempts_exceeded`, `verification_timeout`, `verification_failed`);\n * - `not_awaiting_verification` and `verification_rate_limited` (verify-microdeposits call only) are `unknown` too: the payment may already be verified / processing, or the try only has to wait.\n */\nexport const PAYMENT_NO_CHARGE_CODES: readonly string[] = [\n 'events_backlog', 'exceeds_amount_due', 'already_charged_today', 'merchant_not_ready', 'reconnect_required', 'processor_account_changed', 'reference_changed', 'link_in_use', 'link_already_paid',\n 'reader_busy', // DELETE /v1/terminal/readers/:id refused: the reader still holds a payment, nothing charged (no charge-starting call emits it)\n];\n/**\n * Codes that are a DEFINITIVE failure of the request, never unknown: the failed-attempt replay (the epoch moves), the capture codes of the staff API (`already_captured`, `exceeds_authorized`, `not_capturable`, 409) and the payment-link /\n * processor refusals (`link_expired`, `link_cancelled` = 410, `not_supported_by_processor` = 400), the four definitive verify-microdeposits codes and `location_required` (Square connect, 400). Source: host-kit/contract/payment-errors.json.\n */\nexport const PAYMENT_FAILURE_CODES: readonly string[] = [\n 'attempt_failed_use_new_key', 'already_captured', 'exceeds_authorized', 'not_capturable', 'link_expired', 'link_cancelled', 'not_supported_by_processor',\n // the verify-microdeposits call only (never a refusal of the pay form): the verification failed for good or cannot be tried any more\n // (`not_awaiting_verification` and `verification_rate_limited` are NOT here: the payment may have been verified already / the try only has to wait, so they are unknown, see AMBIGUOUS_HOST_CODES)\n 'verification_amounts_mismatch', 'verification_attempts_exceeded', 'verification_timeout', 'verification_failed',\n 'location_required', // Square connect (merchant setup): the seller has several locations, a definitive 400: the merchant must pick one\n];\nconst FAILURE_HOST_CODES = new Set(PAYMENT_FAILURE_CODES);\nconst AMBIGUOUS_HOST_CODES = new Set([\n 'payment_in_flight', 'request_in_progress', 'duplicate_suspected', 'idempotency_in_progress', 'idempotency_key_reused', 'idempotency_error', 'payment_intent_unexpected_state',\n // verify-microdeposits call only: the payment may already be verified / processing (read its state), or the try only has to wait (retryAfterSeconds): never a definitive failure\n 'not_awaiting_verification', 'verification_rate_limited',\n]);\nconst NO_CHARGE_HOST_CODES = new Set(PAYMENT_NO_CHARGE_CODES);\n\n/** Is this host error the payments service's \"this attempt failed before, use a new attemptKey\" answer (code `attempt_failed_use_new_key`)? */\nexport function isAttemptFailedReplay(error: unknown): boolean {\n const e = error as { code?: unknown; error?: { code?: unknown } | null } | null | undefined;\n return [e?.code, e?.error?.code].some(c => typeof c === 'string' && c.toLowerCase() === FAILED_REPLAY_CODE);\n}\n\nexport { warnQueuedPayment } from './queued-payment-warning';\n\n/** The shared, translated text of the service codes a payer must read in OUR words (the service's own message is English): code -> label key. Other codes keep the service's message. */\nconst HOST_CODE_LABELS: Record<string, UiLabelKey> = {\n reference_changed: 'paymentAttempt.referenceChanged', link_in_use: 'paymentAttempt.linkInUse', link_already_paid: 'paymentAttempt.linkAlreadyPaid',\n link_expired: 'paymentAttempt.linkExpired', link_cancelled: 'paymentAttempt.linkCancelled', not_supported_by_processor: 'paymentAttempt.notSupported',\n};\n/** The codes whose answer will not change on a retry (the balance changed, the link was paid / ended / cancelled, the processor cannot do it): the payment panels keep the text and turn Pay off instead of looping. */\nconst FINAL_HOST_CODES = new Set(['reference_changed', 'link_already_paid', 'link_expired', 'link_cancelled', 'not_supported_by_processor']);\nconst hostCodesOf = (error: unknown): string[] => {\n const e = error as { code?: unknown; error?: { code?: unknown } | null } | null | undefined;\n return [e?.code, e?.error?.code].filter((c): c is string => typeof c === 'string').map(c => c.toLowerCase());\n};\n/**\n * Is this host error the 409 `payment_in_flight` of an open payment that waits for the payer to verify bank micro-deposits (the service adds `awaitingVerification: true` to the error detail; the browser JSON of\n * an app passes it through as `awaitingVerification`, read from the error, its `error` body or a `detail` object)? Then the payment has NOT started: the text is the verification one, not \"already being processed\".\n */\nexport function isAwaitingVerificationError(error: unknown): boolean {\n if (!hostCodesOf(error).includes('payment_in_flight')) return false;\n const e = error as { awaitingVerification?: unknown; detail?: { awaitingVerification?: unknown } | null; error?: { awaitingVerification?: unknown; detail?: { awaitingVerification?: unknown } | null } | null } | null | undefined;\n return [e?.awaitingVerification, e?.detail?.awaitingVerification, e?.error?.awaitingVerification, e?.error?.detail?.awaitingVerification].some(v => v === true);\n}\n/** The label key of the translated text for a host error that carries one of the payment-link / reference codes (or a `payment_in_flight` that awaits bank verification), else `null` (the service's own message is shown). */\nexport function paymentErrorLabelKey(error: unknown): UiLabelKey | null {\n if (isAwaitingVerificationError(error)) return 'paymentAttempt.awaitingVerification';\n for (const code of hostCodesOf(error)) if (HOST_CODE_LABELS[code]) return HOST_CODE_LABELS[code];\n return null;\n}\n/** Is this host error one a retry cannot change (see {@link FINAL_HOST_CODES})? */\nexport function isFinalPaymentRefusal(error: unknown): boolean { return hostCodesOf(error).some(c => FINAL_HOST_CODES.has(c)); }\n\n/**\n * Classifies a failed HOST call (the charge request) for `run()`:\n * - `'not_sent'`: nothing was charged: the request never left (the offline layer refused it: `OfflineBlockedError` / `offlineBlocked: true`) or the payments service refused it with one of its NO-CHARGE codes\n * (`events_backlog`, `exceeds_amount_due`, `already_charged_today`, `merchant_not_ready`, `reconnect_required`, `processor_account_changed`, `reference_changed`, `link_in_use`, `link_already_paid`, `reader_busy`, also as a `409`): release with the key kept, show the message;\n * - `'failure'` for the codes of {@link PAYMENT_FAILURE_CODES} (`attempt_failed_use_new_key`: a replay of a FAILED attempt, even as a `409`, the epoch moves so the next click derives a new key; the capture codes\n * `already_captured` / `exceeds_authorized` / `not_capturable`; `link_expired`, `link_cancelled`, `not_supported_by_processor`, `location_required`, and four verify-microdeposits codes: see the list);\n * - `'unknown'`: it may have reached the processor: no answer (status `0`, a network `TypeError`, an abort / timeout), `408`, `425`, `429`, `5xx`, **any other `409`** (a service that answers \"already in flight / duplicate\n * suspected / idempotency in progress\" must never make the payer pay again), a body or error `code` naming an idempotency / in-flight conflict, an error flagged `unknown: true`, and **an error that carries NO numeric\n * status** (a wrapped `Error`, an error object of a client library): nothing proves it was refused, so only a recognised definitive code decides it;\n * - `'failure'`: the host definitively refused (another `4xx`). The status is read from `status` or `response.status`.\n */\nexport function classifyHostError(error: unknown): 'failure' | 'unknown' | 'not_sent' {\n const e = error as { status?: unknown; response?: { status?: unknown } | null; name?: unknown; unknown?: unknown; offlineBlocked?: unknown; code?: unknown; error?: { code?: unknown } | null } | null | undefined;\n if (e && (e.offlineBlocked === true || e.name === 'OfflineBlockedError')) return 'not_sent';\n if (e && e.unknown === true) return 'unknown';\n const codes = [e?.code, e?.error?.code].filter((c): c is string => typeof c === 'string').map(c => c.toLowerCase());\n if (codes.some(c => FAILURE_HOST_CODES.has(c))) return 'failure'; // a replay of a FAILED attempt (even as a 409), a capture refusal, an ended link, an unsupported processor: definitive (a failed replay also moves the epoch)\n if (codes.some(c => NO_CHARGE_HOST_CODES.has(c))) return 'not_sent'; // the service refused BEFORE any charge (even as a 409)\n if (codes.some(c => AMBIGUOUS_HOST_CODES.has(c))) return 'unknown';\n const status = typeof e?.status === 'number' ? e.status : typeof e?.response?.status === 'number' ? e.response.status : null;\n if (status !== null) return status === 0 || status === 408 || status === 409 || status === 425 || status === 429 || status >= 500 ? 'unknown' : 'failure';\n return 'unknown'; // no numeric status (a TypeError, an abort, a wrapped Error): nothing proves the request was refused\n}\n\n/**\n * Did the offline layer answer a charge request with its synthetic \"queued for later\" response (`@forgeroute/ui/offline`: HTTP 202 whose body carries `_offline: true`) instead of sending it? Such an\n * answer is NOT a payment: nothing reached the processor, so the form must release (key kept) and say so. A genuine 202 from a backend (\"accepted, still processing\") has no `_offline` marker and is not\n * affected. Checks the result itself and, for a host that hands back the response object, its `body`.\n */\nexport function wasQueuedOffline(result: unknown): boolean {\n const r = result as { _offline?: unknown; body?: { _offline?: unknown } | null } | null | undefined;\n if (!r || typeof r !== 'object') return false;\n return r._offline === true || (!!r.body && typeof r.body === 'object' && r.body._offline === true);\n}\n\nexport type PaymentAttemptRun<T> = { refused: PaymentAttemptRefusal } | (PaymentAttemptResult<T> & { refused?: undefined; late?: undefined });\n\n/** Defaults (ms): the status poll interval, how long it polls before offering \"Check again\", how long one request may take before it counts as unknown, and the status check's own timeout / fail grace. */\nexport const PAYMENT_STATUS_POLL_MS = 3000;\nexport const PAYMENT_STATUS_POLL_MAX_MS = 90_000;\nexport const PAYMENT_REQUEST_TIMEOUT_MS = 60_000;\nexport const PAYMENT_STATUS_CHECK_TIMEOUT_MS = 10_000;\nexport const PAYMENT_STATUS_FAIL_GRACE_MS = 60_000;\n/** While the attempt's own request is unsettled a status `failed` / `not_found` is ignored for this long after the attempt became unknown. */\nexport const PAYMENT_STATUS_HARD_MAX_MS = 180_000;\n/** One request may take this long while a 3-D Secure challenge or the Square bank window is open (the main request timeout is replaced, not added). */\nexport const PAYMENT_AUTH_TIMEOUT_MS = 300_000;\n/** A token-only form whose host never reports (markSucceeded / markFailed / markUnknown / markNotCharged) becomes unknown after this long. */\nexport const PAYMENT_HOST_SILENCE_MS = 120_000;\n/** An undecided attempt marker older than this is ignored (the page that wrote it is long gone). */\nexport const PAYMENT_ATTEMPT_MARKER_TTL_MS = 30 * 60_000;\n/** An `unknown` marker of a bank payment that waits for the payer to verify micro-deposits lives this long (10 days: the verification window of a bank payment), so a page load meanwhile still does not offer Pay. Cleared earlier by any decision (a status check `succeeded` / `failed` / `not_found`, a start over, `markFailed`). */\nexport const PAYMENT_ATTEMPT_VERIFICATION_TTL_MS = 10 * 86_400_000;\n/** A tombstone (the attempt was decided: released / failed / succeeded) older than this is ignored. */\nexport const PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS = 2 * 60_000;\n/** The record of a SUCCEEDED attempt (`ui-payment-attempt:<payable>#paid`) is kept this long and locks the payable as PAID in every form that loads meanwhile (the tombstone only covers the first 2 minutes). It is never consumed: a second payment of the same payable is `resetPaid()` or a NEW `payableRef`. */\nexport const PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS = 24 * 60 * 60_000;\n\n/**\n * Where the opaque attempt marker lives (default `localStorage`, shared by every tab of the browser profile; falls back to `sessionStorage`, then `null`). Replace it in specs. It holds ONLY the\n * opaque marker `{ key, startedAt, state, owner, amount, method }` of an UNDECIDED attempt (replaced by a 2-minute tombstone `{ state, key, at, owner }` when it is decided) under\n * `ui-payment-attempt:<payableRef>`, plus one integer epoch under `ui-payment-attempt:<payableRef>#epoch`: never card data, never server data, never a cached response.\n */\nexport const PAYMENT_ATTEMPT_STORAGE = new InjectionToken<() => Storage | null>('PAYMENT_ATTEMPT_STORAGE', {\n providedIn: 'root',\n factory: () => () => {\n try { if (typeof localStorage !== 'undefined') return localStorage; } catch { /* blocked: fall back */ }\n try { return typeof sessionStorage === 'undefined' ? null : sessionStorage; } catch { return null; }\n },\n});\n\nexport const PAYMENT_ATTEMPT_STORAGE_PREFIX = 'ui-payment-attempt:';\n\n/** The opaque marker of an attempt that has started and is not decided yet (shared across tabs and reloads while it lasts). */\nexport interface PaymentAttemptMarker {\n key: string;\n startedAt: number;\n state: 'inflight' | 'unknown';\n /** Random id of the form instance that wrote it (a second instance / tab / reload is not the owner). */\n owner: string;\n amount: number | null;\n method: string;\n /** `microdeposits` = the payment has NOT started and waits for the payer to verify micro-deposits (restored by a reload / another tab; lives {@link PAYMENT_ATTEMPT_VERIFICATION_TTL_MS}). */\n reason?: 'microdeposits';\n}\n\n/** What replaces the marker for 2 minutes when the attempt is decided, so other tabs learn HOW it ended (removing the marker alone says nothing). */\nexport interface PaymentAttemptTombstone {\n state: 'released' | 'failed' | 'succeeded';\n key: string;\n at: number;\n owner: string;\n /** Only on a `succeeded` tombstone: what the paid attempt was started with, so another tab / page load can hand it to a host that reconciles. */\n amount?: number | null;\n method?: string;\n}\n\n/** The record of a succeeded attempt, kept 24 hours under `ui-payment-attempt:<payable>#paid` (local state that MIRRORS a server outcome: it never replaces the backend's own record). */\nexport interface PaymentAttemptPaidRecord {\n key: string;\n amount: number | null;\n method: string;\n at: number;\n owner: string;\n}\n\n/** What a payment-panel plugin forwards to its body, so the HOST can resolve an undecided attempt without a status check (`<ui-square-payment-method #sq>` then `sq.markSucceeded()`). */\nexport interface PaymentAttemptControls {\n markUnknown(): void;\n markSucceeded(): void;\n markFailed(): void;\n markNotCharged(): void;\n /** A deliberate second payment of the payable: forget the paid state, move the epoch (a NEW attempt key). */\n resetPaid(): void;\n}\n\nexport interface PaymentAttemptOptions {\n destroyRef: DestroyRef;\n /** The payable this form pays (a unit balance, an invoice, a reservation): the marker of an undecided attempt is stored under it, and without a host `attemptKey` the key is DERIVED from it. `null` = memory only. */\n payableRef: () => string | null;\n amount: () => number | null;\n method: () => string;\n /** A key the host supplies: used as it is (never generated, never renewed). */\n attemptKey: () => string | null;\n checkStatus: () => CheckPaymentStatusFn | null;\n /** The payable is paid (host re-render, back navigation): every attempt is refused for good. */\n paid: () => boolean;\n /** The host reports an ambiguous result (its own timeout): the form goes to the unknown state while this is true. */\n hostPending?: () => boolean;\n /** A step that is in flight when the connection drops becomes UNKNOWN (default true). A form that only TOKENIZES (no charge yet) turns it off: the token call answers or fails by itself. */\n offlineMidFlight?: boolean;\n pollMs?: () => number;\n pollMaxMs?: () => number;\n /** A status check slower than this counts as `'unknown'` (default 10 s). */\n statusTimeoutMs?: () => number;\n /** An attempt adopted from a reload / another tab, and a `not_found`, is given the request timeout plus this long before a `failed` / `not_found` is believed (default 60 s). */\n failGraceMs?: () => number;\n /** While the attempt's own request is unsettled a `failed` / `not_found` is ignored for this long after the attempt became unknown (default 180 s). */\n statusHardMaxMs?: () => number;\n /**\n * Default true. False (a setup form that saves a payment method and may be used again later): a success does NOT lock the payable for 24 hours. It writes no `#paid` record, does not set `succeeded` / `paidLocked`,\n * ignores the succeeded tombstone and paid record when a new attempt starts or a form mounts, and moves the epoch (the next attempt has a NEW derived key). The `succeeded` outcome is still emitted and an attempt\n * is still never started while another is in flight or unknown. A success that arrives after the form was destroyed or the payable changed also moves the epoch (no tombstone is written). A second `succeed()` with no attempt started in between\n * (a host `markSucceeded()` after `(confirmed)`, a repeated `handleReturn()`) settles nothing again; a late success of a key already reported is silent, and one of ANOTHER key (e.g. an older epoch that answers after a start over and a newer save)\n * is reported once as `unknown` / `duplicate_suspected` for the host to resolve.\n */\n lockAfterSuccess?: () => boolean;\n /** The request timeout is replaced by this while a 3-D Secure challenge / the bank window is open (default 300 s). */\n authTimeoutMs?: () => number;\n /** A token-only form whose host never reports becomes unknown after this long (default 120 s). */\n hostSilenceMs?: () => number;\n storage?: () => Storage | null;\n /** Managed environments where `navigator.onLine === false` is a false negative (captive portal, VPN): do not refuse a click because of it (default false). */\n offlineOverride?: () => boolean;\n /** The clock (specs). */\n now?: () => number;\n onOutcome?: (outcome: PaymentAttemptOutcome) => void;\n onInFlightChange?: (inFlight: boolean) => void;\n onKeyChange?: (key: string) => void;\n}\n\nconst newKey = (): string => {\n const c = typeof crypto !== 'undefined' ? crypto : undefined;\n return c && 'randomUUID' in c ? c.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;\n};\n\n/** A readable, collision-free fragment of a payable reference or method for the derived key. */\nconst keyPart = (value: string): string => value.replace(/[^A-Za-z0-9-]/g, c => `_${c.charCodeAt(0).toString(16)}_`);\n\n/** What a payment attempt starts with: its key, amount, method and payable never follow later input changes. */\ninterface Pinned { key: string; amount: number | null; method: string; at: number; owner: string; ref: string | null }\n\n/** One `run()`: its identity decides whether its result may still touch the shared state. */\ninterface RunInfo { id: number; key: string; ref: string | null; amount: number | null; method: string; settled: boolean; fire: (() => void) | null; timer: ReturnType<typeof setTimeout> | null }\n\nexport class PaymentAttempt {\n /** A step of an attempt is running (set in the SAME synchronous tick as the first click / Enter / programmatic call). */\n readonly inFlight = signal(false);\n /** The outcome of an attempt is not known: Pay stays locked, the screen says \"Checking your payment...\". */\n readonly unknown = signal(false);\n /** A status check is running. */\n readonly checking = signal(false);\n /** The bounded polling gave up: \"Check again\" is offered. */\n readonly pollExpired = signal(false);\n /** A payment of this form succeeded (locks the form until the host resets the payable). */\n readonly succeeded = signal(false);\n /** The token was handed to the host, which is now charging: the screen says \"Waiting for your payment to be confirmed\" until the host reports (or stays silent too long). */\n readonly waitingForHost = signal(false);\n /** The marker could not be written (storage blocked or full): reload / second-tab protection is not active. */\n readonly markerWriteFailed = signal(false);\n readonly offline = signal(typeof navigator !== 'undefined' && navigator.onLine === false);\n /** The browser says offline AND the host did not turn `offlineOverride` on: the click is refused and the offline notice shows. */\n readonly blockedOffline = computed(() => this.offline() && !this.o.offlineOverride?.());\n readonly paidLocked = computed(() => this.o.paid() || this.succeeded());\n /** No new attempt may start. */\n readonly locked = computed(() => this.inFlight() || this.unknown() || this.paidLocked());\n /**\n * A bank payment that needs the payer to verify micro-deposits (reason `microdeposits`): the payment has NOT started and nothing is charged until the payer verifies them. It is an UNKNOWN-until-verified state\n * (locked, the status check decides), never paid; the status block says so in plain words.\n */\n private readonly verifying = signal(false);\n /** Read-only for hosts: only the attempt decides (a `microdeposits` unknown, a stored marker, a status answer). */\n readonly awaitingVerification = this.verifying.asReadonly();\n /** The host gave a status check, so the unknown state can resolve by itself. */\n readonly canCheck = computed(() => !!this.o.checkStatus());\n /** The key, amount, method and payable the running / undecided attempt was STARTED with, `null` when no attempt is undecided. */\n private readonly pinned = signal<Pinned | null>(null);\n readonly pinnedAmount = computed(() => this.pinned()?.amount ?? null);\n readonly pinnedMethod = computed(() => this.pinned()?.method ?? null);\n readonly pinnedRef = computed(() => this.pinned()?.ref ?? null);\n /** Bumped when an attempt of this payable is decided: the next DERIVED key differs from every finished one. */\n private readonly epoch = signal(0);\n private readonly renewTick = signal(0);\n /** The attempt key in effect: the PINNED key of a running / undecided attempt, else the host's, else (with a payableRef) the key derived from payable, amount, method and epoch, else a random one. */\n readonly key = computed(() => { this.renewTick(); return this.pinned()?.key ?? this.resolveKey(); });\n\n private readonly id = newKey();\n private readonly memKeys = new Map<string, string>();\n private destroyed = false;\n private unknownReason: string | null = null;\n private unknownSince = 0;\n private liveRun: RunInfo | null = null;\n private runSeq = 0;\n /** Key of an attempt that started while an OLDER one turned out paid: its own result must not change the paid state and is reported as a suspected duplicate. */\n private watchKey: string | null = null;\n /** Key of the attempt that made the payable paid (a late success with ANOTHER key is a suspected duplicate). */\n private paidKey: string | null = null;\n /** Keys already reported as `duplicate_suspected` (reported once each). */\n private readonly duplicates = new Set<string>();\n /** Only with `lockAfterSuccess` false: a success was already settled and no new attempt began since, so a second `succeed()` (a host `markSucceeded()` after `(confirmed)`, a repeated `handleReturn()`) settles nothing again. Cleared by `begin()`, `resetPaid()` and a payable change. */\n private lastSuccessIdle = false;\n /** Only with `lockAfterSuccess` false: keys whose success was already reported, so a late answer for the same key is silent and a distinct key is reported as `duplicate_suspected`. */\n private readonly reportedKeys = new Set<string>();\n /** The request timeout of the newest `run()` (the status grace is measured against it, not against the default). */\n private requestMs = PAYMENT_REQUEST_TIMEOUT_MS;\n private pollTimer: ReturnType<typeof setTimeout> | null = null;\n private silenceTimer: ReturnType<typeof setTimeout> | null = null;\n private pollElapsed = 0;\n private pollGen = 0;\n private checkRun = 0;\n private hostWasPending = false;\n private lastRef: string | null | undefined = undefined;\n private readonly win = typeof window !== 'undefined' ? window : null;\n private readonly onOffline = (): void => {\n this.offline.set(true);\n if (this.inFlight() && this.o.offlineMidFlight !== false) this.markUnknown('offline');\n };\n private readonly onOnline = (): void => {\n this.offline.set(false);\n if (this.unknown()) void this.checkNow();\n };\n private readonly onStorage = (e: StorageEvent): void => {\n const ref = this.o.payableRef();\n if (!ref || this.destroyed) return;\n if (e.key === this.epochName(ref)) { this.readEpoch(ref); return; }\n if (e.key !== PAYMENT_ATTEMPT_STORAGE_PREFIX + ref) return;\n this.react(this.parseStored(e.newValue));\n };\n /** A frozen / back-forward-cached page missed its storage events: read the shared state again when it comes back. */\n private readonly onResync = (): void => {\n const ref = this.o.payableRef();\n if (!ref || this.destroyed) return;\n this.readEpoch(ref);\n this.react(this.readStored(ref));\n };\n private readonly onVisible = (): void => {\n if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;\n this.onResync();\n };\n\n constructor(private readonly o: PaymentAttemptOptions) {\n this.win?.addEventListener('offline', this.onOffline);\n this.win?.addEventListener('online', this.onOnline);\n this.win?.addEventListener('storage', this.onStorage);\n this.win?.addEventListener('pageshow', this.onResync);\n if (typeof document !== 'undefined') document.addEventListener('visibilitychange', this.onVisible);\n o.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.stopPolling();\n this.clearSilence();\n this.win?.removeEventListener('offline', this.onOffline);\n this.win?.removeEventListener('online', this.onOnline);\n this.win?.removeEventListener('storage', this.onStorage);\n this.win?.removeEventListener('pageshow', this.onResync);\n if (typeof document !== 'undefined') document.removeEventListener('visibilitychange', this.onVisible);\n });\n try { untracked(() => this.readEpoch(o.payableRef())); } catch { /* inputs not readable yet: the payable effect reads it */ }\n effect(() => { const key = this.key(); untracked(() => this.o.onKeyChange?.(key)); });\n effect(() => {\n const pending = this.o.hostPending?.() ?? false;\n untracked(() => {\n if (pending) { this.hostWasPending = true; this.markUnknown('host'); return; }\n // The host says its ambiguity is over. Without a status check nothing else can settle it, so the form leaves the unknown state (the host then reports markSucceeded / markFailed / paid);\n // WITH a status check the check decides and the flag alone changes nothing.\n if (this.hostWasPending && this.unknown() && this.unknownReason === 'host' && !this.o.checkStatus()) this.endUnknown();\n this.hostWasPending = false;\n });\n });\n // The marker follows the payable: a pending marker of THIS payable (a reload, another tab) locks the form in the unknown state; another payable starts clean.\n effect(() => { const ref = this.o.payableRef(); untracked(() => this.onPayableChange(ref)); });\n effect(() => { const check = this.o.checkStatus(); untracked(() => { if (check && this.unknown() && !this.pollTimer && !this.checking() && !this.pollExpired()) this.startPolling(); }); });\n effect(() => { if (this.o.paid()) untracked(() => { this.stopPolling(); const pin = this.pinned(); if (pin) this.removeMarker(pin.ref, pin.key); }); });\n }\n\n /** Which storage protects this payable: `shared` (every tab), `tab` (sessionStorage fallback: this tab only), `none` (blocked). */\n storageScope(): 'shared' | 'tab' | 'none' {\n const store = this.store();\n if (!store) return 'none';\n try { return typeof sessionStorage !== 'undefined' && store === sessionStorage ? 'tab' : 'shared'; } catch { return 'shared'; }\n }\n\n /**\n * Starts an attempt: SYNCHRONOUS, so a second click / Enter / programmatic call in the same tick (or any later one while it runs) is refused. Nothing is sent when it refuses.\n * `locked` (a double click) is silent; `paid`, `unknown` and `offline` also emit a `refused` outcome. The key, amount, method and payable are PINNED here: later input changes never move a running attempt.\n */\n begin(): { ok: true; key: string } | { ok: false; reason: PaymentAttemptRefusal } {\n if (this.destroyed) return { ok: false, reason: 'locked' };\n if (this.paidLocked()) return this.refuse('paid');\n if (this.unknown()) return this.refuse('unknown');\n if (this.inFlight()) return { ok: false, reason: 'locked' };\n if (this.blockedOffline()) return this.refuse('offline');\n const ref = this.o.payableRef();\n this.readEpoch(ref); // another tab may have decided an attempt since the last event: never start with a stale epoch\n this.sweepStale();\n const stored = this.readStored(ref);\n if (this.keepsLock() && stored && stored.type === 'tombstone' && stored.value.state === 'succeeded') { // any owner: this instance's own success counts too once its paid state was reset by a payable round trip\n this.lateSuccess(stored.value.key, 'other_tab', stored.value.amount ?? null, stored.value.method); // another tab paid this payable a moment ago: this idle tab must not charge it again\n return this.refuse('paid');\n }\n if (this.keepsLock() && this.checkPaidRecord(ref)) return this.refuse('paid');\n const foreign = this.foreignMarker();\n if (foreign) { this.adopt(foreign, 'other_tab'); return this.refuse('unknown'); }\n this.lastSuccessIdle = false;\n this.setInFlight(true);\n const pin = this.newPin();\n this.pinned.set(pin);\n // An unlocked form (`lockAfterSuccess` false) intentionally allows a new save after a success. With a HOST-supplied key (no epoch bump on renew) the previous success's tombstone carries the SAME key and the \"never downgrade\" guard of\n // `writeMarker` would refuse this attempt's inflight marker (a reload / second tab during the second save would be unprotected): that spent tombstone is dropped first. Heartbeats keep the guard.\n if (!this.keepsLock() && stored && stored.type === 'tombstone' && stored.value.state === 'succeeded' && stored.value.key === pin.key) {\n const name = this.markerKey(ref);\n const again = this.readStored(ref); // re-read right before removing: a record another tab wrote in the meantime (another key or kind) is never removed\n if (name && again && again.type === 'tombstone' && again.value.state === 'succeeded' && again.value.key === pin.key) { try { this.store()?.removeItem(name); } catch { /* ignore */ } }\n }\n this.writeMarker('inflight');\n const raced = this.foreignMarker(); // two tabs clicking at the same instant: the later write wins, the other one backs off\n if (raced) { this.setInFlight(false); this.pinned.set(null); this.adopt(raced, 'other_tab'); return this.refuse('unknown'); }\n return { ok: true, key: pin.key };\n }\n\n /** The attempt ended BEFORE any charge request (validation, tokenization, buyer verification): unlock, the key is kept. */\n release(): void {\n if (this.destroyed) { this.abandon(); return; }\n if (this.succeeded() && this.pinned()) { this.settleWatched(false); return; }\n this.setInFlight(false);\n this.clearSilence();\n this.waitingForHost.set(false);\n if (this.unknown() && this.unknownReason !== 'host' && this.unknownReason !== 'reload' && this.unknownReason !== 'other_tab' && !this.awaitingVerification()) this.leaveUnknown();\n if (!this.unknown()) { this.endMarker('released'); this.pinned.set(null); }\n }\n\n /** Clears the marker of an attempt that never sent anything, even when the form is already destroyed (a destroyed form must not leave a 30-minute lock behind). */\n abandon(): void {\n const pin = this.pinned();\n if (!pin) return;\n this.clearSilence();\n this.writeTombstone(pin.ref, 'released', pin.key);\n }\n\n /** The host says nothing was sent to the processor (it did not use the token, its call never left): unlock, the key is kept. Only valid for \"NOT SENT\": a retry must find any attempt state the backend holds for the key. */\n markNotCharged(): void {\n if (this.destroyed || this.paidLocked()) return;\n this.stopPolling();\n this.setInFlight(false);\n this.clearSilence();\n this.waitingForHost.set(false);\n this.leaveUnknown();\n this.endMarker('released');\n this.pinned.set(null);\n }\n\n /** The payment succeeded (or exists and is settling): the form locks for this payable. Idempotent. */\n succeed(reason?: string): void {\n if (this.destroyed) return;\n if (this.succeeded()) { this.settleWatched(true); return; }\n if (!this.keepsLock() && !this.pinned() && this.lastSuccessIdle) return; // an unlocked form already settled its success and nothing started since: not a second payment (no phantom outcome, no second epoch bump)\n const key = this.key();\n const pin = this.pinned();\n const ref = pin?.ref ?? this.o.payableRef();\n const amount = pin ? pin.amount : this.o.amount();\n const method = pin?.method ?? this.o.method();\n this.stopPolling();\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.leaveUnknown();\n const lock = this.keepsLock();\n if (lock) { this.succeeded.set(true); this.paidKey = key; } else { this.lastSuccessIdle = true; this.reportedKeys.add(key); }\n this.renew(key, lock ? null : ref); // a success does NOT bump the epoch: a replay of the same key (another tab, a reload) returns the original payment instead of charging again; a form that does not lock (`lockAfterSuccess` false) moves it, the next save has a NEW key\n this.endMarker('succeeded');\n this.writePaidRecord(ref, key, amount, method);\n this.pinned.set(null);\n this.emit({ kind: 'succeeded', attemptKey: key, ...(reason ? { reason } : {}), ...(reason === 'other_tab' ? { amount, method } : {}) });\n }\n\n /**\n * The host starts a deliberate SECOND payment of this payable (an explicit \"pay again\" flow): forgets that this form instance saw a success, removes the succeeded record and tombstone and moves the epoch, so the next\n * attempt has a NEW key. Does nothing against the host's own `paid` input (the host clears that itself) and is IGNORED while an attempt is running or unknown (call it again once that attempt is decided).\n */\n resetPaid(): void {\n if (this.destroyed || this.inFlight() || this.unknown()) return; // an attempt that runs (a watched one included) keeps its bookkeeping: pay again once it is decided\n const ref = this.o.payableRef();\n this.succeeded.set(false);\n this.paidKey = null;\n this.watchKey = null;\n this.duplicates.clear();\n this.reportedKeys.clear();\n this.lastSuccessIdle = false;\n this.memKeys.clear();\n if (ref) {\n this.removePaidRecord(ref);\n const stored = this.readStored(ref);\n const name = this.markerKey(ref);\n if (name && stored && stored.type === 'tombstone' && stored.value.state === 'succeeded') { try { this.store()?.removeItem(name); } catch { /* ignore */ } }\n this.bumpEpoch(ref);\n }\n this.renewTick.update(n => n + 1);\n }\n\n /** A DEFINITIVE failure (declined, failed, status check says failed): unlock, with a NEW key. Never for a timeout or an offline loss. Ignored after a success. */\n fail(reason?: string, external = false): void {\n if (this.destroyed) return;\n if (this.succeeded()) { this.settleWatched(false); return; }\n const key = this.key();\n const ref = this.pinned()?.ref ?? this.o.payableRef();\n this.stopPolling();\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.leaveUnknown();\n this.renew(key, external ? null : ref); // the epoch is written BEFORE the tombstone, so another tab that reacts to the tombstone already sees the new epoch\n this.endMarker('failed');\n this.pinned.set(null);\n this.emit({ kind: 'failed', attemptKey: key, ...(reason ? { reason } : {}) });\n }\n\n /** The payer chose \"Start over\" after the polling window: unlock with a NEW key (only offered when the backend allows ONE open or succeeded attempt per payable, which is what makes it safe). */\n startOver(): void {\n if (this.destroyed || !this.unknown()) return;\n this.fail('start_over');\n }\n\n /** The outcome is ambiguous (timeout, offline mid-flight, host-reported, reload, another tab): lock, KEEP (and pin) the key, check the status. Idempotent. */\n markUnknown(reason: string, verification: boolean = reason === 'microdeposits'): void {\n if (this.destroyed) return;\n if (this.paidLocked()) { if (this.succeeded()) this.settleWatched(false); return; }\n this.setInFlight(false);\n this.clearSilence();\n this.waitingForHost.set(false);\n if (this.unknown()) {\n // The answer that says \"verify the deposits\" can arrive AFTER the attempt became unknown (the confirm outlived the request timeout, or another tab / a reload already adopted it): upgrade, never ignore.\n if (verification && !this.awaitingVerification()) {\n this.verifying.set(true);\n this.writeMarker('unknown');\n this.emit({ kind: 'unknown', attemptKey: this.key(), reason: 'microdeposits' });\n }\n return;\n }\n // A succeeded tombstone of THIS key that another tab wrote while this attempt was running (and was ignored then: its own answer is that payment) decides it now.\n const pending = this.pinned();\n const done = this.readStored(pending?.ref ?? this.o.payableRef());\n if (done && done.type === 'tombstone' && done.value.state === 'succeeded' && done.value.owner !== this.id && done.value.key === (pending?.key ?? this.key())) { this.succeed('other_tab'); return; }\n if (!this.pinned()) this.pinned.set(this.newPin());\n this.unknown.set(true);\n this.unknownReason = reason;\n this.verifying.set(verification);\n this.unknownSince = this.now();\n this.pollExpired.set(false);\n this.writeMarker('unknown');\n this.emit({ kind: 'unknown', attemptKey: this.key(), reason });\n this.startPolling();\n }\n\n /**\n * The step that needs the processor is in progress elsewhere: the lock STAYS ON until the host or a status check decides. `token` = the host is charging a token (the screen says \"Waiting for your\n * payment to be confirmed\", and a host that stays silent for `hostSilenceMs` makes the outcome unknown); `auth_required` / `bank_window` = a 3-D Secure challenge / the bank window is open (the request\n * timeout is replaced by `authTimeoutMs`).\n */\n markPending(reason?: string): void {\n if (this.destroyed || this.paidLocked() || this.unknown()) return; // nothing is pending on a payable that is already paid, and an unknown outcome is already waiting for its status check\n if (reason === 'token') {\n this.waitingForHost.set(true);\n this.clearSilence();\n this.silenceTimer = setTimeout(() => { this.silenceTimer = null; if (this.waitingForHost()) this.markUnknown('host_silent'); }, this.o.hostSilenceMs?.() ?? PAYMENT_HOST_SILENCE_MS);\n } else if (reason === 'auth_required' || reason === 'bank_window') {\n const ms = this.o.authTimeoutMs?.() ?? PAYMENT_AUTH_TIMEOUT_MS;\n // The running request's timeout is replaced; with no running request (the host's own `confirm()` answered `requires_action` and the host runs the challenge) the host has `authTimeoutMs`\n // to come back with the result, else the outcome is unknown (the lock never stays on for ever because the host forgot).\n if (!this.extendRunTimeout(ms) && this.inFlight()) {\n this.clearSilence();\n this.silenceTimer = setTimeout(() => { this.silenceTimer = null; if (this.inFlight()) this.markUnknown('host_silent'); }, ms);\n }\n }\n this.emit({ kind: 'pending', attemptKey: this.key(), ...(reason ? { reason } : {}) });\n }\n\n /** Asks the host's status check once (a newer call supersedes an older one). `succeeded` -> success state, `failed` / `not_found` -> unlocked with a new key (once believed), anything else -> stays locked. */\n async checkNow(): Promise<void> {\n const check = this.o.checkStatus();\n if (!check || this.destroyed || !this.unknown()) return;\n const mine = ++this.checkRun;\n const key = this.key();\n const asked = this.pinned();\n const askedRef = asked?.ref ?? this.o.payableRef();\n this.checking.set(true);\n let answer: PaymentStatusAnswer = 'unknown';\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n const timeout = new Promise<'timeout'>(resolve => { timer = setTimeout(() => resolve('timeout'), this.o.statusTimeoutMs?.() ?? PAYMENT_STATUS_CHECK_TIMEOUT_MS); });\n const result = await Promise.race([callHost(() => check(key)), timeout]);\n answer = result === 'timeout' ? 'unknown' : (result ?? 'unknown');\n } catch { answer = 'unknown'; } finally { if (timer) clearTimeout(timer); }\n if (this.destroyed || mine !== this.checkRun) return;\n this.checking.set(false);\n if (!this.unknown()) {\n // The attempt was unlocked while the check was out (the host's markFailed, a start over): a `succeeded` answer still means the payable IS paid (a failed answer decides nothing here).\n if (answer === 'succeeded' && askedRef === this.o.payableRef()) this.lateSuccess(key, 'status_check', asked ? asked.amount : this.o.amount(), asked?.method ?? this.o.method());\n return;\n }\n if (this.key() !== key) return; // still unknown, but about ANOTHER attempt than the one asked (a newer attempt took over while the check was out): its answer decides nothing here\n if (answer === 'succeeded') this.succeed('status_check');\n else if (answer === 'failed' || answer === 'not_found') {\n if (this.mustWait(answer)) return; // the original request may still land: not a failure yet\n this.fail(answer === 'failed' ? 'status_check' : 'not_found');\n } else if (answer === 'awaiting_verification') this.markUnknown(this.unknownReason ?? 'microdeposits', true); // the payer still has to verify the deposits: stays unknown, says so (also after a timeout / reload that did not know)\n else if (answer === 'in_flight') {\n // The payment is running (or, right after a bank verification, now PROCESSES, so it is no longer \"NOT started\"): the stored marker is rewritten WITHOUT the verification reason (a reload must not say\n // \"NOT started\" for a processing payment) and its clock restarts now. This is also a HEARTBEAT on EVERY `in_flight` answer: a tab that keeps polling keeps its marker fresh, so the lock of a\n // processing payment is not lost to the 30-minute expiry in a reload / second tab while a status check can still decide.\n this.verifying.set(false);\n const pin = this.pinned();\n if (pin) this.pinned.set({ ...pin, at: this.now() });\n this.writeMarker('unknown', false);\n }\n }\n\n /** \"Check again\": polls for another bounded round. */\n checkAgain(): void {\n if (this.destroyed || !this.unknown()) return;\n this.pollExpired.set(false);\n this.startPolling();\n }\n\n /**\n * Runs one attempt: `begin()` (synchronous), then `op(key)`, raced against `timeoutMs` (replaced by `authTimeoutMs` while `markPending('auth_required' | 'bank_window')` is on). The result decides the\n * lock: `success` locks for good, `failure` unlocks with a new key, `released` unlocks with the same key, `pending` keeps the lock, `unknown` and a timeout (or an exception) lock in the unknown state.\n * An answer that arrives AFTER the timeout still settles the attempt while it is still THE attempt (`onLate`); once the attempt moved on (a status check unlocked it, a newer attempt began) a late\n * failure / release / unknown is dropped and a late SUCCESS only marks the payable paid (and is reported once with its own, old key), never touching the newer attempt's lock, pin or marker.\n */\n async run<T>(op: (key: string) => Promise<PaymentAttemptResult<T>>, options: { timeoutMs?: number; onLate?: (result: PaymentAttemptResult<T>) => void } = {}): Promise<PaymentAttemptRun<T>> {\n const begun = this.begin();\n if (!begun.ok) return { refused: begun.reason };\n const pin = this.pinned();\n const info: RunInfo = { id: ++this.runSeq, key: begun.key, ref: pin?.ref ?? null, amount: pin?.amount ?? null, method: pin?.method ?? this.o.method(), settled: false, fire: null, timer: null };\n this.liveRun = info;\n this.requestMs = options.timeoutMs ?? PAYMENT_REQUEST_TIMEOUT_MS;\n // The timeout exists BEFORE the op runs: an op that calls `markPending('auth_required' | 'bank_window')` synchronously (the Square ACH path does) must be able to replace it.\n const timeout = new Promise<'timeout'>(resolve => {\n info.fire = () => resolve('timeout');\n info.timer = setTimeout(info.fire, this.requestMs);\n });\n let running: Promise<PaymentAttemptResult<T>>;\n try { running = op(begun.key); } catch (error) { running = Promise.reject(error); }\n const settled = (): void => { info.settled = true; };\n running.then(settled, settled);\n let result: PaymentAttemptResult<T> | 'timeout';\n try { result = await Promise.race([running, timeout]); } catch { result = { kind: 'unknown', reason: 'error' }; } finally { if (info.timer) { clearTimeout(info.timer); info.timer = null; } }\n if (result === 'timeout') {\n if (this.isCurrent(info)) { if (info.ref !== this.o.payableRef()) this.settleOtherPayable(info, { kind: 'unknown', reason: 'timeout' }); else this.markUnknown('timeout'); }\n void running.then(late => { this.applyRun(info, late); options.onLate?.(late); }, () => undefined);\n return { kind: 'unknown', reason: 'timeout' };\n }\n this.applyRun(info, result);\n return result;\n }\n\n /**\n * Is the run that was given `key` still THE attempt in progress (not replaced by a newer attempt, not decided, the form not destroyed)? An op uses it to skip every screen side effect of a LATE answer\n * (a decline text, `setBusy(false)`, releasing an inner form) that would otherwise land on the NEWER attempt's screen. The result it returns is still applied by `run()` with the same rules.\n */\n isLive(key: string): boolean { return !this.destroyed && this.liveRun?.key === key && this.pinned()?.key === key; }\n\n /** Applies the result of a step to THIS attempt (see {@link PaymentAttemptKind}). */\n apply<T>(result: PaymentAttemptResult<T>): void {\n if (this.destroyed) { if (result.kind === 'released') this.abandon(); return; }\n switch (result.kind) {\n case 'success': this.succeed(result.reason); break;\n case 'failure': this.fail(result.reason); break;\n case 'released': this.release(); break;\n case 'pending': this.markPending(result.reason); break;\n default: this.markUnknown(result.reason ?? 'unknown');\n }\n }\n\n // ── Internals ──────────────────────────────────────────────────────────\n\n private now(): number { return this.o.now ? this.o.now() : Date.now(); }\n\n /** A success locks the payable as paid (default); `false` only for a form that opted out with `lockAfterSuccess`. */\n private keepsLock(): boolean { return this.o.lockAfterSuccess?.() !== false; }\n\n /** Newest run that is still THE attempt in progress (same pinned key, not replaced by a newer run). */\n private isCurrent(info: RunInfo): boolean { return this.liveRun === info && this.pinned()?.key === info.key; }\n\n private applyRun<T>(info: RunInfo, result: PaymentAttemptResult<T>): void {\n if (this.destroyed) { this.settleDestroyed(info, result.kind); return; }\n // The payable on screen changed while this attempt ran: its result only decides the OLD payable's records, never the new payable's state.\n if (info.ref !== this.o.payableRef()) { this.settleOtherPayable(info, result); return; }\n if (this.isCurrent(info)) { this.apply(result); return; }\n // Anything else of an attempt that moved on is dropped; a late SUCCESS of the payable still shown counts.\n if (result.kind === 'success') this.lateSuccess(info.key, result.reason, info.amount, info.method);\n }\n\n /**\n * The form was destroyed before this attempt's answer arrived (the panel closes when it records the payment). The host is not told (nobody listens any more); the records are written so the next form of the\n * payable starts paid (success), unlocked with a new key (failure) or unlocked (released), and a development warning says it happened.\n */\n private settleDestroyed(info: RunInfo, kind: PaymentAttemptKind): void {\n if (kind === 'released') { this.abandon(); return; }\n if (kind !== 'success' && kind !== 'failure') return;\n if (kind === 'success') {\n if (this.keepsLock()) {\n this.writeTombstone(info.ref, 'succeeded', info.key, { amount: info.amount, method: info.method });\n this.writePaidRecord(info.ref, info.key, info.amount, info.method);\n } else if (info.ref) { this.bumpEpoch(info.ref); this.removeMarker(info.ref, info.key); } // nothing locks: the next form of the payable must derive a NEW key (the same key would return this already saved method to a backend that uses it as its idempotency key) and must not adopt this attempt's marker\n if (isDevMode()) console.warn(this.keepsLock()\n ? 'A payment answered after its form was destroyed: it is recorded for the next form of the payable (reconcile it by its attemptKey on your backend).'\n : 'A save answered after its form was destroyed: the epoch moved, so the next form of the payable derives a new key (reconcile it by its attemptKey on your backend).');\n } else {\n if (info.ref) this.bumpEpoch(info.ref);\n this.writeTombstone(info.ref, 'failed', info.key);\n }\n }\n\n /** The result of an attempt that belongs to ANOTHER payable than the one on screen: only that payable's records change; this form's lock, pin and paid state are for the payable on screen. */\n private settleOtherPayable<T>(info: RunInfo, result: PaymentAttemptResult<T>): void {\n const pin = this.pinned();\n const mine = !!pin && pin.key === info.key && pin.ref === info.ref;\n switch (result.kind) {\n case 'success':\n if (this.keepsLock()) {\n this.writeTombstone(info.ref, 'succeeded', info.key, { amount: info.amount, method: info.method });\n this.writePaidRecord(info.ref, info.key, info.amount, info.method);\n } else if (info.ref) { this.bumpEpoch(info.ref); this.removeMarker(info.ref, info.key); } // nothing locks: the old payable's next attempt derives a NEW key and does not adopt this attempt's marker\n break;\n case 'failure':\n if (info.ref) this.bumpEpoch(info.ref);\n this.writeTombstone(info.ref, 'failed', info.key);\n break;\n case 'released': this.writeTombstone(info.ref, 'released', info.key); break;\n case 'unknown': if (mine) this.writeMarker('unknown', result.reason === 'microdeposits'); break; // the old payable keeps its undecided marker: a reload or another tab asks the status check\n default: return; // pending: nothing is decided\n }\n if (mine) {\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.pinned.set(null);\n }\n }\n\n /**\n * An attempt other than the current one turned out paid (a late answer of an older attempt, a late status answer, or another tab's success): the payable IS paid. A newer attempt's lock, pin and marker are\n * left alone. When the payable was ALREADY paid by a different key, the second payment is a suspected duplicate: it is reported once (`unknown` / `duplicate_suspected`, with ITS key) for the host to resolve.\n */\n private lateSuccess(key: string, reason?: string, amount?: number | null, method?: string): void {\n if (!this.keepsLock()) { // nothing locks: the success is only reported, once per key; a success of ANOTHER key than the ones already reported is a suspected duplicate (the host resolves it)\n if (this.reportedKeys.has(key)) return;\n if (this.reportedKeys.size > 0) {\n if (!this.duplicates.has(key)) { this.duplicates.add(key); this.emit({ kind: 'unknown', attemptKey: key, reason: 'duplicate_suspected' }); }\n return;\n }\n this.reportedKeys.add(key);\n this.emit({ kind: 'succeeded', attemptKey: key, ...(reason ? { reason } : {}), ...(method !== undefined ? { amount: amount ?? null, method } : {}) });\n return;\n }\n if (this.succeeded()) {\n if (this.paidKey && key !== this.paidKey && !this.duplicates.has(key)) { this.duplicates.add(key); this.emit({ kind: 'unknown', attemptKey: key, reason: 'duplicate_suspected' }); }\n return;\n }\n const pin = this.pinned();\n this.succeeded.set(true);\n this.paidKey = key;\n this.stopPolling();\n if (pin && pin.key !== key) this.watchKey = pin.key;\n if (reason !== 'other_tab') this.writePaidRecord(pin?.ref ?? this.o.payableRef(), key, amount ?? null, method ?? this.o.method()); // another tab's success is already recorded by that tab\n this.emit({ kind: 'succeeded', attemptKey: key, ...(reason ? { reason } : {}), ...(method !== undefined ? { amount: amount ?? null, method } : {}) });\n }\n\n /**\n * The result of the attempt that was running when the payable turned out paid: it only releases its own lock (and leaves its own marker as `succeeded`). If it was an attempt with ANOTHER key and it ALSO\n * succeeded it is reported as a suspected duplicate for the host to resolve; one with the SAME key is that very payment and settles silently.\n */\n private settleWatched(success: boolean): void {\n const pin = this.pinned();\n if (!pin) return;\n const watched = this.watchKey !== null && pin.key === this.watchKey;\n if (watched) this.watchKey = null;\n this.stopPolling();\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.leaveUnknown();\n // The marker of this attempt becomes a `succeeded` tombstone only when it IS a paid attempt (it succeeded itself, or it is the very payment that made the payable paid: the same key). A DIFFERENT attempt that\n // failed / was released / timed out is just removed: another tab must never read \"paid\" with the key of a payment that did not happen.\n if (success || pin.key === this.paidKey) this.endMarker('succeeded');\n else this.removeMarker(pin.ref, pin.key);\n this.pinned.set(null);\n if (success && watched && !this.duplicates.has(pin.key)) { this.duplicates.add(pin.key); this.emit({ kind: 'unknown', attemptKey: pin.key, reason: 'duplicate_suspected' }); }\n }\n\n private currentRunUnsettled(): boolean {\n const run = this.liveRun;\n return !!run && !run.settled && run.key === this.pinned()?.key;\n }\n\n /**\n * Is a `failed` / `not_found` answer too early to believe? (see {@link CheckPaymentStatusFn})\n * - the attempt's own request is still unsettled: ignored for `statusHardMaxMs` after it became unknown (counted from there, so a long auth timeout does not use it up);\n * - the host's charge may still be running (`host_silent`, `host`): the request timeout plus the grace, counted from the moment it became unknown;\n * - adopted from a reload / another tab, or `not_found`: the request timeout plus the grace, counted from the START of the attempt.\n */\n private mustWait(answer: PaymentStatusAnswer): boolean {\n const now = this.now();\n const grace = this.o.failGraceMs?.() ?? PAYMENT_STATUS_FAIL_GRACE_MS;\n if (this.currentRunUnsettled()) return now - this.unknownSince < (this.o.statusHardMaxMs?.() ?? PAYMENT_STATUS_HARD_MAX_MS);\n if (this.unknownReason === 'host_silent' || this.unknownReason === 'host') return now - this.unknownSince < this.requestMs + grace;\n const adopted = this.unknownReason === 'reload' || this.unknownReason === 'other_tab';\n if (adopted || answer === 'not_found') return now - (this.pinned()?.at ?? this.unknownSince) < this.requestMs + grace;\n return false;\n }\n\n /** Replaces the request timeout of the running request; `false` when no request is running. */\n private extendRunTimeout(ms: number): boolean {\n const run = this.liveRun;\n if (!run || run.settled || !run.fire || !run.timer) return false;\n clearTimeout(run.timer);\n run.timer = setTimeout(run.fire, ms);\n return true;\n }\n\n private clearSilence(): void { if (this.silenceTimer) { clearTimeout(this.silenceTimer); this.silenceTimer = null; } }\n\n private refuse(reason: PaymentAttemptRefusal): { ok: false; reason: PaymentAttemptRefusal } {\n this.emit({ kind: 'refused', attemptKey: this.key(), reason });\n return { ok: false, reason };\n }\n\n private emit(outcome: PaymentAttemptOutcome): void { if (!this.destroyed) this.o.onOutcome?.(outcome); }\n\n /** What a NEW attempt starts with (its key, amount, method and payable never follow later input changes). */\n private newPin(): Pinned { return { key: this.resolveKey(), amount: this.o.amount(), method: this.o.method(), at: this.now(), owner: this.id, ref: this.o.payableRef() }; }\n\n private setInFlight(value: boolean): void {\n if (this.inFlight() === value) return;\n this.inFlight.set(value);\n this.o.onInFlightChange?.(value);\n }\n\n private leaveUnknown(): void {\n this.unknown.set(false);\n this.unknownReason = null;\n this.verifying.set(false);\n this.pollExpired.set(false);\n }\n\n /** The host says its own ambiguity is over: leave the unknown state without deciding (the host reports the result itself). */\n private endUnknown(): void {\n this.stopPolling();\n this.leaveUnknown();\n const pin = this.pinned();\n if (pin) this.removeMarker(pin.ref, pin.key);\n this.pinned.set(null);\n }\n\n private startPolling(): void {\n this.stopPolling();\n if (!this.o.checkStatus()) return;\n this.pollElapsed = 0;\n void this.pollOnce(this.pollGen);\n }\n\n /** One round: the check now, then (while still unknown and inside the bounded window) the next one after `pollMs`. */\n private async pollOnce(gen: number): Promise<void> {\n await this.checkNow();\n if (this.destroyed || gen !== this.pollGen || !this.unknown()) return;\n const every = Math.max(1, this.o.pollMs?.() ?? PAYMENT_STATUS_POLL_MS);\n this.pollElapsed += every;\n if (this.pollElapsed >= (this.o.pollMaxMs?.() ?? PAYMENT_STATUS_POLL_MAX_MS)) { this.pollExpired.set(true); return; }\n this.pollTimer = setTimeout(() => { this.pollTimer = null; void this.pollOnce(gen); }, every);\n }\n\n private stopPolling(): void {\n this.pollGen++;\n if (this.pollTimer) { clearTimeout(this.pollTimer); this.pollTimer = null; }\n }\n\n private amountPart(): string {\n const amount = this.o.amount();\n return amount == null || !Number.isFinite(amount) ? 'na' : String(Math.round(amount * 100));\n }\n\n private tupleId(): string { return `${this.amountPart()}|${this.o.method()}`; }\n\n /**\n * The key of a NEW attempt: the host's; else, with a payableRef, a DERIVED readable one (`pa_<payable>_<cents>_<method>_e<epoch>`) so every tab and every reload of the same payable, amount and\n * method hold the SAME key without talking to each other (the epoch only grows when an attempt of the payable is decided); else a random one held in memory per (amount, method).\n */\n private resolveKey(): string {\n const host = this.o.attemptKey();\n if (host) return host;\n const ref = this.o.payableRef();\n if (ref) return `pa_${keyPart(ref)}_${this.amountPart()}_${keyPart(this.o.method())}_e${this.epoch()}`;\n const id = this.tupleId();\n let key = this.memKeys.get(id);\n if (!key) { key = newKey(); this.memKeys.set(id, key); }\n return key;\n }\n\n /** The attempt with `finished` ended definitively: no key may be resolved again for it. With `bumpRef` (a definitive FAILURE of this payable) the epoch grows too, so the next attempt gets a new derived key. */\n private renew(finished: string, bumpRef: string | null): void {\n if (this.o.attemptKey()) return;\n for (const [tuple, key] of this.memKeys) if (key === finished) this.memKeys.delete(tuple);\n if (bumpRef) this.bumpEpoch(bumpRef);\n this.renewTick.update(n => n + 1);\n }\n\n // ── The opaque marker, tombstone and epoch (reload and second-tab protection) ──\n\n private store(): Storage | null { try { return this.o.storage?.() ?? null; } catch { return null; } }\n\n private markerKey(ref: string | null): string | null { return ref ? PAYMENT_ATTEMPT_STORAGE_PREFIX + ref : null; }\n\n private epochName(ref: string | null): string | null { return ref ? `${PAYMENT_ATTEMPT_STORAGE_PREFIX}${ref}#epoch` : null; }\n\n private storedEpoch(name: string | null): number {\n if (!name) return 0;\n try { const n = Number(this.store()?.getItem(name)); return Number.isInteger(n) && n > 0 ? n : 0; } catch { return 0; }\n }\n\n /** The shared epoch of `ref` (cleared storage reads as 0: a replayed key then returns the ORIGINAL payment, which the host must record idempotently). */\n private readEpoch(ref: string | null): void {\n const value = this.storedEpoch(this.epochName(ref));\n if (value !== this.epoch()) this.epoch.set(value);\n }\n\n /** Never goes backwards: the next epoch is one above the larger of this page's and the stored one. */\n private bumpEpoch(ref: string): void {\n const name = this.epochName(ref);\n const current = ref === this.o.payableRef();\n const next = Math.max(current ? this.epoch() : 0, this.storedEpoch(name)) + 1;\n if (current) this.epoch.set(next);\n if (name) { try { this.store()?.setItem(name, String(next)); } catch { /* storage unavailable: the epoch lives in this page */ } }\n }\n\n private parseStored(raw: string | null | undefined): { type: 'marker'; value: PaymentAttemptMarker } | { type: 'tombstone'; value: PaymentAttemptTombstone } | null {\n if (!raw) return null;\n try {\n const m = JSON.parse(raw) as Record<string, unknown> | null;\n if (!m || typeof m !== 'object' || typeof m['key'] !== 'string' || !m['key'] || typeof m['owner'] !== 'string') return null;\n const now = this.now();\n if ((m['state'] === 'released' || m['state'] === 'failed' || m['state'] === 'succeeded') && typeof m['at'] === 'number') {\n if (now - m['at'] > PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS) return null;\n return { type: 'tombstone', value: { state: m['state'], key: m['key'], at: m['at'], owner: m['owner'], ...(typeof m['method'] === 'string' ? { amount: typeof m['amount'] === 'number' ? m['amount'] : null, method: m['method'] } : {}) } };\n }\n if (typeof m['startedAt'] !== 'number' || (m['state'] !== 'inflight' && m['state'] !== 'unknown')) return null;\n const verification = m['state'] === 'unknown' && m['reason'] === 'microdeposits';\n if (now - m['startedAt'] > (verification ? PAYMENT_ATTEMPT_VERIFICATION_TTL_MS : PAYMENT_ATTEMPT_MARKER_TTL_MS)) return null;\n return { type: 'marker', value: { key: m['key'], startedAt: m['startedAt'], state: m['state'], owner: m['owner'], amount: typeof m['amount'] === 'number' ? m['amount'] : null, method: typeof m['method'] === 'string' ? m['method'] : '', ...(verification ? { reason: 'microdeposits' as const } : {}) } };\n } catch { return null; }\n }\n\n private readStored(ref: string | null): ReturnType<PaymentAttempt['parseStored']> {\n const name = this.markerKey(ref);\n if (!name) return null;\n try { return this.parseStored(this.store()?.getItem(name)); } catch { return null; }\n }\n\n /** A pending marker of this payable that another form instance (tab, page load) wrote and that is not expired. */\n private foreignMarker(): PaymentAttemptMarker | null {\n const stored = this.readStored(this.o.payableRef());\n return stored && stored.type === 'marker' && stored.value.owner !== this.id ? stored.value : null;\n }\n\n /**\n * COMPARE-AND-WRITE: the stored record belongs to ANOTHER attempt (a different key) and must not be replaced or removed by this instance. A marker is only blocked by an undecided marker of another key\n * (a tombstone of a finished attempt is simply replaced by the next attempt's marker); a tombstone / removal is blocked by ANY stored record of another key (this instance's decision is stale).\n */\n private storedOfOther(ref: string | null, key: string, markerOnly: boolean): boolean {\n const stored = this.readStored(ref);\n return !!stored && stored.value.key !== key && (!markerOnly || stored.type === 'marker');\n }\n\n private writeMarker(state: 'inflight' | 'unknown', verification: boolean = this.awaitingVerification()): void {\n const pin = this.pinned();\n const name = this.markerKey(pin?.ref ?? null);\n if (!name || !pin) return;\n if (this.storedOfOther(pin.ref, pin.key, true)) return;\n // Never downgrade: another tab already decided THIS attempt as succeeded (its tombstone), which an `unknown` marker (a heartbeat included) must not overwrite.\n const stored = this.readStored(pin.ref);\n if (stored && stored.type === 'tombstone' && stored.value.key === pin.key && stored.value.state === 'succeeded') return;\n const marker: PaymentAttemptMarker = { key: pin.key, state, owner: pin.owner, startedAt: pin.at, amount: pin.amount, method: pin.method, ...(state === 'unknown' && verification ? { reason: 'microdeposits' as const } : {}) };\n const raw = JSON.stringify(marker);\n let ok = false;\n try {\n const store = this.store();\n store?.setItem(name, raw);\n ok = !!store && store.getItem(name) !== null; // read it back: a quota error that is swallowed by the browser must not leave the protection silently off\n } catch { ok = false; }\n this.markerWriteFailed.set(!ok);\n }\n\n private writeTombstone(ref: string | null, state: 'released' | 'failed' | 'succeeded', key: string, paid?: { amount: number | null; method: string }): void {\n const name = this.markerKey(ref);\n if (!name || this.storedOfOther(ref, key, false)) return;\n const tombstone: PaymentAttemptTombstone = { state, key, at: this.now(), owner: this.id, ...(state === 'succeeded' && paid ? { amount: paid.amount, method: paid.method } : {}) };\n try { this.store()?.setItem(name, JSON.stringify(tombstone)); } catch { /* ignore */ }\n }\n\n /** The attempt was decided: replace its marker by a short tombstone so other tabs learn HOW it ended (a removed marker says nothing). */\n private endMarker(state: 'released' | 'failed' | 'succeeded'): void {\n const pin = this.pinned();\n if (!pin) return;\n this.writeTombstone(pin.ref, state, pin.key, { amount: pin.amount, method: pin.method });\n }\n\n private removeMarker(ref: string | null, key: string): void {\n const name = this.markerKey(ref);\n if (!name || this.storedOfOther(ref, key, false)) return;\n try { this.store()?.removeItem(name); } catch { /* ignore */ }\n }\n\n private paidName(ref: string | null): string | null { return ref ? `${PAYMENT_ATTEMPT_STORAGE_PREFIX}${ref}#paid` : null; }\n\n /** The succeeded record of a payable (24 hours), or null. */\n private readPaidRecord(ref: string | null): PaymentAttemptPaidRecord | null {\n const name = this.paidName(ref);\n if (!name) return null;\n try {\n const m = JSON.parse(this.store()?.getItem(name) ?? 'null') as Record<string, unknown> | null;\n if (!m || typeof m !== 'object' || typeof m['key'] !== 'string' || !m['key'] || typeof m['at'] !== 'number' || typeof m['owner'] !== 'string') return null;\n if (this.now() - m['at'] > PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS) return null;\n return { key: m['key'], at: m['at'], owner: m['owner'], amount: typeof m['amount'] === 'number' ? m['amount'] : null, method: typeof m['method'] === 'string' ? m['method'] : '' };\n } catch { return null; }\n }\n\n private writePaidRecord(ref: string | null, key: string, amount: number | null, method: string): void {\n const name = this.paidName(ref);\n if (!name || !this.keepsLock()) return;\n const record: PaymentAttemptPaidRecord = { key, amount, method, at: this.now(), owner: this.id };\n try { this.store()?.setItem(name, JSON.stringify(record)); } catch { /* storage unavailable */ }\n }\n\n private removePaidRecord(ref: string | null): void {\n const name = this.paidName(ref);\n if (!name) return;\n try { this.store()?.removeItem(name); } catch { /* ignore */ }\n }\n\n /**\n * The 24-hour record of a payment that succeeded for this payable: the payable is PAID here too for the WHOLE 24 hours (whenever the record exists and the host's `paid` input is false), however long ago it was written.\n * The record is never consumed by a form that loads later: a deliberate second payment is `resetPaid()` or a NEW `payableRef` (the host contract), never a silent new key. Returns true when the payable was marked paid.\n */\n private checkPaidRecord(ref: string | null): boolean {\n if (!ref || this.o.paid() || this.succeeded()) return false;\n const record = this.readPaidRecord(ref);\n if (!record) return false; // any owner: a payable that this very instance paid and left (A -> B -> A) is still paid for the 24 hours\n this.lateSuccess(record.key, 'other_tab', record.amount, record.method);\n return true;\n }\n\n /** Best effort, at most one pass per `begin()`: drops this library's own expired markers and tombstones (never the epochs: removing one would let a finished key be derived again). */\n private sweepStale(): void {\n const store = this.store();\n if (!store) return;\n try {\n const now = this.now();\n const drop: string[] = [];\n let seen = 0;\n const total = Math.min(store.length, 5000);\n for (let i = 0; i < total && seen < 200; i++) {\n const name = store.key(i);\n if (!name || !name.startsWith(PAYMENT_ATTEMPT_STORAGE_PREFIX) || name.endsWith('#epoch')) continue; // other apps' keys do not use up the cap\n seen++;\n let m: Record<string, unknown> | null = null;\n try { m = JSON.parse(store.getItem(name) ?? 'null') as Record<string, unknown> | null; } catch { m = null; }\n if (!m || typeof m !== 'object') continue;\n if (name.endsWith('#paid')) { if (typeof m['at'] === 'number' && now - m['at'] > PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS) drop.push(name); }\n else if (typeof m['at'] === 'number' && now - m['at'] > PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS) drop.push(name);\n else if (typeof m['startedAt'] === 'number' && now - m['startedAt'] > (m['state'] === 'unknown' && m['reason'] === 'microdeposits' ? PAYMENT_ATTEMPT_VERIFICATION_TTL_MS : PAYMENT_ATTEMPT_MARKER_TTL_MS)) drop.push(name);\n }\n for (const name of drop) store.removeItem(name);\n } catch { /* storage unavailable */ }\n }\n\n /** What another tab (or a re-read of the storage) says about this payable. */\n private react(stored: ReturnType<PaymentAttempt['parseStored']>): void {\n if (!stored) {\n // The marker was removed without a tombstone (the host's `paid`, an ended host ambiguity): the outcome is for the status check (or the host) to tell.\n if (this.unknown() && (this.unknownReason === 'other_tab' || this.unknownReason === 'reload') && this.o.checkStatus()) void this.checkNow();\n return;\n }\n if (stored.type === 'tombstone') { this.onTombstone(stored.value); return; }\n const marker = stored.value;\n if (marker.owner === this.id) return;\n if (this.inFlight()) this.markUnknown('other_tab', marker.reason === 'microdeposits'); // two tabs started at once: neither may be trusted to be the only one\n else if (!this.unknown() && !this.paidLocked()) this.adopt(marker, 'other_tab');\n else if (this.unknown() && marker.reason === 'microdeposits' && this.pinned()?.key === marker.key) this.markUnknown(this.unknownReason ?? 'other_tab', true); // the other tab learned it is a bank verification wait: so does this one\n }\n\n /**\n * Another tab decided an attempt of this payable. `succeeded`: the payable is PAID (same key as the undecided attempt: it is that payment; another key while paid / running: it is recorded with its own key and a\n * second payment is reported as a suspected duplicate). `failed` / `released`: only an attempt this instance ADOPTED from that tab is unlocked by it.\n */\n private onTombstone(t: PaymentAttemptTombstone): void {\n if (t.owner === this.id) return;\n const pin = this.pinned();\n if (t.state === 'succeeded') {\n if (!this.succeeded() && pin?.key === t.key) {\n if (this.unknown()) this.succeed('other_tab');\n return; // running with the same key: its own answer is that payment (decided at the latest when its request times out: see markUnknown)\n }\n if (this.keepsLock()) this.lateSuccess(t.key, 'other_tab', t.amount ?? null, t.method);\n return;\n }\n if (!this.unknown() || !pin || pin.key !== t.key || (this.unknownReason !== 'other_tab' && this.unknownReason !== 'reload')) return;\n if (t.state === 'failed') this.fail('other_tab', true);\n else { this.stopPolling(); this.leaveUnknown(); this.pinned.set(null); }\n }\n\n /** Takes over an attempt another instance started: pin ITS key, lock in the unknown state and ask the status check. */\n private adopt(marker: PaymentAttemptMarker, reason: 'reload' | 'other_tab'): void {\n if (this.destroyed || this.unknown() || this.paidLocked()) return;\n this.pinned.set({ key: marker.key, amount: marker.amount, method: marker.method, at: marker.startedAt, owner: marker.owner, ref: this.o.payableRef() });\n this.markUnknown(reason, marker.reason === 'microdeposits'); // a verification wait survives a reload / another tab: it keeps its own text and its longer marker\n }\n\n private onPayableChange(ref: string | null): void {\n if (this.destroyed) return;\n if (this.lastRef !== undefined && ref !== this.lastRef) {\n // Another payable: nothing of the previous one (a success, an undecided attempt, a host-reported ambiguity) applies any more. The old payable's marker stays in the storage and keeps protecting it.\n this.succeeded.set(false);\n this.paidKey = null;\n this.watchKey = null;\n this.duplicates.clear();\n this.reportedKeys.clear();\n this.lastSuccessIdle = false;\n if (this.unknown()) { this.stopPolling(); this.clearSilence(); this.waitingForHost.set(false); this.leaveUnknown(); }\n if (!this.inFlight()) this.pinned.set(null);\n }\n this.lastRef = ref;\n this.readEpoch(ref);\n if (this.inFlight() || this.unknown() || this.paidLocked()) return;\n const stored = this.readStored(ref);\n if (stored) {\n if (stored.type === 'marker') { if (stored.value.owner !== this.id) { this.adopt(stored.value, 'reload'); return; } } // this instance's own undecided marker is not adopted\n else if (stored.value.state === 'succeeded' && this.keepsLock()) { this.lateSuccess(stored.value.key, 'other_tab', stored.value.amount ?? null, stored.value.method); return; } // a reload within 2 minutes of a payment made in another tab / page load: the payable is paid\n }\n if (this.keepsLock()) this.checkPaidRecord(ref); // a payment older than the tombstone: the 24-hour record still locks the payable as paid\n }\n}\n","import { DestroyRef, computed, signal, untracked, effect } from '@angular/core';\nimport type { UiLabelKey } from '@forgeroute/ui/core';\nimport { callHost, type HostResult } from '../payment-side-panel/payment-side-panel.models';\n\n/**\n * Readiness gate of the payment forms: Pay is blocked, with a specific reason, while we can already tell a payment cannot complete AND be recorded (offline, a connection too slow to pay\n * safely, a blocked payment SDK, a browser that cannot pay safely, the host's backend not ready, an earlier payment of unknown outcome). It is evaluated when the form opens, every\n * `everyMs` (default 10 s) while it is open, on online / offline / visibility events, and AGAIN synchronously right before every submit (`passSync()`): a gate that turned false after\n * the last render blocks the click and sends nothing.\n */\nexport interface PaymentReadinessResult {\n ready: boolean;\n reasons: string[];\n /** With the reason `payment_in_flight`: the open payment waits for the payer to verify bank micro-deposits (it has NOT started). The text says so instead of \"already being processed\". Ignored for any other reason. */\n awaitingVerification?: boolean;\n}\n\n/** The host's check (`GET /api/payments/ready?payable=...`): `{ ready, reasons }`. A slow answer (> `readinessTimeoutMs`) counts as `slow_connection`, a rejection as `offline` / `slow_connection`. */\nexport type ReadinessCheckFn = () => HostResult<PaymentReadinessResult>;\n\n/** The machine reasons the library knows (a host may send others: they block with a generic text). */\nexport const PAYMENT_READINESS_REASONS = [\n 'offline', 'slow_connection', 'sdk_blocked', 'service_unavailable', 'merchant_not_ready', 'events_backlog', 'payable_changed', 'already_paid', 'payment_in_flight', 'unsupported_browser',\n 'unknown_payment', 'checking', 'awaiting_verification', 'reconnect_required', 'outcome_unknown',\n] as const;\n\nexport const PAYMENT_READINESS_TIMEOUT_MS = 4000;\nexport const PAYMENT_READINESS_EVERY_MS = 10_000;\n/** A measured round trip above this (ms) from `navigator.connection.rtt` counts as a slow connection. */\nexport const PAYMENT_READINESS_SLOW_RTT_MS = 2000;\n\nexport type PaymentSdkState = 'ok' | 'loading' | 'blocked';\n\nexport interface PaymentReadinessOptions {\n destroyRef: DestroyRef;\n /** The host's check; `null` = only the built-in checks. */\n check: () => ReadinessCheckFn | null;\n timeoutMs: () => number;\n everyMs?: () => number;\n /** The processor SDK / tokenizer state of the form: `'blocked'` (the script or the form could not be loaded) blocks with `sdk_blocked`. */\n sdk: () => PaymentSdkState;\n /** An earlier payment of unknown outcome is pending (blocks with `unknown_payment`). */\n unknownPending: () => boolean;\n /** The gate applies (the Stripe form turns it off unless duplicate protection is on). */\n enabled?: () => boolean;\n /** Is the attempt-marker storage usable? (warning only: without it a reload or a second tab cannot be recognised as an undecided attempt.) */\n storageAvailable?: () => boolean;\n /** Managed environments where `navigator.onLine === false` is a false negative (captive portal, VPN): the browser's offline flag does not block (default false). */\n offlineOverride?: () => boolean;\n onChange?: (state: PaymentReadinessResult) => void;\n}\n\n/** The label key that words a refusal reason (a readiness reason, `paid`, `unknown`, `offline`): one mapping for every form and plugin. */\nexport function refusalLabelKey(reason: string): UiLabelKey {\n if (reason === 'paid') return 'paymentAttempt.paid';\n if (reason === 'unknown') return 'paymentAttempt.checking';\n if (reason === 'awaiting_verification') return 'paymentAttempt.awaitingVerification'; // a bank payment waiting for the payer's micro-deposit verification: one wording, wherever it is worded from\n return (PAYMENT_READINESS_REASONS as readonly string[]).includes(reason) ? (`paymentReadiness.${reason}` as UiLabelKey) : 'paymentReadiness.generic';\n}\n\nconst sameList = (a: readonly string[], b: readonly string[]): boolean => a.length === b.length && a.every((v, i) => v === b[i]);\n\n/** What the browser itself tells about the environment (pure: easy to fake). */\nexport function builtInReadinessReasons(ignoreOffline = false): string[] {\n const reasons: string[] = [];\n if (!ignoreOffline && typeof navigator !== 'undefined' && navigator.onLine === false) reasons.push('offline');\n const connection = (typeof navigator !== 'undefined' ? (navigator as unknown as { connection?: { saveData?: boolean; effectiveType?: string; rtt?: number } }).connection : undefined);\n // Data saver (`saveData`) is a preference, not a slow link: it never blocks a payment.\n if (connection && (connection.effectiveType === 'slow-2g' || connection.effectiveType === '2g'\n || (typeof connection.rtt === 'number' && connection.rtt > PAYMENT_READINESS_SLOW_RTT_MS))) reasons.push('slow_connection');\n const secure = typeof window === 'undefined' || (window as { isSecureContext?: boolean }).isSecureContext !== false;\n const randomValues = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n if (!secure || !randomValues) reasons.push('unsupported_browser');\n return reasons;\n}\n\nexport class PaymentReadiness {\n /** The host's last answer's reasons (empty until it answered). */\n private readonly hostReasons = signal<string[]>([], { equal: sameList });\n /** The host's last answer said the open payment awaits bank verification (only meaningful with the reason `payment_in_flight`). */\n private readonly hostAwaitingVerification = signal(false);\n /** The check the host's last answer belongs to (a host check added or replaced later keeps the gate closed, reason `checking`, until it has answered). */\n private readonly answeredFor = signal<ReadinessCheckFn | null>(null);\n /** The first evaluation finished: no host check to wait for, or the current one has answered. */\n readonly evaluated = computed(() => { const check = this.o.check(); return !check || this.answeredFor() === check; });\n private readonly builtIns = signal<string[]>(builtInReadinessReasons(), { equal: sameList });\n\n /** Why Pay is blocked, most important first; empty = ready. */\n readonly reasons = computed((): string[] => {\n if (this.o.enabled && !this.o.enabled()) return [];\n const out: string[] = [...this.builtIns()];\n const add = (reason: string) => { if (!out.includes(reason)) out.push(reason); };\n if (this.o.sdk() === 'blocked') add('sdk_blocked');\n for (const reason of this.hostReasons()) add(reason);\n if (this.o.unknownPending()) add('unknown_payment');\n if (!this.evaluated()) add('checking');\n return out;\n }, { equal: sameList });\n readonly ready = computed(() => this.reasons().length === 0);\n /** The label key of the text for `reason`: the verification text for a `payment_in_flight` that awaits the payer's bank verification, else {@link refusalLabelKey}. */\n labelKeyFor(reason: string): UiLabelKey {\n return reason === 'payment_in_flight' && this.hostAwaitingVerification() ? 'paymentAttempt.awaitingVerification' : refusalLabelKey(reason); // `awaiting_verification` itself is mapped by refusalLabelKey\n }\n /** Not blocking: the browser blocks storage, so a reload during a payment cannot reuse the attempt key automatically. */\n readonly storageWarning = computed(() => (this.o.storageAvailable ? !this.o.storageAvailable() : false));\n\n private destroyed = false;\n private timer: ReturnType<typeof setTimeout> | null = null;\n private readonly win = typeof window !== 'undefined' ? window : null;\n private readonly doc = typeof document !== 'undefined' ? document : null;\n private run = 0;\n private loop = 0;\n private readonly onEvent = (): void => { void this.evaluate(); };\n private builtIn(): string[] { return builtInReadinessReasons(!!this.o.offlineOverride?.()); }\n\n constructor(private readonly o: PaymentReadinessOptions) {\n if (o.offlineOverride?.()) this.builtIns.set(this.builtIn());\n this.win?.addEventListener('online', this.onEvent);\n this.win?.addEventListener('offline', this.onEvent);\n this.doc?.addEventListener('visibilitychange', this.onEvent);\n o.destroyRef.onDestroy(() => {\n this.destroyed = true;\n if (this.timer) clearTimeout(this.timer);\n this.win?.removeEventListener('online', this.onEvent);\n this.win?.removeEventListener('offline', this.onEvent);\n this.doc?.removeEventListener('visibilitychange', this.onEvent);\n });\n effect(() => { const ready = this.ready(); const reasons = this.reasons(); untracked(() => this.o.onChange?.({ ready, reasons })); });\n // The first evaluation and the periodic loop start once the component's inputs are bound (an effect runs after them; a plugin body reads its config lazily).\n // The periodic loop exists only with a host check (the built-ins are re-read on every online / offline / visibility event and by every `passSync()`), so a form without one leaves no timer behind.\n effect(() => { const check = this.o.check(); untracked(() => { void this.evaluate(); this.loop++; if (this.timer) { clearTimeout(this.timer); this.timer = null; } if (check) this.schedule(); }); });\n }\n\n /**\n * The gate right now, SYNCHRONOUSLY (called by every submit before anything is sent): the built-in checks are read afresh, the host's last answer and the SDK / unknown state are\n * current. A host check that has not answered yet keeps the gate closed. A fresh host check starts in the background for the NEXT click (a click must stay synchronous: a bank window\n * is only allowed inside the user gesture).\n */\n passSync(): boolean {\n if (this.destroyed) return false;\n this.builtIns.set(this.builtIn());\n const ready = this.ready();\n if (this.o.check()) void this.evaluate();\n return ready;\n }\n\n /** Runs the checks: the built-ins now, then the host's check (raced against the timeout). */\n async evaluate(): Promise<void> {\n if (this.destroyed) return;\n this.builtIns.set(this.builtIn());\n const check = this.o.check();\n if (!check) { this.hostReasons.set([]); this.hostAwaitingVerification.set(false); return; }\n const mine = ++this.run;\n let answer: PaymentReadinessResult;\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n const timeout = new Promise<'timeout'>(resolve => { timer = setTimeout(() => resolve('timeout'), this.o.timeoutMs()); });\n const result = await Promise.race([callHost(() => check()), timeout]);\n if (result === 'timeout') answer = { ready: false, reasons: ['slow_connection'] };\n else if (!result || typeof result !== 'object') answer = { ready: false, reasons: ['service_unavailable'] };\n else {\n const reasons = Array.isArray(result.reasons) ? result.reasons.filter(r => typeof r === 'string' && !!r) : [];\n // The flag belongs to the reason `payment_in_flight` and is ignored for any other answer.\n answer = { ready: result.ready === true && !(result.reasons?.length), reasons, awaitingVerification: result.awaitingVerification === true && reasons.includes('payment_in_flight') };\n }\n if (!answer.ready && answer.reasons.length === 0) answer.reasons = ['service_unavailable'];\n } catch {\n // A failing host check is `offline` only when the browser says so AND the host did not turn `offlineOverride` on (then the flag is not trusted and the real reason, an unreachable check, is `slow_connection`).\n answer = { ready: false, reasons: [typeof navigator !== 'undefined' && navigator.onLine === false && !this.o.offlineOverride?.() ? 'offline' : 'slow_connection'] };\n } finally {\n if (timer) clearTimeout(timer);\n }\n if (this.destroyed || mine !== this.run) return;\n this.hostReasons.set(answer.reasons);\n this.hostAwaitingVerification.set(answer.awaitingVerification === true);\n this.answeredFor.set(check);\n }\n\n /** Starts (or restarts) the periodic loop: any callback of an earlier schedule is invalidated, so two loops can never run side by side. */\n private schedule(): void {\n if (this.destroyed) return;\n if (this.timer) { clearTimeout(this.timer); this.timer = null; }\n const token = ++this.loop;\n this.timer = setTimeout(async () => {\n this.timer = null;\n if (token !== this.loop) return;\n await this.evaluate();\n if (token === this.loop && this.o.check()) this.schedule();\n }, Math.max(1, this.o.everyMs?.() ?? PAYMENT_READINESS_EVERY_MS));\n }\n}\n","import { DestroyRef, inject, type Signal } from '@angular/core';\nimport { PAYMENT_ATTEMPT_STORAGE, PaymentAttempt, type CheckPaymentStatusFn, type PaymentAttemptOutcome } from './payment-attempt';\nimport { PaymentReadiness, type PaymentReadinessResult, type PaymentSdkState, type ReadinessCheckFn } from './payment-readiness';\n\n/** The inputs every protected payment form declares (the same names and defaults everywhere). */\nexport interface PaymentProtectionInputs {\n payableRef: Signal<string | null>;\n attemptKey: Signal<string | null>;\n checkStatus: Signal<CheckPaymentStatusFn | null>;\n paid: Signal<boolean>;\n hostPending: Signal<boolean>;\n statusPollMs: Signal<number>;\n statusPollMaxMs: Signal<number>;\n /** A status check slower than this counts as unknown. */\n statusCheckTimeoutMs: Signal<number>;\n /** A status answer `failed` is ignored this long while the attempt's own request is unsettled. */\n statusFailGraceMs: Signal<number>;\n /** While the attempt's own request is unsettled a status answer `failed` / `not_found` is ignored this long after it became unknown (optional: default 180 s). */\n statusHardMaxMs?: Signal<number>;\n /** The request timeout is replaced by this while a 3-D Secure challenge / the bank window is open (optional: default 300 s). */\n authTimeoutMs?: Signal<number>;\n /** A token-only form whose host never reports becomes unknown after this long (optional: default 120 s). */\n hostSilenceMs?: Signal<number>;\n /** Managed environments where `navigator.onLine === false` is a false negative (captive portal, VPN): do not refuse a payment because of it (optional: default false). */\n offlineOverride?: Signal<boolean>;\n readinessCheck: Signal<ReadinessCheckFn | null>;\n readinessTimeoutMs: Signal<number>;\n readinessEveryMs: Signal<number>;\n}\n\nexport interface PaymentProtectionOptions {\n amount: () => number | null;\n method: () => string;\n /** The processor SDK / tokenizer / form of this component. */\n sdk?: () => PaymentSdkState;\n /** The Stripe form turns everything off unless its duplicate-protection flag is on (existing behaviour stays exactly as it was). */\n enabled?: () => boolean;\n /** `false` = a success does not lock the payable for 24 hours (a setup form that opted out with `lockAfterSuccess`); default true. */\n lockAfterSuccess?: () => boolean;\n /** A form that only TOKENIZES keeps its lock to the token call: going offline then does not make the outcome unknown. */\n offlineMidFlight?: boolean;\n onOutcome?: (outcome: PaymentAttemptOutcome) => void;\n onInFlightChange?: (inFlight: boolean) => void;\n onKeyChange?: (key: string) => void;\n onReadinessChange?: (state: PaymentReadinessResult) => void;\n}\n\n/**\n * Builds the attempt (lock, key, unknown state) and the readiness gate of one payment form from its inputs. Call it in the component's constructor / field initializers (injection\n * context): it injects the destroy hook and the attempt-marker storage seam.\n */\nexport function createPaymentProtection(inputs: PaymentProtectionInputs, options: PaymentProtectionOptions): { attempt: PaymentAttempt; readiness: PaymentReadiness } {\n const destroyRef = inject(DestroyRef);\n const storage = inject(PAYMENT_ATTEMPT_STORAGE);\n const enabled = options.enabled ?? (() => true);\n const attempt = new PaymentAttempt({\n destroyRef,\n payableRef: () => (enabled() ? inputs.payableRef() : null), // a Stripe form with the flag off must never adopt (or write) a marker\n amount: options.amount,\n method: options.method,\n attemptKey: inputs.attemptKey,\n checkStatus: () => (enabled() ? inputs.checkStatus() : null),\n paid: () => enabled() && inputs.paid(),\n hostPending: () => enabled() && inputs.hostPending(),\n offlineMidFlight: options.offlineMidFlight,\n pollMs: inputs.statusPollMs,\n pollMaxMs: inputs.statusPollMaxMs,\n statusTimeoutMs: inputs.statusCheckTimeoutMs,\n failGraceMs: inputs.statusFailGraceMs,\n statusHardMaxMs: inputs.statusHardMaxMs,\n lockAfterSuccess: options.lockAfterSuccess,\n authTimeoutMs: inputs.authTimeoutMs,\n hostSilenceMs: inputs.hostSilenceMs,\n offlineOverride: inputs.offlineOverride,\n storage,\n onOutcome: options.onOutcome,\n onInFlightChange: options.onInFlightChange,\n onKeyChange: options.onKeyChange,\n });\n const readiness = new PaymentReadiness({\n destroyRef,\n check: () => (enabled() ? inputs.readinessCheck() : null),\n timeoutMs: inputs.readinessTimeoutMs,\n everyMs: inputs.readinessEveryMs,\n sdk: options.sdk ?? (() => 'ok'),\n unknownPending: () => enabled() && attempt.unknown(),\n enabled,\n // Warns when the cross-tab / reload protection is not fully active: storage blocked, only this tab's sessionStorage, or the marker could not be written (quota). Reads signals, so it follows them.\n // Only for a form with a payableRef: without one nothing is stored, so there is nothing to warn about.\n storageAvailable: () => !(enabled() && inputs.payableRef()) || (attempt.storageScope() === 'shared' && !attempt.markerWriteFailed()),\n offlineOverride: () => !!inputs.offlineOverride?.(),\n onChange: options.onReadinessChange,\n });\n return { attempt, readiness };\n}\n","import type { UiLabelKey } from '@forgeroute/ui/core';\n\n/** What a protected attempt is for: a payment (default) or saving a payment method (a SetupIntent: nothing is charged). */\nexport type PaymentAttemptPurpose = 'payment' | 'setup';\n\n/**\n * The texts of the attempt status and the readiness reasons are written for a PAYMENT (\"do not pay again\"). For saving a payment method they would be wrong, so a protected\n * `mode=\"setup\"` form shows these instead. A key that is not listed (a reason that cannot happen for a setup) keeps its payment text.\n */\nconst SETUP_LABEL_KEYS: Readonly<Partial<Record<UiLabelKey, UiLabelKey>>> = {\n 'paymentAttempt.checking': 'paymentSetup.checking',\n 'paymentAttempt.checkingHelp': 'paymentSetup.checkingHelp',\n 'paymentAttempt.stillUnknown': 'paymentSetup.stillUnknown',\n 'paymentAttempt.waiting': 'paymentSetup.waiting',\n 'paymentAttempt.paid': 'paymentSetup.paid',\n 'paymentAttempt.queuedOffline': 'paymentSetup.queuedOffline',\n 'paymentAttempt.offline': 'paymentSetup.offline',\n 'paymentAttempt.awaitingVerification': 'paymentSetup.awaitingVerification',\n 'paymentReadiness.offline': 'paymentSetup.offline',\n 'paymentReadiness.slow_connection': 'paymentSetup.slowConnection',\n 'paymentReadiness.service_unavailable': 'paymentSetup.serviceUnavailable',\n 'paymentReadiness.outcome_unknown': 'paymentSetup.outcomeUnknown',\n 'paymentReadiness.unknown_payment': 'paymentSetup.outcomeUnknown',\n 'paymentReadiness.payment_in_flight': 'paymentSetup.inFlight',\n 'paymentReadiness.unsupported_browser': 'paymentSetup.unsupportedBrowser',\n 'paymentReadiness.merchant_not_ready': 'paymentSetup.merchantNotReady',\n 'paymentReadiness.events_backlog': 'paymentSetup.eventsBacklog',\n 'paymentReadiness.payable_changed': 'paymentSetup.payableChanged',\n 'paymentReadiness.reconnect_required': 'paymentSetup.reconnectRequired',\n 'paymentReadiness.checking': 'paymentSetup.readinessChecking',\n 'paymentReadiness.generic': 'paymentSetup.readinessGeneric',\n 'paymentReadiness.already_paid': 'paymentSetup.alreadySaved',\n 'paymentReadiness.storageWarning': 'paymentSetup.storageWarning',\n};\n\n/** The label key to show for `key` in an attempt of `kind` (the same key for a payment). */\nexport function attemptLabelKey(key: UiLabelKey, kind: PaymentAttemptPurpose): UiLabelKey {\n return kind === 'setup' ? (SETUP_LABEL_KEYS[key] ?? key) : key;\n}\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation, computed, inject, input, output } from '@angular/core';\nimport { AlertComponent } from '@forgeroute/ui/alert';\nimport { ButtonComponent } from '@forgeroute/ui/core';\nimport { LiveRegionComponent } from '@forgeroute/ui/live-region';\nimport { UiLabelsService, type UiLabelKey } from '@forgeroute/ui/core';\nimport { refusalLabelKey } from './payment-readiness';\nimport { attemptLabelKey, type PaymentAttemptPurpose } from './payment-setup-labels';\nimport type { PaymentAttempt } from './payment-attempt';\nimport type { PaymentReadiness } from './payment-readiness';\n\n/**\n * What the payer reads while a payment attempt is not a plain \"form\" any more: \"Checking your payment...\" (the outcome is unknown: Pay stays locked, never \"failed, try again\"), the\n * offline notice, and the paid state. A polite live region announces each state. Used by every payment form of the library; hosts normally never place it themselves.\n */\n@Component({\n selector: 'ui-payment-attempt-status',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AlertComponent, ButtonComponent, LiveRegionComponent],\n template: `\n <ui-live-region data-testid=\"pa-live\" [message]=\"announcement()\" />\n @if (attempt().paidLocked() && showPaid()) {\n <ui-alert variant=\"success\" [quiet]=\"true\" data-testid=\"pa-paid\">{{ text('paymentAttempt.paid') }}</ui-alert>\n } @else if (attempt().awaitingVerification()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-verification\">\n <p class=\"pa-line\" data-testid=\"pa-verification-text\">{{ text('paymentAttempt.awaitingVerification') }}</p>\n @if (attempt().canCheck()) {\n <!-- always offered while waiting for a bank verification (the payer may have verified the deposits a minute ago; the wait can last days, long after the bounded polling stopped) -->\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"pa-check-again\" [loading]=\"attempt().checking()\" (click)=\"attempt().checkAgain()\">{{ text('paymentAttempt.checkAgain') }}</ui-button>\n }\n </ui-alert>\n } @else if (attempt().unknown()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-checking\">\n <p class=\"pa-line\" data-testid=\"pa-checking-title\">{{ text('paymentAttempt.checking') }}</p>\n <p class=\"pa-line\" data-testid=\"pa-checking-help\">{{ text(attempt().canCheck() && attempt().pollExpired() ? 'paymentAttempt.stillUnknown' : 'paymentAttempt.checkingHelp') }}</p>\n @if (attempt().canCheck() && attempt().pollExpired()) {\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"pa-check-again\" [loading]=\"attempt().checking()\" (click)=\"attempt().checkAgain()\">{{ text('paymentAttempt.checkAgain') }}</ui-button>\n @if (allowStartOver()) {\n <ui-button variant=\"ghost\" size=\"sm\" data-testid=\"pa-start-over\" (click)=\"attempt().startOver()\">{{ text('paymentAttempt.startOver') }}</ui-button>\n }\n }\n </ui-alert>\n } @else if (attempt().waitingForHost()) {\n <ui-alert variant=\"info\" [quiet]=\"true\" data-testid=\"pa-waiting\">{{ text('paymentAttempt.waiting') }}</ui-alert>\n } @else if (readiness() && !readiness()!.ready()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-not-ready\" [attr.data-reason]=\"firstReason()\">\n <p class=\"pa-line\" data-testid=\"pa-not-ready-text\">{{ readinessText() }}</p>\n @if (firstReason() === 'sdk_blocked') {\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"pa-retry-load\" (click)=\"retryLoad.emit()\">{{ text('paymentReadiness.retryLoad') }}</ui-button>\n }\n </ui-alert>\n } @else if (attempt().blockedOffline()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-offline\">{{ text('paymentAttempt.offline') }}</ui-alert>\n }\n @if (readiness()?.storageWarning()) {\n <ui-alert variant=\"info\" [quiet]=\"true\" data-testid=\"pa-storage-warning\">{{ text('paymentReadiness.storageWarning') }}</ui-alert>\n }\n `,\n styles: [`\n ui-payment-attempt-status { display: block; min-width: 0; }\n ui-payment-attempt-status .pa-line { margin: 0 0 6px; }\n `],\n encapsulation: ViewEncapsulation.None,\n})\nexport class PaymentAttemptStatusComponent {\n protected readonly labels = inject(UiLabelsService);\n /** The attempt of the form this status belongs to. */\n readonly attempt = input.required<PaymentAttempt>();\n /** Show the paid state (a form that has its own success notice sets it off while that notice is up). */\n readonly showPaid = input(true);\n /** Offer \"Start over\" after the polling window (only for a backend that allows ONE open or succeeded attempt per payable: that rule is what makes it safe). */\n readonly allowStartOver = input(false);\n /** The readiness gate of the form (its reasons are shown while Pay is blocked). */\n readonly readiness = input<PaymentReadiness | null>(null);\n /** \"Retry loading the payment form\" was pressed (shown for `sdk_blocked`). */\n readonly retryLoad = output<void>();\n\n /** What the attempt is for: `'setup'` (saving a payment method) shows the setup wording instead of the payment wording. */\n readonly kind = input<PaymentAttemptPurpose>('payment');\n /** The text of `key` for this attempt's kind. */\n protected text(key: UiLabelKey): string { return this.labels.t(attemptLabelKey(key, this.kind())); }\n\n protected readonly firstReason = computed(() => this.readiness()?.reasons()[0] ?? '');\n /** The translated text of the first blocking reason; a reason the library does not know blocks with the generic text. */\n protected readonly readinessText = computed(() => this.text(this.readiness()?.labelKeyFor(this.firstReason()) ?? refusalLabelKey(this.firstReason())));\n\n /** The text the live region reads: the current state, never empty while a state is on screen. */\n protected readonly announcement = computed(() => {\n const attempt = this.attempt();\n if (attempt.paidLocked() && this.showPaid()) return this.text('paymentAttempt.paid');\n if (attempt.awaitingVerification()) return this.text('paymentAttempt.awaitingVerification');\n if (attempt.unknown()) return this.text(attempt.canCheck() && attempt.pollExpired() ? 'paymentAttempt.stillUnknown' : 'paymentAttempt.checking');\n if (attempt.waitingForHost()) return this.text('paymentAttempt.waiting');\n if (this.readiness() && !this.readiness()!.ready()) return this.readinessText();\n if (attempt.blockedOffline()) return this.text('paymentAttempt.offline');\n if (this.readiness()?.storageWarning()) return this.text('paymentReadiness.storageWarning'); // the alert itself is quiet: the shared live region says it once\n return '';\n });\n}\n","import { Component, ChangeDetectionStrategy, computed, effect, input, output, signal, untracked, inject } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { DateInputComponent } from '@forgeroute/ui/date-input';\nimport { EmptyStateComponent } from '@forgeroute/ui/empty-state';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { SelectComponent, SelectOption } from '@forgeroute/ui/select';\nimport { SidePanelComponent } from '@forgeroute/ui/core';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { TextareaInputComponent } from '@forgeroute/ui/textarea-input';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** A charge type the host offers (for example a community's configured charge types). `defaultAmount` and `description` pre-fill the form. */\nexport interface ChargeTypeOption {\n /** Stable id (used for `track`; not sent). */\n id: string;\n /** The type's name; it is what the form value carries (`chargeType`). */\n name: string;\n /** Pre-fills the amount when the amount is still empty. */\n defaultAmount?: number | null;\n /** Replaces the description when the type is picked. */\n description?: string | null;\n}\n\n/** What the form hands the host. */\nexport interface ChargeFormData {\n chargeType: string;\n amount: number | null;\n /** ISO date `YYYY-MM-DD`. */\n dueDate: string;\n description: string;\n}\n\n/** The local calendar day as `YYYY-MM-DD` (`toISOString()` is the UTC day, which is tomorrow on a US evening). */\nfunction localToday(): string {\n const d = new Date();\n return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;\n}\n\n/**\n * Add-a-charge form, the same in every app: charge type, amount, due date and an optional description, built only from library inputs.\n * It does not talk to a server: the host passes the `chargeTypes` and saves the `submitted` data.\n *\n * <ui-charge-form [open]=\"open()\" [chargeTypes]=\"types()\" [saving]=\"saving()\" (submitted)=\"save($event)\" (closed)=\"open.set(false)\" />\n *\n * Two shapes:\n * - `panel` (default `true`): it renders inside its own `ui-side-panel` with Cancel and the primary button (`submitLabel`).\n * `open`, `title`, `subtitle` drive the panel; `closed` is Cancel / close / Escape (not emitted while `saving`).\n * - `[panel]=\"false\"`: body only, for a host that supplies its own panel or page section. Read `formChange` / `validChange` or call `getFormData()`.\n *\n * Rules (the common backend rules, adjustable): the type is required; the amount is required, between `minAmount` (0.01) and `maxAmount` (99,999.99)\n * with at most 2 decimals; the due date is required (default today, or `defaultDueDate`); the description is at most `descriptionMaxLength` (2000).\n * Picking a type fills the amount (only when it is still empty) and the description from the type. When `chargeTypes` is empty and `loading` is false\n * the form shows an empty state (`emptyTitle`, `emptyMessage`) instead of the fields and the primary button stays disabled.\n */\n@Component({\n selector: 'ui-charge-form',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, NgTemplateOutlet, DateInputComponent, EmptyStateComponent, FormSectionComponent, SelectComponent, SidePanelComponent, TextInputComponent, TextareaInputComponent],\n template: `\n @if (panel()) {\n <ui-side-panel\n [open]=\"open()\"\n [title]=\"title()\"\n [subtitle]=\"subtitle()\"\n [primaryLabel]=\"showEmpty() ? '' : submitLabel()\"\n [cancelLabel]=\"showEmpty() ? closeLabel() : cancelLabel()\"\n [primaryLoading]=\"saving()\"\n [primaryDisabled]=\"saving() || !valid()\"\n primaryTestId=\"charge-form-submit\"\n cancelTestId=\"charge-form-cancel\"\n (closed)=\"onClosed()\"\n (primaryClick)=\"submit()\">\n <ng-container [ngTemplateOutlet]=\"body\" />\n </ui-side-panel>\n } @else {\n <ng-container [ngTemplateOutlet]=\"body\" />\n }\n <ng-template #body>\n @if (showEmpty()) {\n <ui-empty-state data-testid=\"charge-types-empty\" iconType=\"money\" [title]=\"emptyTitle()\" [message]=\"emptyMessage()\" />\n } @else {\n <ui-form-section data-testid=\"charge-form\">\n <ui-select data-testid=\"charge-type\" [label]=\"labels.t('chargeForm.chargeType')\" [ariaLabel]=\"labels.t('chargeForm.chargeType')\" [placeholder]=\"labels.t('chargeForm.selectType')\" [required]=\"true\" [options]=\"typeOptions()\"\n [ngModel]=\"chargeType()\" (ngModelChange)=\"pickType($event)\" name=\"chargeType\" />\n <ui-text-input data-testid=\"charge-amount\" [label]=\"labels.t('chargeForm.amount')\" [ariaLabel]=\"labels.t('chargeForm.amount2')\" type=\"number\" valueType=\"number\" placeholder=\"0.00\" [required]=\"true\"\n [step]=\"0.01\" [min]=\"minAmount()\" [max]=\"maxAmount()\" [maxDecimals]=\"2\" [ngModel]=\"amount()\" (ngModelChange)=\"setAmount($event)\" name=\"amount\" />\n <ui-date-input data-testid=\"charge-due-date\" [label]=\"labels.t('chargeForm.dueDate')\" [required]=\"true\" [ngModel]=\"dueDate()\" (ngModelChange)=\"setDueDate($event)\" name=\"dueDate\" />\n <ui-textarea-input data-testid=\"charge-description\" [label]=\"labels.t('chargeForm.description')\" [ariaLabel]=\"labels.t('chargeForm.description')\" [placeholder]=\"labels.t('chargeForm.optionalDescription')\" [rows]=\"2\"\n [maxlength]=\"descriptionMaxLength()\" [ngModel]=\"description()\" (ngModelChange)=\"setDescription($event)\" name=\"description\" />\n </ui-form-section>\n }\n </ng-template>\n `,\n})\nexport class ChargeFormComponent {\n protected readonly labels = inject(UiLabelsService);\n /** The charge types to choose from. */\n readonly chargeTypes = input<ChargeTypeOption[]>([]);\n /** True while the host is still loading the types: no empty state is shown. */\n readonly loading = input(false);\n /** True while the host saves: the primary button shows its spinner and Cancel / Escape do nothing. */\n readonly saving = input(false);\n\n /** `true` (default): rendered inside its own `ui-side-panel`. `false`: body only. */\n readonly panel = input(true);\n readonly open = input(false);\n readonly titleInput = input<string | null>(null, { alias: 'title' });\n readonly title = computed(() => this.titleInput() ?? this.labels.t('chargeForm.title'));\n readonly subtitle = input('');\n readonly submitLabelInput = input<string | null>(null, { alias: 'submitLabel' });\n readonly submitLabel = computed(() => this.submitLabelInput() ?? this.labels.t('chargeForm.submitLabel'));\n readonly cancelLabelInput = input<string | null>(null, { alias: 'cancelLabel' });\n readonly cancelLabel = computed(() => this.cancelLabelInput() ?? this.labels.t('chargeForm.cancelLabel'));\n /** Label of the only button while the empty state is shown. */\n readonly closeLabelInput = input<string | null>(null, { alias: 'closeLabel' });\n readonly closeLabel = computed(() => this.closeLabelInput() ?? this.labels.t('chargeForm.closeLabel'));\n\n readonly emptyTitleInput = input<string | null>(null, { alias: 'emptyTitle' });\n\n readonly emptyTitle = computed(() => this.emptyTitleInput() ?? this.labels.t('chargeForm.emptyTitle'));\n readonly emptyMessageInput = input<string | null>(null, { alias: 'emptyMessage' });\n readonly emptyMessage = computed(() => this.emptyMessageInput() ?? this.labels.t('chargeForm.emptyMessage'));\n\n readonly minAmount = input(0.01);\n readonly maxAmount = input(99999.99);\n readonly descriptionMaxLength = input(2000);\n /** ISO date the due date starts at. Empty (default) = today. */\n readonly defaultDueDate = input('');\n\n /** The whole form after every change. */\n readonly formChange = output<ChargeFormData>();\n /** Emits when the form becomes valid / invalid. */\n readonly validChange = output<boolean>();\n /** Panel mode: the primary button was pressed on a valid form. */\n readonly submitted = output<ChargeFormData>();\n /** Panel mode: Cancel / close / Escape (not while `saving`). */\n readonly closed = output<void>();\n\n protected readonly chargeType = signal('');\n protected readonly amount = signal<number | null>(null);\n protected readonly dueDate = signal(localToday());\n protected readonly description = signal('');\n\n protected readonly typeOptions = computed((): SelectOption[] => this.chargeTypes().map(t => ({ value: t.name, label: t.name })));\n protected readonly showEmpty = computed(() => this.chargeTypes().length === 0 && !this.loading());\n\n /** The rule the backend enforces: min..max with at most two decimals, a type and a due date. */\n readonly valid = computed(() => {\n const a = this.amount();\n return !this.showEmpty()\n && !!this.chargeType()\n && a != null && a >= this.minAmount() && a <= this.maxAmount() && /^\\d+(\\.\\d{1,2})?$/.test(String(a))\n && !!this.dueDate()\n && this.description().length <= this.descriptionMaxLength();\n });\n\n private lastValid: boolean | null = null;\n\n constructor() {\n // A new panel opening starts from a blank form, so the previous charge never shows again.\n effect(() => {\n if (this.open()) untracked(() => this.reset());\n });\n effect(() => {\n const v = this.valid();\n untracked(() => {\n if (v !== this.lastValid) { this.lastValid = v; this.validChange.emit(v); }\n });\n });\n }\n\n /** The form as it stands. */\n getFormData(): ChargeFormData {\n return { chargeType: this.chargeType(), amount: this.amount(), dueDate: this.dueDate(), description: this.description() };\n }\n\n /** Back to the blank form (no type, no amount, due date today or `defaultDueDate`, no description). */\n reset(): void {\n this.chargeType.set('');\n this.amount.set(null);\n this.dueDate.set(this.defaultDueDate() || localToday());\n this.description.set('');\n this.emitForm();\n }\n\n protected pickType(name: string): void {\n this.chargeType.set(name ?? '');\n const t = this.chargeTypes().find(x => x.name === name);\n if (t?.defaultAmount && !this.amount()) this.amount.set(t.defaultAmount);\n this.description.set(t?.description ?? '');\n this.emitForm();\n }\n\n protected setAmount(v: number | null): void { this.amount.set(v ?? null); this.emitForm(); }\n protected setDueDate(v: string): void { this.dueDate.set(v ?? ''); this.emitForm(); }\n protected setDescription(v: string): void { this.description.set(v ?? ''); this.emitForm(); }\n\n protected submit(): void {\n if (!this.valid() || this.saving()) return;\n this.submitted.emit(this.getFormData());\n }\n\n protected onClosed(): void {\n if (!this.saving()) this.closed.emit();\n }\n\n private emitForm(): void {\n this.formChange.emit(this.getFormData());\n }\n}\n","import { Component, ChangeDetectionStrategy, DestroyRef, computed, effect, input, output, signal, untracked, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { AlertComponent } from '@forgeroute/ui/alert';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { PanelInfoListComponent, PanelInfoSection } from '@forgeroute/ui/panel-info-list';\nimport { RadioGroupComponent, RadioOption } from '@forgeroute/ui/radio';\nimport { SelectComponent, SelectOption } from '@forgeroute/ui/select';\nimport { SidePanelComponent } from '@forgeroute/ui/core';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { TextareaInputComponent } from '@forgeroute/ui/textarea-input';\nimport { formatCurrency } from '@forgeroute/ui/utils';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { ToastService } from '@forgeroute/ui/core';\nimport { getErrorMessage } from '@forgeroute/ui/core';\nimport { FORGEROUTE_CONFIG } from '@forgeroute/ui/core';\n\n/** The payment being refunded. Amounts are in currency units (dollars), not cents. */\nexport interface RefundablePayment {\n id: string;\n /** What the customer originally paid (without processor fees). */\n amount: number;\n /** Already refunded; the refundable maximum is `amount - refundedAmount`. */\n refundedAmount?: number | null;\n /** Shown read-only at the top (for example \"Card\", \"ACH\"). */\n methodLabel?: string;\n reference?: string | null;\n customerName?: string | null;\n /** The processor's fee (Stripe, Square, ...) the customer paid on top of `amount` for the WHOLE payment. 0 / absent = none. */\n processorFee?: number | null;\n /** The app's own service / processing fee the customer paid on top of `amount` for the WHOLE payment. 0 / absent = none. */\n serviceFee?: number | null;\n}\n\n/** What the host gets when the refund is confirmed. */\nexport interface RefundRequest {\n paymentId: string;\n /** The base amount to refund (the payment's own amount, or the partial amount), in currency units with at most 2 decimals. */\n amount: number;\n /** The fees that go back to the customer with it: this refund's proportional share of the processor and service fees when `absorbFees`, else 0. */\n feeAmount: number;\n /** What the customer receives: `amount + feeAmount`. */\n total: number;\n /** The selected reason's value, or `''` when the reason field is hidden. */\n reason: string;\n notes: string;\n /**\n * True when the park chose \"refund the full charge\": the customer gets everything they were charged back, and the PARK loses all the fees\n * (the processor's fee and the app's service fee; none of them is returned to the park). False (default): the customer gets the charge\n * minus the fees back, i.e. only `amount`. Only offered when the payment has fees.\n */\n absorbFees: boolean;\n}\n\nexport const DEFAULT_REFUND_REASONS: readonly SelectOption[] = [\n { value: 'CUSTOMER_REQUEST', label: 'Customer Request' },\n { value: 'DUPLICATE_PAYMENT', label: 'Duplicate Payment' },\n { value: 'BILLING_ERROR', label: 'Billing Error' },\n { value: 'OVERPAYMENT', label: 'Overpayment' },\n { value: 'FRAUDULENT', label: 'Fraudulent' },\n { value: 'OTHER', label: 'Other' },\n];\n\n/**\n * Full or partial refund of a payment, the same in every app. It does not talk to a server: the host passes the `payment`,\n * calls its API on `submitted` and reports back with `saving` and `error`.\n *\n * <ui-refund-panel [open]=\"open()\" [payment]=\"payment()\" [saving]=\"saving()\" [error]=\"error()\" (submitted)=\"refund($event)\" (closed)=\"open.set(false)\" />\n *\n * Shapes: `panel` (default `true`) renders inside its own `ui-side-panel` (danger primary button, Cancel); `[panel]=\"false\"` is the body only.\n * Every time the panel opens the form starts over (full refund, first reason, no notes, no fee choice).\n *\n * Built-in request mode: set `endpoint` (relative to `FORGEROUTE_CONFIG.baseUrl`, `{id}` is replaced by the payment id, for example\n * `/payments/{id}/refund`) and the panel sends the refund itself: `POST` with `{ amount, reason, reasonNotes, absorbFees }`, shows `saving` and the\n * server's error message, toasts `successMessage`, then emits `refunded` and `closed`. Without `endpoint` the host does it on `submitted`.\n *\n * Fee rule (when the payment has `processorFee` / `serviceFee`): the customer was charged `amount + fees`. Park does NOT absorb (default): the customer gets\n * the charge minus the fees back (= `amount`; for a partial refund the same proportion). Park absorbs: the customer gets the full charge back (`amount` + the\n * proportional fees) and the park alone loses the processor fee AND the app's service fee. The fee share of a partial refund is `fees * partial / amount`.\n *\n * Fields: a read-only summary (customer, method / reference, original amount, already refunded), \"Refund Type\" (full for the remaining amount,\n * or partial with an amount between 0.01 and the remaining amount, at most 2 decimals), an optional reason select (`showReason`), optional\n * notes (`showNotes`, up to `notesMaxLength`), and, when the payment has fees (`processorFee` + `serviceFee`, or the legacy `processorFees`), one\n * checkbox \"Refund $X in fees\" (unchecked = the customer gets the base amount; checked = the full charge, the park absorbs the fees) with a note that\n * the fees are non-refundable. The primary button reads \"Refund $total\". When the remaining amount is 0 the form is disabled with an info alert.\n */\n@Component({\n selector: 'ui-refund-panel',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, NgTemplateOutlet, AlertComponent, CheckboxComponent, FormSectionComponent, PanelInfoListComponent, RadioGroupComponent, SelectComponent, SidePanelComponent, TextInputComponent, TextareaInputComponent],\n template: `\n @if (panel()) {\n <ui-side-panel\n [open]=\"open()\"\n [title]=\"title()\"\n [primaryLabel]=\"primaryLabel()\"\n primaryVariant=\"danger\"\n [primaryLoading]=\"isSaving()\"\n [primaryDisabled]=\"!canSubmit() || isSaving()\"\n primaryTestId=\"refund-submit\"\n cancelTestId=\"refund-cancel\"\n (closed)=\"onClosed()\"\n (primaryClick)=\"submit()\">\n <ng-container [ngTemplateOutlet]=\"body\" />\n </ui-side-panel>\n } @else {\n <ng-container [ngTemplateOutlet]=\"body\" />\n }\n <ng-template #body>\n @if (payment()) {\n <ui-form-section data-testid=\"refund-form\">\n <ui-panel-info-list [sections]=\"summarySections()\" data-testid=\"refund-summary\" />\n\n @if (remaining() <= 0) {\n <ui-alert variant=\"info\" data-testid=\"refund-nothing-left\">{{ nothingLeftMessage() }}</ui-alert>\n } @else {\n <ui-radio-group [label]=\"labels.t('refundPanel.refundType')\" [options]=\"refundTypeOptions()\" [ngModel]=\"refundType()\" (ngModelChange)=\"setRefundType($event)\" data-testid=\"refund-type\" />\n\n @if (refundType() === 'partial') {\n <ui-text-input data-testid=\"refund-amount\" [label]=\"labels.t('refundPanel.refundAmount')\" [ariaLabel]=\"labels.t('refundPanel.refundAmount2')\" type=\"number\" valueType=\"number\" placeholder=\"0.00\" [required]=\"true\"\n [min]=\"0.01\" [max]=\"remaining()\" [step]=\"0.01\" [maxDecimals]=\"2\" [error]=\"partialAmountError()\"\n [ngModel]=\"partialAmount()\" (ngModelChange)=\"partialAmount.set($event ?? null)\" name=\"refundAmount\" />\n }\n\n @if (fees() > 0) {\n <ui-checkbox data-testid=\"refund-fees\" [label]=\"feeCheckboxLabel()\" [hint]=\"feeHint()\" [ngModel]=\"absorbFees()\" (ngModelChange)=\"absorbFees.set(!!$event)\" name=\"refundAbsorbFees\" />\n }\n\n @if (fees() > 0) {\n <ui-alert variant=\"info\" data-testid=\"refund-fees-note\">{{ feesNote() }}</ui-alert>\n }\n\n @if (showReason()) {\n <ui-select data-testid=\"refund-reason\" [label]=\"labels.t('refundPanel.reason')\" [ariaLabel]=\"labels.t('refundPanel.reason')\" [required]=\"true\" [options]=\"reasonOptions()\" [ngModel]=\"reason()\" (ngModelChange)=\"reason.set($event ?? '')\" name=\"refundReason\" />\n }\n\n @if (showNotes()) {\n <ui-textarea-input data-testid=\"refund-notes\" [label]=\"labels.t('refundPanel.notes')\" [ariaLabel]=\"labels.t('refundPanel.notes')\" [placeholder]=\"labels.t('refundPanel.enterReasonForRefund')\" [rows]=\"3\" [maxlength]=\"notesMaxLength()\"\n [ngModel]=\"notes()\" (ngModelChange)=\"notes.set($event ?? '')\" name=\"refundNotes\" />\n }\n\n <ui-alert variant=\"warning\" data-testid=\"refund-warning\">{{ warning() }}</ui-alert>\n }\n\n @if (shownError()) {\n <ui-alert variant=\"danger\" data-testid=\"refund-error\">{{ shownError() }}</ui-alert>\n }\n </ui-form-section>\n }\n </ng-template>\n `,\n})\nexport class RefundPanelComponent {\n protected readonly labels = inject(UiLabelsService);\n readonly payment = input<RefundablePayment | null>(null);\n /** True while the host processes the refund: the primary button spins and Cancel / Escape / `submitted` do nothing. */\n readonly saving = input(false);\n /** A message from the host (for example a failed refund); shown as a danger alert at the bottom. */\n readonly error = input('');\n\n /** `true` (default): inside its own `ui-side-panel`. `false`: the body only. */\n readonly panel = input(true);\n readonly open = input(false);\n readonly titleInput = input<string | null>(null, { alias: 'title' });\n readonly title = computed(() => this.titleInput() ?? this.labels.t('refundPanel.title'));\n readonly currency = input('USD');\n\n readonly showReason = input(true);\n readonly reasons = input<readonly SelectOption[]>(DEFAULT_REFUND_REASONS);\n /** The reasons as the select wants them (a mutable copy of the readonly input). */\n protected readonly reasonOptions = computed((): SelectOption[] => [...this.reasons()]);\n readonly showNotes = input(true);\n readonly notesMaxLength = input(2000);\n /** Legacy / host override: the total fees (currency units) the customer paid on top. Used only when the payment carries no `processorFee` / `serviceFee`. */\n readonly processorFees = input(0);\n /** Built-in request mode: the refund endpoint (relative to the API base URL; `{id}` = the payment id). Empty = the host handles `submitted`. */\n readonly endpoint = input('');\n /** Toast text after a successful built-in refund. */\n readonly successMessage = input('Refund processed successfully');\n /** The note shown whenever the payment has fees. */\n readonly feesNote = input('Processing and service fees are non-refundable. If you refund them to the customer, the park absorbs them.');\n readonly warningInput = input<string | null>(null, { alias: 'warning' });\n readonly warning = computed(() => this.warningInput() ?? this.labels.t('refundPanel.warning'));\n readonly nothingLeftMessageInput = input<string | null>(null, { alias: 'nothingLeftMessage' });\n readonly nothingLeftMessage = computed(() => this.nothingLeftMessageInput() ?? this.labels.t('refundPanel.nothingLeftMessage'));\n\n readonly submitted = output<RefundRequest>();\n /** Built-in request mode: the server accepted the refund. */\n readonly refunded = output<RefundRequest>();\n readonly closed = output<void>();\n\n private readonly http = inject(HttpClient, { optional: true });\n private readonly toast = inject(ToastService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly apiBase = inject(FORGEROUTE_CONFIG, { optional: true })?.baseUrl ?? '/api';\n private readonly busy = signal(false);\n private readonly failure = signal('');\n /** True while the host or the built-in request is saving. */\n protected readonly isSaving = computed(() => this.saving() || this.busy());\n /** The host's `error` or the built-in request's server message. */\n protected readonly shownError = computed(() => this.failure() || this.error());\n\n protected readonly refundType = signal<'full' | 'partial'>('full');\n protected readonly partialAmount = signal<number | null>(null);\n protected readonly reason = signal('');\n protected readonly notes = signal('');\n protected readonly absorbFees = signal(false);\n\n /** What can still be refunded, rounded to cents. */\n readonly remaining = computed(() => {\n const p = this.payment();\n return p ? Math.max(0, Math.round((p.amount - (p.refundedAmount ?? 0)) * 100) / 100) : 0;\n });\n\n private fmt(v: number): string { return formatCurrency(v, { currency: this.currency() }); }\n\n /** The fees the customer paid on top of the payment (processor + service); 0 = none. */\n readonly fees = computed(() => {\n const p = this.payment();\n const own = (p?.processorFee ?? 0) + (p?.serviceFee ?? 0);\n return Math.round((own > 0 ? own : this.processorFees()) * 100) / 100;\n });\n\n /** This refund's proportional share of the fees: `fees * base / payment amount`, rounded to cents (never above the fees). */\n readonly feeShare = computed(() => {\n const p = this.payment();\n const base = this.refundAmount();\n if (!p || p.amount <= 0 || this.fees() <= 0 || base <= 0) return 0;\n return Math.min(this.fees(), Math.round((this.fees() * base / p.amount) * 100) / 100);\n });\n\n /** What the customer receives as things stand: the base amount, plus the fee share when the park absorbs the fees. */\n readonly customerReceives = computed(() => Math.round((this.refundAmount() + (this.absorbFees() && this.fees() > 0 ? this.feeShare() : 0)) * 100) / 100);\n\n protected readonly summarySections = computed((): PanelInfoSection[] => {\n const p = this.payment();\n if (!p) return [];\n const items = [\n ...(p.customerName ? [{ label: 'Customer', value: p.customerName }] : []),\n ...(p.methodLabel ? [{ label: 'Method', value: p.methodLabel + (p.reference ? ` ${p.reference}` : '') }] : []),\n { label: 'Original Amount', value: this.fmt(p.amount) },\n ...(p.refundedAmount ? [{ label: 'Already Refunded', value: this.fmt(p.refundedAmount) }] : []),\n ...(this.fees() > 0 ? [{ label: 'Total Charged (incl. fees)', value: this.fmt(p.amount + this.fees()) }] : []),\n ];\n return [{ items }];\n });\n\n protected readonly refundTypeOptions = computed((): RadioOption[] => [\n { value: 'full', label: `Full Refund (${this.fmt(this.remaining())})` },\n { value: 'partial', label: 'Partial Amount' },\n ]);\n\n /** The checkbox label: the fees that go back to the customer with this refund, for example \"Refund $3.50 in fees\". */\n protected readonly feeCheckboxLabel = computed(() => `Refund ${this.fmt(this.feeShare())} in fees`);\n protected readonly feeHint = computed(() => 'The park absorbs the processing and service fees; they are not returned to the park.');\n\n /** The amount that will be refunded as things stand (0 when a partial amount is not yet valid). */\n readonly refundAmount = computed(() => {\n if (this.refundType() === 'full') return this.remaining();\n const v = this.partialAmount();\n return v != null && v > 0 ? v : 0;\n });\n\n protected readonly partialAmountError = computed(() => {\n if (this.refundType() !== 'partial') return '';\n const v = this.partialAmount();\n if (v == null) return '';\n if (!(v > 0)) return 'Enter an amount greater than 0.';\n if (v > this.remaining()) return `Amount cannot exceed the remaining refundable amount of ${this.fmt(this.remaining())}.`;\n if (!/^\\d+(\\.\\d{1,2})?$/.test(String(v))) return 'Use at most 2 decimal places.';\n return '';\n });\n\n readonly canSubmit = computed(() => {\n if (!this.payment() || this.remaining() <= 0) return false;\n if (this.showReason() && !this.reason()) return false;\n if (this.refundType() === 'full') return true;\n const v = this.partialAmount();\n return v != null && v > 0 && v <= this.remaining() && !this.partialAmountError();\n });\n\n protected readonly primaryLabel = computed(() => {\n if (!this.payment() || this.remaining() <= 0) return '';\n const a = this.customerReceives();\n return a > 0 ? `Refund ${this.fmt(a)}` : 'Issue Refund';\n });\n\n constructor() {\n // A new panel opening starts from a fresh form.\n effect(() => {\n if (this.open()) untracked(() => this.reset());\n });\n }\n\n /** Back to a full refund with the first reason, no notes and no fee choice. */\n reset(): void {\n this.refundType.set('full');\n this.partialAmount.set(null);\n this.reason.set(this.showReason() ? (this.reasons()[0]?.value as string | undefined) ?? '' : '');\n this.notes.set('');\n this.absorbFees.set(false);\n this.failure.set('');\n }\n\n protected setRefundType(t: string): void {\n this.refundType.set(t === 'partial' ? 'partial' : 'full');\n }\n\n protected submit(): void {\n const p = this.payment();\n if (!p || !this.canSubmit() || this.isSaving()) return;\n const absorb = this.fees() > 0 && this.absorbFees();\n const fee = absorb ? this.feeShare() : 0;\n const request: RefundRequest = {\n paymentId: p.id,\n amount: this.refundAmount(),\n feeAmount: fee,\n total: Math.round((this.refundAmount() + fee) * 100) / 100,\n reason: this.showReason() ? this.reason() : '',\n notes: this.showNotes() ? this.notes().trim() : '',\n absorbFees: absorb,\n };\n const endpoint = this.endpoint();\n if (!endpoint || !this.http) { this.submitted.emit(request); return; }\n this.busy.set(true);\n this.failure.set('');\n this.http.post(`${this.apiBase}${endpoint.replace('{id}', encodeURIComponent(p.id))}`,\n { amount: request.amount, reason: request.reason, reasonNotes: request.notes || null, absorbFees: request.absorbFees })\n .pipe(takeUntilDestroyed(this.destroyRef)).subscribe({\n next: () => { this.busy.set(false); this.toast.success(this.successMessage()); this.submitted.emit(request); this.refunded.emit(request); this.closed.emit(); },\n error: (err) => { this.busy.set(false); this.failure.set(getErrorMessage(err, 'refund', 'create')); },\n });\n }\n\n protected onClosed(): void {\n if (!this.isSaving()) this.closed.emit();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAa,4BACX;AAgBF,MAAa,oCAAoD,CAAC;CAAE,OAAO;CAAY,OAAO;AAAU,GAAI;CAAE,OAAO;CAAW,OAAO;AAAS,CAAE;AAClJ,MAAa,mCAAmD,CAAC;CAAE,OAAO;CAAc,OAAO;AAAY,GAAI;CAAE,OAAO;CAAW,OAAO;AAAU,CAAE;AAEtJ,MAAM,cAAc,SAAiB,QAAgB,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,MAAM,GAAG,GAAG;AAgDxF,IAAa,2BAAb,MAAa,yBAAwB;CA6EnC,cAAA;EA5EmB,KAAA,SAAS,OAAO,eAAe;EAEzC,KAAA,aAAa,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;EAEzB,KAAA,WAAW,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CA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,SAAA;MAAA;MAAA;MAAA;KAAA;IAAA;GAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AA+DnN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EAnEhC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;GACZ,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAa;IAAkB;IAAgB;IAAmB;IAAsB;IAAwB;IAAqB;IAAiB;IAAoB;IAAoB;GAAsB;GAC9N,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DX,CAAA"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-payments.mjs","names":[],"sources":["../../../projects/forgeroute-ui/payments/src/lib/bank-account-form/bank-account-form.component.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-side-panel.models.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-method-plugin.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-custom-method.component.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-side-panel/payment-side-panel.component.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/queued-payment-warning.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-attempt.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-readiness.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-protection.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-setup-labels.ts","../../../projects/forgeroute-ui/payments/src/lib/payment-attempt/payment-attempt-status.component.ts","../../../projects/forgeroute-ui/payments/src/lib/charge-form/charge-form.component.ts","../../../projects/forgeroute-ui/payments/src/lib/refund-panel/refund-panel.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, forwardRef, input, output, signal, untracked, viewChildren, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { FormRowComponent } from '@forgeroute/ui/form-row';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { SelectComponent, SelectOption } from '@forgeroute/ui/select';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { UiFieldValidity } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** Default ACH debit authorization text (same wording the contractor bank-account kiosk used). */\nexport const DEFAULT_BANK_MANDATE_TEXT =\n 'By checking this box, I authorize the above business to initiate ACH debit entries to my bank account for agreed-upon payments. ' +\n 'I understand I may revoke this authorization at any time by contacting the business.';\n\nexport type BankAccountType = 'checking' | 'savings';\nexport type BankHolderType = 'individual' | 'company';\n\n/** What `(submitted)` emits: every text value trimmed, `mandateAccepted` always `true`. */\nexport interface BankAccountFormValue {\n routingNumber: string;\n accountNumber: string;\n accountType: BankAccountType;\n accountHolderName: string;\n holderType: BankHolderType;\n mandateAccepted: true;\n}\n\nexport const DEFAULT_BANK_ACCOUNT_TYPE_OPTIONS: SelectOption[] = [{ value: 'checking', label: 'Checking' }, { value: 'savings', label: 'Savings' }];\nexport const DEFAULT_BANK_HOLDER_TYPE_OPTIONS: SelectOption[] = [{ value: 'individual', label: 'Individual' }, { value: 'company', label: 'Business' }];\n\nconst digitsOnly = (max: number) => (raw: string) => raw.replace(/\\D/g, '').slice(0, max);\n\n/**\n * `ui-bank-account-form` - the US bank-account entry form (routing number, account number + confirmation, account type, holder name + type,\n * ACH debit authorization). Built only from library inputs; it holds NO HTTP and no provider logic: the host listens to `(submitted)` and talks to\n * its payment provider (Stripe `confirmUsBankAccountSetup`, Square, ...). See docs/modal-kiosk-and-bank-account-form.md.\n *\n * - Validation is inline through the inputs' own `[error]` / built-in rules. The routing number is only checked for 9 digits (no ABA checksum: the\n * provider validates the real number, and a client checksum would reject test numbers). Account numbers are 4-17 digits.\n * - Every message (the built-in ones and the form's own routing / account / confirm messages, which are passed to the inputs as `[error]`) shows after the user left THAT field (blur), or at once on every field while `[showErrors]` is true or after a failed `submit()`. Switching the reveal flag from true back to false (the host's `showErrors` going false, or `reset()`) clears every field's touched state.\n * - The form provides `UiFieldValidity` (`invalid` = not submittable), so a host can gate its own button with `viewChildren(UiFieldValidity)`,\n * or use `(validChange)`.\n * - The host's footer button calls `form.submit()` (via `viewChild`); Enter in a text field submits too.\n */\n@Component({\n selector: 'ui-bank-account-form',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, CheckboxComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent],\n providers: [{ provide: UiFieldValidity, useExisting: forwardRef(() => BankAccountFormComponent) }],\n host: { '[attr.aria-busy]': 'busy() ? \"true\" : null' },\n template: `\n <form novalidate (submit)=\"$event.preventDefault(); submit()\" (keydown.enter)=\"onEnter($event)\">\n <ui-form-section>\n <ui-text-input [label]=\"labels.t('bankAccountForm.accountHolderName')\" [inputTestId]=\"id('holder-name')\" autocomplete=\"name\" [required]=\"true\" [maxlength]=\"100\"\n [showErrors]=\"reveal()\" [disabled]=\"locked()\" [ngModel]=\"accountHolderName()\" (ngModelChange)=\"accountHolderName.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-text-input [label]=\"labels.t('bankAccountForm.routingNumber')\" [inputTestId]=\"id('routing')\" inputmode=\"numeric\" [placeholder]=\"labels.t('bankAccountForm.9DigitRoutingNumber')\" [required]=\"true\"\n [maxlength]=\"9\" [formatter]=\"routingFormatter\" [error]=\"routingError()\" [showErrors]=\"reveal()\" [disabled]=\"locked()\"\n [ngModel]=\"routingNumber()\" (ngModelChange)=\"routingNumber.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-text-input [label]=\"labels.t('bankAccountForm.accountNumber')\" [inputTestId]=\"id('account')\" inputmode=\"numeric\" [placeholder]=\"labels.t('bankAccountForm.accountNumber')\" [required]=\"true\"\n [maxlength]=\"17\" [formatter]=\"accountFormatter\" [error]=\"accountError()\" [showErrors]=\"reveal()\" [disabled]=\"locked()\"\n [ngModel]=\"accountNumber()\" (ngModelChange)=\"accountNumber.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-text-input [label]=\"labels.t('bankAccountForm.confirmAccountNumber')\" [inputTestId]=\"id('confirm')\" inputmode=\"numeric\" [placeholder]=\"labels.t('bankAccountForm.reEnterAccountNumber')\" [required]=\"true\"\n [maxlength]=\"17\" [formatter]=\"accountFormatter\" [error]=\"confirmError()\" [showErrors]=\"reveal()\" [disabled]=\"locked()\"\n [ngModel]=\"confirmAccount()\" (ngModelChange)=\"confirmAccount.set($event ?? '')\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-form-row>\n <ui-select [label]=\"labels.t('bankAccountForm.accountType')\" [attr.data-testid]=\"id('account-type')\" [options]=\"accountTypeOptions()\" [required]=\"true\" [showErrors]=\"reveal()\"\n [disabled]=\"locked()\" [ngModel]=\"accountType()\" (ngModelChange)=\"accountType.set($event)\" [ngModelOptions]=\"{ standalone: true }\" />\n <ui-select [label]=\"labels.t('bankAccountForm.holderType')\" [attr.data-testid]=\"id('holder-type')\" [options]=\"holderTypeOptions()\" [required]=\"true\" [showErrors]=\"reveal()\"\n [disabled]=\"locked()\" [ngModel]=\"holderType()\" (ngModelChange)=\"holderType.set($event)\" [ngModelOptions]=\"{ standalone: true }\" />\n </ui-form-row>\n <ui-checkbox [testId]=\"id('mandate')\" [label]=\"mandateText()\" [required]=\"true\" [requiredMessage]=\"labels.t('bankAccountForm.mandateRequired')\"\n [showErrors]=\"reveal()\" [disabled]=\"locked()\" [ngModel]=\"mandateAccepted()\" (ngModelChange)=\"mandateAccepted.set(!!$event)\" [ngModelOptions]=\"{ standalone: true }\" />\n </ui-form-section>\n </form>\n `,\n styles: [`:host { display: block; }`],\n})\nexport class BankAccountFormComponent implements UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n /** The host's \"tried to submit\" flag (e.g. a panel's `touched()`). `true` reveals every field's message at once and blocks submitting; switching it from true back to false clears every field's touched state. */\n readonly showErrors = input(false);\n /** Disables every field and blocks `submit()`. */\n readonly disabled = input(false);\n /** Like `disabled`, plus `aria-busy` on the host: a provider call is running. */\n readonly busy = input(false);\n /** The authorization text next to the checkbox (it is the checkbox label). The unticked default is never changed by the form. */\n readonly mandateTextInput = input<string | null>(null, { alias: 'mandateText' });\n readonly mandateText = computed(() => this.mandateTextInput() ?? this.labels.t('bankAccountForm.mandate'));\n /** Account type choices; values must stay `checking` / `savings`. */\n readonly accountTypeOptionsInput = input<SelectOption[] | null>(null, { alias: 'accountTypeOptions' });\n readonly accountTypeOptions = computed((): SelectOption[] => this.accountTypeOptionsInput() ?? [{ value: 'checking', label: this.labels.t('bankAccountForm.accountType.checking') }, { value: 'savings', label: this.labels.t('bankAccountForm.accountType.savings') }]);\n /** Holder type choices; values must stay `individual` / `company`. */\n readonly holderTypeOptionsInput = input<SelectOption[] | null>(null, { alias: 'holderTypeOptions' });\n readonly holderTypeOptions = computed((): SelectOption[] => this.holderTypeOptionsInput() ?? [{ value: 'individual', label: this.labels.t('bankAccountForm.holderType.individual') }, { value: 'company', label: this.labels.t('bankAccountForm.holderType.company') }]);\n /** Pre-fills the account holder name (e.g. the customer's name) whenever it changes; the user can edit it. */\n readonly accountHolderNameDefault = input('');\n /** Prefix of the inner test ids: `<prefix>-routing`, `-account`, `-confirm`, `-holder-name`, `-account-type`, `-holder-type`, `-mandate`. */\n readonly testIdPrefix = input('bank');\n\n /** Emits the typed payload when `submit()` runs on a valid form. */\n readonly submitted = output<BankAccountFormValue>();\n /** Emits `true` / `false` whenever the form becomes submittable / not (also once on init). */\n readonly validChange = output<boolean>();\n\n protected readonly routingNumber = signal('');\n protected readonly accountNumber = signal('');\n protected readonly confirmAccount = signal('');\n protected readonly accountHolderName = signal('');\n protected readonly accountType = signal('checking');\n protected readonly holderType = signal('individual');\n protected readonly mandateAccepted = signal(false);\n private readonly _touched = signal(false);\n\n protected readonly routingFormatter = digitsOnly(9);\n protected readonly accountFormatter = digitsOnly(17);\n\n protected readonly locked = computed(() => this.disabled() || this.busy());\n /** Handed to the inputs as `[showErrors]`. `true` reveals each input's message at once; true -> false (host flag off, or `reset()` after a failed `submit()`) clears each input's touched state. */\n protected readonly reveal = computed(() => this.showErrors() || this._touched());\n\n protected readonly routingError = computed(() => {\n const v = this.routingNumber().trim();\n return v && v.length !== 9 ? this.labels.t('bankAccountForm.routingMustBe9') : '';\n });\n protected readonly accountError = computed(() => {\n const v = this.accountNumber().trim();\n return v && v.length < 4 ? this.labels.t('bankAccountForm.accountMin4') : '';\n });\n protected readonly confirmError = computed(() => {\n const v = this.confirmAccount().trim();\n return v && v !== this.accountNumber().trim() ? this.labels.t('bankAccountForm.accountsDoNotMatch') : '';\n });\n\n /** First reason the form cannot be submitted ('' when it can). */\n readonly errorMessage = computed(() => {\n if (!this.accountHolderName().trim()) return this.labels.t('bankAccountForm.holderRequired');\n if (!this.routingNumber().trim()) return this.labels.t('bankAccountForm.routingRequired');\n if (this.routingError()) return this.routingError();\n if (!this.accountNumber().trim()) return this.labels.t('bankAccountForm.accountRequired');\n if (this.accountError()) return this.accountError();\n if (!this.confirmAccount().trim()) return this.labels.t('bankAccountForm.confirmRequired');\n if (this.confirmError()) return this.confirmError();\n if (!this.accountTypeOptions().some(o => String(o.value) === this.accountType())) return this.labels.t('bankAccountForm.selectValidAccountType');\n if (!this.holderTypeOptions().some(o => String(o.value) === this.holderType())) return this.labels.t('bankAccountForm.selectValidHolderType');\n if (!this.mandateAccepted()) return this.labels.t('bankAccountForm.mandateRequired');\n return '';\n });\n /** True while the form cannot be submitted (`UiFieldValidity`). */\n readonly invalid = computed(() => this.errorMessage() !== '');\n /** True when the form can be submitted (ignores `disabled` / `busy`). */\n readonly valid = computed(() => !this.invalid());\n\n private readonly _fields = viewChildren(UiFieldValidity);\n\n constructor() {\n effect(() => { const d = this.accountHolderNameDefault(); untracked(() => this.accountHolderName.set(d)); });\n effect(() => { const v = this.valid(); untracked(() => this.validChange.emit(v)); });\n }\n\n protected id(name: string): string { return `${this.testIdPrefix()}-${name}`; }\n\n protected onEnter(event: Event) {\n const t = event.target as HTMLElement | null;\n if (t instanceof HTMLInputElement && t.type === 'text') { event.preventDefault(); this.submit(); }\n }\n\n /** Validates and, when valid, emits `submitted`. An invalid form emits nothing and reveals no message on a field the user never left. Ignored while `disabled` / `busy`. */\n submit(): void {\n if (this.locked()) return;\n if (this.invalid() || this._fields().some(f => f.invalid())) { this._touched.set(true); return; }\n this.submitted.emit({\n routingNumber: this.routingNumber().trim(),\n accountNumber: this.accountNumber().trim(),\n accountType: this.accountType() as BankAccountType,\n accountHolderName: this.accountHolderName().trim(),\n holderType: this.holderType() as BankHolderType,\n mandateAccepted: true,\n });\n }\n\n /** Clears every field back to the defaults (checking, individual, authorization unticked, holder name = `accountHolderNameDefault`). */\n reset(): void {\n this.routingNumber.set('');\n this.accountNumber.set('');\n this.confirmAccount.set('');\n this.accountHolderName.set(this.accountHolderNameDefault());\n this.accountType.set('checking');\n this.holderType.set('individual');\n this.mandateAccepted.set(false);\n this._touched.set(false);\n }\n}\n","import { isObservable, firstValueFrom, type Observable } from 'rxjs';\nimport { UiLabelKey, uiText } from '@forgeroute/ui/core';\n\n/**\n * Types and pure helpers of `ui-payment-side-panel`. Nothing here knows a payment processor: Stripe / Square arrive as plugins\n * (`PaymentMethodPlugin`), the card-present terminal as host callbacks.\n */\n\n/** Well-known method values the panel gives behaviour to. Hosts may list any other value (it is recorded like Cash). */\nexport const PAYMENT_METHOD = {\n CARD: 'CARD',\n ACH: 'ACH',\n CASH: 'CASH',\n CHECK: 'CHECK',\n MONEY_ORDER: 'MONEY_ORDER',\n CARD_PRESENT: 'CARD_PRESENT',\n} as const;\n\nexport interface PaymentMethodOption {\n value: string;\n label: string;\n /** `'terminal'`: listed only while the host gave the terminal callbacks (`listReaders` + `startTerminalPayment`). */\n requires?: 'terminal';\n}\n\n/** The methods listed when the host gives none: Card and ACH are record-only until a processor plugin takes them over. */\nexport const DEFAULT_PAYMENT_METHODS: readonly PaymentMethodOption[] = [\n { value: PAYMENT_METHOD.CARD, label: 'Card' },\n { value: PAYMENT_METHOD.ACH, label: 'ACH / Bank Transfer' },\n { value: PAYMENT_METHOD.CASH, label: 'Cash' },\n { value: PAYMENT_METHOD.CHECK, label: 'Check' },\n { value: PAYMENT_METHOD.MONEY_ORDER, label: 'Money Order' },\n { value: PAYMENT_METHOD.CARD_PRESENT, label: 'Card Present (Terminal)', requires: 'terminal' },\n];\n\n/** The default methods with their names in the app's active language (what the panel lists when the host gives none). */\nexport function localizedPaymentMethods(): PaymentMethodOption[] {\n return DEFAULT_PAYMENT_METHODS.map(m => ({ ...m, label: uiText(`paymentSidePanel.method.${m.value}` as UiLabelKey) }));\n}\n\nexport interface PayableCharge {\n id: string;\n chargeType: string;\n description: string;\n /** ISO date `YYYY-MM-DD`. */\n dueDate: string;\n balanceDue: number;\n}\n\nexport interface SavedPaymentMethod {\n method: string;\n last4: string;\n label?: string;\n}\n\nexport interface AllocationModeOption {\n value: string;\n label: string;\n}\n\nexport const ALLOCATION_CUSTOM = 'custom';\n\nexport const DEFAULT_ALLOCATION_MODES: readonly AllocationModeOption[] = [\n { value: 'oldest', label: 'Oldest charges first' },\n { value: 'newest', label: 'Newest charges first' },\n { value: ALLOCATION_CUSTOM, label: 'Choose charges' },\n];\n\n/** The default allocation modes with their names in the app's active language. */\nexport function localizedAllocationModes(): AllocationModeOption[] {\n return DEFAULT_ALLOCATION_MODES.map(m => ({ ...m, label: uiText(`paymentSidePanel.allocation.${m.value}` as UiLabelKey) }));\n}\n\nexport interface ChargeAllocation {\n chargeId: string;\n amount: number;\n}\n\n/**\n * How the payment is applied to charges. A non-custom mode sends `{ allocationMode }`. \"Choose charges\" sends `{ allocationChargeIds, allocations }`\n * (no `allocationMode`, like the old drawer); `allocations` carries the amount per charge.\n */\nexport interface PaymentAllocation {\n allocationMode?: string;\n allocationChargeIds?: string[];\n allocations?: ChargeAllocation[];\n}\n\nexport interface PaymentEntry {\n paymentMethod: string;\n amount: number;\n /** Check number / last 4 digits; `null` when the method has none. */\n reference: string | null;\n /** The receipt checkbox applies to the LAST entry only (like the old drawer); earlier split entries are `false`. */\n sendReceipt: boolean;\n}\n\nexport interface RecordPaymentPayload extends PaymentAllocation {\n /** Total of all entries. */\n amount: number;\n /** The method of a single payment, `'SPLIT'` when `split`. */\n paymentMethod: string;\n receivedDate: string;\n /** Reference of the single payment (`null` for a split: see `entries`). */\n reference: string | null;\n notes: string | null;\n sendReceipt: boolean;\n /** One per payment to create (the host posts one request per entry, or one request with all). */\n entries: PaymentEntry[];\n split: boolean;\n}\n\nexport interface RecordPaymentResult {\n type: 'manual' | 'stripe' | 'split';\n paymentMethod: string;\n amount: number;\n /**\n * Which online processor took the payment, set by a payment plugin that is not Stripe (`'square'`, `'quickbooks'`): `type` stays `'stripe'` for every live card / bank\n * payment (\"online\", kept for existing hosts), `processor` says which one. Absent for a manual record and for the Stripe plugin.\n */\n processor?: string;\n}\n\n/** What the panel reports for the host to word (toasts, analytics). It never toasts itself. */\nexport type PaymentPanelOutcome =\n | { kind: 'recorded'; result: RecordPaymentResult }\n | { kind: 'split-recorded'; result: RecordPaymentResult }\n | { kind: 'terminal-paid'; result: RecordPaymentResult }\n | { kind: 'plugin'; method: string; code: string; result?: RecordPaymentResult; message?: string; attemptKey?: string; paid?: { amount: number | null; method: string } }\n | { kind: 'failed'; stage: 'record' | 'readers' | 'terminal'; message: string };\n\nexport type HostResult<T> = Observable<T> | Promise<T> | T;\nexport type RecordPaymentFn = (payload: RecordPaymentPayload) => HostResult<unknown>;\n\n// ── Terminal (card present), generic callbacks ──\nexport interface TerminalReader {\n id: string;\n label?: string;\n status: string;\n deviceType?: string;\n}\nexport interface TerminalStartContext extends PaymentAllocation {\n readerId: string;\n amount: number;\n receivedDate: string;\n notes: string | null;\n}\nexport interface TerminalStartResult { paymentIntentId: string }\nexport interface TerminalStatusResult { status: string }\nexport interface TerminalConfirmContext extends TerminalStartContext { paymentIntentId: string }\n\nexport type TerminalPhase = 'idle' | 'waiting' | 'confirming' | 'success';\n\n/** Reader statuses that end the wait. */\nexport function terminalVerdict(status: string | null | undefined): 'succeeded' | 'canceled' | 'declined' | 'pending' {\n if (status === 'succeeded') return 'succeeded';\n if (status === 'canceled') return 'canceled';\n if (status === 'requires_payment_method') return 'declined';\n return 'pending';\n}\n\nexport function terminalTimeoutText(ms: number): string {\n const seconds = Math.max(1, Math.round(ms / 1000));\n const span = seconds >= 60 && seconds % 60 === 0\n ? uiText(seconds === 60 ? 'paymentSidePanel.span.minute_one' : 'paymentSidePanel.span.minute_other', { count: seconds / 60 })\n : uiText(seconds === 1 ? 'paymentSidePanel.span.second_one' : 'paymentSidePanel.span.second_other', { count: seconds });\n return uiText('paymentSidePanel.readerTimeout', { span });\n}\n\n// ── Money ──\nexport const MIN_PAYMENT_AMOUNT = 0.01;\nexport const MAX_PAYMENT_AMOUNT = 99999.99;\n\nexport const toCents = (value: number): number => Math.round(value * 100);\nexport const fromCents = (cents: number): number => cents / 100;\nexport const roundMoney = (value: number): number => fromCents(toCents(value));\n\n/** A payable amount: a finite number from 0.01 to `max` with at most two decimals. */\nexport function isValidAmount(value: unknown, max = MAX_PAYMENT_AMOUNT): value is number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return false;\n if (value < MIN_PAYMENT_AMOUNT || value > max) return false;\n return Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;\n}\n\nexport function sumMoney(values: readonly number[]): number {\n return fromCents(values.reduce((sum, v) => sum + toCents(v), 0));\n}\n\n// ── Reference ──\nexport function referenceKind(method: string, live: boolean): 'check' | 'last4-card' | 'last4-account' | null {\n if (method === PAYMENT_METHOD.CHECK) return 'check';\n if (live) return null;\n if (method === PAYMENT_METHOD.CARD) return 'last4-card';\n if (method === PAYMENT_METHOD.ACH) return 'last4-account';\n return null;\n}\n\n/** The last-4 box accepts digits only (blank is fine). */\nexport function last4Error(value: string): string {\n if (!value) return '';\n return /^\\d{4}$/.test(value) ? '' : uiText('paymentSidePanel.exactly4Digits');\n}\n\nexport function last4Digits(value: string, max = 4): string {\n return value.replace(/\\D/g, '').slice(0, max);\n}\n\n// ── Allocation ──\nexport interface AllocationCheck {\n general: string;\n perCharge: Record<string, string>;\n}\n\nexport type SelectedCharges = Record<string, number | null>;\n\nexport function allocationCheck(\n charges: readonly PayableCharge[], selected: SelectedCharges, totalPayment: number | null, format: (n: number) => string,\n): AllocationCheck {\n const check: AllocationCheck = { general: '', perCharge: {} };\n const ticked = charges.filter(c => c.id in selected);\n if (!ticked.length) { check.general = uiText('paymentSidePanel.selectAtLeastOneCharge'); return check; }\n let sum = 0;\n for (const charge of ticked) {\n const amount = selected[charge.id];\n if (amount == null || !(amount > 0)) { check.perCharge[charge.id] = uiText('paymentSidePanel.enterAnAmount'); continue; }\n if (Math.abs(amount * 100 - Math.round(amount * 100)) > 1e-6) { check.perCharge[charge.id] = uiText('paymentSidePanel.atMost2Decimals'); continue; }\n if (toCents(amount) > toCents(charge.balanceDue)) { check.perCharge[charge.id] = uiText('paymentSidePanel.cannotExceedBalance', { amount: format(charge.balanceDue) }); continue; }\n sum += toCents(amount);\n }\n if (!check.general && totalPayment != null && sum > toCents(totalPayment)) {\n check.general = uiText('paymentSidePanel.allocatedExceeds', { allocated: format(fromCents(sum)), payment: format(totalPayment) });\n }\n return check;\n}\n\n/** The amount to propose when a charge is ticked: its balance, capped by what is left of the payment. */\nexport function defaultChargeAmount(charge: PayableCharge, selected: SelectedCharges, totalPayment: number | null): number | null {\n const balance = roundMoney(charge.balanceDue);\n if (totalPayment == null) return balance > 0 ? balance : null;\n const used = Object.entries(selected).reduce((s, [, v]) => s + (v ? toCents(v) : 0), 0);\n const left = toCents(totalPayment) - used;\n const cents = Math.min(toCents(balance), left);\n return cents > 0 ? fromCents(cents) : null;\n}\n\nexport function buildAllocation(mode: string, charges: readonly PayableCharge[], selected: SelectedCharges): PaymentAllocation {\n if (mode !== ALLOCATION_CUSTOM) return { allocationMode: mode };\n const ticked = charges.filter(c => c.id in selected);\n return {\n allocationChargeIds: ticked.map(c => c.id),\n allocations: ticked.map(c => ({ chargeId: c.id, amount: roundMoney(selected[c.id] ?? 0) })),\n };\n}\n\n/** \"2026-11-03\" -> \"Nov 3, 2026\" without `Date` string parsing (Safari-safe, time-zone independent). */\nexport function formatDueDate(iso: string, locale = 'en-US'): string {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(iso ?? '');\n if (!m) return iso ?? '';\n const date = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));\n return new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' }).format(date);\n}\n\n/** Runs a host callback that may return an Observable, a Promise or a value; a synchronous throw becomes a rejection. */\nexport async function callHost<T>(thunk: () => HostResult<T>): Promise<T> {\n const result = thunk();\n if (isObservable(result)) return firstValueFrom(result, { defaultValue: undefined as T });\n return result;\n}\n\n/** The text of a failed host call: its HTTP body message, its message, else the fallback. */\nexport function hostErrorMessage(err: unknown, fallback: string): string {\n const e = err as { error?: { message?: unknown }; message?: unknown } | null | undefined;\n if (typeof e?.error?.message === 'string' && e.error.message) return e.error.message;\n if (typeof e?.message === 'string' && e.message) return e.message;\n return fallback;\n}\n","import { InjectionToken, type Signal, type TemplateRef } from '@angular/core';\nimport type { PaymentAllocation, RecordPaymentResult } from './payment-side-panel.models';\n\n/** A method a plugin contributes to the panel's method select (while the plugin is rendered inside the panel). */\nexport interface PaymentPluginMethod {\n value: string;\n label: string;\n}\n\n/** The footer button a plugin body may ask the panel to show instead of the panel's own (the panel's own button is hidden for plugin methods). */\nexport interface PaymentPluginPrimary {\n label: string;\n disabled?: boolean;\n loading?: boolean;\n onClick: () => void;\n}\n\n/**\n * What the panel hands to a plugin body (`<ng-template let-ctx>`). The values are a snapshot that is replaced whenever the form changes (read them in the\n * template or in an `input()` of a child component); the functions are stable.\n */\nexport interface PaymentMethodContext {\n /** The selected method value (one of the plugin's `methods`). */\n readonly method: string;\n /** The entered amount, or `null` while it is empty or invalid (a plugin should not start a charge without it). */\n readonly amount: number | null;\n /** ISO date the payment was received. */\n readonly receivedDate: string;\n readonly note: string;\n /** How the payment is applied to charges (same shape the manual payload carries). */\n readonly allocation: PaymentAllocation;\n /** ISO 4217 code of the panel (`'USD'`). */\n readonly currency: string;\n /** Every field of the panel is valid (amount, date, note, allocation). */\n readonly valid: boolean;\n /** Marks the panel as submit-attempted (as a failed Save click does; it reveals no message on a field the user never left) and returns whether the form is valid. Call it before starting a charge. */\n validate(): boolean;\n /** Clears the whole form (method, amount, note, split, allocation; the date returns to today). */\n reset(): void;\n /** The payment is done: the panel reports it (`outcome` kind `'plugin'`, code `'complete'`, then `recorded`). Defaults: type `'manual'`, the selected method, the entered amount. Runs once. */\n complete(result?: Partial<RecordPaymentResult>): void;\n /** A flow is running: the fields are locked and the method cannot be changed. */\n setBusy(busy: boolean): void;\n /** The plugin's own footer button (e.g. \"Pay $120.00\"); `null` removes it. The panel's own Save button never shows for a plugin method. */\n setPrimary(button: PaymentPluginPrimary | null): void;\n /** Hide the panel's fields and show only the plugin body (e.g. a \"payment submitted\" notice). */\n setExclusive(on: boolean): void;\n /**\n * Optional (library source 2026-11-21): asks the panel not to close while the plugin has something that must not be abandoned (a payment waiting on a card reader). The panel calls `fn` when the user\n * closes it (Cancel, X, Escape); `fn` returns `true` to let it close, `false` to keep it open (the plugin shows why). Cleared by `setCloseGuard(null)`, a method change, `complete()` and a reset. A host that\n * closes the panel itself (`[open]=\"false\"`) is not asked: the cancel hook of `onCancel` runs then. Older panels do not have it: call it as `ctx.setCloseGuard?.(...)`.\n */\n setCloseGuard?(fn: (() => boolean) | null): void;\n /** Called when the body is about to go away unfinished: the panel closes, the method changes, or the plugin is removed. Not called after `complete()`. */\n onCancel(fn: (() => void) | null): void;\n /** Tell the host something happened (`outcome` kind `'plugin'`) so it can word a toast. `attemptKey` names the attempt a report is about (the second payment of a `duplicate_suspected`, the payment another tab made in `paid_elsewhere`); `paid` is the amount (major units) and method that payment was made with, for a host that reconciles it. */\n report(code: string, extra?: { result?: RecordPaymentResult; message?: string; attemptKey?: string; paid?: { amount: number | null; method: string } }): void;\n /** Text for the panel's screen-reader status region. */\n announce(text: string): void;\n}\n\nexport interface PaymentMethodBodyContext {\n $implicit: PaymentMethodContext;\n}\n\n/**\n * The contract of a payment plugin: a child element of `<ui-payment-side-panel>` that contributes live methods (Stripe, Square, ...).\n * The panel finds plugins with `contentChildren(PAYMENT_METHOD_PLUGIN)`, so presence IS the opt-in; remove the element and its methods leave the select.\n * A plugin whose method value is `CARD` or `ACH` replaces the record-only behaviour (last 4 digits) of that value while it is rendered.\n */\nexport abstract class PaymentMethodPlugin {\n abstract readonly methods: Signal<readonly PaymentPluginMethod[]>;\n /** The body shown under the form while one of the plugin's methods is selected. */\n abstract readonly template: Signal<TemplateRef<PaymentMethodBodyContext> | undefined>;\n}\n\nexport const PAYMENT_METHOD_PLUGIN = new InjectionToken<PaymentMethodPlugin>('PAYMENT_METHOD_PLUGIN');\n","import { ChangeDetectionStrategy, Component, TemplateRef, computed, contentChild, forwardRef, input } from '@angular/core';\nimport { PAYMENT_METHOD_PLUGIN, PaymentMethodPlugin, type PaymentMethodBodyContext, type PaymentPluginMethod } from './payment-method-plugin';\n\n/**\n * The generic payment plugin: the host renders the body of a method it built itself (Square Web SDK, a gateway widget, ...).\n *\n * <ui-payment-side-panel ...>\n * <ui-payment-custom-method value=\"CARD\" label=\"Card\">\n * <ng-template let-ctx> <my-square-card [amount]=\"ctx.amount\" (paid)=\"ctx.complete({ type: 'stripe' })\" /> </ng-template>\n * </ui-payment-custom-method>\n * </ui-payment-side-panel>\n */\n@Component({\n selector: 'ui-payment-custom-method',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: PAYMENT_METHOD_PLUGIN, useExisting: forwardRef(() => PaymentCustomMethodComponent) }],\n template: ``,\n host: { style: 'display: none' },\n})\nexport class PaymentCustomMethodComponent extends PaymentMethodPlugin {\n readonly value = input.required<string>();\n readonly label = input.required<string>();\n private readonly body = contentChild(TemplateRef<PaymentMethodBodyContext>);\n\n readonly methods = computed((): readonly PaymentPluginMethod[] => [{ value: this.value(), label: this.label() }]);\n readonly template = computed(() => this.body() as TemplateRef<PaymentMethodBodyContext> | undefined);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injector, ViewEncapsulation, afterNextRender, computed, contentChildren, effect, inject, input, isDevMode, output, signal, untracked, viewChildren } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { AlertComponent } from '@forgeroute/ui/alert';\nimport { ButtonComponent } from '@forgeroute/ui/core';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { ChipComponent } from '@forgeroute/ui/chip';\nimport { ChipGroupComponent } from '@forgeroute/ui/chip';\nimport { DateInputComponent } from '@forgeroute/ui/date-input';\nimport { ErrorComponent } from '@forgeroute/ui/error';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { KpiCardComponent } from '@forgeroute/ui/kpi-card';\nimport { SelectComponent } from '@forgeroute/ui/select';\nimport { SidePanelComponent } from '@forgeroute/ui/core';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { TextareaInputComponent } from '@forgeroute/ui/textarea-input';\nimport { formatCurrency } from '@forgeroute/ui/utils';\nimport { UiFieldValidity } from '@forgeroute/ui/core';\nimport { PAYMENT_METHOD_PLUGIN, type PaymentMethodBodyContext, type PaymentMethodContext, type PaymentMethodPlugin, type PaymentPluginPrimary } from './payment-method-plugin';\nimport {\n ALLOCATION_CUSTOM, localizedAllocationModes, localizedPaymentMethods, MAX_PAYMENT_AMOUNT, PAYMENT_METHOD, allocationCheck, buildAllocation, callHost, defaultChargeAmount,\n last4Digits, formatDueDate, hostErrorMessage, isValidAmount, last4Error, referenceKind, roundMoney, sumMoney, terminalTimeoutText, terminalVerdict,\n type AllocationModeOption, type HostResult, type PayableCharge, type PaymentAllocation, type PaymentEntry, type PaymentMethodOption, type PaymentPanelOutcome,\n type RecordPaymentFn, type RecordPaymentPayload, type RecordPaymentResult, type SavedPaymentMethod, type SelectedCharges, type TerminalConfirmContext,\n type TerminalPhase, type TerminalReader, type TerminalStartContext, type TerminalStartResult, type TerminalStatusResult,\n} from './payment-side-panel.models';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { safeLocale } from '@forgeroute/ui/core';\n\nlet nextId = 0;\n\ninterface SplitEntry { method: string; amount: number; reference: string }\n\n/**\n * Side panel for staff to RECORD or COLLECT a payment. Works on its own (record-only: Cash, Check, Money Order, Card and ACH with the last 4 digits) and grows\n * by PLUGINS the host drops in as child elements (`ui-payment-stripe-method` from `@forgeroute/ui/stripe`, `ui-payment-custom-method` for Square or any widget):\n * a plugin's presence IS the opt-in, and a plugin method with the value `CARD` / `ACH` replaces the record-only behaviour while it is rendered.\n * The panel has no HTTP and no processor knowledge: the host gives callbacks (`recordPayment`, the terminal calls) and words the `outcome` events.\n *\n * <ui-payment-side-panel [open]=\"open()\" [today]=\"today()\" [outstandingBalance]=\"due()\" [charges]=\"charges()\"\n * [recordPayment]=\"record\" (recorded)=\"onRecorded($event)\" (closed)=\"open.set(false)\" />\n *\n * See docs/payment-side-panel.md.\n */\n@Component({\n selector: 'ui-payment-side-panel',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n FormsModule, NgTemplateOutlet, AlertComponent, ButtonComponent, CheckboxComponent, ChipComponent, ChipGroupComponent, DateInputComponent, ErrorComponent,\n KpiCardComponent, FormSectionComponent, SelectComponent, SidePanelComponent, TextInputComponent, TextareaInputComponent,\n ],\n template: `\n <ui-side-panel [open]=\"open()\" [title]=\"title()\" [subtitle]=\"subtitle()\" [primaryLabel]=\"primaryLabel()\" [primaryLoading]=\"primaryLoading()\"\n [primaryDisabled]=\"primaryDisabled()\" primaryTestId=\"psp-primary\" cancelTestId=\"psp-cancel\" (closed)=\"onClose()\" (primaryClick)=\"onPrimary()\">\n @if (open()) {\n <div class=\"psp-sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" data-testid=\"psp-live\">{{ announcement() }}</div>\n <div class=\"psp\" [attr.aria-busy]=\"busy() || submitting() ? 'true' : null\">\n @if (!exclusive()) {\n @if (outstandingBalance() != null && outstandingBalance()! > 0) {\n <ui-kpi-card class=\"psp-balance\" data-testid=\"psp-balance\" [label]=\"labels.t('paymentSidePanel.outstandingBalance')\" [value]=\"money(outstandingBalance()!)\" icon=\"alert-circle\" color=\"red\" valueColor=\"red\" />\n }\n\n @if (splitEntries().length > 0) {\n <div class=\"psp-split\" data-testid=\"psp-split\" role=\"group\" [attr.aria-labelledby]=\"ids + '-split'\">\n <ui-kpi-card class=\"psp-split-total\" data-testid=\"psp-split-total\" [label]=\"labels.t('paymentSidePanel.recordedSoFar')\" [value]=\"money(splitTotal())\"\n [subtitle]=\"labels.t(splitEntries().length === 1 ? 'paymentSidePanel.splitPayments_one' : 'paymentSidePanel.splitPayments_other', { count: splitEntries().length })\" icon=\"check-circle\" color=\"blue\" valueColor=\"blue\" />\n <span class=\"psp-split-title\" [id]=\"ids + '-split'\">{{ labels.t('paymentSidePanel.splitPayment') }}</span>\n @for (entry of splitEntries(); track $index) {\n <div class=\"psp-split-entry\" data-testid=\"psp-split-entry\">\n <span>{{ methodLabel(entry.method) }}@if (entry.reference) { <span class=\"psp-muted\"> •••• {{ entry.reference }}</span> }</span>\n <span>{{ money(entry.amount) }}</span>\n <ui-button variant=\"icon\" size=\"sm\" [disabled]=\"busy() || submitting()\" [ariaLabel]=\"labels.t('paymentSidePanel.removeEntry', { method: methodLabel(entry.method), amount: money(entry.amount) })\" data-testid=\"psp-split-remove\" (click)=\"removeSplit($index)\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M18 6L6 18\"/><path d=\"M6 6l12 12\"/></svg>\n </ui-button>\n </div>\n }\n </div>\n }\n\n @if (savedChips().length > 0) {\n <div class=\"psp-saved\" data-testid=\"psp-saved\" role=\"group\" [attr.aria-labelledby]=\"ids + '-saved'\">\n <span class=\"psp-saved-label\" [id]=\"ids + '-saved'\">{{ labels.t('paymentSidePanel.previouslyUsed') }}</span>\n <ui-chip-group gap=\"sm\" spaceAbove=\"none\" spaceBelow=\"sm\">\n @for (saved of savedChips(); track saved.method + saved.last4) {\n <ui-chip size=\"sm\" [label]=\"chipLabel(saved)\" [active]=\"method() === saved.method && reference() === saved.last4\" data-testid=\"psp-saved-chip\" (select)=\"selectSaved(saved)\" />\n }\n </ui-chip-group>\n </div>\n }\n\n <ui-form-section>\n <div class=\"psp-method-row\">\n <ui-select class=\"psp-method\" [label]=\"labels.t('paymentSidePanel.paymentMethod')\" [placeholder]=\"labels.t('paymentSidePanel.selectPaymentMethod')\" [required]=\"methodRequired()\" [options]=\"methodOptions()\"\n [disabled]=\"busy() || submitting() || !!retryIntentId()\" [showErrors]=\"touched()\" [ngModel]=\"method()\" (ngModelChange)=\"onMethodChange($event)\" data-testid=\"psp-method\" />\n @if (method()) {\n <ui-button variant=\"icon\" size=\"sm\" [disabled]=\"busy() || submitting() || !!retryIntentId()\" [ariaLabel]=\"labels.t('paymentSidePanel.clearPaymentMethod')\" data-testid=\"psp-method-clear\" (click)=\"onMethodChange('')\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M18 6L6 18\"/><path d=\"M6 6l12 12\"/></svg>\n </ui-button>\n }\n </div>\n\n <ui-text-input [label]=\"splitEntries().length > 0 ? labels.t('paymentSidePanel.additionalAmountLabel', { symbol: currencySymbol() }) : labels.t('paymentSidePanel.amountLabel', { symbol: currencySymbol() })\" type=\"number\" valueType=\"number\"\n [required]=\"splitEntries().length === 0\" [min]=\"0.01\" [max]=\"maxAmount()\" [maxDecimals]=\"2\" [step]=\"0.01\" inputmode=\"decimal\" [placeholder]=\"labels.t('paymentSidePanel.enterAmount')\"\n [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"amount()\" (ngModelChange)=\"amount.set($event)\" inputTestId=\"psp-amount\" />\n\n <ui-date-input [label]=\"labels.t('paymentSidePanel.receivedDate')\" [required]=\"true\" [max]=\"dateMax()\" [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"receivedDate()\" (ngModelChange)=\"receivedDate.set($event ?? '')\" data-testid=\"psp-date\" />\n\n @switch (refKind()) {\n @case ('check') {\n <ui-text-input [label]=\"labels.t('paymentSidePanel.check')\" [placeholder]=\"labels.t('common.example', { value: '1234' })\" [maxlength]=\"50\" [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"reference()\" (ngModelChange)=\"reference.set($event ?? '')\" inputTestId=\"psp-reference\" />\n }\n @case ('last4-card') {\n <ui-text-input [label]=\"labels.t('paymentSidePanel.last4DigitsOfCard')\" [placeholder]=\"labels.t('common.example', { value: '4242' })\" [maxlength]=\"4\" inputmode=\"numeric\" [disabled]=\"locked()\" [error]=\"touched() ? referenceError() : ''\"\n [ngModel]=\"reference()\" (ngModelChange)=\"onLast4($event)\" inputTestId=\"psp-reference\" />\n }\n @case ('last4-account') {\n <ui-text-input [label]=\"labels.t('paymentSidePanel.last4DigitsOfAccount')\" [placeholder]=\"labels.t('common.example', { value: '6789' })\" [maxlength]=\"4\" inputmode=\"numeric\" [disabled]=\"locked()\" [error]=\"touched() ? referenceError() : ''\"\n [ngModel]=\"reference()\" (ngModelChange)=\"onLast4($event)\" inputTestId=\"psp-reference\" />\n }\n }\n\n <ui-textarea-input [label]=\"labels.t('common.note')\" [placeholder]=\"labels.t('paymentSidePanel.optionalNote')\" [rows]=\"2\" [maxlength]=\"500\" [disabled]=\"locked()\" [showErrors]=\"touched()\" [ngModel]=\"note()\" (ngModelChange)=\"note.set($event ?? '')\" data-testid=\"psp-note\" />\n\n @if (charges().length > 0) {\n <div class=\"psp-allocation\" data-testid=\"psp-allocation\" role=\"group\" [attr.aria-labelledby]=\"ids + '-alloc'\">\n <span class=\"psp-saved-label\" [id]=\"ids + '-alloc'\">{{ labels.t('paymentSidePanel.applyPaymentTo') }}</span>\n <ui-select [ariaLabel]=\"labels.t('paymentSidePanel.applyPaymentTo')\" [ariaDescribedBy]=\"allocationMessage() ? ids + '-alloc-error' : ''\" [options]=\"allocationOptions()\" [disabled]=\"locked()\" [ngModel]=\"allocationMode()\" (ngModelChange)=\"onAllocationMode($event)\" data-testid=\"psp-allocation-mode\" />\n @if (allocationMode() === customMode) {\n <div class=\"psp-charges\" data-testid=\"psp-charges\" (focusout)=\"allocationTouched.set(true)\">\n @for (charge of charges(); track charge.id) {\n <div class=\"psp-charge\" data-testid=\"psp-charge\">\n <ui-checkbox [label]=\"charge.chargeType\" [description]=\"chargeDescription(charge)\" [disabled]=\"locked()\" [ngModel]=\"isTicked(charge.id)\" (ngModelChange)=\"toggleCharge(charge, $event)\" [testId]=\"'psp-charge-' + charge.id\" />\n @if (isTicked(charge.id)) {\n <ui-text-input class=\"psp-charge-amount\" type=\"number\" valueType=\"number\" [ariaLabel]=\"labels.t('paymentSidePanel.amountFor', { name: charge.chargeType })\" [min]=\"0.01\" [maxDecimals]=\"2\" [step]=\"0.01\" inputmode=\"decimal\"\n [disabled]=\"locked()\" [error]=\"allocation().perCharge[charge.id] ?? ''\" [ngModel]=\"selectedCharges()[charge.id]\" (ngModelChange)=\"setChargeAmount(charge.id, $event)\" [inputTestId]=\"'psp-charge-amount-' + charge.id\" />\n }\n </div>\n }\n </div>\n <ui-error [errorId]=\"ids + '-alloc-error'\" [message]=\"allocationMessage()\" data-testid=\"psp-allocation-error\" />\n }\n </div>\n }\n\n @if (kind() === 'manual' && method() && canSplit()) {\n <div>\n <ui-button variant=\"secondary\" size=\"sm\" [disabled]=\"locked() || submitting()\" data-testid=\"psp-add-split\" (click)=\"addSplit()\">{{ labels.t('paymentSidePanel.addAsSplitPayment') }}</ui-button>\n </div>\n }\n @if (receiptLabel() && ((kind() === 'manual' && method()) || splitEntries().length > 0)) {\n <ui-checkbox [label]=\"receiptLabel()\" [disabled]=\"locked()\" [ngModel]=\"sendReceipt()\" (ngModelChange)=\"sendReceipt.set(!!$event)\" testId=\"psp-receipt\" />\n }\n </ui-form-section>\n }\n\n @if (kind() === 'terminal' && !exclusive()) {\n <div class=\"psp-terminal\" data-testid=\"psp-terminal\">\n <div class=\"psp-reader-row\">\n <ui-select class=\"psp-reader\" [label]=\"labels.t('paymentSidePanel.selectReader')\" [placeholder]=\"labels.t('paymentSidePanel.chooseAReader')\" [required]=\"true\" [options]=\"readerOptions()\" [disabled]=\"terminalPhase() !== 'idle' || sendingToReader() || !!retryIntentId()\"\n [ngModel]=\"readerId()\" (ngModelChange)=\"readerId.set($event ?? '')\" data-testid=\"psp-reader\" />\n <ui-button variant=\"icon\" size=\"sm\" [ariaLabel]=\"labels.t('paymentSidePanel.refreshReaderStatus')\" [disabled]=\"loadingReaders()\" data-testid=\"psp-reader-refresh\" (click)=\"refreshReaders()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"23 4 23 10 17 10\"/><polyline points=\"1 20 1 14 7 14\"/><path d=\"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15\"/></svg>\n </ui-button>\n </div>\n @if (readers().length === 0 && readersLoaded() && !loadingReaders() && !readersError()) {\n <ui-alert variant=\"warning\" data-testid=\"psp-no-readers\">{{ noReadersText() }}</ui-alert>\n }\n @if (readersError()) { <ui-alert variant=\"danger\" data-testid=\"psp-readers-error\">{{ readersError() }}</ui-alert> }\n @if (readerId() && selectedReader()) {\n @if (selectedReader()!.status === 'online') {\n <ui-alert variant=\"success\" [compact]=\"true\" data-testid=\"psp-reader-online\">{{ labels.t('paymentSidePanel.deviceConnected', { provider: terminalProvider() }) }}</ui-alert>\n } @else {\n <ui-alert variant=\"danger\" [compact]=\"true\" data-testid=\"psp-reader-offline\">{{ labels.t('paymentSidePanel.deviceNotConnected', { provider: terminalProvider() }) }}</ui-alert>\n }\n }\n @switch (terminalPhase()) {\n @case ('idle') {\n @if (retryIntentId()) {\n <ui-button variant=\"primary\" [loading]=\"retrying()\" [disabled]=\"retrying()\" data-testid=\"psp-terminal-retry\" (click)=\"retryRecording()\">{{ labels.t('paymentSidePanel.retryRecording') }}</ui-button>\n } @else {\n <ui-button variant=\"primary\" [loading]=\"sendingToReader()\" [disabled]=\"!canSendToReader()\" data-testid=\"psp-terminal-send\" (click)=\"sendToReader()\">{{ sendingToReader() ? labels.t('paymentSidePanel.sending') : labels.t('paymentSidePanel.sendToReader') }}</ui-button>\n }\n }\n @case ('waiting') {\n <div class=\"psp-waiting\" data-testid=\"psp-terminal-waiting\">\n <span>{{ labels.t('paymentSidePanel.waitingForCustomerToTap') }}</span>\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"psp-terminal-cancel\" (click)=\"cancelTerminalPayment()\">{{ labels.t('common.cancel') }}</ui-button>\n </div>\n }\n @case ('confirming') { <div class=\"psp-waiting\" data-testid=\"psp-terminal-confirming\">{{ labels.t('paymentSidePanel.recordingPayment') }}</div> }\n @case ('success') { <ui-alert variant=\"success\" data-testid=\"psp-terminal-success\">{{ labels.t('paymentSidePanel.paymentSuccessful', { amount: money(terminalAmount()) }) }}</ui-alert> }\n }\n @if (terminalError()) { <div class=\"psp-terminal-error\" tabindex=\"-1\" data-testid=\"psp-terminal-error-wrap\"><ui-alert variant=\"danger\" data-testid=\"psp-terminal-error\">{{ terminalError() }}</ui-alert></div> }\n </div>\n }\n\n @if (kind() === 'live') {\n @if (pluginTemplate(); as tpl) {\n <div class=\"psp-plugin\" data-testid=\"psp-plugin\">\n <ng-container *ngTemplateOutlet=\"tpl; context: pluginContext()\" />\n </div>\n }\n }\n\n @if (submitError()) { <div class=\"psp-alert\"><ui-alert variant=\"danger\" data-testid=\"psp-submit-error\">{{ submitError() }}</ui-alert></div> }\n </div>\n }\n </ui-side-panel>\n `,\n styles: [`\n ui-payment-side-panel { display: contents; }\n ui-payment-side-panel .psp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n ui-payment-side-panel .psp { --psp-sunken: var(--ui-psp-sunken, #f8fafc); --psp-border: var(--ui-psp-border, #e2e8f0); --psp-text: var(--ui-psp-text, #1e293b); --psp-muted: var(--ui-psp-muted, #475569); --psp-danger: var(--ui-psp-danger, #b91c1c); display: flex; flex-direction: column; gap: 14px; color: var(--psp-text); }\n ui-payment-side-panel .psp-split { font-size: 0.8125rem; }\n ui-payment-side-panel .psp-split-title { display: block; margin: 12px 0 4px; font-weight: 600; }\n ui-payment-side-panel .psp-split-entry { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--psp-muted); border-bottom: 1px solid var(--psp-border); }\n ui-payment-side-panel .psp-split-entry:last-child { border-bottom: none; }\n ui-payment-side-panel .psp-split-entry > span:first-child { flex: 1; min-width: 0; }\n ui-payment-side-panel .psp-muted { color: var(--psp-muted); }\n ui-payment-side-panel .psp-saved-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--psp-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }\n ui-payment-side-panel .psp-method-row, ui-payment-side-panel .psp-reader-row { display: flex; align-items: flex-end; gap: 8px; }\n ui-payment-side-panel .psp-method, ui-payment-side-panel .psp-reader { flex: 1; min-width: 0; }\n ui-payment-side-panel .psp-allocation { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--psp-border); }\n ui-payment-side-panel .psp-charges { max-height: 260px; overflow-y: auto; border: 1px solid var(--psp-border); border-radius: 8px; }\n ui-payment-side-panel .psp-charge { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--psp-border); }\n ui-payment-side-panel .psp-charge:last-child { border-bottom: none; }\n ui-payment-side-panel .psp-terminal { display: flex; flex-direction: column; gap: 12px; }\n ui-payment-side-panel .psp-waiting { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 16px; background: var(--psp-sunken); border-radius: 10px; text-align: center; font-size: 0.875rem; font-weight: 500; color: var(--psp-muted); }\n ui-payment-side-panel .psp-plugin { min-width: 0; }\n ui-payment-side-panel .psp-terminal-error:focus { outline: none; }\n `],\n})\nexport class PaymentSidePanelComponent {\n protected readonly labels = inject(UiLabelsService);\n private readonly injector = inject(Injector);\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n protected readonly ids = `psp-${nextId++}`;\n protected readonly customMode = ALLOCATION_CUSTOM;\n\n // ── Inputs ──\n readonly open = input(false);\n readonly titleInput = input<string | null>(null, { alias: 'title' });\n readonly title = computed(() => this.titleInput() ?? this.labels.t('paymentSidePanel.title'));\n readonly subtitle = input('');\n /** Today as `YYYY-MM-DD` (the host's clock/time zone): the default Received Date. The panel never builds dates itself. */\n readonly today = input('');\n /** When > 0 a banner shows it and the amount starts at this balance. */\n readonly outstandingBalance = input<number | null>(null);\n /** ISO 4217 code used for every amount shown. */\n readonly currency = input('USD');\n readonly maxAmount = input(MAX_PAYMENT_AMOUNT);\n /** Latest Received Date (ISO). Default: `today`, because a payment cannot be received in the future. */\n readonly maxDate = input('');\n /** The methods listed (value/label). Default: Card, ACH / Bank Transfer, Cash, Check, Money Order, Card Present (terminal callbacks given). */\n readonly methodsInput = input<readonly PaymentMethodOption[] | null>(null, { alias: 'methods' });\n readonly methods = computed((): readonly PaymentMethodOption[] => this.methodsInput() ?? localizedPaymentMethods());\n readonly savedMethods = input<readonly SavedPaymentMethod[]>([]);\n readonly charges = input<readonly PayableCharge[]>([]);\n readonly allocationModesInput = input<readonly AllocationModeOption[] | null>(null, { alias: 'allocationModes' });\n readonly allocationModes = computed((): readonly AllocationModeOption[] => this.allocationModesInput() ?? localizedAllocationModes());\n readonly defaultAllocationMode = input('oldest');\n /** Text of the \"send receipt\" checkbox (e.g. \"Email receipt to resident\"); empty hides it. */\n readonly receiptLabel = input('');\n readonly submitLabelInput = input<string | null>(null, { alias: 'submitLabel' });\n readonly submitLabel = computed(() => this.submitLabelInput() ?? this.labels.t('paymentSidePanel.submitLabel'));\n readonly splitSubmitLabelInput = input<string | null>(null, { alias: 'splitSubmitLabel' });\n readonly splitSubmitLabel = computed(() => this.splitSubmitLabelInput() ?? this.labels.t('paymentSidePanel.splitSubmitLabel'));\n /** Records the payment. Returns an Observable / Promise; a rejection is shown in the panel and it stays open. */\n readonly recordPayment = input<RecordPaymentFn | null>(null);\n\n // Card-present terminal (generic callbacks; the method is listed while `listReaders` and `startTerminalPayment` are given)\n readonly listReaders = input<(() => HostResult<readonly TerminalReader[]>) | null>(null);\n readonly startTerminalPayment = input<((ctx: TerminalStartContext) => HostResult<TerminalStartResult>) | null>(null);\n readonly terminalStatus = input<((paymentIntentId: string) => HostResult<TerminalStatusResult>) | null>(null);\n readonly confirmTerminalPayment = input<((ctx: TerminalConfirmContext) => HostResult<unknown>) | null>(null);\n readonly cancelTerminal = input<((readerId: string) => HostResult<unknown>) | null>(null);\n readonly terminalProviderInput = input<string | null>(null, { alias: 'terminalProvider' });\n readonly terminalProvider = computed(() => this.terminalProviderInput() ?? this.labels.t('paymentSidePanel.terminalProvider'));\n readonly noReadersTextInput = input<string | null>(null, { alias: 'noReadersText' });\n readonly noReadersText = computed(() => this.noReadersTextInput() ?? this.labels.t('paymentSidePanel.noReadersText'));\n readonly terminalPollMs = input(2000);\n readonly terminalTimeoutMs = input(120000);\n readonly readerRefreshMs = input(15000);\n readonly terminalSuccessDelayMs = input(1500);\n\n // ── Outputs ──\n readonly closed = output<void>();\n /** The payment is done (any flow). The host closes the panel. */\n readonly recorded = output<RecordPaymentResult>();\n /** What happened, for the host to word (the panel never toasts). */\n readonly outcome = output<PaymentPanelOutcome>();\n\n // ── Plugins ──\n private readonly plugins = contentChildren<PaymentMethodPlugin>(PAYMENT_METHOD_PLUGIN, { descendants: true });\n private readonly fields = viewChildren(UiFieldValidity);\n\n // ── Form state ──\n readonly method = signal('');\n readonly amount = signal<number | null>(null);\n readonly receivedDate = signal('');\n readonly reference = signal('');\n readonly note = signal('');\n readonly sendReceipt = signal(false);\n readonly splitEntries = signal<SplitEntry[]>([]);\n readonly allocationMode = signal('oldest');\n readonly selectedCharges = signal<SelectedCharges>({});\n readonly touched = signal(false);\n /** The user ticked / unticked a charge, edited a charge amount or left the charge list. Only then is the allocation message (\"Select at least one charge\") shown; a failed Save does not reveal it (it still blocks Save via `hasInvalid`). */\n readonly allocationTouched = signal(false);\n readonly submitting = signal(false);\n readonly submitError = signal('');\n readonly announcement = signal('');\n\n // Plugin state\n private readonly pluginBusy = signal(false);\n protected readonly exclusive = signal(false);\n private readonly pluginPrimary = signal<PaymentPluginPrimary | null>(null);\n private cancelHook: (() => void) | null = null;\n /** A plugin's \"may the panel close?\" check (see `PaymentMethodContext.setCloseGuard`). */\n private closeGuard: (() => boolean) | null = null;\n /** The method value that was a live plugin method when last checked ('' = none), to notice the plugin disappearing under a selected method. */\n private liveMethodValue = '';\n private completed = false;\n /** The plugin's last report was `verification` (a bank payment that has NOT started): its \"Done\" is announced as \"payment not started\", never as \"Payment recorded\". */\n private verificationReported = false;\n\n // Terminal state\n readonly readers = signal<readonly TerminalReader[]>([]);\n readonly readersLoaded = signal(false);\n readonly loadingReaders = signal(false);\n readonly readersError = signal('');\n readonly readerId = signal('');\n readonly terminalPhase = signal<TerminalPhase>('idle');\n readonly terminalError = signal('');\n readonly sendingToReader = signal(false);\n readonly retryIntentId = signal('');\n readonly retrying = signal(false);\n readonly terminalAmount = signal(0);\n /** Bumped when the form is reset or the panel closes: an async terminal step that finishes later must not touch the new state. */\n private session = 0;\n private retryContext: TerminalConfirmContext | null = null;\n private pollTimer: ReturnType<typeof setTimeout> | null = null;\n private pollToken = 0;\n private refreshTimer: ReturnType<typeof setTimeout> | null = null;\n private successTimer: ReturnType<typeof setTimeout> | null = null;\n private pendingTerminalResult: RecordPaymentResult | null = null;\n private terminalContext: TerminalConfirmContext | null = null;\n\n protected readonly busy = computed(() => this.pluginBusy() || this.terminalPhase() !== 'idle' || this.sendingToReader() || this.retrying());\n /** Fields are read-only while something runs, and while a taken terminal payment still has to be recorded (its amount must not change). */\n protected readonly locked = computed(() => this.busy() || this.submitting() || !!this.retryIntentId());\n protected readonly dateMax = computed(() => this.maxDate() || this.today());\n protected readonly money = (value: number): string => formatCurrency(value, { currency: this.currency(), locale: this.labels.locale() });\n protected readonly currencySymbol = computed(() => {\n try { return new Intl.NumberFormat(safeLocale(this.labels.locale()), { style: 'currency', currency: this.currency() }).formatToParts(0).find(p => p.type === 'currency')?.value ?? this.currency(); } catch { return this.currency(); }\n });\n\n private readonly terminalAvailable = computed(() => !!this.listReaders() && !!this.startTerminalPayment());\n /** value -> label of every live method the rendered plugins contribute (the first plugin wins a duplicate value). */\n private readonly liveMethods = computed(() => {\n const map = new Map<string, { label: string; plugin: PaymentMethodPlugin }>();\n for (const plugin of this.plugins()) for (const m of plugin.methods()) if (!map.has(m.value)) map.set(m.value, { label: m.label, plugin });\n return map;\n });\n protected readonly kind = computed((): 'none' | 'manual' | 'live' | 'terminal' => this.kindOf(this.method()));\n private kindOf(value: string): 'none' | 'manual' | 'live' | 'terminal' {\n if (!value) return 'none';\n if (this.liveMethods().has(value)) return 'live';\n if (value === PAYMENT_METHOD.CARD_PRESENT && this.terminalAvailable()) return 'terminal';\n return 'manual';\n }\n\n /** The method list as shown: record-only built-ins (a plugin takes over its own values), plugin extras, and only manual ones while a split is being built. */\n readonly methodList = computed((): PaymentMethodOption[] => {\n const live = this.liveMethods();\n const terminal = this.terminalAvailable();\n const listed = this.methods();\n const base = listed.filter(o => o.requires !== 'terminal' || terminal).map(o => ({ value: o.value, label: live.get(o.value)?.label ?? o.label }));\n const extra = [...live.entries()].filter(([value]) => !listed.some(o => o.value === value)).map(([value, v]) => ({ value, label: v.label }));\n const all = [...base, ...extra];\n return this.splitEntries().length > 0 ? all.filter(o => this.kindOf(o.value) === 'manual') : all;\n });\n protected readonly methodOptions = computed(() => this.methodList().map(o => ({ value: o.value, label: o.label })));\n protected readonly methodRequired = computed(() => this.splitEntries().length === 0 || this.amount() != null);\n protected readonly allocationOptions = computed(() => this.allocationModes().map(o => ({ value: o.value, label: o.label })));\n\n /** Hidden while a taken terminal payment still has to be recorded: the method cannot change then. */\n protected readonly savedChips = computed(() => this.retryIntentId() ? [] : this.savedMethods().filter(s => this.methodList().some(o => o.value === s.method)));\n protected readonly refKind = computed(() => (this.kind() === 'manual' || this.kind() === 'none' ? referenceKind(this.method(), false) : null));\n protected readonly referenceError = computed(() => (this.refKind() === 'last4-card' || this.refKind() === 'last4-account' ? last4Error(this.reference()) : ''));\n\n private readonly amountValid = computed(() => isValidAmount(this.amount(), this.maxAmount()));\n protected readonly splitTotal = computed(() => sumMoney(this.splitEntries().map(e => e.amount)));\n private readonly totalPayment = computed((): number | null => {\n const total = sumMoney([...this.splitEntries().map(e => e.amount), ...(this.amountValid() ? [this.amount() as number] : [])]);\n return total > 0 ? total : null;\n });\n protected readonly allocation = computed(() => (this.allocationMode() === ALLOCATION_CUSTOM && this.charges().length\n ? allocationCheck(this.charges(), this.selectedCharges(), this.totalPayment(), this.money)\n : { general: '', perCharge: {} as Record<string, string> }));\n private readonly allocationPayload = computed((): PaymentAllocation => {\n // \"Choose charges\" needs a charge list; without one the payment goes by the default mode (never \"custom\").\n let mode = this.allocationMode();\n if (mode === ALLOCATION_CUSTOM && !this.charges().length) mode = this.defaultAllocationMode() === ALLOCATION_CUSTOM ? 'oldest' : this.defaultAllocationMode();\n return buildAllocation(mode, this.charges(), this.selectedCharges());\n });\n\n /** `allocation().general` limited to what the user has interacted with. */\n protected readonly allocationMessage = computed(() => this.allocationTouched() ? this.allocation().general : '');\n protected readonly hasInvalid = computed(() => this.fields().some(f => f.invalid()) || !!this.allocation().general || !!this.referenceError());\n protected readonly canSplit = computed(() => this.kind() === 'manual' && !this.busy());\n protected readonly readerOptions = computed(() => this.readers().map(r => ({ value: r.id, label: `${r.label || r.deviceType || r.id} (${r.status})` })));\n protected readonly selectedReader = computed(() => this.readers().find(r => r.id === this.readerId()) ?? null);\n protected readonly canSendToReader = computed(() => !!this.readerId() && this.selectedReader()?.status === 'online' && this.amountValid() && !!this.receivedDate()\n && !this.sendingToReader() && !this.hasInvalid());\n\n protected readonly pluginTemplate = computed(() => this.liveMethods().get(this.method())?.plugin.template());\n protected readonly pluginContext = computed((): PaymentMethodBodyContext => ({ $implicit: this.buildContext() }));\n\n protected readonly primaryLabel = computed(() => {\n if (!this.open()) return '';\n switch (this.kind()) {\n case 'live': return this.pluginPrimary()?.label ?? '';\n case 'terminal': return '';\n default: return this.splitEntries().length > 0 ? this.splitSubmitLabel() : this.submitLabel();\n }\n });\n protected readonly primaryLoading = computed(() => (this.kind() === 'live' ? !!this.pluginPrimary()?.loading : this.submitting()));\n protected readonly primaryDisabled = computed(() => {\n if (this.kind() === 'live') return !!this.pluginPrimary()?.disabled;\n return this.submitting() || (this.touched() && this.hasInvalid());\n });\n\n constructor() {\n effect(() => {\n const isOpen = this.open();\n untracked(() => (isOpen ? this.init() : this.teardown()));\n });\n effect(() => {\n const today = this.today();\n untracked(() => { if (!this.receivedDate() && today) this.receivedDate.set(today); });\n });\n // The selected method left the list (a plugin was removed, the split filter): back to \"no method\", the plugin gets its cancel hook.\n effect(() => {\n const list = this.methodList();\n const method = this.method();\n untracked(() => { if (method && !list.some(o => o.value === method)) this.onMethodChange(''); });\n });\n // The selected value stays in the list but stops being a live method (the plugin was removed and the record-only Card / ACH takes its place):\n // the unfinished live flow is told to stop and the choice is cleared, like any other method change.\n effect(() => {\n const kind = this.kind();\n const method = this.method();\n untracked(() => {\n if (this.liveMethodValue && this.liveMethodValue === method && kind !== 'live') this.onMethodChange('');\n this.liveMethodValue = kind === 'live' ? method : '';\n });\n });\n effect(() => {\n const visible = this.kind() === 'terminal';\n untracked(() => (visible ? this.startTerminalSession() : this.stopReaderRefresh()));\n });\n inject(DestroyRef).onDestroy(() => { this.destroyed = true; this.cleanup(); });\n }\n\n /** The panel is gone: a late answer of a plugin (its confirmation came after the panel closed) must not emit on outputs nobody listens to any more (Angular NG0953). */\n private destroyed = false;\n\n // ── Lifecycle ──\n private init(): void {\n this.resetForm();\n if (!this.today() && isDevMode()) console.warn('ui-payment-side-panel: the `today` input is empty, so Received Date has no default. Pass today as YYYY-MM-DD.');\n const due = this.outstandingBalance();\n if (due != null && due > 0) this.amount.set(roundMoney(due));\n }\n\n private teardown(): void {\n this.cleanup();\n this.resetForm();\n }\n\n private resetForm(): void {\n this.session++;\n this.method.set('');\n this.amount.set(null);\n this.receivedDate.set(this.today());\n this.reference.set('');\n this.note.set('');\n this.sendReceipt.set(false);\n this.splitEntries.set([]);\n this.allocationMode.set(this.defaultAllocationMode());\n this.selectedCharges.set({});\n this.touched.set(false);\n this.allocationTouched.set(false);\n this.submitting.set(false);\n this.submitError.set('');\n this.announcement.set('');\n this.pluginBusy.set(false);\n this.exclusive.set(false);\n this.pluginPrimary.set(null);\n this.completed = false;\n this.verificationReported = false;\n this.resetTerminal();\n }\n\n /** A card payment the reader took but that was never recorded is being abandoned: the host must hear about it. */\n private dropPendingRetry(): void {\n const context = this.retryContext;\n if (!this.retryIntentId() || !context) { this.retryIntentId.set(''); this.retryContext = null; return; }\n this.retryIntentId.set('');\n this.retryContext = null;\n // A retry that is in flight reports its own (single) result; announcing \"not recorded\" now would contradict it.\n if (this.retrying()) return;\n this.outcome.emit({\n kind: 'failed', stage: 'terminal',\n message: this.labels.t('paymentSidePanel.terminalNotRecorded', { amount: this.money(context.amount), id: context.paymentIntentId }),\n });\n }\n\n private cleanup(): void {\n this.session++;\n this.dropPendingRetry();\n this.runCancelHook();\n this.sendingToReader.set(false);\n if (this.terminalPhase() === 'confirming') this.terminalPhase.set('idle');\n if (this.terminalPhase() === 'waiting') {\n if (this.readerId()) this.fireCancelReader(this.readerId());\n this.terminalPhase.set('idle');\n }\n this.stopPolling();\n this.stopReaderRefresh();\n if (this.successTimer) { clearTimeout(this.successTimer); this.successTimer = null; }\n this.finishTerminal();\n }\n\n protected onClose(): void {\n // A plugin with something that must not be abandoned (a payment waiting on a card reader) keeps the panel open and says why.\n if (this.closeGuard) { let allowed = true; try { allowed = this.closeGuard(); } catch { allowed = true; } if (!allowed) return; }\n this.cleanup();\n this.closed.emit();\n }\n\n private runCancelHook(): void {\n const hook = this.cancelHook;\n this.cancelHook = null;\n this.closeGuard = null;\n if (hook) { try { hook(); } catch { /* a plugin's cancel must not block closing */ } }\n }\n\n // ── Method ──\n protected onMethodChange(value: string | null): void {\n const next = value ?? '';\n if (next === this.method()) return;\n this.runCancelHook();\n this.cancelTerminalIfWaiting();\n this.pluginBusy.set(false);\n this.exclusive.set(false);\n this.pluginPrimary.set(null);\n this.terminalError.set('');\n this.dropPendingRetry();\n this.submitError.set('');\n this.reference.set('');\n this.method.set(next);\n }\n\n protected selectSaved(saved: SavedPaymentMethod): void {\n this.onMethodChange(saved.method);\n this.reference.set(saved.last4);\n }\n\n protected chipLabel(saved: SavedPaymentMethod): string {\n return `${saved.label || this.methodLabel(saved.method)} •••• ${saved.last4}`;\n }\n\n protected methodLabel(value: string): string {\n return this.methodList().find(o => o.value === value)?.label ?? this.methods().find(o => o.value === value)?.label ?? value;\n }\n\n protected onLast4(value: string | null): void {\n this.reference.set(last4Digits(value ?? ''));\n }\n\n // ── Split ──\n protected addSplit(): void {\n const method = this.method();\n const amount = this.amount();\n if (this.kind() !== 'manual' || !method || !this.amountValid() || this.referenceError()) { this.touched.set(true); return; }\n const entry: SplitEntry = { method, amount: roundMoney(amount as number), reference: this.referenceFor(method) ?? '' };\n this.splitEntries.update(list => [...list, entry]);\n this.amount.set(null);\n this.method.set('');\n this.reference.set('');\n this.touched.set(false);\n this.allocationTouched.set(false);\n this.announcement.set(this.labels.t('paymentSidePanel.addedToSplit', { method: this.methodLabel(entry.method), amount: this.money(entry.amount), total: this.money(this.splitTotal()) }));\n }\n\n protected removeSplit(index: number): void {\n const removed = this.splitEntries()[index];\n this.splitEntries.update(list => list.filter((_, i) => i !== index));\n if (removed) this.announcement.set(this.labels.t('paymentSidePanel.removedFromSplit', { method: this.methodLabel(removed.method), amount: this.money(removed.amount) }));\n }\n\n // ── Allocation ──\n protected onAllocationMode(value: string | null): void {\n this.allocationMode.set(value ?? this.defaultAllocationMode());\n }\n protected isTicked(id: string): boolean { return id in this.selectedCharges(); }\n protected toggleCharge(charge: PayableCharge, checked: boolean): void {\n this.allocationTouched.set(true);\n this.selectedCharges.update(current => {\n const next = { ...current };\n if (checked) next[charge.id] = defaultChargeAmount(charge, current, this.totalPayment());\n else delete next[charge.id];\n return next;\n });\n }\n protected setChargeAmount(id: string, value: number | string | null): void {\n this.allocationTouched.set(true);\n this.selectedCharges.update(current => ({ ...current, [id]: typeof value === 'number' ? value : null }));\n }\n protected chargeDescription(charge: PayableCharge): string {\n return [charge.description, charge.dueDate ? this.labels.t('paymentSidePanel.dueOn', { date: formatDueDate(charge.dueDate, this.labels.locale()) }) : '', this.labels.t('paymentSidePanel.balanceAmount', { amount: this.money(charge.balanceDue) })].filter(Boolean).join(' · ');\n }\n\n // ── Manual submit ──\n private referenceFor(method: string): string | null {\n const kind = referenceKind(method, false);\n if (!kind) return null;\n const value = this.reference().trim();\n return value || null;\n }\n\n private buildEntries(): PaymentEntry[] {\n const entries: PaymentEntry[] = this.splitEntries().map(e => ({ paymentMethod: e.method, amount: e.amount, reference: e.reference || null, sendReceipt: false }));\n if (this.amountValid() && this.method()) {\n entries.push({ paymentMethod: this.method(), amount: roundMoney(this.amount() as number), reference: this.referenceFor(this.method()), sendReceipt: this.sendReceipt() });\n }\n return entries;\n }\n\n /** The payload the host receives, or `null` when there is nothing valid to record. */\n buildPayload(): RecordPaymentPayload | null {\n const entries = this.buildEntries();\n if (!entries.length || !this.receivedDate()) return null;\n entries.forEach((e, i) => { e.sendReceipt = i === entries.length - 1 && this.sendReceipt(); });\n const split = entries.length > 1;\n return {\n amount: sumMoney(entries.map(e => e.amount)),\n paymentMethod: split ? 'SPLIT' : entries[0].paymentMethod,\n receivedDate: this.receivedDate(),\n reference: split ? null : entries[0].reference,\n notes: this.note().trim() || null,\n sendReceipt: this.sendReceipt(),\n entries,\n split,\n ...this.allocationPayload(),\n };\n }\n\n protected onPrimary(): void {\n if (this.kind() === 'live') this.pluginPrimary()?.onClick();\n else void this.submit();\n }\n\n async submit(): Promise<void> {\n if (this.submitting() || this.busy() || this.kind() === 'live' || this.kind() === 'terminal') return;\n this.touched.set(true);\n if (this.hasInvalid()) return;\n const payload = this.buildPayload();\n const record = this.recordPayment();\n if (!record || !payload) {\n const message = !record ? this.labels.t('paymentSidePanel.notConfigured') : this.labels.t('paymentSidePanel.enterAmountToRecord');\n this.submitError.set(message);\n this.outcome.emit({ kind: 'failed', stage: 'record', message });\n return;\n }\n this.submitting.set(true);\n this.submitError.set('');\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecording'));\n try {\n await callHost(() => record(payload));\n } catch (err) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.recordFailed'));\n this.dropPostedEntries(err, payload);\n this.submitError.set(message);\n this.submitting.set(false);\n this.outcome.emit({ kind: 'failed', stage: 'record', message });\n return;\n }\n this.submitting.set(false);\n const result: RecordPaymentResult = { type: payload.split ? 'split' : 'manual', paymentMethod: payload.paymentMethod, amount: payload.amount };\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecorded'));\n this.outcome.emit({ kind: payload.split ? 'split-recorded' : 'recorded', result });\n this.recorded.emit(result);\n }\n\n /**\n * A host that posts the entries one by one can tell the panel how many went through before a failure: `throw { message, postedEntries: 1 }`.\n * Those first entries are removed, so a retry does not post them again.\n */\n private dropPostedEntries(err: unknown, payload: RecordPaymentPayload): void {\n const posted = (err as { postedEntries?: unknown } | null)?.postedEntries;\n if (typeof posted !== 'number' || !Number.isInteger(posted) || posted < 1) return;\n const count = Math.min(posted, payload.entries.length);\n const splitCount = this.splitEntries().length;\n this.splitEntries.update(list => list.slice(Math.min(count, splitCount)));\n if (count > splitCount) { this.amount.set(null); this.method.set(''); this.reference.set(''); this.touched.set(false); }\n }\n\n // ── Plugin context ──\n private buildContext(): PaymentMethodContext {\n const amount = this.amountValid() ? (this.amount() as number) : null;\n const method = this.method();\n return {\n method, amount, receivedDate: this.receivedDate(), note: this.note().trim(), allocation: this.allocationPayload(), currency: this.currency(),\n valid: !this.hasInvalid() && !!this.receivedDate() && amount != null,\n validate: () => { this.touched.set(true); return !this.hasInvalid() && !!this.receivedDate() && this.amountValid(); },\n reset: () => { this.runCancelHook(); this.init(); },\n complete: result => this.completeFromPlugin(method, amount, result),\n setBusy: busy => this.pluginBusy.set(busy),\n setPrimary: button => this.pluginPrimary.set(button),\n setExclusive: on => this.exclusive.set(on),\n onCancel: fn => { this.cancelHook = fn; },\n setCloseGuard: fn => { this.closeGuard = fn; },\n report: (code, extra) => { if (this.destroyed) return; this.verificationReported = code === 'verification'; this.outcome.emit({ kind: 'plugin', method, code, ...(extra?.result ? { result: extra.result } : {}), ...(extra?.message ? { message: extra.message } : {}), ...(extra?.attemptKey ? { attemptKey: extra.attemptKey } : {}), ...(extra?.paid ? { paid: extra.paid } : {}) }); },\n announce: text => this.announcement.set(text),\n };\n }\n\n private completeFromPlugin(method: string, snapshotAmount: number | null, partial?: Partial<RecordPaymentResult>): void {\n if (this.completed || this.destroyed) return;\n this.completed = true;\n this.cancelHook = null;\n this.closeGuard = null;\n this.pluginBusy.set(false);\n const result: RecordPaymentResult = { type: partial?.type ?? 'manual', paymentMethod: partial?.paymentMethod ?? method, amount: partial?.amount ?? snapshotAmount ?? 0, ...(partial?.processor ? { processor: partial.processor } : {}) };\n // `recorded` is still emitted (the host closes its panel and refreshes on it), but a bank payment waiting for the payer's verification has NOT started: it is announced as such, never as recorded.\n this.announcement.set(this.labels.t(this.verificationReported ? 'paymentSidePanel.verificationRecorded' : 'paymentSidePanel.announceRecorded'));\n this.outcome.emit({ kind: 'plugin', method, code: 'complete', result });\n this.recorded.emit(result);\n }\n\n // ── Terminal ──\n private resetTerminal(): void {\n this.stopPolling();\n this.stopReaderRefresh();\n if (this.successTimer) { clearTimeout(this.successTimer); this.successTimer = null; }\n this.pendingTerminalResult = null;\n this.terminalContext = null;\n this.retryContext = null;\n this.readers.set([]);\n this.readersLoaded.set(false);\n this.loadingReaders.set(false);\n this.readersError.set('');\n this.readerId.set('');\n this.terminalPhase.set('idle');\n this.terminalError.set('');\n this.sendingToReader.set(false);\n this.retryIntentId.set('');\n this.retrying.set(false);\n }\n\n private startTerminalSession(): void {\n void this.loadReaders(false);\n }\n\n protected refreshReaders(): void { void this.loadReaders(false); }\n\n private async loadReaders(silent: boolean): Promise<void> {\n const list = this.listReaders();\n if (!list) return;\n const session = this.session;\n if (!silent) { this.loadingReaders.set(true); this.readersError.set(''); }\n try {\n const readers = (await callHost(() => list())) ?? [];\n if (session !== this.session) return;\n this.readers.set(readers);\n this.readersLoaded.set(true);\n if (readers.length === 1 && !this.readerId()) this.readerId.set(readers[0].id);\n if (this.readerId() && !readers.some(r => r.id === this.readerId()) && this.terminalPhase() === 'idle') this.readerId.set('');\n } catch (err) {\n if (!silent && session === this.session) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.couldNotLoadReaders'));\n this.readersError.set(message);\n this.outcome.emit({ kind: 'failed', stage: 'readers', message });\n }\n } finally {\n if (!silent && session === this.session) this.loadingReaders.set(false);\n }\n if (session === this.session && this.kind() === 'terminal') this.scheduleReaderRefresh();\n }\n\n private scheduleReaderRefresh(): void {\n this.stopReaderRefresh();\n this.refreshTimer = setTimeout(() => {\n this.refreshTimer = null;\n if (this.kind() === 'terminal' && this.open()) void this.loadReaders(true);\n }, this.readerRefreshMs());\n }\n\n private stopReaderRefresh(): void {\n if (this.refreshTimer) { clearTimeout(this.refreshTimer); this.refreshTimer = null; }\n }\n\n private terminalBase(): TerminalStartContext | null {\n const amount = this.amount();\n if (!this.amountValid() || !this.readerId() || !this.receivedDate()) return null;\n return { readerId: this.readerId(), amount: amount as number, receivedDate: this.receivedDate(), notes: this.note().trim() || null, ...this.allocationPayload() };\n }\n\n async sendToReader(): Promise<void> {\n const start = this.startTerminalPayment();\n if (!start || this.sendingToReader() || this.terminalPhase() !== 'idle') return;\n this.touched.set(true);\n const base = this.terminalBase();\n if (!base || this.hasInvalid() || this.selectedReader()?.status !== 'online') return;\n const session = this.session;\n this.sendingToReader.set(true);\n this.terminalError.set('');\n let started: TerminalStartResult;\n try {\n started = await callHost(() => start(base));\n } catch (err) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.failedSendToReader'));\n if (session !== this.session) return;\n this.sendingToReader.set(false);\n this.terminalError.set(message);\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n this.outcome.emit({ kind: 'failed', stage: 'terminal', message });\n return;\n }\n if (session !== this.session) {\n // The panel was closed or reset while the reader was being armed: disarm it again.\n if (started?.paymentIntentId) this.fireCancelReader(base.readerId);\n return;\n }\n this.sendingToReader.set(false);\n if (!started?.paymentIntentId) {\n this.terminalError.set(this.labels.t('paymentSidePanel.readerDidNotAccept'));\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n return;\n }\n this.terminalAmount.set(base.amount);\n this.terminalContext = { ...base, paymentIntentId: started.paymentIntentId };\n this.terminalPhase.set('waiting');\n this.announcement.set(this.labels.t('paymentSidePanel.announceWaiting'));\n this.focusLater('[data-testid=\"psp-terminal-cancel\"] button');\n this.startPolling(started.paymentIntentId);\n }\n\n private startPolling(paymentIntentId: string): void {\n this.stopPolling();\n const token = ++this.pollToken;\n const every = Math.max(1, this.terminalPollMs());\n const maxPolls = Math.max(1, Math.ceil(this.terminalTimeoutMs() / every));\n let polls = 0;\n const step = (): void => {\n this.pollTimer = setTimeout(async () => {\n this.pollTimer = null;\n if (token !== this.pollToken) return;\n polls++;\n let status: string | null = null;\n const fetchStatus = this.terminalStatus();\n if (fetchStatus) {\n try { status = (await callHost(() => fetchStatus(paymentIntentId)))?.status ?? null; } catch { /* keep trying until the timeout */ }\n }\n if (token !== this.pollToken) return;\n const verdict = terminalVerdict(status);\n if (verdict === 'succeeded') {\n this.stopPolling();\n if (this.terminalContext) await this.confirmTerminal(this.terminalContext);\n return;\n }\n if (verdict === 'canceled' || verdict === 'declined') {\n this.stopPolling();\n this.endWaiting(verdict === 'canceled' ? this.labels.t('paymentSidePanel.paymentCancelled') : this.labels.t('paymentSidePanel.cardDeclined'));\n return;\n }\n if (polls >= maxPolls) {\n this.stopPolling();\n const readerId = this.terminalContext?.readerId;\n if (readerId) this.fireCancelReader(readerId);\n this.endWaiting(terminalTimeoutText(this.terminalTimeoutMs()));\n return;\n }\n step();\n }, every);\n };\n step();\n }\n\n private stopPolling(): void {\n this.pollToken++;\n if (this.pollTimer) { clearTimeout(this.pollTimer); this.pollTimer = null; }\n }\n\n private endWaiting(message: string): void {\n this.terminalPhase.set('idle');\n this.terminalContext = null;\n this.terminalError.set(message);\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n }\n\n private async confirmTerminal(context: TerminalConfirmContext): Promise<void> {\n const session = this.session;\n this.terminalPhase.set('confirming');\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecording'));\n const confirm = this.confirmTerminalPayment();\n const result: RecordPaymentResult = { type: 'manual', paymentMethod: PAYMENT_METHOD.CARD_PRESENT, amount: context.amount };\n try {\n if (confirm) await callHost(() => confirm(context));\n } catch (err) {\n const message = hostErrorMessage(err, this.labels.t('paymentSidePanel.succeededNotRecorded'));\n this.outcome.emit({ kind: 'failed', stage: 'terminal', message });\n if (session !== this.session) return; // closed meanwhile: the failure was reported, there is no screen to update\n this.terminalPhase.set('idle');\n // The terminal method left the list while the retry ran (already reported as failed): nothing to retry on screen, so nothing stays locked.\n if (this.kind() !== 'terminal') return;\n this.retryIntentId.set(context.paymentIntentId);\n this.retryContext = context;\n this.terminalError.set(message);\n this.focusLater('[data-testid=\"psp-terminal-error-wrap\"]');\n return;\n }\n if (session !== this.session) {\n // Closed while the payment was being recorded: it IS recorded, so the host hears about it now (no screen state, no timer).\n this.outcome.emit({ kind: 'terminal-paid', result });\n this.recorded.emit(result);\n return;\n }\n this.retryIntentId.set('');\n this.retryContext = null;\n this.terminalPhase.set('success');\n this.pendingTerminalResult = result;\n const delay = this.terminalSuccessDelayMs();\n if (delay > 0) this.successTimer = setTimeout(() => { this.successTimer = null; this.finishTerminal(); }, delay);\n else this.finishTerminal();\n }\n\n /** Repeats the recording for the payment the reader already took, with the amount that was charged (not the form's current values). */\n protected async retryRecording(): Promise<void> {\n const context = this.retryContext;\n if (this.retrying() || !context) return;\n const session = this.session;\n this.retrying.set(true);\n this.terminalError.set('');\n await this.confirmTerminal(context);\n if (session === this.session) this.retrying.set(false); // a retry of a closed session must not clear the flag of the reopened session's own retry\n }\n\n private finishTerminal(): void {\n const result = this.pendingTerminalResult;\n if (!result) return;\n this.pendingTerminalResult = null;\n this.announcement.set(this.labels.t('paymentSidePanel.announceRecorded'));\n this.outcome.emit({ kind: 'terminal-paid', result });\n this.recorded.emit(result);\n }\n\n protected cancelTerminalPayment(): void {\n const readerId = this.readerId();\n this.stopPolling();\n this.terminalPhase.set('idle');\n this.terminalContext = null;\n this.announcement.set(this.labels.t('paymentSidePanel.readerPaymentCancelled'));\n this.focusLater('[data-testid=\"psp-terminal-send\"] button');\n if (readerId) this.fireCancelReader(readerId);\n }\n\n private cancelTerminalIfWaiting(): void {\n if (this.terminalPhase() === 'waiting') this.cancelTerminalPayment();\n else { this.stopPolling(); }\n }\n\n /** Moves focus after the next render (the control that had it was just removed from the DOM). */\n private focusLater(selector: string): void {\n afterNextRender(() => this.hostEl.nativeElement.querySelector<HTMLElement>(selector)?.focus(), { injector: this.injector });\n }\n\n private fireCancelReader(readerId: string): void {\n const cancel = this.cancelTerminal();\n if (!cancel) return;\n callHost(() => cancel(readerId)).catch(() => { /* best effort */ });\n }\n}\n","import { isDevMode } from '@angular/core';\n\n/**\n * Development help for the payment components: the offline layer answered a charge request with its synthetic \"queued\" 202, so the request is STILL SAVED on the device and would be replayed after\n * reconnecting (with the old token). Payment routes belong in `blockOffline` (`blockPaymentsOffline`); the backend also dedupes a replay by `attemptKey`. Logs once per page, in development mode only.\n */\nlet queuedPaymentWarned = false;\nexport function warnQueuedPayment(): void {\n if (!isDevMode() || queuedPaymentWarned) return;\n queuedPaymentWarned = true;\n console.error('A payment request was QUEUED by the offline layer and may be replayed after reconnecting: list your payment routes in blockOffline with blockPaymentsOffline().');\n}\n\n/** Specs only: warn again. This file is NOT re-exported by the public entry (only `warnQueuedPayment` is). */\nexport function resetQueuedPaymentWarning(): void { queuedPaymentWarned = false; }\n\n","import { DestroyRef, InjectionToken, computed, effect, isDevMode, signal, untracked } from '@angular/core';\nimport { callHost, type HostResult } from '../payment-side-panel/payment-side-panel.models';\nimport type { UiLabelKey } from '@forgeroute/ui/core';\n\n/**\n * Duplicate-payment protection shared by every payment form of the library (Stripe, Square, QuickBooks forms and the payment-panel plugins).\n *\n * One `PaymentAttempt` per form instance holds, in signals: the SYNCHRONOUS in-flight lock, the ATTEMPT KEY (an opaque idempotency key the host sends to its backend with the charge),\n * the UNKNOWN state (timeouts, going offline mid-flight, host-reported ambiguity) with bounded status polling through the host's `checkStatus`, the OFFLINE state and the PAID lock.\n * It never charges and never retries by itself: it only decides whether the form may start an attempt and what the screen says.\n */\nexport type PaymentStatusAnswer = 'succeeded' | 'failed' | 'not_found' | 'unknown' | 'in_flight' | 'awaiting_verification';\n\n/**\n * The host's status check: asks ITS backend for the state of the attempt with this key (`GET /payments/attempts/{key}`). A rejection or an answer slower than `statusCheckTimeoutMs` counts as\n * `'unknown'`. `'awaiting_verification'` = a bank payment that has NOT started because the payer still has to verify the micro-deposits (stays locked and unknown, shows the verification text, sets `awaitingVerification`);\n * `'in_flight'` = the payment IS processing (after the verification, or any other running request: clears `awaitingVerification` and shows the \"Checking your payment\" text). **A key whose request may still be running must answer `'unknown'` / `'in_flight'`, never `'failed'`**: a `'failed'` answer unlocks the form with a NEW key, so a late-landing original\n * request would become a second charge. `'not_found'` means \"the backend has definitively never seen this key\": the library only believes it once the attempt is older than the request timeout\n * plus the fail grace (a slow original request may still be on its way), then unlocks with a new key. While the attempt's own request is unsettled `'failed'` / `'not_found'` are ignored for a hard\n * maximum counted from the moment it became unknown; an attempt whose host charge may still be running (`host_silent`, `host`) is given the request timeout plus the grace counted from that\n * moment too, and an attempt adopted from a reload or another tab the request timeout plus the grace counted from the START of the attempt. The request timeout is the one of the form's own request.\n */\nexport type CheckPaymentStatusFn = (attemptKey: string) => HostResult<PaymentStatusAnswer>;\n\n/** Why a new attempt was not started: another one is running (`locked`), the payable is paid (`paid`), the outcome of an earlier attempt is unknown (`unknown`), no connection (`offline`). */\nexport type PaymentAttemptRefusal = 'locked' | 'paid' | 'unknown' | 'offline';\n\nexport type PaymentAttemptOutcomeKind = 'succeeded' | 'failed' | 'unknown' | 'refused' | 'pending';\n\n/**\n * The unified outcome event of a payment form: `reason` is `timeout`, `microdeposits` (a bank payment waits for the payer to verify micro-deposits: unknown-until-verified, never paid), `offline`, `host`, `host_error`, `host_silent`, `status_check`, `error`, `auth_abandoned`, `paid`, `reload`, `other_tab`, `token`,\n * `duplicate_suspected` (an attempt that started after an older one turned out paid ALSO produced a payment: the host must resolve the duplicate),\n * `setup_action` (a SetupIntent that still `requires_action` after `confirmSetup`: the status check decides), `unexpected_status` (an intent state that proves nothing: no intent, an unexpected status, a SetupIntent without a payment method id; the status check decides),\n * `setup_processing` (a protected SetupIntent that is `processing`, e.g. a bank debit: it can still fail, so it is unknown until the status check says it was saved), `return` (the intent a redirect brought back decided the attempt: `succeeded` /\n * `failed`), `return_action` (the redirect brought back an intent that proves nothing, e.g. an unknown status: unknown, the status check decides), `start_over` (the payer chose \"Start over\": a `failed` outcome with a new key), `no_result`, ...\n */\nexport interface PaymentAttemptOutcome {\n kind: PaymentAttemptOutcomeKind;\n attemptKey: string;\n reason?: string;\n /**\n * Only on a `succeeded` outcome that the form did NOT see happen itself (`other_tab`: another tab / page load paid; a late success of an older attempt; a status check that found it paid after the\n * form had moved on): the amount (major units) and method the PAID attempt was started with, so a host that wants to reconcile it can read them. Absent otherwise.\n */\n amount?: number | null;\n method?: string;\n}\n\n/** What a step of an attempt reports: `success` (money moved / payment exists), `failure` (a DEFINITIVE refusal: new key), `unknown` (ambiguous: key kept, locked), `pending` (a challenge / the host's charge is in progress: lock stays), `released` (failed BEFORE any charge request: unlock, key kept). */\nexport type PaymentAttemptKind = 'success' | 'failure' | 'unknown' | 'pending' | 'released';\nexport interface PaymentAttemptResult<T> { kind: PaymentAttemptKind; value?: T; reason?: string }\n\n/** The payments service answers a replay of a FAILED attempt with this code (409): nothing was charged, the attempt can never complete, a NEW attempt key is needed. A definitive failure that moves the epoch. */\nconst FAILED_REPLAY_CODE = 'attempt_failed_use_new_key';\n\n/**\n * Every machine-readable code of the payments service's money endpoints, mapped explicitly (three groups below). SOURCE: host-kit/contract/payment-errors.json of the forgeroute-payments service (the library\n * cannot import it: these tables repeat its codes, and `payment-errors.contract.spec.ts` embeds a verbatim copy and fails when a code has no row; a new code there must be added here).\n * - NO CHARGE was made (`not_sent`: release, the key is kept): `events_backlog` (new payments are paused), `exceeds_amount_due`, `already_charged_today`, `merchant_not_ready`, `reconnect_required` and\n * `processor_account_changed` (the merchant's processor connection needs attention), `reference_changed` (the balance changed since the link was made), `link_in_use` and `link_already_paid` (payment links),\n * `reader_busy` (a card reader that still holds a payment: the DELETE of the reader was refused, nothing charged);\n * - the attempt exists or runs (`unknown`: look it up by its key, never start another): `payment_in_flight`, `request_in_progress`, `duplicate_suspected` (an identical payment was made moments ago),\n * `idempotency_in_progress`, `idempotency_key_reused`, `idempotency_error`, `payment_intent_unexpected_state`;\n * - the request FAILED for good (`failure`, see {@link PAYMENT_FAILURE_CODES}): `attempt_failed_use_new_key` (a replay of a FAILED attempt, the epoch moves), the capture codes, `link_expired`, `link_cancelled`,\n * `not_supported_by_processor`, `location_required` (Square connect: the seller has several locations, a definitive 400), and four of the six verify-microdeposits codes (`verification_amounts_mismatch`,\n * `verification_attempts_exceeded`, `verification_timeout`, `verification_failed`);\n * - `not_awaiting_verification` and `verification_rate_limited` (verify-microdeposits call only) are `unknown` too: the payment may already be verified / processing, or the try only has to wait.\n */\nexport const PAYMENT_NO_CHARGE_CODES: readonly string[] = [\n 'events_backlog', 'exceeds_amount_due', 'already_charged_today', 'merchant_not_ready', 'reconnect_required', 'processor_account_changed', 'reference_changed', 'link_in_use', 'link_already_paid',\n 'reader_busy', // DELETE /v1/terminal/readers/:id refused: the reader still holds a payment, nothing charged (no charge-starting call emits it)\n];\n/**\n * Codes that are a DEFINITIVE failure of the request, never unknown: the failed-attempt replay (the epoch moves), the capture codes of the staff API (`already_captured`, `exceeds_authorized`, `not_capturable`, 409) and the payment-link /\n * processor refusals (`link_expired`, `link_cancelled` = 410, `not_supported_by_processor` = 400), the four definitive verify-microdeposits codes and `location_required` (Square connect, 400). Source: host-kit/contract/payment-errors.json.\n */\nexport const PAYMENT_FAILURE_CODES: readonly string[] = [\n 'attempt_failed_use_new_key', 'already_captured', 'exceeds_authorized', 'not_capturable', 'link_expired', 'link_cancelled', 'not_supported_by_processor',\n // the verify-microdeposits call only (never a refusal of the pay form): the verification failed for good or cannot be tried any more\n // (`not_awaiting_verification` and `verification_rate_limited` are NOT here: the payment may have been verified already / the try only has to wait, so they are unknown, see AMBIGUOUS_HOST_CODES)\n 'verification_amounts_mismatch', 'verification_attempts_exceeded', 'verification_timeout', 'verification_failed',\n 'location_required', // Square connect (merchant setup): the seller has several locations, a definitive 400: the merchant must pick one\n];\nconst FAILURE_HOST_CODES = new Set(PAYMENT_FAILURE_CODES);\nconst AMBIGUOUS_HOST_CODES = new Set([\n 'payment_in_flight', 'request_in_progress', 'duplicate_suspected', 'idempotency_in_progress', 'idempotency_key_reused', 'idempotency_error', 'payment_intent_unexpected_state',\n // verify-microdeposits call only: the payment may already be verified / processing (read its state), or the try only has to wait (retryAfterSeconds): never a definitive failure\n 'not_awaiting_verification', 'verification_rate_limited',\n]);\nconst NO_CHARGE_HOST_CODES = new Set(PAYMENT_NO_CHARGE_CODES);\n\n/** Is this host error the payments service's \"this attempt failed before, use a new attemptKey\" answer (code `attempt_failed_use_new_key`)? */\nexport function isAttemptFailedReplay(error: unknown): boolean {\n const e = error as { code?: unknown; error?: { code?: unknown } | null } | null | undefined;\n return [e?.code, e?.error?.code].some(c => typeof c === 'string' && c.toLowerCase() === FAILED_REPLAY_CODE);\n}\n\nexport { warnQueuedPayment } from './queued-payment-warning';\n\n/** The shared, translated text of the service codes a payer must read in OUR words (the service's own message is English): code -> label key. Other codes keep the service's message. */\nconst HOST_CODE_LABELS: Record<string, UiLabelKey> = {\n reference_changed: 'paymentAttempt.referenceChanged', link_in_use: 'paymentAttempt.linkInUse', link_already_paid: 'paymentAttempt.linkAlreadyPaid',\n link_expired: 'paymentAttempt.linkExpired', link_cancelled: 'paymentAttempt.linkCancelled', not_supported_by_processor: 'paymentAttempt.notSupported',\n};\n/** The codes whose answer will not change on a retry (the balance changed, the link was paid / ended / cancelled, the processor cannot do it): the payment panels keep the text and turn Pay off instead of looping. */\nconst FINAL_HOST_CODES = new Set(['reference_changed', 'link_already_paid', 'link_expired', 'link_cancelled', 'not_supported_by_processor']);\nconst hostCodesOf = (error: unknown): string[] => {\n const e = error as { code?: unknown; error?: { code?: unknown } | null } | null | undefined;\n return [e?.code, e?.error?.code].filter((c): c is string => typeof c === 'string').map(c => c.toLowerCase());\n};\n/**\n * Is this host error the 409 `payment_in_flight` of an open payment that waits for the payer to verify bank micro-deposits (the service adds `awaitingVerification: true` to the error detail; the browser JSON of\n * an app passes it through as `awaitingVerification`, read from the error, its `error` body or a `detail` object)? Then the payment has NOT started: the text is the verification one, not \"already being processed\".\n */\nexport function isAwaitingVerificationError(error: unknown): boolean {\n if (!hostCodesOf(error).includes('payment_in_flight')) return false;\n const e = error as { awaitingVerification?: unknown; detail?: { awaitingVerification?: unknown } | null; error?: { awaitingVerification?: unknown; detail?: { awaitingVerification?: unknown } | null } | null } | null | undefined;\n return [e?.awaitingVerification, e?.detail?.awaitingVerification, e?.error?.awaitingVerification, e?.error?.detail?.awaitingVerification].some(v => v === true);\n}\n/** The label key of the translated text for a host error that carries one of the payment-link / reference codes (or a `payment_in_flight` that awaits bank verification), else `null` (the service's own message is shown). */\nexport function paymentErrorLabelKey(error: unknown): UiLabelKey | null {\n if (isAwaitingVerificationError(error)) return 'paymentAttempt.awaitingVerification';\n for (const code of hostCodesOf(error)) if (HOST_CODE_LABELS[code]) return HOST_CODE_LABELS[code];\n return null;\n}\n/** Is this host error one a retry cannot change (see {@link FINAL_HOST_CODES})? */\nexport function isFinalPaymentRefusal(error: unknown): boolean { return hostCodesOf(error).some(c => FINAL_HOST_CODES.has(c)); }\n\n/**\n * Classifies a failed HOST call (the charge request) for `run()`:\n * - `'not_sent'`: nothing was charged: the request never left (the offline layer refused it: `OfflineBlockedError` / `offlineBlocked: true`) or the payments service refused it with one of its NO-CHARGE codes\n * (`events_backlog`, `exceeds_amount_due`, `already_charged_today`, `merchant_not_ready`, `reconnect_required`, `processor_account_changed`, `reference_changed`, `link_in_use`, `link_already_paid`, `reader_busy`, also as a `409`): release with the key kept, show the message;\n * - `'failure'` for the codes of {@link PAYMENT_FAILURE_CODES} (`attempt_failed_use_new_key`: a replay of a FAILED attempt, even as a `409`, the epoch moves so the next click derives a new key; the capture codes\n * `already_captured` / `exceeds_authorized` / `not_capturable`; `link_expired`, `link_cancelled`, `not_supported_by_processor`, `location_required`, and four verify-microdeposits codes: see the list);\n * - `'unknown'`: it may have reached the processor: no answer (status `0`, a network `TypeError`, an abort / timeout), `408`, `425`, `429`, `5xx`, **any other `409`** (a service that answers \"already in flight / duplicate\n * suspected / idempotency in progress\" must never make the payer pay again), a body or error `code` naming an idempotency / in-flight conflict, an error flagged `unknown: true`, and **an error that carries NO numeric\n * status** (a wrapped `Error`, an error object of a client library): nothing proves it was refused, so only a recognised definitive code decides it;\n * - `'failure'`: the host definitively refused (another `4xx`). The status is read from `status` or `response.status`.\n */\nexport function classifyHostError(error: unknown): 'failure' | 'unknown' | 'not_sent' {\n const e = error as { status?: unknown; response?: { status?: unknown } | null; name?: unknown; unknown?: unknown; offlineBlocked?: unknown; code?: unknown; error?: { code?: unknown } | null } | null | undefined;\n if (e && (e.offlineBlocked === true || e.name === 'OfflineBlockedError')) return 'not_sent';\n if (e && e.unknown === true) return 'unknown';\n const codes = [e?.code, e?.error?.code].filter((c): c is string => typeof c === 'string').map(c => c.toLowerCase());\n if (codes.some(c => FAILURE_HOST_CODES.has(c))) return 'failure'; // a replay of a FAILED attempt (even as a 409), a capture refusal, an ended link, an unsupported processor: definitive (a failed replay also moves the epoch)\n if (codes.some(c => NO_CHARGE_HOST_CODES.has(c))) return 'not_sent'; // the service refused BEFORE any charge (even as a 409)\n if (codes.some(c => AMBIGUOUS_HOST_CODES.has(c))) return 'unknown';\n const status = typeof e?.status === 'number' ? e.status : typeof e?.response?.status === 'number' ? e.response.status : null;\n if (status !== null) return status === 0 || status === 408 || status === 409 || status === 425 || status === 429 || status >= 500 ? 'unknown' : 'failure';\n return 'unknown'; // no numeric status (a TypeError, an abort, a wrapped Error): nothing proves the request was refused\n}\n\n/**\n * Did the offline layer answer a charge request with its synthetic \"queued for later\" response (`@forgeroute/ui/offline`: HTTP 202 whose body carries `_offline: true`) instead of sending it? Such an\n * answer is NOT a payment: nothing reached the processor, so the form must release (key kept) and say so. A genuine 202 from a backend (\"accepted, still processing\") has no `_offline` marker and is not\n * affected. Checks the result itself and, for a host that hands back the response object, its `body`.\n */\nexport function wasQueuedOffline(result: unknown): boolean {\n const r = result as { _offline?: unknown; body?: { _offline?: unknown } | null } | null | undefined;\n if (!r || typeof r !== 'object') return false;\n return r._offline === true || (!!r.body && typeof r.body === 'object' && r.body._offline === true);\n}\n\nexport type PaymentAttemptRun<T> = { refused: PaymentAttemptRefusal } | (PaymentAttemptResult<T> & { refused?: undefined; late?: undefined });\n\n/** Defaults (ms): the status poll interval, how long it polls before offering \"Check again\", how long one request may take before it counts as unknown, and the status check's own timeout / fail grace. */\nexport const PAYMENT_STATUS_POLL_MS = 3000;\nexport const PAYMENT_STATUS_POLL_MAX_MS = 90_000;\nexport const PAYMENT_REQUEST_TIMEOUT_MS = 60_000;\nexport const PAYMENT_STATUS_CHECK_TIMEOUT_MS = 10_000;\nexport const PAYMENT_STATUS_FAIL_GRACE_MS = 60_000;\n/** While the attempt's own request is unsettled a status `failed` / `not_found` is ignored for this long after the attempt became unknown. */\nexport const PAYMENT_STATUS_HARD_MAX_MS = 180_000;\n/** One request may take this long while a 3-D Secure challenge or the Square bank window is open (the main request timeout is replaced, not added). */\nexport const PAYMENT_AUTH_TIMEOUT_MS = 300_000;\n/** A token-only form whose host never reports (markSucceeded / markFailed / markUnknown / markNotCharged) becomes unknown after this long. */\nexport const PAYMENT_HOST_SILENCE_MS = 120_000;\n/** An undecided attempt marker older than this is ignored (the page that wrote it is long gone). */\nexport const PAYMENT_ATTEMPT_MARKER_TTL_MS = 30 * 60_000;\n/** An `unknown` marker of a bank payment that waits for the payer to verify micro-deposits lives this long (10 days: the verification window of a bank payment), so a page load meanwhile still does not offer Pay. Cleared earlier by any decision (a status check `succeeded` / `failed` / `not_found`, a start over, `markFailed`). */\nexport const PAYMENT_ATTEMPT_VERIFICATION_TTL_MS = 10 * 86_400_000;\n/** A tombstone (the attempt was decided: released / failed / succeeded) older than this is ignored. */\nexport const PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS = 2 * 60_000;\n/** The record of a SUCCEEDED attempt (`ui-payment-attempt:<payable>#paid`) is kept this long and locks the payable as PAID in every form that loads meanwhile (the tombstone only covers the first 2 minutes). It is never consumed: a second payment of the same payable is `resetPaid()` or a NEW `payableRef`. */\nexport const PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS = 24 * 60 * 60_000;\n\n/**\n * Where the opaque attempt marker lives (default `localStorage`, shared by every tab of the browser profile; falls back to `sessionStorage`, then `null`). Replace it in specs. It holds ONLY the\n * opaque marker `{ key, startedAt, state, owner, amount, method }` of an UNDECIDED attempt (replaced by a 2-minute tombstone `{ state, key, at, owner }` when it is decided) under\n * `ui-payment-attempt:<payableRef>`, plus one integer epoch under `ui-payment-attempt:<payableRef>#epoch`: never card data, never server data, never a cached response.\n */\nexport const PAYMENT_ATTEMPT_STORAGE = new InjectionToken<() => Storage | null>('PAYMENT_ATTEMPT_STORAGE', {\n providedIn: 'root',\n factory: () => () => {\n try { if (typeof localStorage !== 'undefined') return localStorage; } catch { /* blocked: fall back */ }\n try { return typeof sessionStorage === 'undefined' ? null : sessionStorage; } catch { return null; }\n },\n});\n\nexport const PAYMENT_ATTEMPT_STORAGE_PREFIX = 'ui-payment-attempt:';\n\n/** The opaque marker of an attempt that has started and is not decided yet (shared across tabs and reloads while it lasts). */\nexport interface PaymentAttemptMarker {\n key: string;\n startedAt: number;\n state: 'inflight' | 'unknown';\n /** Random id of the form instance that wrote it (a second instance / tab / reload is not the owner). */\n owner: string;\n amount: number | null;\n method: string;\n /** `microdeposits` = the payment has NOT started and waits for the payer to verify micro-deposits (restored by a reload / another tab; lives {@link PAYMENT_ATTEMPT_VERIFICATION_TTL_MS}). */\n reason?: 'microdeposits';\n}\n\n/** What replaces the marker for 2 minutes when the attempt is decided, so other tabs learn HOW it ended (removing the marker alone says nothing). */\nexport interface PaymentAttemptTombstone {\n state: 'released' | 'failed' | 'succeeded';\n key: string;\n at: number;\n owner: string;\n /** Only on a `succeeded` tombstone: what the paid attempt was started with, so another tab / page load can hand it to a host that reconciles. */\n amount?: number | null;\n method?: string;\n}\n\n/** The record of a succeeded attempt, kept 24 hours under `ui-payment-attempt:<payable>#paid` (local state that MIRRORS a server outcome: it never replaces the backend's own record). */\nexport interface PaymentAttemptPaidRecord {\n key: string;\n amount: number | null;\n method: string;\n at: number;\n owner: string;\n}\n\n/** What a payment-panel plugin forwards to its body, so the HOST can resolve an undecided attempt without a status check (`<ui-square-payment-method #sq>` then `sq.markSucceeded()`). */\nexport interface PaymentAttemptControls {\n markUnknown(): void;\n markSucceeded(): void;\n markFailed(): void;\n markNotCharged(): void;\n /** A deliberate second payment of the payable: forget the paid state, move the epoch (a NEW attempt key). */\n resetPaid(): void;\n}\n\nexport interface PaymentAttemptOptions {\n destroyRef: DestroyRef;\n /** The payable this form pays (a unit balance, an invoice, a reservation): the marker of an undecided attempt is stored under it, and without a host `attemptKey` the key is DERIVED from it. `null` = memory only. */\n payableRef: () => string | null;\n amount: () => number | null;\n method: () => string;\n /** A key the host supplies: used as it is (never generated, never renewed). */\n attemptKey: () => string | null;\n checkStatus: () => CheckPaymentStatusFn | null;\n /** The payable is paid (host re-render, back navigation): every attempt is refused for good. */\n paid: () => boolean;\n /** The host reports an ambiguous result (its own timeout): the form goes to the unknown state while this is true. */\n hostPending?: () => boolean;\n /** A step that is in flight when the connection drops becomes UNKNOWN (default true). A form that only TOKENIZES (no charge yet) turns it off: the token call answers or fails by itself. */\n offlineMidFlight?: boolean;\n pollMs?: () => number;\n pollMaxMs?: () => number;\n /** A status check slower than this counts as `'unknown'` (default 10 s). */\n statusTimeoutMs?: () => number;\n /** An attempt adopted from a reload / another tab, and a `not_found`, is given the request timeout plus this long before a `failed` / `not_found` is believed (default 60 s). */\n failGraceMs?: () => number;\n /** While the attempt's own request is unsettled a `failed` / `not_found` is ignored for this long after the attempt became unknown (default 180 s). */\n statusHardMaxMs?: () => number;\n /**\n * Default true. False (a setup form that saves a payment method and may be used again later): a success does NOT lock the payable for 24 hours. It writes no `#paid` record, does not set `succeeded` / `paidLocked`,\n * ignores the succeeded tombstone and paid record when a new attempt starts or a form mounts, and moves the epoch (the next attempt has a NEW derived key). The `succeeded` outcome is still emitted and an attempt\n * is still never started while another is in flight or unknown. A success that arrives after the form was destroyed or the payable changed also moves the epoch (no tombstone is written). A second `succeed()` with no attempt started in between\n * (a host `markSucceeded()` after `(confirmed)`, a repeated `handleReturn()`) settles nothing again; a late success of a key already reported is silent, and one of ANOTHER key (e.g. an older epoch that answers after a start over and a newer save)\n * is reported once as `unknown` / `duplicate_suspected` for the host to resolve.\n */\n lockAfterSuccess?: () => boolean;\n /** The request timeout is replaced by this while a 3-D Secure challenge / the bank window is open (default 300 s). */\n authTimeoutMs?: () => number;\n /** A token-only form whose host never reports becomes unknown after this long (default 120 s). */\n hostSilenceMs?: () => number;\n storage?: () => Storage | null;\n /** Managed environments where `navigator.onLine === false` is a false negative (captive portal, VPN): do not refuse a click because of it (default false). */\n offlineOverride?: () => boolean;\n /** The clock (specs). */\n now?: () => number;\n onOutcome?: (outcome: PaymentAttemptOutcome) => void;\n onInFlightChange?: (inFlight: boolean) => void;\n onKeyChange?: (key: string) => void;\n}\n\nconst newKey = (): string => {\n const c = typeof crypto !== 'undefined' ? crypto : undefined;\n return c && 'randomUUID' in c ? c.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;\n};\n\n/** A readable, collision-free fragment of a payable reference or method for the derived key. */\nconst keyPart = (value: string): string => value.replace(/[^A-Za-z0-9-]/g, c => `_${c.charCodeAt(0).toString(16)}_`);\n\n/** What a payment attempt starts with: its key, amount, method and payable never follow later input changes. */\ninterface Pinned { key: string; amount: number | null; method: string; at: number; owner: string; ref: string | null }\n\n/** One `run()`: its identity decides whether its result may still touch the shared state. */\ninterface RunInfo { id: number; key: string; ref: string | null; amount: number | null; method: string; settled: boolean; fire: (() => void) | null; timer: ReturnType<typeof setTimeout> | null }\n\nexport class PaymentAttempt {\n /** A step of an attempt is running (set in the SAME synchronous tick as the first click / Enter / programmatic call). */\n readonly inFlight = signal(false);\n /** The outcome of an attempt is not known: Pay stays locked, the screen says \"Checking your payment...\". */\n readonly unknown = signal(false);\n /** A status check is running. */\n readonly checking = signal(false);\n /** The bounded polling gave up: \"Check again\" is offered. */\n readonly pollExpired = signal(false);\n /** A payment of this form succeeded (locks the form until the host resets the payable). */\n readonly succeeded = signal(false);\n /** The token was handed to the host, which is now charging: the screen says \"Waiting for your payment to be confirmed\" until the host reports (or stays silent too long). */\n readonly waitingForHost = signal(false);\n /** The marker could not be written (storage blocked or full): reload / second-tab protection is not active. */\n readonly markerWriteFailed = signal(false);\n readonly offline = signal(typeof navigator !== 'undefined' && navigator.onLine === false);\n /** The browser says offline AND the host did not turn `offlineOverride` on: the click is refused and the offline notice shows. */\n readonly blockedOffline = computed(() => this.offline() && !this.o.offlineOverride?.());\n readonly paidLocked = computed(() => this.o.paid() || this.succeeded());\n /** No new attempt may start. */\n readonly locked = computed(() => this.inFlight() || this.unknown() || this.paidLocked());\n /**\n * A bank payment that needs the payer to verify micro-deposits (reason `microdeposits`): the payment has NOT started and nothing is charged until the payer verifies them. It is an UNKNOWN-until-verified state\n * (locked, the status check decides), never paid; the status block says so in plain words.\n */\n private readonly verifying = signal(false);\n /** Read-only for hosts: only the attempt decides (a `microdeposits` unknown, a stored marker, a status answer). */\n readonly awaitingVerification = this.verifying.asReadonly();\n /** The host gave a status check, so the unknown state can resolve by itself. */\n readonly canCheck = computed(() => !!this.o.checkStatus());\n /** The key, amount, method and payable the running / undecided attempt was STARTED with, `null` when no attempt is undecided. */\n private readonly pinned = signal<Pinned | null>(null);\n readonly pinnedAmount = computed(() => this.pinned()?.amount ?? null);\n readonly pinnedMethod = computed(() => this.pinned()?.method ?? null);\n readonly pinnedRef = computed(() => this.pinned()?.ref ?? null);\n /** Bumped when an attempt of this payable is decided: the next DERIVED key differs from every finished one. */\n private readonly epoch = signal(0);\n private readonly renewTick = signal(0);\n /** The attempt key in effect: the PINNED key of a running / undecided attempt, else the host's, else (with a payableRef) the key derived from payable, amount, method and epoch, else a random one. */\n readonly key = computed(() => { this.renewTick(); return this.pinned()?.key ?? this.resolveKey(); });\n\n private readonly id = newKey();\n private readonly memKeys = new Map<string, string>();\n private destroyed = false;\n private unknownReason: string | null = null;\n private unknownSince = 0;\n private liveRun: RunInfo | null = null;\n private runSeq = 0;\n /** Key of an attempt that started while an OLDER one turned out paid: its own result must not change the paid state and is reported as a suspected duplicate. */\n private watchKey: string | null = null;\n /** Key of the attempt that made the payable paid (a late success with ANOTHER key is a suspected duplicate). */\n private paidKey: string | null = null;\n /** Keys already reported as `duplicate_suspected` (reported once each). */\n private readonly duplicates = new Set<string>();\n /** Only with `lockAfterSuccess` false: a success was already settled and no new attempt began since, so a second `succeed()` (a host `markSucceeded()` after `(confirmed)`, a repeated `handleReturn()`) settles nothing again. Cleared by `begin()`, `resetPaid()` and a payable change. */\n private lastSuccessIdle = false;\n /** Only with `lockAfterSuccess` false: keys whose success was already reported, so a late answer for the same key is silent and a distinct key is reported as `duplicate_suspected`. */\n private readonly reportedKeys = new Set<string>();\n /** The request timeout of the newest `run()` (the status grace is measured against it, not against the default). */\n private requestMs = PAYMENT_REQUEST_TIMEOUT_MS;\n private pollTimer: ReturnType<typeof setTimeout> | null = null;\n private silenceTimer: ReturnType<typeof setTimeout> | null = null;\n private pollElapsed = 0;\n private pollGen = 0;\n private checkRun = 0;\n private hostWasPending = false;\n private lastRef: string | null | undefined = undefined;\n private readonly win = typeof window !== 'undefined' ? window : null;\n private readonly onOffline = (): void => {\n this.offline.set(true);\n if (this.inFlight() && this.o.offlineMidFlight !== false) this.markUnknown('offline');\n };\n private readonly onOnline = (): void => {\n this.offline.set(false);\n if (this.unknown()) void this.checkNow();\n };\n private readonly onStorage = (e: StorageEvent): void => {\n const ref = this.o.payableRef();\n if (!ref || this.destroyed) return;\n if (e.key === this.epochName(ref)) { this.readEpoch(ref); return; }\n if (e.key !== PAYMENT_ATTEMPT_STORAGE_PREFIX + ref) return;\n this.react(this.parseStored(e.newValue));\n };\n /** A frozen / back-forward-cached page missed its storage events: read the shared state again when it comes back. */\n private readonly onResync = (): void => {\n const ref = this.o.payableRef();\n if (!ref || this.destroyed) return;\n this.readEpoch(ref);\n this.react(this.readStored(ref));\n };\n private readonly onVisible = (): void => {\n if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;\n this.onResync();\n };\n\n constructor(private readonly o: PaymentAttemptOptions) {\n this.win?.addEventListener('offline', this.onOffline);\n this.win?.addEventListener('online', this.onOnline);\n this.win?.addEventListener('storage', this.onStorage);\n this.win?.addEventListener('pageshow', this.onResync);\n if (typeof document !== 'undefined') document.addEventListener('visibilitychange', this.onVisible);\n o.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.stopPolling();\n this.clearSilence();\n this.win?.removeEventListener('offline', this.onOffline);\n this.win?.removeEventListener('online', this.onOnline);\n this.win?.removeEventListener('storage', this.onStorage);\n this.win?.removeEventListener('pageshow', this.onResync);\n if (typeof document !== 'undefined') document.removeEventListener('visibilitychange', this.onVisible);\n });\n try { untracked(() => this.readEpoch(o.payableRef())); } catch { /* inputs not readable yet: the payable effect reads it */ }\n effect(() => { const key = this.key(); untracked(() => this.o.onKeyChange?.(key)); });\n effect(() => {\n const pending = this.o.hostPending?.() ?? false;\n untracked(() => {\n if (pending) { this.hostWasPending = true; this.markUnknown('host'); return; }\n // The host says its ambiguity is over. Without a status check nothing else can settle it, so the form leaves the unknown state (the host then reports markSucceeded / markFailed / paid);\n // WITH a status check the check decides and the flag alone changes nothing.\n if (this.hostWasPending && this.unknown() && this.unknownReason === 'host' && !this.o.checkStatus()) this.endUnknown();\n this.hostWasPending = false;\n });\n });\n // The marker follows the payable: a pending marker of THIS payable (a reload, another tab) locks the form in the unknown state; another payable starts clean.\n effect(() => { const ref = this.o.payableRef(); untracked(() => this.onPayableChange(ref)); });\n effect(() => { const check = this.o.checkStatus(); untracked(() => { if (check && this.unknown() && !this.pollTimer && !this.checking() && !this.pollExpired()) this.startPolling(); }); });\n effect(() => { if (this.o.paid()) untracked(() => { this.stopPolling(); const pin = this.pinned(); if (pin) this.removeMarker(pin.ref, pin.key); }); });\n }\n\n /** Which storage protects this payable: `shared` (every tab), `tab` (sessionStorage fallback: this tab only), `none` (blocked). */\n storageScope(): 'shared' | 'tab' | 'none' {\n const store = this.store();\n if (!store) return 'none';\n try { return typeof sessionStorage !== 'undefined' && store === sessionStorage ? 'tab' : 'shared'; } catch { return 'shared'; }\n }\n\n /**\n * Starts an attempt: SYNCHRONOUS, so a second click / Enter / programmatic call in the same tick (or any later one while it runs) is refused. Nothing is sent when it refuses.\n * `locked` (a double click) is silent; `paid`, `unknown` and `offline` also emit a `refused` outcome. The key, amount, method and payable are PINNED here: later input changes never move a running attempt.\n */\n begin(): { ok: true; key: string } | { ok: false; reason: PaymentAttemptRefusal } {\n if (this.destroyed) return { ok: false, reason: 'locked' };\n if (this.paidLocked()) return this.refuse('paid');\n if (this.unknown()) return this.refuse('unknown');\n if (this.inFlight()) return { ok: false, reason: 'locked' };\n if (this.blockedOffline()) return this.refuse('offline');\n const ref = this.o.payableRef();\n this.readEpoch(ref); // another tab may have decided an attempt since the last event: never start with a stale epoch\n this.sweepStale();\n const stored = this.readStored(ref);\n if (this.keepsLock() && stored && stored.type === 'tombstone' && stored.value.state === 'succeeded') { // any owner: this instance's own success counts too once its paid state was reset by a payable round trip\n this.lateSuccess(stored.value.key, 'other_tab', stored.value.amount ?? null, stored.value.method); // another tab paid this payable a moment ago: this idle tab must not charge it again\n return this.refuse('paid');\n }\n if (this.keepsLock() && this.checkPaidRecord(ref)) return this.refuse('paid');\n const foreign = this.foreignMarker();\n if (foreign) { this.adopt(foreign, 'other_tab'); return this.refuse('unknown'); }\n this.lastSuccessIdle = false;\n this.setInFlight(true);\n const pin = this.newPin();\n this.pinned.set(pin);\n // An unlocked form (`lockAfterSuccess` false) intentionally allows a new save after a success. With a HOST-supplied key (no epoch bump on renew) the previous success's tombstone carries the SAME key and the \"never downgrade\" guard of\n // `writeMarker` would refuse this attempt's inflight marker (a reload / second tab during the second save would be unprotected): that spent tombstone is dropped first. Heartbeats keep the guard.\n if (!this.keepsLock() && stored && stored.type === 'tombstone' && stored.value.state === 'succeeded' && stored.value.key === pin.key) {\n const name = this.markerKey(ref);\n const again = this.readStored(ref); // re-read right before removing: a record another tab wrote in the meantime (another key or kind) is never removed\n if (name && again && again.type === 'tombstone' && again.value.state === 'succeeded' && again.value.key === pin.key) { try { this.store()?.removeItem(name); } catch { /* ignore */ } }\n }\n this.writeMarker('inflight');\n const raced = this.foreignMarker(); // two tabs clicking at the same instant: the later write wins, the other one backs off\n if (raced) { this.setInFlight(false); this.pinned.set(null); this.adopt(raced, 'other_tab'); return this.refuse('unknown'); }\n return { ok: true, key: pin.key };\n }\n\n /** The attempt ended BEFORE any charge request (validation, tokenization, buyer verification): unlock, the key is kept. */\n release(): void {\n if (this.destroyed) { this.abandon(); return; }\n if (this.succeeded() && this.pinned()) { this.settleWatched(false); return; }\n this.setInFlight(false);\n this.clearSilence();\n this.waitingForHost.set(false);\n if (this.unknown() && this.unknownReason !== 'host' && this.unknownReason !== 'reload' && this.unknownReason !== 'other_tab' && !this.awaitingVerification()) this.leaveUnknown();\n if (!this.unknown()) { this.endMarker('released'); this.pinned.set(null); }\n }\n\n /** Clears the marker of an attempt that never sent anything, even when the form is already destroyed (a destroyed form must not leave a 30-minute lock behind). */\n abandon(): void {\n const pin = this.pinned();\n if (!pin) return;\n this.clearSilence();\n this.writeTombstone(pin.ref, 'released', pin.key);\n }\n\n /** The host says nothing was sent to the processor (it did not use the token, its call never left): unlock, the key is kept. Only valid for \"NOT SENT\": a retry must find any attempt state the backend holds for the key. */\n markNotCharged(): void {\n if (this.destroyed || this.paidLocked()) return;\n this.stopPolling();\n this.setInFlight(false);\n this.clearSilence();\n this.waitingForHost.set(false);\n this.leaveUnknown();\n this.endMarker('released');\n this.pinned.set(null);\n }\n\n /** The payment succeeded (or exists and is settling): the form locks for this payable. Idempotent. */\n succeed(reason?: string): void {\n if (this.destroyed) return;\n if (this.succeeded()) { this.settleWatched(true); return; }\n if (!this.keepsLock() && !this.pinned() && this.lastSuccessIdle) return; // an unlocked form already settled its success and nothing started since: not a second payment (no phantom outcome, no second epoch bump)\n const key = this.key();\n const pin = this.pinned();\n const ref = pin?.ref ?? this.o.payableRef();\n const amount = pin ? pin.amount : this.o.amount();\n const method = pin?.method ?? this.o.method();\n this.stopPolling();\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.leaveUnknown();\n const lock = this.keepsLock();\n if (lock) { this.succeeded.set(true); this.paidKey = key; } else { this.lastSuccessIdle = true; this.reportedKeys.add(key); }\n this.renew(key, lock ? null : ref); // a success does NOT bump the epoch: a replay of the same key (another tab, a reload) returns the original payment instead of charging again; a form that does not lock (`lockAfterSuccess` false) moves it, the next save has a NEW key\n this.endMarker('succeeded');\n this.writePaidRecord(ref, key, amount, method);\n this.pinned.set(null);\n this.emit({ kind: 'succeeded', attemptKey: key, ...(reason ? { reason } : {}), ...(reason === 'other_tab' ? { amount, method } : {}) });\n }\n\n /**\n * The host starts a deliberate SECOND payment of this payable (an explicit \"pay again\" flow): forgets that this form instance saw a success, removes the succeeded record and tombstone and moves the epoch, so the next\n * attempt has a NEW key. Does nothing against the host's own `paid` input (the host clears that itself) and is IGNORED while an attempt is running or unknown (call it again once that attempt is decided).\n */\n resetPaid(): void {\n if (this.destroyed || this.inFlight() || this.unknown()) return; // an attempt that runs (a watched one included) keeps its bookkeeping: pay again once it is decided\n const ref = this.o.payableRef();\n this.succeeded.set(false);\n this.paidKey = null;\n this.watchKey = null;\n this.duplicates.clear();\n this.reportedKeys.clear();\n this.lastSuccessIdle = false;\n this.memKeys.clear();\n if (ref) {\n this.removePaidRecord(ref);\n const stored = this.readStored(ref);\n const name = this.markerKey(ref);\n if (name && stored && stored.type === 'tombstone' && stored.value.state === 'succeeded') { try { this.store()?.removeItem(name); } catch { /* ignore */ } }\n this.bumpEpoch(ref);\n }\n this.renewTick.update(n => n + 1);\n }\n\n /** A DEFINITIVE failure (declined, failed, status check says failed): unlock, with a NEW key. Never for a timeout or an offline loss. Ignored after a success. */\n fail(reason?: string, external = false): void {\n if (this.destroyed) return;\n if (this.succeeded()) { this.settleWatched(false); return; }\n const key = this.key();\n const ref = this.pinned()?.ref ?? this.o.payableRef();\n this.stopPolling();\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.leaveUnknown();\n this.renew(key, external ? null : ref); // the epoch is written BEFORE the tombstone, so another tab that reacts to the tombstone already sees the new epoch\n this.endMarker('failed');\n this.pinned.set(null);\n this.emit({ kind: 'failed', attemptKey: key, ...(reason ? { reason } : {}) });\n }\n\n /** The payer chose \"Start over\" after the polling window: unlock with a NEW key (only offered when the backend allows ONE open or succeeded attempt per payable, which is what makes it safe). */\n startOver(): void {\n if (this.destroyed || !this.unknown()) return;\n this.fail('start_over');\n }\n\n /** The outcome is ambiguous (timeout, offline mid-flight, host-reported, reload, another tab): lock, KEEP (and pin) the key, check the status. Idempotent. */\n markUnknown(reason: string, verification: boolean = reason === 'microdeposits'): void {\n if (this.destroyed) return;\n if (this.paidLocked()) { if (this.succeeded()) this.settleWatched(false); return; }\n this.setInFlight(false);\n this.clearSilence();\n this.waitingForHost.set(false);\n if (this.unknown()) {\n // The answer that says \"verify the deposits\" can arrive AFTER the attempt became unknown (the confirm outlived the request timeout, or another tab / a reload already adopted it): upgrade, never ignore.\n if (verification && !this.awaitingVerification()) {\n this.verifying.set(true);\n this.writeMarker('unknown');\n this.emit({ kind: 'unknown', attemptKey: this.key(), reason: 'microdeposits' });\n }\n return;\n }\n // A succeeded tombstone of THIS key that another tab wrote while this attempt was running (and was ignored then: its own answer is that payment) decides it now.\n const pending = this.pinned();\n const done = this.readStored(pending?.ref ?? this.o.payableRef());\n if (done && done.type === 'tombstone' && done.value.state === 'succeeded' && done.value.owner !== this.id && done.value.key === (pending?.key ?? this.key())) { this.succeed('other_tab'); return; }\n if (!this.pinned()) this.pinned.set(this.newPin());\n this.unknown.set(true);\n this.unknownReason = reason;\n this.verifying.set(verification);\n this.unknownSince = this.now();\n this.pollExpired.set(false);\n this.writeMarker('unknown');\n this.emit({ kind: 'unknown', attemptKey: this.key(), reason });\n this.startPolling();\n }\n\n /**\n * The step that needs the processor is in progress elsewhere: the lock STAYS ON until the host or a status check decides. `token` = the host is charging a token (the screen says \"Waiting for your\n * payment to be confirmed\", and a host that stays silent for `hostSilenceMs` makes the outcome unknown); `auth_required` / `bank_window` = a 3-D Secure challenge / the bank window is open (the request\n * timeout is replaced by `authTimeoutMs`).\n */\n markPending(reason?: string): void {\n if (this.destroyed || this.paidLocked() || this.unknown()) return; // nothing is pending on a payable that is already paid, and an unknown outcome is already waiting for its status check\n if (reason === 'token') {\n this.waitingForHost.set(true);\n this.clearSilence();\n this.silenceTimer = setTimeout(() => { this.silenceTimer = null; if (this.waitingForHost()) this.markUnknown('host_silent'); }, this.o.hostSilenceMs?.() ?? PAYMENT_HOST_SILENCE_MS);\n } else if (reason === 'auth_required' || reason === 'bank_window') {\n const ms = this.o.authTimeoutMs?.() ?? PAYMENT_AUTH_TIMEOUT_MS;\n // The running request's timeout is replaced; with no running request (the host's own `confirm()` answered `requires_action` and the host runs the challenge) the host has `authTimeoutMs`\n // to come back with the result, else the outcome is unknown (the lock never stays on for ever because the host forgot).\n if (!this.extendRunTimeout(ms) && this.inFlight()) {\n this.clearSilence();\n this.silenceTimer = setTimeout(() => { this.silenceTimer = null; if (this.inFlight()) this.markUnknown('host_silent'); }, ms);\n }\n }\n this.emit({ kind: 'pending', attemptKey: this.key(), ...(reason ? { reason } : {}) });\n }\n\n /** Asks the host's status check once (a newer call supersedes an older one). `succeeded` -> success state, `failed` / `not_found` -> unlocked with a new key (once believed), anything else -> stays locked. */\n async checkNow(): Promise<void> {\n const check = this.o.checkStatus();\n if (!check || this.destroyed || !this.unknown()) return;\n const mine = ++this.checkRun;\n const key = this.key();\n const asked = this.pinned();\n const askedRef = asked?.ref ?? this.o.payableRef();\n this.checking.set(true);\n let answer: PaymentStatusAnswer = 'unknown';\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n const timeout = new Promise<'timeout'>(resolve => { timer = setTimeout(() => resolve('timeout'), this.o.statusTimeoutMs?.() ?? PAYMENT_STATUS_CHECK_TIMEOUT_MS); });\n const result = await Promise.race([callHost(() => check(key)), timeout]);\n answer = result === 'timeout' ? 'unknown' : (result ?? 'unknown');\n } catch { answer = 'unknown'; } finally { if (timer) clearTimeout(timer); }\n if (this.destroyed || mine !== this.checkRun) return;\n this.checking.set(false);\n if (!this.unknown()) {\n // The attempt was unlocked while the check was out (the host's markFailed, a start over): a `succeeded` answer still means the payable IS paid (a failed answer decides nothing here).\n if (answer === 'succeeded' && askedRef === this.o.payableRef()) this.lateSuccess(key, 'status_check', asked ? asked.amount : this.o.amount(), asked?.method ?? this.o.method());\n return;\n }\n if (this.key() !== key) return; // still unknown, but about ANOTHER attempt than the one asked (a newer attempt took over while the check was out): its answer decides nothing here\n if (answer === 'succeeded') this.succeed('status_check');\n else if (answer === 'failed' || answer === 'not_found') {\n if (this.mustWait(answer)) return; // the original request may still land: not a failure yet\n this.fail(answer === 'failed' ? 'status_check' : 'not_found');\n } else if (answer === 'awaiting_verification') this.markUnknown(this.unknownReason ?? 'microdeposits', true); // the payer still has to verify the deposits: stays unknown, says so (also after a timeout / reload that did not know)\n else if (answer === 'in_flight') {\n // The payment is running (or, right after a bank verification, now PROCESSES, so it is no longer \"NOT started\"): the stored marker is rewritten WITHOUT the verification reason (a reload must not say\n // \"NOT started\" for a processing payment) and its clock restarts now. This is also a HEARTBEAT on EVERY `in_flight` answer: a tab that keeps polling keeps its marker fresh, so the lock of a\n // processing payment is not lost to the 30-minute expiry in a reload / second tab while a status check can still decide.\n this.verifying.set(false);\n const pin = this.pinned();\n if (pin) this.pinned.set({ ...pin, at: this.now() });\n this.writeMarker('unknown', false);\n }\n }\n\n /** \"Check again\": polls for another bounded round. */\n checkAgain(): void {\n if (this.destroyed || !this.unknown()) return;\n this.pollExpired.set(false);\n this.startPolling();\n }\n\n /**\n * Runs one attempt: `begin()` (synchronous), then `op(key)`, raced against `timeoutMs` (replaced by `authTimeoutMs` while `markPending('auth_required' | 'bank_window')` is on). The result decides the\n * lock: `success` locks for good, `failure` unlocks with a new key, `released` unlocks with the same key, `pending` keeps the lock, `unknown` and a timeout (or an exception) lock in the unknown state.\n * An answer that arrives AFTER the timeout still settles the attempt while it is still THE attempt (`onLate`); once the attempt moved on (a status check unlocked it, a newer attempt began) a late\n * failure / release / unknown is dropped and a late SUCCESS only marks the payable paid (and is reported once with its own, old key), never touching the newer attempt's lock, pin or marker.\n */\n async run<T>(op: (key: string) => Promise<PaymentAttemptResult<T>>, options: { timeoutMs?: number; onLate?: (result: PaymentAttemptResult<T>) => void } = {}): Promise<PaymentAttemptRun<T>> {\n const begun = this.begin();\n if (!begun.ok) return { refused: begun.reason };\n const pin = this.pinned();\n const info: RunInfo = { id: ++this.runSeq, key: begun.key, ref: pin?.ref ?? null, amount: pin?.amount ?? null, method: pin?.method ?? this.o.method(), settled: false, fire: null, timer: null };\n this.liveRun = info;\n this.requestMs = options.timeoutMs ?? PAYMENT_REQUEST_TIMEOUT_MS;\n // The timeout exists BEFORE the op runs: an op that calls `markPending('auth_required' | 'bank_window')` synchronously (the Square ACH path does) must be able to replace it.\n const timeout = new Promise<'timeout'>(resolve => {\n info.fire = () => resolve('timeout');\n info.timer = setTimeout(info.fire, this.requestMs);\n });\n let running: Promise<PaymentAttemptResult<T>>;\n try { running = op(begun.key); } catch (error) { running = Promise.reject(error); }\n const settled = (): void => { info.settled = true; };\n running.then(settled, settled);\n let result: PaymentAttemptResult<T> | 'timeout';\n try { result = await Promise.race([running, timeout]); } catch { result = { kind: 'unknown', reason: 'error' }; } finally { if (info.timer) { clearTimeout(info.timer); info.timer = null; } }\n if (result === 'timeout') {\n if (this.isCurrent(info)) { if (info.ref !== this.o.payableRef()) this.settleOtherPayable(info, { kind: 'unknown', reason: 'timeout' }); else this.markUnknown('timeout'); }\n void running.then(late => { this.applyRun(info, late); options.onLate?.(late); }, () => undefined);\n return { kind: 'unknown', reason: 'timeout' };\n }\n this.applyRun(info, result);\n return result;\n }\n\n /**\n * Is the run that was given `key` still THE attempt in progress (not replaced by a newer attempt, not decided, the form not destroyed)? An op uses it to skip every screen side effect of a LATE answer\n * (a decline text, `setBusy(false)`, releasing an inner form) that would otherwise land on the NEWER attempt's screen. The result it returns is still applied by `run()` with the same rules.\n */\n isLive(key: string): boolean { return !this.destroyed && this.liveRun?.key === key && this.pinned()?.key === key; }\n\n /** Applies the result of a step to THIS attempt (see {@link PaymentAttemptKind}). */\n apply<T>(result: PaymentAttemptResult<T>): void {\n if (this.destroyed) { if (result.kind === 'released') this.abandon(); return; }\n switch (result.kind) {\n case 'success': this.succeed(result.reason); break;\n case 'failure': this.fail(result.reason); break;\n case 'released': this.release(); break;\n case 'pending': this.markPending(result.reason); break;\n default: this.markUnknown(result.reason ?? 'unknown');\n }\n }\n\n // ── Internals ──────────────────────────────────────────────────────────\n\n private now(): number { return this.o.now ? this.o.now() : Date.now(); }\n\n /** A success locks the payable as paid (default); `false` only for a form that opted out with `lockAfterSuccess`. */\n private keepsLock(): boolean { return this.o.lockAfterSuccess?.() !== false; }\n\n /** Newest run that is still THE attempt in progress (same pinned key, not replaced by a newer run). */\n private isCurrent(info: RunInfo): boolean { return this.liveRun === info && this.pinned()?.key === info.key; }\n\n private applyRun<T>(info: RunInfo, result: PaymentAttemptResult<T>): void {\n if (this.destroyed) { this.settleDestroyed(info, result.kind); return; }\n // The payable on screen changed while this attempt ran: its result only decides the OLD payable's records, never the new payable's state.\n if (info.ref !== this.o.payableRef()) { this.settleOtherPayable(info, result); return; }\n if (this.isCurrent(info)) { this.apply(result); return; }\n // Anything else of an attempt that moved on is dropped; a late SUCCESS of the payable still shown counts.\n if (result.kind === 'success') this.lateSuccess(info.key, result.reason, info.amount, info.method);\n }\n\n /**\n * The form was destroyed before this attempt's answer arrived (the panel closes when it records the payment). The host is not told (nobody listens any more); the records are written so the next form of the\n * payable starts paid (success), unlocked with a new key (failure) or unlocked (released), and a development warning says it happened.\n */\n private settleDestroyed(info: RunInfo, kind: PaymentAttemptKind): void {\n if (kind === 'released') { this.abandon(); return; }\n if (kind !== 'success' && kind !== 'failure') return;\n if (kind === 'success') {\n if (this.keepsLock()) {\n this.writeTombstone(info.ref, 'succeeded', info.key, { amount: info.amount, method: info.method });\n this.writePaidRecord(info.ref, info.key, info.amount, info.method);\n } else if (info.ref) { this.bumpEpoch(info.ref); this.removeMarker(info.ref, info.key); } // nothing locks: the next form of the payable must derive a NEW key (the same key would return this already saved method to a backend that uses it as its idempotency key) and must not adopt this attempt's marker\n if (isDevMode()) console.warn(this.keepsLock()\n ? 'A payment answered after its form was destroyed: it is recorded for the next form of the payable (reconcile it by its attemptKey on your backend).'\n : 'A save answered after its form was destroyed: the epoch moved, so the next form of the payable derives a new key (reconcile it by its attemptKey on your backend).');\n } else {\n if (info.ref) this.bumpEpoch(info.ref);\n this.writeTombstone(info.ref, 'failed', info.key);\n }\n }\n\n /** The result of an attempt that belongs to ANOTHER payable than the one on screen: only that payable's records change; this form's lock, pin and paid state are for the payable on screen. */\n private settleOtherPayable<T>(info: RunInfo, result: PaymentAttemptResult<T>): void {\n const pin = this.pinned();\n const mine = !!pin && pin.key === info.key && pin.ref === info.ref;\n switch (result.kind) {\n case 'success':\n if (this.keepsLock()) {\n this.writeTombstone(info.ref, 'succeeded', info.key, { amount: info.amount, method: info.method });\n this.writePaidRecord(info.ref, info.key, info.amount, info.method);\n } else if (info.ref) { this.bumpEpoch(info.ref); this.removeMarker(info.ref, info.key); } // nothing locks: the old payable's next attempt derives a NEW key and does not adopt this attempt's marker\n break;\n case 'failure':\n if (info.ref) this.bumpEpoch(info.ref);\n this.writeTombstone(info.ref, 'failed', info.key);\n break;\n case 'released': this.writeTombstone(info.ref, 'released', info.key); break;\n case 'unknown': if (mine) this.writeMarker('unknown', result.reason === 'microdeposits'); break; // the old payable keeps its undecided marker: a reload or another tab asks the status check\n default: return; // pending: nothing is decided\n }\n if (mine) {\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.pinned.set(null);\n }\n }\n\n /**\n * An attempt other than the current one turned out paid (a late answer of an older attempt, a late status answer, or another tab's success): the payable IS paid. A newer attempt's lock, pin and marker are\n * left alone. When the payable was ALREADY paid by a different key, the second payment is a suspected duplicate: it is reported once (`unknown` / `duplicate_suspected`, with ITS key) for the host to resolve.\n */\n private lateSuccess(key: string, reason?: string, amount?: number | null, method?: string): void {\n if (!this.keepsLock()) { // nothing locks: the success is only reported, once per key; a success of ANOTHER key than the ones already reported is a suspected duplicate (the host resolves it)\n if (this.reportedKeys.has(key)) return;\n if (this.reportedKeys.size > 0) {\n if (!this.duplicates.has(key)) { this.duplicates.add(key); this.emit({ kind: 'unknown', attemptKey: key, reason: 'duplicate_suspected' }); }\n return;\n }\n this.reportedKeys.add(key);\n this.emit({ kind: 'succeeded', attemptKey: key, ...(reason ? { reason } : {}), ...(method !== undefined ? { amount: amount ?? null, method } : {}) });\n return;\n }\n if (this.succeeded()) {\n if (this.paidKey && key !== this.paidKey && !this.duplicates.has(key)) { this.duplicates.add(key); this.emit({ kind: 'unknown', attemptKey: key, reason: 'duplicate_suspected' }); }\n return;\n }\n const pin = this.pinned();\n this.succeeded.set(true);\n this.paidKey = key;\n this.stopPolling();\n if (pin && pin.key !== key) this.watchKey = pin.key;\n if (reason !== 'other_tab') this.writePaidRecord(pin?.ref ?? this.o.payableRef(), key, amount ?? null, method ?? this.o.method()); // another tab's success is already recorded by that tab\n this.emit({ kind: 'succeeded', attemptKey: key, ...(reason ? { reason } : {}), ...(method !== undefined ? { amount: amount ?? null, method } : {}) });\n }\n\n /**\n * The result of the attempt that was running when the payable turned out paid: it only releases its own lock (and leaves its own marker as `succeeded`). If it was an attempt with ANOTHER key and it ALSO\n * succeeded it is reported as a suspected duplicate for the host to resolve; one with the SAME key is that very payment and settles silently.\n */\n private settleWatched(success: boolean): void {\n const pin = this.pinned();\n if (!pin) return;\n const watched = this.watchKey !== null && pin.key === this.watchKey;\n if (watched) this.watchKey = null;\n this.stopPolling();\n this.clearSilence();\n this.waitingForHost.set(false);\n this.setInFlight(false);\n this.leaveUnknown();\n // The marker of this attempt becomes a `succeeded` tombstone only when it IS a paid attempt (it succeeded itself, or it is the very payment that made the payable paid: the same key). A DIFFERENT attempt that\n // failed / was released / timed out is just removed: another tab must never read \"paid\" with the key of a payment that did not happen.\n if (success || pin.key === this.paidKey) this.endMarker('succeeded');\n else this.removeMarker(pin.ref, pin.key);\n this.pinned.set(null);\n if (success && watched && !this.duplicates.has(pin.key)) { this.duplicates.add(pin.key); this.emit({ kind: 'unknown', attemptKey: pin.key, reason: 'duplicate_suspected' }); }\n }\n\n private currentRunUnsettled(): boolean {\n const run = this.liveRun;\n return !!run && !run.settled && run.key === this.pinned()?.key;\n }\n\n /**\n * Is a `failed` / `not_found` answer too early to believe? (see {@link CheckPaymentStatusFn})\n * - the attempt's own request is still unsettled: ignored for `statusHardMaxMs` after it became unknown (counted from there, so a long auth timeout does not use it up);\n * - the host's charge may still be running (`host_silent`, `host`): the request timeout plus the grace, counted from the moment it became unknown;\n * - adopted from a reload / another tab, or `not_found`: the request timeout plus the grace, counted from the START of the attempt.\n */\n private mustWait(answer: PaymentStatusAnswer): boolean {\n const now = this.now();\n const grace = this.o.failGraceMs?.() ?? PAYMENT_STATUS_FAIL_GRACE_MS;\n if (this.currentRunUnsettled()) return now - this.unknownSince < (this.o.statusHardMaxMs?.() ?? PAYMENT_STATUS_HARD_MAX_MS);\n if (this.unknownReason === 'host_silent' || this.unknownReason === 'host') return now - this.unknownSince < this.requestMs + grace;\n const adopted = this.unknownReason === 'reload' || this.unknownReason === 'other_tab';\n if (adopted || answer === 'not_found') return now - (this.pinned()?.at ?? this.unknownSince) < this.requestMs + grace;\n return false;\n }\n\n /** Replaces the request timeout of the running request; `false` when no request is running. */\n private extendRunTimeout(ms: number): boolean {\n const run = this.liveRun;\n if (!run || run.settled || !run.fire || !run.timer) return false;\n clearTimeout(run.timer);\n run.timer = setTimeout(run.fire, ms);\n return true;\n }\n\n private clearSilence(): void { if (this.silenceTimer) { clearTimeout(this.silenceTimer); this.silenceTimer = null; } }\n\n private refuse(reason: PaymentAttemptRefusal): { ok: false; reason: PaymentAttemptRefusal } {\n this.emit({ kind: 'refused', attemptKey: this.key(), reason });\n return { ok: false, reason };\n }\n\n private emit(outcome: PaymentAttemptOutcome): void { if (!this.destroyed) this.o.onOutcome?.(outcome); }\n\n /** What a NEW attempt starts with (its key, amount, method and payable never follow later input changes). */\n private newPin(): Pinned { return { key: this.resolveKey(), amount: this.o.amount(), method: this.o.method(), at: this.now(), owner: this.id, ref: this.o.payableRef() }; }\n\n private setInFlight(value: boolean): void {\n if (this.inFlight() === value) return;\n this.inFlight.set(value);\n this.o.onInFlightChange?.(value);\n }\n\n private leaveUnknown(): void {\n this.unknown.set(false);\n this.unknownReason = null;\n this.verifying.set(false);\n this.pollExpired.set(false);\n }\n\n /** The host says its own ambiguity is over: leave the unknown state without deciding (the host reports the result itself). */\n private endUnknown(): void {\n this.stopPolling();\n this.leaveUnknown();\n const pin = this.pinned();\n if (pin) this.removeMarker(pin.ref, pin.key);\n this.pinned.set(null);\n }\n\n private startPolling(): void {\n this.stopPolling();\n if (!this.o.checkStatus()) return;\n this.pollElapsed = 0;\n void this.pollOnce(this.pollGen);\n }\n\n /** One round: the check now, then (while still unknown and inside the bounded window) the next one after `pollMs`. */\n private async pollOnce(gen: number): Promise<void> {\n await this.checkNow();\n if (this.destroyed || gen !== this.pollGen || !this.unknown()) return;\n const every = Math.max(1, this.o.pollMs?.() ?? PAYMENT_STATUS_POLL_MS);\n this.pollElapsed += every;\n if (this.pollElapsed >= (this.o.pollMaxMs?.() ?? PAYMENT_STATUS_POLL_MAX_MS)) { this.pollExpired.set(true); return; }\n this.pollTimer = setTimeout(() => { this.pollTimer = null; void this.pollOnce(gen); }, every);\n }\n\n private stopPolling(): void {\n this.pollGen++;\n if (this.pollTimer) { clearTimeout(this.pollTimer); this.pollTimer = null; }\n }\n\n private amountPart(): string {\n const amount = this.o.amount();\n return amount == null || !Number.isFinite(amount) ? 'na' : String(Math.round(amount * 100));\n }\n\n private tupleId(): string { return `${this.amountPart()}|${this.o.method()}`; }\n\n /**\n * The key of a NEW attempt: the host's; else, with a payableRef, a DERIVED readable one (`pa_<payable>_<cents>_<method>_e<epoch>`) so every tab and every reload of the same payable, amount and\n * method hold the SAME key without talking to each other (the epoch only grows when an attempt of the payable is decided); else a random one held in memory per (amount, method).\n */\n private resolveKey(): string {\n const host = this.o.attemptKey();\n if (host) return host;\n const ref = this.o.payableRef();\n if (ref) return `pa_${keyPart(ref)}_${this.amountPart()}_${keyPart(this.o.method())}_e${this.epoch()}`;\n const id = this.tupleId();\n let key = this.memKeys.get(id);\n if (!key) { key = newKey(); this.memKeys.set(id, key); }\n return key;\n }\n\n /** The attempt with `finished` ended definitively: no key may be resolved again for it. With `bumpRef` (a definitive FAILURE of this payable) the epoch grows too, so the next attempt gets a new derived key. */\n private renew(finished: string, bumpRef: string | null): void {\n if (this.o.attemptKey()) return;\n for (const [tuple, key] of this.memKeys) if (key === finished) this.memKeys.delete(tuple);\n if (bumpRef) this.bumpEpoch(bumpRef);\n this.renewTick.update(n => n + 1);\n }\n\n // ── The opaque marker, tombstone and epoch (reload and second-tab protection) ──\n\n private store(): Storage | null { try { return this.o.storage?.() ?? null; } catch { return null; } }\n\n private markerKey(ref: string | null): string | null { return ref ? PAYMENT_ATTEMPT_STORAGE_PREFIX + ref : null; }\n\n private epochName(ref: string | null): string | null { return ref ? `${PAYMENT_ATTEMPT_STORAGE_PREFIX}${ref}#epoch` : null; }\n\n private storedEpoch(name: string | null): number {\n if (!name) return 0;\n try { const n = Number(this.store()?.getItem(name)); return Number.isInteger(n) && n > 0 ? n : 0; } catch { return 0; }\n }\n\n /** The shared epoch of `ref` (cleared storage reads as 0: a replayed key then returns the ORIGINAL payment, which the host must record idempotently). */\n private readEpoch(ref: string | null): void {\n const value = this.storedEpoch(this.epochName(ref));\n if (value !== this.epoch()) this.epoch.set(value);\n }\n\n /** Never goes backwards: the next epoch is one above the larger of this page's and the stored one. */\n private bumpEpoch(ref: string): void {\n const name = this.epochName(ref);\n const current = ref === this.o.payableRef();\n const next = Math.max(current ? this.epoch() : 0, this.storedEpoch(name)) + 1;\n if (current) this.epoch.set(next);\n if (name) { try { this.store()?.setItem(name, String(next)); } catch { /* storage unavailable: the epoch lives in this page */ } }\n }\n\n private parseStored(raw: string | null | undefined): { type: 'marker'; value: PaymentAttemptMarker } | { type: 'tombstone'; value: PaymentAttemptTombstone } | null {\n if (!raw) return null;\n try {\n const m = JSON.parse(raw) as Record<string, unknown> | null;\n if (!m || typeof m !== 'object' || typeof m['key'] !== 'string' || !m['key'] || typeof m['owner'] !== 'string') return null;\n const now = this.now();\n if ((m['state'] === 'released' || m['state'] === 'failed' || m['state'] === 'succeeded') && typeof m['at'] === 'number') {\n if (now - m['at'] > PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS) return null;\n return { type: 'tombstone', value: { state: m['state'], key: m['key'], at: m['at'], owner: m['owner'], ...(typeof m['method'] === 'string' ? { amount: typeof m['amount'] === 'number' ? m['amount'] : null, method: m['method'] } : {}) } };\n }\n if (typeof m['startedAt'] !== 'number' || (m['state'] !== 'inflight' && m['state'] !== 'unknown')) return null;\n const verification = m['state'] === 'unknown' && m['reason'] === 'microdeposits';\n if (now - m['startedAt'] > (verification ? PAYMENT_ATTEMPT_VERIFICATION_TTL_MS : PAYMENT_ATTEMPT_MARKER_TTL_MS)) return null;\n return { type: 'marker', value: { key: m['key'], startedAt: m['startedAt'], state: m['state'], owner: m['owner'], amount: typeof m['amount'] === 'number' ? m['amount'] : null, method: typeof m['method'] === 'string' ? m['method'] : '', ...(verification ? { reason: 'microdeposits' as const } : {}) } };\n } catch { return null; }\n }\n\n private readStored(ref: string | null): ReturnType<PaymentAttempt['parseStored']> {\n const name = this.markerKey(ref);\n if (!name) return null;\n try { return this.parseStored(this.store()?.getItem(name)); } catch { return null; }\n }\n\n /** A pending marker of this payable that another form instance (tab, page load) wrote and that is not expired. */\n private foreignMarker(): PaymentAttemptMarker | null {\n const stored = this.readStored(this.o.payableRef());\n return stored && stored.type === 'marker' && stored.value.owner !== this.id ? stored.value : null;\n }\n\n /**\n * COMPARE-AND-WRITE: the stored record belongs to ANOTHER attempt (a different key) and must not be replaced or removed by this instance. A marker is only blocked by an undecided marker of another key\n * (a tombstone of a finished attempt is simply replaced by the next attempt's marker); a tombstone / removal is blocked by ANY stored record of another key (this instance's decision is stale).\n */\n private storedOfOther(ref: string | null, key: string, markerOnly: boolean): boolean {\n const stored = this.readStored(ref);\n return !!stored && stored.value.key !== key && (!markerOnly || stored.type === 'marker');\n }\n\n private writeMarker(state: 'inflight' | 'unknown', verification: boolean = this.awaitingVerification()): void {\n const pin = this.pinned();\n const name = this.markerKey(pin?.ref ?? null);\n if (!name || !pin) return;\n if (this.storedOfOther(pin.ref, pin.key, true)) return;\n // Never downgrade: another tab already decided THIS attempt as succeeded (its tombstone), which an `unknown` marker (a heartbeat included) must not overwrite.\n const stored = this.readStored(pin.ref);\n if (stored && stored.type === 'tombstone' && stored.value.key === pin.key && stored.value.state === 'succeeded') return;\n const marker: PaymentAttemptMarker = { key: pin.key, state, owner: pin.owner, startedAt: pin.at, amount: pin.amount, method: pin.method, ...(state === 'unknown' && verification ? { reason: 'microdeposits' as const } : {}) };\n const raw = JSON.stringify(marker);\n let ok = false;\n try {\n const store = this.store();\n store?.setItem(name, raw);\n ok = !!store && store.getItem(name) !== null; // read it back: a quota error that is swallowed by the browser must not leave the protection silently off\n } catch { ok = false; }\n this.markerWriteFailed.set(!ok);\n }\n\n private writeTombstone(ref: string | null, state: 'released' | 'failed' | 'succeeded', key: string, paid?: { amount: number | null; method: string }): void {\n const name = this.markerKey(ref);\n if (!name || this.storedOfOther(ref, key, false)) return;\n const tombstone: PaymentAttemptTombstone = { state, key, at: this.now(), owner: this.id, ...(state === 'succeeded' && paid ? { amount: paid.amount, method: paid.method } : {}) };\n try { this.store()?.setItem(name, JSON.stringify(tombstone)); } catch { /* ignore */ }\n }\n\n /** The attempt was decided: replace its marker by a short tombstone so other tabs learn HOW it ended (a removed marker says nothing). */\n private endMarker(state: 'released' | 'failed' | 'succeeded'): void {\n const pin = this.pinned();\n if (!pin) return;\n this.writeTombstone(pin.ref, state, pin.key, { amount: pin.amount, method: pin.method });\n }\n\n private removeMarker(ref: string | null, key: string): void {\n const name = this.markerKey(ref);\n if (!name || this.storedOfOther(ref, key, false)) return;\n try { this.store()?.removeItem(name); } catch { /* ignore */ }\n }\n\n private paidName(ref: string | null): string | null { return ref ? `${PAYMENT_ATTEMPT_STORAGE_PREFIX}${ref}#paid` : null; }\n\n /** The succeeded record of a payable (24 hours), or null. */\n private readPaidRecord(ref: string | null): PaymentAttemptPaidRecord | null {\n const name = this.paidName(ref);\n if (!name) return null;\n try {\n const m = JSON.parse(this.store()?.getItem(name) ?? 'null') as Record<string, unknown> | null;\n if (!m || typeof m !== 'object' || typeof m['key'] !== 'string' || !m['key'] || typeof m['at'] !== 'number' || typeof m['owner'] !== 'string') return null;\n if (this.now() - m['at'] > PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS) return null;\n return { key: m['key'], at: m['at'], owner: m['owner'], amount: typeof m['amount'] === 'number' ? m['amount'] : null, method: typeof m['method'] === 'string' ? m['method'] : '' };\n } catch { return null; }\n }\n\n private writePaidRecord(ref: string | null, key: string, amount: number | null, method: string): void {\n const name = this.paidName(ref);\n if (!name || !this.keepsLock()) return;\n const record: PaymentAttemptPaidRecord = { key, amount, method, at: this.now(), owner: this.id };\n try { this.store()?.setItem(name, JSON.stringify(record)); } catch { /* storage unavailable */ }\n }\n\n private removePaidRecord(ref: string | null): void {\n const name = this.paidName(ref);\n if (!name) return;\n try { this.store()?.removeItem(name); } catch { /* ignore */ }\n }\n\n /**\n * The 24-hour record of a payment that succeeded for this payable: the payable is PAID here too for the WHOLE 24 hours (whenever the record exists and the host's `paid` input is false), however long ago it was written.\n * The record is never consumed by a form that loads later: a deliberate second payment is `resetPaid()` or a NEW `payableRef` (the host contract), never a silent new key. Returns true when the payable was marked paid.\n */\n private checkPaidRecord(ref: string | null): boolean {\n if (!ref || this.o.paid() || this.succeeded()) return false;\n const record = this.readPaidRecord(ref);\n if (!record) return false; // any owner: a payable that this very instance paid and left (A -> B -> A) is still paid for the 24 hours\n this.lateSuccess(record.key, 'other_tab', record.amount, record.method);\n return true;\n }\n\n /** Best effort, at most one pass per `begin()`: drops this library's own expired markers and tombstones (never the epochs: removing one would let a finished key be derived again). */\n private sweepStale(): void {\n const store = this.store();\n if (!store) return;\n try {\n const now = this.now();\n const drop: string[] = [];\n let seen = 0;\n const total = Math.min(store.length, 5000);\n for (let i = 0; i < total && seen < 200; i++) {\n const name = store.key(i);\n if (!name || !name.startsWith(PAYMENT_ATTEMPT_STORAGE_PREFIX) || name.endsWith('#epoch')) continue; // other apps' keys do not use up the cap\n seen++;\n let m: Record<string, unknown> | null = null;\n try { m = JSON.parse(store.getItem(name) ?? 'null') as Record<string, unknown> | null; } catch { m = null; }\n if (!m || typeof m !== 'object') continue;\n if (name.endsWith('#paid')) { if (typeof m['at'] === 'number' && now - m['at'] > PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS) drop.push(name); }\n else if (typeof m['at'] === 'number' && now - m['at'] > PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS) drop.push(name);\n else if (typeof m['startedAt'] === 'number' && now - m['startedAt'] > (m['state'] === 'unknown' && m['reason'] === 'microdeposits' ? PAYMENT_ATTEMPT_VERIFICATION_TTL_MS : PAYMENT_ATTEMPT_MARKER_TTL_MS)) drop.push(name);\n }\n for (const name of drop) store.removeItem(name);\n } catch { /* storage unavailable */ }\n }\n\n /** What another tab (or a re-read of the storage) says about this payable. */\n private react(stored: ReturnType<PaymentAttempt['parseStored']>): void {\n if (!stored) {\n // The marker was removed without a tombstone (the host's `paid`, an ended host ambiguity): the outcome is for the status check (or the host) to tell.\n if (this.unknown() && (this.unknownReason === 'other_tab' || this.unknownReason === 'reload') && this.o.checkStatus()) void this.checkNow();\n return;\n }\n if (stored.type === 'tombstone') { this.onTombstone(stored.value); return; }\n const marker = stored.value;\n if (marker.owner === this.id) return;\n if (this.inFlight()) this.markUnknown('other_tab', marker.reason === 'microdeposits'); // two tabs started at once: neither may be trusted to be the only one\n else if (!this.unknown() && !this.paidLocked()) this.adopt(marker, 'other_tab');\n else if (this.unknown() && marker.reason === 'microdeposits' && this.pinned()?.key === marker.key) this.markUnknown(this.unknownReason ?? 'other_tab', true); // the other tab learned it is a bank verification wait: so does this one\n }\n\n /**\n * Another tab decided an attempt of this payable. `succeeded`: the payable is PAID (same key as the undecided attempt: it is that payment; another key while paid / running: it is recorded with its own key and a\n * second payment is reported as a suspected duplicate). `failed` / `released`: only an attempt this instance ADOPTED from that tab is unlocked by it.\n */\n private onTombstone(t: PaymentAttemptTombstone): void {\n if (t.owner === this.id) return;\n const pin = this.pinned();\n if (t.state === 'succeeded') {\n if (!this.succeeded() && pin?.key === t.key) {\n if (this.unknown()) this.succeed('other_tab');\n return; // running with the same key: its own answer is that payment (decided at the latest when its request times out: see markUnknown)\n }\n if (this.keepsLock()) this.lateSuccess(t.key, 'other_tab', t.amount ?? null, t.method);\n return;\n }\n if (!this.unknown() || !pin || pin.key !== t.key || (this.unknownReason !== 'other_tab' && this.unknownReason !== 'reload')) return;\n if (t.state === 'failed') this.fail('other_tab', true);\n else { this.stopPolling(); this.leaveUnknown(); this.pinned.set(null); }\n }\n\n /** Takes over an attempt another instance started: pin ITS key, lock in the unknown state and ask the status check. */\n private adopt(marker: PaymentAttemptMarker, reason: 'reload' | 'other_tab'): void {\n if (this.destroyed || this.unknown() || this.paidLocked()) return;\n this.pinned.set({ key: marker.key, amount: marker.amount, method: marker.method, at: marker.startedAt, owner: marker.owner, ref: this.o.payableRef() });\n this.markUnknown(reason, marker.reason === 'microdeposits'); // a verification wait survives a reload / another tab: it keeps its own text and its longer marker\n }\n\n private onPayableChange(ref: string | null): void {\n if (this.destroyed) return;\n if (this.lastRef !== undefined && ref !== this.lastRef) {\n // Another payable: nothing of the previous one (a success, an undecided attempt, a host-reported ambiguity) applies any more. The old payable's marker stays in the storage and keeps protecting it.\n this.succeeded.set(false);\n this.paidKey = null;\n this.watchKey = null;\n this.duplicates.clear();\n this.reportedKeys.clear();\n this.lastSuccessIdle = false;\n if (this.unknown()) { this.stopPolling(); this.clearSilence(); this.waitingForHost.set(false); this.leaveUnknown(); }\n if (!this.inFlight()) this.pinned.set(null);\n }\n this.lastRef = ref;\n this.readEpoch(ref);\n if (this.inFlight() || this.unknown() || this.paidLocked()) return;\n const stored = this.readStored(ref);\n if (stored) {\n if (stored.type === 'marker') { if (stored.value.owner !== this.id) { this.adopt(stored.value, 'reload'); return; } } // this instance's own undecided marker is not adopted\n else if (stored.value.state === 'succeeded' && this.keepsLock()) { this.lateSuccess(stored.value.key, 'other_tab', stored.value.amount ?? null, stored.value.method); return; } // a reload within 2 minutes of a payment made in another tab / page load: the payable is paid\n }\n if (this.keepsLock()) this.checkPaidRecord(ref); // a payment older than the tombstone: the 24-hour record still locks the payable as paid\n }\n}\n","import { DestroyRef, computed, signal, untracked, effect } from '@angular/core';\nimport type { UiLabelKey } from '@forgeroute/ui/core';\nimport { callHost, type HostResult } from '../payment-side-panel/payment-side-panel.models';\n\n/**\n * Readiness gate of the payment forms: Pay is blocked, with a specific reason, while we can already tell a payment cannot complete AND be recorded (offline, a connection too slow to pay\n * safely, a blocked payment SDK, a browser that cannot pay safely, the host's backend not ready, an earlier payment of unknown outcome). It is evaluated when the form opens, every\n * `everyMs` (default 10 s) while it is open, on online / offline / visibility events, and AGAIN synchronously right before every submit (`passSync()`): a gate that turned false after\n * the last render blocks the click and sends nothing.\n */\nexport interface PaymentReadinessResult {\n ready: boolean;\n reasons: string[];\n /** With the reason `payment_in_flight`: the open payment waits for the payer to verify bank micro-deposits (it has NOT started). The text says so instead of \"already being processed\". Ignored for any other reason. */\n awaitingVerification?: boolean;\n}\n\n/** The host's check (`GET /api/payments/ready?payable=...`): `{ ready, reasons }`. A slow answer (> `readinessTimeoutMs`) counts as `slow_connection`, a rejection as `offline` / `slow_connection`. */\nexport type ReadinessCheckFn = () => HostResult<PaymentReadinessResult>;\n\n/** The machine reasons the library knows (a host may send others: they block with a generic text). */\nexport const PAYMENT_READINESS_REASONS = [\n 'offline', 'slow_connection', 'sdk_blocked', 'service_unavailable', 'merchant_not_ready', 'events_backlog', 'payable_changed', 'already_paid', 'payment_in_flight', 'unsupported_browser',\n 'unknown_payment', 'checking', 'awaiting_verification', 'reconnect_required', 'outcome_unknown',\n] as const;\n\nexport const PAYMENT_READINESS_TIMEOUT_MS = 4000;\nexport const PAYMENT_READINESS_EVERY_MS = 10_000;\n/** A measured round trip above this (ms) from `navigator.connection.rtt` counts as a slow connection. */\nexport const PAYMENT_READINESS_SLOW_RTT_MS = 2000;\n\nexport type PaymentSdkState = 'ok' | 'loading' | 'blocked';\n\nexport interface PaymentReadinessOptions {\n destroyRef: DestroyRef;\n /** The host's check; `null` = only the built-in checks. */\n check: () => ReadinessCheckFn | null;\n timeoutMs: () => number;\n everyMs?: () => number;\n /** The processor SDK / tokenizer state of the form: `'blocked'` (the script or the form could not be loaded) blocks with `sdk_blocked`. */\n sdk: () => PaymentSdkState;\n /** An earlier payment of unknown outcome is pending (blocks with `unknown_payment`). */\n unknownPending: () => boolean;\n /** The gate applies (the Stripe form turns it off unless duplicate protection is on). */\n enabled?: () => boolean;\n /** Is the attempt-marker storage usable? (warning only: without it a reload or a second tab cannot be recognised as an undecided attempt.) */\n storageAvailable?: () => boolean;\n /** Managed environments where `navigator.onLine === false` is a false negative (captive portal, VPN): the browser's offline flag does not block (default false). */\n offlineOverride?: () => boolean;\n onChange?: (state: PaymentReadinessResult) => void;\n}\n\n/** The label key that words a refusal reason (a readiness reason, `paid`, `unknown`, `offline`): one mapping for every form and plugin. */\nexport function refusalLabelKey(reason: string): UiLabelKey {\n if (reason === 'paid') return 'paymentAttempt.paid';\n if (reason === 'unknown') return 'paymentAttempt.checking';\n if (reason === 'awaiting_verification') return 'paymentAttempt.awaitingVerification'; // a bank payment waiting for the payer's micro-deposit verification: one wording, wherever it is worded from\n return (PAYMENT_READINESS_REASONS as readonly string[]).includes(reason) ? (`paymentReadiness.${reason}` as UiLabelKey) : 'paymentReadiness.generic';\n}\n\nconst sameList = (a: readonly string[], b: readonly string[]): boolean => a.length === b.length && a.every((v, i) => v === b[i]);\n\n/** What the browser itself tells about the environment (pure: easy to fake). */\nexport function builtInReadinessReasons(ignoreOffline = false): string[] {\n const reasons: string[] = [];\n if (!ignoreOffline && typeof navigator !== 'undefined' && navigator.onLine === false) reasons.push('offline');\n const connection = (typeof navigator !== 'undefined' ? (navigator as unknown as { connection?: { saveData?: boolean; effectiveType?: string; rtt?: number } }).connection : undefined);\n // Data saver (`saveData`) is a preference, not a slow link: it never blocks a payment.\n if (connection && (connection.effectiveType === 'slow-2g' || connection.effectiveType === '2g'\n || (typeof connection.rtt === 'number' && connection.rtt > PAYMENT_READINESS_SLOW_RTT_MS))) reasons.push('slow_connection');\n const secure = typeof window === 'undefined' || (window as { isSecureContext?: boolean }).isSecureContext !== false;\n const randomValues = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n if (!secure || !randomValues) reasons.push('unsupported_browser');\n return reasons;\n}\n\nexport class PaymentReadiness {\n /** The host's last answer's reasons (empty until it answered). */\n private readonly hostReasons = signal<string[]>([], { equal: sameList });\n /** The host's last answer said the open payment awaits bank verification (only meaningful with the reason `payment_in_flight`). */\n private readonly hostAwaitingVerification = signal(false);\n /** The check the host's last answer belongs to (a host check added or replaced later keeps the gate closed, reason `checking`, until it has answered). */\n private readonly answeredFor = signal<ReadinessCheckFn | null>(null);\n /** The first evaluation finished: no host check to wait for, or the current one has answered. */\n readonly evaluated = computed(() => { const check = this.o.check(); return !check || this.answeredFor() === check; });\n private readonly builtIns = signal<string[]>(builtInReadinessReasons(), { equal: sameList });\n\n /** Why Pay is blocked, most important first; empty = ready. */\n readonly reasons = computed((): string[] => {\n if (this.o.enabled && !this.o.enabled()) return [];\n const out: string[] = [...this.builtIns()];\n const add = (reason: string) => { if (!out.includes(reason)) out.push(reason); };\n if (this.o.sdk() === 'blocked') add('sdk_blocked');\n for (const reason of this.hostReasons()) add(reason);\n if (this.o.unknownPending()) add('unknown_payment');\n if (!this.evaluated()) add('checking');\n return out;\n }, { equal: sameList });\n readonly ready = computed(() => this.reasons().length === 0);\n /** The label key of the text for `reason`: the verification text for a `payment_in_flight` that awaits the payer's bank verification, else {@link refusalLabelKey}. */\n labelKeyFor(reason: string): UiLabelKey {\n return reason === 'payment_in_flight' && this.hostAwaitingVerification() ? 'paymentAttempt.awaitingVerification' : refusalLabelKey(reason); // `awaiting_verification` itself is mapped by refusalLabelKey\n }\n /** Not blocking: the browser blocks storage, so a reload during a payment cannot reuse the attempt key automatically. */\n readonly storageWarning = computed(() => (this.o.storageAvailable ? !this.o.storageAvailable() : false));\n\n private destroyed = false;\n private timer: ReturnType<typeof setTimeout> | null = null;\n private readonly win = typeof window !== 'undefined' ? window : null;\n private readonly doc = typeof document !== 'undefined' ? document : null;\n private run = 0;\n private loop = 0;\n private readonly onEvent = (): void => { void this.evaluate(); };\n private builtIn(): string[] { return builtInReadinessReasons(!!this.o.offlineOverride?.()); }\n\n constructor(private readonly o: PaymentReadinessOptions) {\n if (o.offlineOverride?.()) this.builtIns.set(this.builtIn());\n this.win?.addEventListener('online', this.onEvent);\n this.win?.addEventListener('offline', this.onEvent);\n this.doc?.addEventListener('visibilitychange', this.onEvent);\n o.destroyRef.onDestroy(() => {\n this.destroyed = true;\n if (this.timer) clearTimeout(this.timer);\n this.win?.removeEventListener('online', this.onEvent);\n this.win?.removeEventListener('offline', this.onEvent);\n this.doc?.removeEventListener('visibilitychange', this.onEvent);\n });\n effect(() => { const ready = this.ready(); const reasons = this.reasons(); untracked(() => this.o.onChange?.({ ready, reasons })); });\n // The first evaluation and the periodic loop start once the component's inputs are bound (an effect runs after them; a plugin body reads its config lazily).\n // The periodic loop exists only with a host check (the built-ins are re-read on every online / offline / visibility event and by every `passSync()`), so a form without one leaves no timer behind.\n effect(() => { const check = this.o.check(); untracked(() => { void this.evaluate(); this.loop++; if (this.timer) { clearTimeout(this.timer); this.timer = null; } if (check) this.schedule(); }); });\n }\n\n /**\n * The gate right now, SYNCHRONOUSLY (called by every submit before anything is sent): the built-in checks are read afresh, the host's last answer and the SDK / unknown state are\n * current. A host check that has not answered yet keeps the gate closed. A fresh host check starts in the background for the NEXT click (a click must stay synchronous: a bank window\n * is only allowed inside the user gesture).\n */\n passSync(): boolean {\n if (this.destroyed) return false;\n this.builtIns.set(this.builtIn());\n const ready = this.ready();\n if (this.o.check()) void this.evaluate();\n return ready;\n }\n\n /** Runs the checks: the built-ins now, then the host's check (raced against the timeout). */\n async evaluate(): Promise<void> {\n if (this.destroyed) return;\n this.builtIns.set(this.builtIn());\n const check = this.o.check();\n if (!check) { this.hostReasons.set([]); this.hostAwaitingVerification.set(false); return; }\n const mine = ++this.run;\n let answer: PaymentReadinessResult;\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n const timeout = new Promise<'timeout'>(resolve => { timer = setTimeout(() => resolve('timeout'), this.o.timeoutMs()); });\n const result = await Promise.race([callHost(() => check()), timeout]);\n if (result === 'timeout') answer = { ready: false, reasons: ['slow_connection'] };\n else if (!result || typeof result !== 'object') answer = { ready: false, reasons: ['service_unavailable'] };\n else {\n const reasons = Array.isArray(result.reasons) ? result.reasons.filter(r => typeof r === 'string' && !!r) : [];\n // The flag belongs to the reason `payment_in_flight` and is ignored for any other answer.\n answer = { ready: result.ready === true && !(result.reasons?.length), reasons, awaitingVerification: result.awaitingVerification === true && reasons.includes('payment_in_flight') };\n }\n if (!answer.ready && answer.reasons.length === 0) answer.reasons = ['service_unavailable'];\n } catch {\n // A failing host check is `offline` only when the browser says so AND the host did not turn `offlineOverride` on (then the flag is not trusted and the real reason, an unreachable check, is `slow_connection`).\n answer = { ready: false, reasons: [typeof navigator !== 'undefined' && navigator.onLine === false && !this.o.offlineOverride?.() ? 'offline' : 'slow_connection'] };\n } finally {\n if (timer) clearTimeout(timer);\n }\n if (this.destroyed || mine !== this.run) return;\n this.hostReasons.set(answer.reasons);\n this.hostAwaitingVerification.set(answer.awaitingVerification === true);\n this.answeredFor.set(check);\n }\n\n /** Starts (or restarts) the periodic loop: any callback of an earlier schedule is invalidated, so two loops can never run side by side. */\n private schedule(): void {\n if (this.destroyed) return;\n if (this.timer) { clearTimeout(this.timer); this.timer = null; }\n const token = ++this.loop;\n this.timer = setTimeout(async () => {\n this.timer = null;\n if (token !== this.loop) return;\n await this.evaluate();\n if (token === this.loop && this.o.check()) this.schedule();\n }, Math.max(1, this.o.everyMs?.() ?? PAYMENT_READINESS_EVERY_MS));\n }\n}\n","import { DestroyRef, inject, type Signal } from '@angular/core';\nimport { PAYMENT_ATTEMPT_STORAGE, PaymentAttempt, type CheckPaymentStatusFn, type PaymentAttemptOutcome } from './payment-attempt';\nimport { PaymentReadiness, type PaymentReadinessResult, type PaymentSdkState, type ReadinessCheckFn } from './payment-readiness';\n\n/** The inputs every protected payment form declares (the same names and defaults everywhere). */\nexport interface PaymentProtectionInputs {\n payableRef: Signal<string | null>;\n attemptKey: Signal<string | null>;\n checkStatus: Signal<CheckPaymentStatusFn | null>;\n paid: Signal<boolean>;\n hostPending: Signal<boolean>;\n statusPollMs: Signal<number>;\n statusPollMaxMs: Signal<number>;\n /** A status check slower than this counts as unknown. */\n statusCheckTimeoutMs: Signal<number>;\n /** A status answer `failed` is ignored this long while the attempt's own request is unsettled. */\n statusFailGraceMs: Signal<number>;\n /** While the attempt's own request is unsettled a status answer `failed` / `not_found` is ignored this long after it became unknown (optional: default 180 s). */\n statusHardMaxMs?: Signal<number>;\n /** The request timeout is replaced by this while a 3-D Secure challenge / the bank window is open (optional: default 300 s). */\n authTimeoutMs?: Signal<number>;\n /** A token-only form whose host never reports becomes unknown after this long (optional: default 120 s). */\n hostSilenceMs?: Signal<number>;\n /** Managed environments where `navigator.onLine === false` is a false negative (captive portal, VPN): do not refuse a payment because of it (optional: default false). */\n offlineOverride?: Signal<boolean>;\n readinessCheck: Signal<ReadinessCheckFn | null>;\n readinessTimeoutMs: Signal<number>;\n readinessEveryMs: Signal<number>;\n}\n\nexport interface PaymentProtectionOptions {\n amount: () => number | null;\n method: () => string;\n /** The processor SDK / tokenizer / form of this component. */\n sdk?: () => PaymentSdkState;\n /** The Stripe form turns everything off unless its duplicate-protection flag is on (existing behaviour stays exactly as it was). */\n enabled?: () => boolean;\n /** `false` = a success does not lock the payable for 24 hours (a setup form that opted out with `lockAfterSuccess`); default true. */\n lockAfterSuccess?: () => boolean;\n /** A form that only TOKENIZES keeps its lock to the token call: going offline then does not make the outcome unknown. */\n offlineMidFlight?: boolean;\n onOutcome?: (outcome: PaymentAttemptOutcome) => void;\n onInFlightChange?: (inFlight: boolean) => void;\n onKeyChange?: (key: string) => void;\n onReadinessChange?: (state: PaymentReadinessResult) => void;\n}\n\n/**\n * Builds the attempt (lock, key, unknown state) and the readiness gate of one payment form from its inputs. Call it in the component's constructor / field initializers (injection\n * context): it injects the destroy hook and the attempt-marker storage seam.\n */\nexport function createPaymentProtection(inputs: PaymentProtectionInputs, options: PaymentProtectionOptions): { attempt: PaymentAttempt; readiness: PaymentReadiness } {\n const destroyRef = inject(DestroyRef);\n const storage = inject(PAYMENT_ATTEMPT_STORAGE);\n const enabled = options.enabled ?? (() => true);\n const attempt = new PaymentAttempt({\n destroyRef,\n payableRef: () => (enabled() ? inputs.payableRef() : null), // a Stripe form with the flag off must never adopt (or write) a marker\n amount: options.amount,\n method: options.method,\n attemptKey: inputs.attemptKey,\n checkStatus: () => (enabled() ? inputs.checkStatus() : null),\n paid: () => enabled() && inputs.paid(),\n hostPending: () => enabled() && inputs.hostPending(),\n offlineMidFlight: options.offlineMidFlight,\n pollMs: inputs.statusPollMs,\n pollMaxMs: inputs.statusPollMaxMs,\n statusTimeoutMs: inputs.statusCheckTimeoutMs,\n failGraceMs: inputs.statusFailGraceMs,\n statusHardMaxMs: inputs.statusHardMaxMs,\n lockAfterSuccess: options.lockAfterSuccess,\n authTimeoutMs: inputs.authTimeoutMs,\n hostSilenceMs: inputs.hostSilenceMs,\n offlineOverride: inputs.offlineOverride,\n storage,\n onOutcome: options.onOutcome,\n onInFlightChange: options.onInFlightChange,\n onKeyChange: options.onKeyChange,\n });\n const readiness = new PaymentReadiness({\n destroyRef,\n check: () => (enabled() ? inputs.readinessCheck() : null),\n timeoutMs: inputs.readinessTimeoutMs,\n everyMs: inputs.readinessEveryMs,\n sdk: options.sdk ?? (() => 'ok'),\n unknownPending: () => enabled() && attempt.unknown(),\n enabled,\n // Warns when the cross-tab / reload protection is not fully active: storage blocked, only this tab's sessionStorage, or the marker could not be written (quota). Reads signals, so it follows them.\n // Only for a form with a payableRef: without one nothing is stored, so there is nothing to warn about.\n storageAvailable: () => !(enabled() && inputs.payableRef()) || (attempt.storageScope() === 'shared' && !attempt.markerWriteFailed()),\n offlineOverride: () => !!inputs.offlineOverride?.(),\n onChange: options.onReadinessChange,\n });\n return { attempt, readiness };\n}\n","import type { UiLabelKey } from '@forgeroute/ui/core';\n\n/** What a protected attempt is for: a payment (default) or saving a payment method (a SetupIntent: nothing is charged). */\nexport type PaymentAttemptPurpose = 'payment' | 'setup';\n\n/**\n * The texts of the attempt status and the readiness reasons are written for a PAYMENT (\"do not pay again\"). For saving a payment method they would be wrong, so a protected\n * `mode=\"setup\"` form shows these instead. A key that is not listed (a reason that cannot happen for a setup) keeps its payment text.\n */\nconst SETUP_LABEL_KEYS: Readonly<Partial<Record<UiLabelKey, UiLabelKey>>> = {\n 'paymentAttempt.checking': 'paymentSetup.checking',\n 'paymentAttempt.checkingHelp': 'paymentSetup.checkingHelp',\n 'paymentAttempt.stillUnknown': 'paymentSetup.stillUnknown',\n 'paymentAttempt.waiting': 'paymentSetup.waiting',\n 'paymentAttempt.paid': 'paymentSetup.paid',\n 'paymentAttempt.queuedOffline': 'paymentSetup.queuedOffline',\n 'paymentAttempt.offline': 'paymentSetup.offline',\n 'paymentAttempt.awaitingVerification': 'paymentSetup.awaitingVerification',\n 'paymentReadiness.offline': 'paymentSetup.offline',\n 'paymentReadiness.slow_connection': 'paymentSetup.slowConnection',\n 'paymentReadiness.service_unavailable': 'paymentSetup.serviceUnavailable',\n 'paymentReadiness.outcome_unknown': 'paymentSetup.outcomeUnknown',\n 'paymentReadiness.unknown_payment': 'paymentSetup.outcomeUnknown',\n 'paymentReadiness.payment_in_flight': 'paymentSetup.inFlight',\n 'paymentReadiness.unsupported_browser': 'paymentSetup.unsupportedBrowser',\n 'paymentReadiness.merchant_not_ready': 'paymentSetup.merchantNotReady',\n 'paymentReadiness.events_backlog': 'paymentSetup.eventsBacklog',\n 'paymentReadiness.payable_changed': 'paymentSetup.payableChanged',\n 'paymentReadiness.reconnect_required': 'paymentSetup.reconnectRequired',\n 'paymentReadiness.checking': 'paymentSetup.readinessChecking',\n 'paymentReadiness.generic': 'paymentSetup.readinessGeneric',\n 'paymentReadiness.already_paid': 'paymentSetup.alreadySaved',\n 'paymentReadiness.storageWarning': 'paymentSetup.storageWarning',\n};\n\n/** The label key to show for `key` in an attempt of `kind` (the same key for a payment). */\nexport function attemptLabelKey(key: UiLabelKey, kind: PaymentAttemptPurpose): UiLabelKey {\n return kind === 'setup' ? (SETUP_LABEL_KEYS[key] ?? key) : key;\n}\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation, computed, inject, input, output } from '@angular/core';\nimport { AlertComponent } from '@forgeroute/ui/alert';\nimport { ButtonComponent } from '@forgeroute/ui/core';\nimport { LiveRegionComponent } from '@forgeroute/ui/live-region';\nimport { UiLabelsService, type UiLabelKey } from '@forgeroute/ui/core';\nimport { refusalLabelKey } from './payment-readiness';\nimport { attemptLabelKey, type PaymentAttemptPurpose } from './payment-setup-labels';\nimport type { PaymentAttempt } from './payment-attempt';\nimport type { PaymentReadiness } from './payment-readiness';\n\n/**\n * What the payer reads while a payment attempt is not a plain \"form\" any more: \"Checking your payment...\" (the outcome is unknown: Pay stays locked, never \"failed, try again\"), the\n * offline notice, and the paid state. A polite live region announces each state. Used by every payment form of the library; hosts normally never place it themselves.\n */\n@Component({\n selector: 'ui-payment-attempt-status',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AlertComponent, ButtonComponent, LiveRegionComponent],\n template: `\n <ui-live-region data-testid=\"pa-live\" [message]=\"announcement()\" />\n @if (attempt().paidLocked() && showPaid()) {\n <ui-alert variant=\"success\" [quiet]=\"true\" data-testid=\"pa-paid\">{{ text('paymentAttempt.paid') }}</ui-alert>\n } @else if (attempt().awaitingVerification()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-verification\">\n <p class=\"pa-line\" data-testid=\"pa-verification-text\">{{ text('paymentAttempt.awaitingVerification') }}</p>\n @if (attempt().canCheck()) {\n <!-- always offered while waiting for a bank verification (the payer may have verified the deposits a minute ago; the wait can last days, long after the bounded polling stopped) -->\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"pa-check-again\" [loading]=\"attempt().checking()\" (click)=\"attempt().checkAgain()\">{{ text('paymentAttempt.checkAgain') }}</ui-button>\n }\n </ui-alert>\n } @else if (attempt().unknown()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-checking\">\n <p class=\"pa-line\" data-testid=\"pa-checking-title\">{{ text('paymentAttempt.checking') }}</p>\n <p class=\"pa-line\" data-testid=\"pa-checking-help\">{{ text(attempt().canCheck() && attempt().pollExpired() ? 'paymentAttempt.stillUnknown' : 'paymentAttempt.checkingHelp') }}</p>\n @if (attempt().canCheck() && attempt().pollExpired()) {\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"pa-check-again\" [loading]=\"attempt().checking()\" (click)=\"attempt().checkAgain()\">{{ text('paymentAttempt.checkAgain') }}</ui-button>\n @if (allowStartOver()) {\n <ui-button variant=\"ghost\" size=\"sm\" data-testid=\"pa-start-over\" (click)=\"attempt().startOver()\">{{ text('paymentAttempt.startOver') }}</ui-button>\n }\n }\n </ui-alert>\n } @else if (attempt().waitingForHost()) {\n <ui-alert variant=\"info\" [quiet]=\"true\" data-testid=\"pa-waiting\">{{ text('paymentAttempt.waiting') }}</ui-alert>\n } @else if (readiness() && !readiness()!.ready()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-not-ready\" [attr.data-reason]=\"firstReason()\">\n <p class=\"pa-line\" data-testid=\"pa-not-ready-text\">{{ readinessText() }}</p>\n @if (firstReason() === 'sdk_blocked') {\n <ui-button variant=\"secondary\" size=\"sm\" data-testid=\"pa-retry-load\" (click)=\"retryLoad.emit()\">{{ text('paymentReadiness.retryLoad') }}</ui-button>\n }\n </ui-alert>\n } @else if (attempt().blockedOffline()) {\n <ui-alert variant=\"warning\" [quiet]=\"true\" data-testid=\"pa-offline\">{{ text('paymentAttempt.offline') }}</ui-alert>\n }\n @if (readiness()?.storageWarning()) {\n <ui-alert variant=\"info\" [quiet]=\"true\" data-testid=\"pa-storage-warning\">{{ text('paymentReadiness.storageWarning') }}</ui-alert>\n }\n `,\n styles: [`\n ui-payment-attempt-status { display: block; min-width: 0; }\n ui-payment-attempt-status .pa-line { margin: 0 0 6px; }\n `],\n encapsulation: ViewEncapsulation.None,\n})\nexport class PaymentAttemptStatusComponent {\n protected readonly labels = inject(UiLabelsService);\n /** The attempt of the form this status belongs to. */\n readonly attempt = input.required<PaymentAttempt>();\n /** Show the paid state (a form that has its own success notice sets it off while that notice is up). */\n readonly showPaid = input(true);\n /** Offer \"Start over\" after the polling window (only for a backend that allows ONE open or succeeded attempt per payable: that rule is what makes it safe). */\n readonly allowStartOver = input(false);\n /** The readiness gate of the form (its reasons are shown while Pay is blocked). */\n readonly readiness = input<PaymentReadiness | null>(null);\n /** \"Retry loading the payment form\" was pressed (shown for `sdk_blocked`). */\n readonly retryLoad = output<void>();\n\n /** What the attempt is for: `'setup'` (saving a payment method) shows the setup wording instead of the payment wording. */\n readonly kind = input<PaymentAttemptPurpose>('payment');\n /** The text of `key` for this attempt's kind. */\n protected text(key: UiLabelKey): string { return this.labels.t(attemptLabelKey(key, this.kind())); }\n\n protected readonly firstReason = computed(() => this.readiness()?.reasons()[0] ?? '');\n /** The translated text of the first blocking reason; a reason the library does not know blocks with the generic text. */\n protected readonly readinessText = computed(() => this.text(this.readiness()?.labelKeyFor(this.firstReason()) ?? refusalLabelKey(this.firstReason())));\n\n /** The text the live region reads: the current state, never empty while a state is on screen. */\n protected readonly announcement = computed(() => {\n const attempt = this.attempt();\n if (attempt.paidLocked() && this.showPaid()) return this.text('paymentAttempt.paid');\n if (attempt.awaitingVerification()) return this.text('paymentAttempt.awaitingVerification');\n if (attempt.unknown()) return this.text(attempt.canCheck() && attempt.pollExpired() ? 'paymentAttempt.stillUnknown' : 'paymentAttempt.checking');\n if (attempt.waitingForHost()) return this.text('paymentAttempt.waiting');\n if (this.readiness() && !this.readiness()!.ready()) return this.readinessText();\n if (attempt.blockedOffline()) return this.text('paymentAttempt.offline');\n if (this.readiness()?.storageWarning()) return this.text('paymentReadiness.storageWarning'); // the alert itself is quiet: the shared live region says it once\n return '';\n });\n}\n","import { Component, ChangeDetectionStrategy, computed, effect, input, output, signal, untracked, inject } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { DateInputComponent } from '@forgeroute/ui/date-input';\nimport { EmptyStateComponent } from '@forgeroute/ui/empty-state';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { SelectComponent, SelectOption } from '@forgeroute/ui/select';\nimport { SidePanelComponent } from '@forgeroute/ui/core';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { TextareaInputComponent } from '@forgeroute/ui/textarea-input';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** A charge type the host offers (for example a community's configured charge types). `defaultAmount` and `description` pre-fill the form. */\nexport interface ChargeTypeOption {\n /** Stable id (used for `track`; not sent). */\n id: string;\n /** The type's name; it is what the form value carries (`chargeType`). */\n name: string;\n /** Pre-fills the amount when the amount is still empty. */\n defaultAmount?: number | null;\n /** Replaces the description when the type is picked. */\n description?: string | null;\n}\n\n/** What the form hands the host. */\nexport interface ChargeFormData {\n chargeType: string;\n amount: number | null;\n /** ISO date `YYYY-MM-DD`. */\n dueDate: string;\n description: string;\n}\n\n/** The local calendar day as `YYYY-MM-DD` (`toISOString()` is the UTC day, which is tomorrow on a US evening). */\nfunction localToday(): string {\n const d = new Date();\n return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;\n}\n\n/**\n * Add-a-charge form, the same in every app: charge type, amount, due date and an optional description, built only from library inputs.\n * It does not talk to a server: the host passes the `chargeTypes` and saves the `submitted` data.\n *\n * <ui-charge-form [open]=\"open()\" [chargeTypes]=\"types()\" [saving]=\"saving()\" (submitted)=\"save($event)\" (closed)=\"open.set(false)\" />\n *\n * Two shapes:\n * - `panel` (default `true`): it renders inside its own `ui-side-panel` with Cancel and the primary button (`submitLabel`).\n * `open`, `title`, `subtitle` drive the panel; `closed` is Cancel / close / Escape (not emitted while `saving`).\n * - `[panel]=\"false\"`: body only, for a host that supplies its own panel or page section. Read `formChange` / `validChange` or call `getFormData()`.\n *\n * Rules (the common backend rules, adjustable): the type is required; the amount is required, between `minAmount` (0.01) and `maxAmount` (99,999.99)\n * with at most 2 decimals; the due date is required (default today, or `defaultDueDate`); the description is at most `descriptionMaxLength` (2000).\n * Picking a type fills the amount (only when it is still empty) and the description from the type. When `chargeTypes` is empty and `loading` is false\n * the form shows an empty state (`emptyTitle`, `emptyMessage`) instead of the fields and the primary button stays disabled.\n */\n@Component({\n selector: 'ui-charge-form',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, NgTemplateOutlet, DateInputComponent, EmptyStateComponent, FormSectionComponent, SelectComponent, SidePanelComponent, TextInputComponent, TextareaInputComponent],\n template: `\n @if (panel()) {\n <ui-side-panel\n [open]=\"open()\"\n [title]=\"title()\"\n [subtitle]=\"subtitle()\"\n [primaryLabel]=\"showEmpty() ? '' : submitLabel()\"\n [cancelLabel]=\"showEmpty() ? closeLabel() : cancelLabel()\"\n [primaryLoading]=\"saving()\"\n [primaryDisabled]=\"saving() || !valid()\"\n primaryTestId=\"charge-form-submit\"\n cancelTestId=\"charge-form-cancel\"\n (closed)=\"onClosed()\"\n (primaryClick)=\"submit()\">\n <ng-container [ngTemplateOutlet]=\"body\" />\n </ui-side-panel>\n } @else {\n <ng-container [ngTemplateOutlet]=\"body\" />\n }\n <ng-template #body>\n @if (showEmpty()) {\n <ui-empty-state data-testid=\"charge-types-empty\" iconType=\"money\" [title]=\"emptyTitle()\" [message]=\"emptyMessage()\" />\n } @else {\n <ui-form-section data-testid=\"charge-form\">\n <ui-select data-testid=\"charge-type\" [label]=\"labels.t('chargeForm.chargeType')\" [ariaLabel]=\"labels.t('chargeForm.chargeType')\" [placeholder]=\"labels.t('chargeForm.selectType')\" [required]=\"true\" [options]=\"typeOptions()\"\n [ngModel]=\"chargeType()\" (ngModelChange)=\"pickType($event)\" name=\"chargeType\" />\n <ui-text-input data-testid=\"charge-amount\" [label]=\"labels.t('chargeForm.amount')\" [ariaLabel]=\"labels.t('chargeForm.amount2')\" type=\"number\" valueType=\"number\" placeholder=\"0.00\" [required]=\"true\"\n [step]=\"0.01\" [min]=\"minAmount()\" [max]=\"maxAmount()\" [maxDecimals]=\"2\" [ngModel]=\"amount()\" (ngModelChange)=\"setAmount($event)\" name=\"amount\" />\n <ui-date-input data-testid=\"charge-due-date\" [label]=\"labels.t('chargeForm.dueDate')\" [required]=\"true\" [ngModel]=\"dueDate()\" (ngModelChange)=\"setDueDate($event)\" name=\"dueDate\" />\n <ui-textarea-input data-testid=\"charge-description\" [label]=\"labels.t('chargeForm.description')\" [ariaLabel]=\"labels.t('chargeForm.description')\" [placeholder]=\"labels.t('chargeForm.optionalDescription')\" [rows]=\"2\"\n [maxlength]=\"descriptionMaxLength()\" [ngModel]=\"description()\" (ngModelChange)=\"setDescription($event)\" name=\"description\" />\n </ui-form-section>\n }\n </ng-template>\n `,\n})\nexport class ChargeFormComponent {\n protected readonly labels = inject(UiLabelsService);\n /** The charge types to choose from. */\n readonly chargeTypes = input<ChargeTypeOption[]>([]);\n /** True while the host is still loading the types: no empty state is shown. */\n readonly loading = input(false);\n /** True while the host saves: the primary button shows its spinner and Cancel / Escape do nothing. */\n readonly saving = input(false);\n\n /** `true` (default): rendered inside its own `ui-side-panel`. `false`: body only. */\n readonly panel = input(true);\n readonly open = input(false);\n readonly titleInput = input<string | null>(null, { alias: 'title' });\n readonly title = computed(() => this.titleInput() ?? this.labels.t('chargeForm.title'));\n readonly subtitle = input('');\n readonly submitLabelInput = input<string | null>(null, { alias: 'submitLabel' });\n readonly submitLabel = computed(() => this.submitLabelInput() ?? this.labels.t('chargeForm.submitLabel'));\n readonly cancelLabelInput = input<string | null>(null, { alias: 'cancelLabel' });\n readonly cancelLabel = computed(() => this.cancelLabelInput() ?? this.labels.t('chargeForm.cancelLabel'));\n /** Label of the only button while the empty state is shown. */\n readonly closeLabelInput = input<string | null>(null, { alias: 'closeLabel' });\n readonly closeLabel = computed(() => this.closeLabelInput() ?? this.labels.t('chargeForm.closeLabel'));\n\n readonly emptyTitleInput = input<string | null>(null, { alias: 'emptyTitle' });\n\n readonly emptyTitle = computed(() => this.emptyTitleInput() ?? this.labels.t('chargeForm.emptyTitle'));\n readonly emptyMessageInput = input<string | null>(null, { alias: 'emptyMessage' });\n readonly emptyMessage = computed(() => this.emptyMessageInput() ?? this.labels.t('chargeForm.emptyMessage'));\n\n readonly minAmount = input(0.01);\n readonly maxAmount = input(99999.99);\n readonly descriptionMaxLength = input(2000);\n /** ISO date the due date starts at. Empty (default) = today. */\n readonly defaultDueDate = input('');\n\n /** The whole form after every change. */\n readonly formChange = output<ChargeFormData>();\n /** Emits when the form becomes valid / invalid. */\n readonly validChange = output<boolean>();\n /** Panel mode: the primary button was pressed on a valid form. */\n readonly submitted = output<ChargeFormData>();\n /** Panel mode: Cancel / close / Escape (not while `saving`). */\n readonly closed = output<void>();\n\n protected readonly chargeType = signal('');\n protected readonly amount = signal<number | null>(null);\n protected readonly dueDate = signal(localToday());\n protected readonly description = signal('');\n\n protected readonly typeOptions = computed((): SelectOption[] => this.chargeTypes().map(t => ({ value: t.name, label: t.name })));\n protected readonly showEmpty = computed(() => this.chargeTypes().length === 0 && !this.loading());\n\n /** The rule the backend enforces: min..max with at most two decimals, a type and a due date. */\n readonly valid = computed(() => {\n const a = this.amount();\n return !this.showEmpty()\n && !!this.chargeType()\n && a != null && a >= this.minAmount() && a <= this.maxAmount() && /^\\d+(\\.\\d{1,2})?$/.test(String(a))\n && !!this.dueDate()\n && this.description().length <= this.descriptionMaxLength();\n });\n\n private lastValid: boolean | null = null;\n\n constructor() {\n // A new panel opening starts from a blank form, so the previous charge never shows again.\n effect(() => {\n if (this.open()) untracked(() => this.reset());\n });\n effect(() => {\n const v = this.valid();\n untracked(() => {\n if (v !== this.lastValid) { this.lastValid = v; this.validChange.emit(v); }\n });\n });\n }\n\n /** The form as it stands. */\n getFormData(): ChargeFormData {\n return { chargeType: this.chargeType(), amount: this.amount(), dueDate: this.dueDate(), description: this.description() };\n }\n\n /** Back to the blank form (no type, no amount, due date today or `defaultDueDate`, no description). */\n reset(): void {\n this.chargeType.set('');\n this.amount.set(null);\n this.dueDate.set(this.defaultDueDate() || localToday());\n this.description.set('');\n this.emitForm();\n }\n\n protected pickType(name: string): void {\n this.chargeType.set(name ?? '');\n const t = this.chargeTypes().find(x => x.name === name);\n if (t?.defaultAmount && !this.amount()) this.amount.set(t.defaultAmount);\n this.description.set(t?.description ?? '');\n this.emitForm();\n }\n\n protected setAmount(v: number | null): void { this.amount.set(v ?? null); this.emitForm(); }\n protected setDueDate(v: string): void { this.dueDate.set(v ?? ''); this.emitForm(); }\n protected setDescription(v: string): void { this.description.set(v ?? ''); this.emitForm(); }\n\n protected submit(): void {\n if (!this.valid() || this.saving()) return;\n this.submitted.emit(this.getFormData());\n }\n\n protected onClosed(): void {\n if (!this.saving()) this.closed.emit();\n }\n\n private emitForm(): void {\n this.formChange.emit(this.getFormData());\n }\n}\n","import { Component, ChangeDetectionStrategy, DestroyRef, computed, effect, input, output, signal, untracked, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { AlertComponent } from '@forgeroute/ui/alert';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { FormSectionComponent } from '@forgeroute/ui/form-section';\nimport { PanelInfoListComponent, PanelInfoSection } from '@forgeroute/ui/panel-info-list';\nimport { RadioGroupComponent, RadioOption } from '@forgeroute/ui/radio';\nimport { SelectComponent, SelectOption } from '@forgeroute/ui/select';\nimport { SidePanelComponent } from '@forgeroute/ui/core';\nimport { TextInputComponent } from '@forgeroute/ui/text-input';\nimport { TextareaInputComponent } from '@forgeroute/ui/textarea-input';\nimport { formatCurrency } from '@forgeroute/ui/utils';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { ToastService } from '@forgeroute/ui/core';\nimport { getErrorMessage } from '@forgeroute/ui/core';\nimport { FORGEROUTE_CONFIG } from '@forgeroute/ui/core';\n\n/** The payment being refunded. Amounts are in currency units (dollars), not cents. */\nexport interface RefundablePayment {\n id: string;\n /** What the customer originally paid (without processor fees). */\n amount: number;\n /** Already refunded; the refundable maximum is `amount - refundedAmount`. */\n refundedAmount?: number | null;\n /** Shown read-only at the top (for example \"Card\", \"ACH\"). */\n methodLabel?: string;\n reference?: string | null;\n customerName?: string | null;\n /** The processor's fee (Stripe, Square, ...) the customer paid on top of `amount` for the WHOLE payment. 0 / absent = none. */\n processorFee?: number | null;\n /** The app's own service / processing fee the customer paid on top of `amount` for the WHOLE payment. 0 / absent = none. */\n serviceFee?: number | null;\n}\n\n/** What the host gets when the refund is confirmed. */\nexport interface RefundRequest {\n paymentId: string;\n /** The base amount to refund (the payment's own amount, or the partial amount), in currency units with at most 2 decimals. */\n amount: number;\n /** The fees that go back to the customer with it: this refund's proportional share of the processor and service fees when `absorbFees`, else 0. */\n feeAmount: number;\n /** What the customer receives: `amount + feeAmount`. */\n total: number;\n /** The selected reason's value, or `''` when the reason field is hidden. */\n reason: string;\n notes: string;\n /**\n * True when the park chose \"refund the full charge\": the customer gets everything they were charged back, and the PARK loses all the fees\n * (the processor's fee and the app's service fee; none of them is returned to the park). False (default): the customer gets the charge\n * minus the fees back, i.e. only `amount`. Only offered when the payment has fees.\n */\n absorbFees: boolean;\n}\n\nexport const DEFAULT_REFUND_REASONS: readonly SelectOption[] = [\n { value: 'CUSTOMER_REQUEST', label: 'Customer Request' },\n { value: 'DUPLICATE_PAYMENT', label: 'Duplicate Payment' },\n { value: 'BILLING_ERROR', label: 'Billing Error' },\n { value: 'OVERPAYMENT', label: 'Overpayment' },\n { value: 'FRAUDULENT', label: 'Fraudulent' },\n { value: 'OTHER', label: 'Other' },\n];\n\n/**\n * Full or partial refund of a payment, the same in every app. It does not talk to a server: the host passes the `payment`,\n * calls its API on `submitted` and reports back with `saving` and `error`.\n *\n * <ui-refund-panel [open]=\"open()\" [payment]=\"payment()\" [saving]=\"saving()\" [error]=\"error()\" (submitted)=\"refund($event)\" (closed)=\"open.set(false)\" />\n *\n * Shapes: `panel` (default `true`) renders inside its own `ui-side-panel` (danger primary button, Cancel); `[panel]=\"false\"` is the body only.\n * Every time the panel opens the form starts over (full refund, first reason, no notes, no fee choice).\n *\n * Built-in request mode: set `endpoint` (relative to `FORGEROUTE_CONFIG.baseUrl`, `{id}` is replaced by the payment id, for example\n * `/payments/{id}/refund`) and the panel sends the refund itself: `POST` with `{ amount, reason, reasonNotes, absorbFees }`, shows `saving` and the\n * server's error message, toasts `successMessage`, then emits `refunded` and `closed`. Without `endpoint` the host does it on `submitted`.\n *\n * Fee rule (when the payment has `processorFee` / `serviceFee`): the customer was charged `amount + fees`. Park does NOT absorb (default): the customer gets\n * the charge minus the fees back (= `amount`; for a partial refund the same proportion). Park absorbs: the customer gets the full charge back (`amount` + the\n * proportional fees) and the park alone loses the processor fee AND the app's service fee. The fee share of a partial refund is `fees * partial / amount`.\n *\n * Fields: a read-only summary (customer, method / reference, original amount, already refunded), \"Refund Type\" (full for the remaining amount,\n * or partial with an amount between 0.01 and the remaining amount, at most 2 decimals), an optional reason select (`showReason`), optional\n * notes (`showNotes`, up to `notesMaxLength`), and, when the payment has fees (`processorFee` + `serviceFee`, or the legacy `processorFees`), one\n * checkbox \"Refund $X in fees\" (unchecked = the customer gets the base amount; checked = the full charge, the park absorbs the fees) with a note that\n * the fees are non-refundable. The primary button reads \"Refund $total\". When the remaining amount is 0 the form is disabled with an info alert.\n */\n@Component({\n selector: 'ui-refund-panel',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, NgTemplateOutlet, AlertComponent, CheckboxComponent, FormSectionComponent, PanelInfoListComponent, RadioGroupComponent, SelectComponent, SidePanelComponent, TextInputComponent, TextareaInputComponent],\n template: `\n @if (panel()) {\n <ui-side-panel\n [open]=\"open()\"\n [title]=\"title()\"\n [primaryLabel]=\"primaryLabel()\"\n primaryVariant=\"danger\"\n [primaryLoading]=\"isSaving()\"\n [primaryDisabled]=\"!canSubmit() || isSaving()\"\n primaryTestId=\"refund-submit\"\n cancelTestId=\"refund-cancel\"\n (closed)=\"onClosed()\"\n (primaryClick)=\"submit()\">\n <ng-container [ngTemplateOutlet]=\"body\" />\n </ui-side-panel>\n } @else {\n <ng-container [ngTemplateOutlet]=\"body\" />\n }\n <ng-template #body>\n @if (payment()) {\n <ui-form-section data-testid=\"refund-form\">\n <ui-panel-info-list [sections]=\"summarySections()\" data-testid=\"refund-summary\" />\n\n @if (remaining() <= 0) {\n <ui-alert variant=\"info\" data-testid=\"refund-nothing-left\">{{ nothingLeftMessage() }}</ui-alert>\n } @else {\n <ui-radio-group [label]=\"labels.t('refundPanel.refundType')\" [options]=\"refundTypeOptions()\" [ngModel]=\"refundType()\" (ngModelChange)=\"setRefundType($event)\" data-testid=\"refund-type\" />\n\n @if (refundType() === 'partial') {\n <ui-text-input data-testid=\"refund-amount\" [label]=\"labels.t('refundPanel.refundAmount')\" [ariaLabel]=\"labels.t('refundPanel.refundAmount2')\" type=\"number\" valueType=\"number\" placeholder=\"0.00\" [required]=\"true\"\n [min]=\"0.01\" [max]=\"remaining()\" [step]=\"0.01\" [maxDecimals]=\"2\" [error]=\"partialAmountError()\"\n [ngModel]=\"partialAmount()\" (ngModelChange)=\"partialAmount.set($event ?? null)\" name=\"refundAmount\" />\n }\n\n @if (fees() > 0) {\n <ui-checkbox data-testid=\"refund-fees\" [label]=\"feeCheckboxLabel()\" [hint]=\"feeHint()\" [ngModel]=\"absorbFees()\" (ngModelChange)=\"absorbFees.set(!!$event)\" name=\"refundAbsorbFees\" />\n }\n\n @if (fees() > 0) {\n <ui-alert variant=\"info\" data-testid=\"refund-fees-note\">{{ feesNote() }}</ui-alert>\n }\n\n @if (showReason()) {\n <ui-select data-testid=\"refund-reason\" [label]=\"labels.t('refundPanel.reason')\" [ariaLabel]=\"labels.t('refundPanel.reason')\" [required]=\"true\" [options]=\"reasonOptions()\" [ngModel]=\"reason()\" (ngModelChange)=\"reason.set($event ?? '')\" name=\"refundReason\" />\n }\n\n @if (showNotes()) {\n <ui-textarea-input data-testid=\"refund-notes\" [label]=\"labels.t('refundPanel.notes')\" [ariaLabel]=\"labels.t('refundPanel.notes')\" [placeholder]=\"labels.t('refundPanel.enterReasonForRefund')\" [rows]=\"3\" [maxlength]=\"notesMaxLength()\"\n [ngModel]=\"notes()\" (ngModelChange)=\"notes.set($event ?? '')\" name=\"refundNotes\" />\n }\n\n <ui-alert variant=\"warning\" data-testid=\"refund-warning\">{{ warning() }}</ui-alert>\n }\n\n @if (shownError()) {\n <ui-alert variant=\"danger\" data-testid=\"refund-error\">{{ shownError() }}</ui-alert>\n }\n </ui-form-section>\n }\n </ng-template>\n `,\n})\nexport class RefundPanelComponent {\n protected readonly labels = inject(UiLabelsService);\n readonly payment = input<RefundablePayment | null>(null);\n /** True while the host processes the refund: the primary button spins and Cancel / Escape / `submitted` do nothing. */\n readonly saving = input(false);\n /** A message from the host (for example a failed refund); shown as a danger alert at the bottom. */\n readonly error = input('');\n\n /** `true` (default): inside its own `ui-side-panel`. `false`: the body only. */\n readonly panel = input(true);\n readonly open = input(false);\n readonly titleInput = input<string | null>(null, { alias: 'title' });\n readonly title = computed(() => this.titleInput() ?? this.labels.t('refundPanel.title'));\n readonly currency = input('USD');\n\n readonly showReason = input(true);\n readonly reasons = input<readonly SelectOption[]>(DEFAULT_REFUND_REASONS);\n /** The reasons as the select wants them (a mutable copy of the readonly input). */\n protected readonly reasonOptions = computed((): SelectOption[] => [...this.reasons()]);\n readonly showNotes = input(true);\n readonly notesMaxLength = input(2000);\n /** Legacy / host override: the total fees (currency units) the customer paid on top. Used only when the payment carries no `processorFee` / `serviceFee`. */\n readonly processorFees = input(0);\n /** Built-in request mode: the refund endpoint (relative to the API base URL; `{id}` = the payment id). Empty = the host handles `submitted`. */\n readonly endpoint = input('');\n /** Toast text after a successful built-in refund. */\n readonly successMessage = input('Refund processed successfully');\n /** The note shown whenever the payment has fees. */\n readonly feesNote = input('Processing and service fees are non-refundable. If you refund them to the customer, the park absorbs them.');\n readonly warningInput = input<string | null>(null, { alias: 'warning' });\n readonly warning = computed(() => this.warningInput() ?? this.labels.t('refundPanel.warning'));\n readonly nothingLeftMessageInput = input<string | null>(null, { alias: 'nothingLeftMessage' });\n readonly nothingLeftMessage = computed(() => this.nothingLeftMessageInput() ?? this.labels.t('refundPanel.nothingLeftMessage'));\n\n readonly submitted = output<RefundRequest>();\n /** Built-in request mode: the server accepted the refund. */\n readonly refunded = output<RefundRequest>();\n readonly closed = output<void>();\n\n private readonly http = inject(HttpClient, { optional: true });\n private readonly toast = inject(ToastService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly apiBase = inject(FORGEROUTE_CONFIG, { optional: true })?.baseUrl ?? '/api';\n private readonly busy = signal(false);\n private readonly failure = signal('');\n /** True while the host or the built-in request is saving. */\n protected readonly isSaving = computed(() => this.saving() || this.busy());\n /** The host's `error` or the built-in request's server message. */\n protected readonly shownError = computed(() => this.failure() || this.error());\n\n protected readonly refundType = signal<'full' | 'partial'>('full');\n protected readonly partialAmount = signal<number | null>(null);\n protected readonly reason = signal('');\n protected readonly notes = signal('');\n protected readonly absorbFees = signal(false);\n\n /** What can still be refunded, rounded to cents. */\n readonly remaining = computed(() => {\n const p = this.payment();\n return p ? Math.max(0, Math.round((p.amount - (p.refundedAmount ?? 0)) * 100) / 100) : 0;\n });\n\n private fmt(v: number): string { return formatCurrency(v, { currency: this.currency() }); }\n\n /** The fees the customer paid on top of the payment (processor + service); 0 = none. */\n readonly fees = computed(() => {\n const p = this.payment();\n const own = (p?.processorFee ?? 0) + (p?.serviceFee ?? 0);\n return Math.round((own > 0 ? own : this.processorFees()) * 100) / 100;\n });\n\n /** This refund's proportional share of the fees: `fees * base / payment amount`, rounded to cents (never above the fees). */\n readonly feeShare = computed(() => {\n const p = this.payment();\n const base = this.refundAmount();\n if (!p || p.amount <= 0 || this.fees() <= 0 || base <= 0) return 0;\n return Math.min(this.fees(), Math.round((this.fees() * base / p.amount) * 100) / 100);\n });\n\n /** What the customer receives as things stand: the base amount, plus the fee share when the park absorbs the fees. */\n readonly customerReceives = computed(() => Math.round((this.refundAmount() + (this.absorbFees() && this.fees() > 0 ? this.feeShare() : 0)) * 100) / 100);\n\n protected readonly summarySections = computed((): PanelInfoSection[] => {\n const p = this.payment();\n if (!p) return [];\n const items = [\n ...(p.customerName ? [{ label: 'Customer', value: p.customerName }] : []),\n ...(p.methodLabel ? [{ label: 'Method', value: p.methodLabel + (p.reference ? ` ${p.reference}` : '') }] : []),\n { label: 'Original Amount', value: this.fmt(p.amount) },\n ...(p.refundedAmount ? [{ label: 'Already Refunded', value: this.fmt(p.refundedAmount) }] : []),\n ...(this.fees() > 0 ? [{ label: 'Total Charged (incl. fees)', value: this.fmt(p.amount + this.fees()) }] : []),\n ];\n return [{ items }];\n });\n\n protected readonly refundTypeOptions = computed((): RadioOption[] => [\n { value: 'full', label: `Full Refund (${this.fmt(this.remaining())})` },\n { value: 'partial', label: 'Partial Amount' },\n ]);\n\n /** The checkbox label: the fees that go back to the customer with this refund, for example \"Refund $3.50 in fees\". */\n protected readonly feeCheckboxLabel = computed(() => `Refund ${this.fmt(this.feeShare())} in fees`);\n protected readonly feeHint = computed(() => 'The park absorbs the processing and service fees; they are not returned to the park.');\n\n /** The amount that will be refunded as things stand (0 when a partial amount is not yet valid). */\n readonly refundAmount = computed(() => {\n if (this.refundType() === 'full') return this.remaining();\n const v = this.partialAmount();\n return v != null && v > 0 ? v : 0;\n });\n\n protected readonly partialAmountError = computed(() => {\n if (this.refundType() !== 'partial') return '';\n const v = this.partialAmount();\n if (v == null) return '';\n if (!(v > 0)) return 'Enter an amount greater than 0.';\n if (v > this.remaining()) return `Amount cannot exceed the remaining refundable amount of ${this.fmt(this.remaining())}.`;\n if (!/^\\d+(\\.\\d{1,2})?$/.test(String(v))) return 'Use at most 2 decimal places.';\n return '';\n });\n\n readonly canSubmit = computed(() => {\n if (!this.payment() || this.remaining() <= 0) return false;\n if (this.showReason() && !this.reason()) return false;\n if (this.refundType() === 'full') return true;\n const v = this.partialAmount();\n return v != null && v > 0 && v <= this.remaining() && !this.partialAmountError();\n });\n\n protected readonly primaryLabel = computed(() => {\n if (!this.payment() || this.remaining() <= 0) return '';\n const a = this.customerReceives();\n return a > 0 ? `Refund ${this.fmt(a)}` : 'Issue Refund';\n });\n\n constructor() {\n // A new panel opening starts from a fresh form.\n effect(() => {\n if (this.open()) untracked(() => this.reset());\n });\n }\n\n /** Back to a full refund with the first reason, no notes and no fee choice. */\n reset(): void {\n this.refundType.set('full');\n this.partialAmount.set(null);\n this.reason.set(this.showReason() ? (this.reasons()[0]?.value as string | undefined) ?? '' : '');\n this.notes.set('');\n this.absorbFees.set(false);\n this.failure.set('');\n }\n\n protected setRefundType(t: string): void {\n this.refundType.set(t === 'partial' ? 'partial' : 'full');\n }\n\n protected submit(): void {\n const p = this.payment();\n if (!p || !this.canSubmit() || this.isSaving()) return;\n const absorb = this.fees() > 0 && this.absorbFees();\n const fee = absorb ? this.feeShare() : 0;\n const request: RefundRequest = {\n paymentId: p.id,\n amount: this.refundAmount(),\n feeAmount: fee,\n total: Math.round((this.refundAmount() + fee) * 100) / 100,\n reason: this.showReason() ? this.reason() : '',\n notes: this.showNotes() ? this.notes().trim() : '',\n absorbFees: absorb,\n };\n const endpoint = this.endpoint();\n if (!endpoint || !this.http) { this.submitted.emit(request); return; }\n this.busy.set(true);\n this.failure.set('');\n this.http.post(`${this.apiBase}${endpoint.replace('{id}', encodeURIComponent(p.id))}`,\n { amount: request.amount, reason: request.reason, reasonNotes: request.notes || null, absorbFees: request.absorbFees })\n .pipe(takeUntilDestroyed(this.destroyRef)).subscribe({\n next: () => { this.busy.set(false); this.toast.success(this.successMessage()); this.submitted.emit(request); this.refunded.emit(request); this.closed.emit(); },\n error: (err) => { this.busy.set(false); this.failure.set(getErrorMessage(err, 'refund', 'create')); },\n });\n }\n\n protected onClosed(): void {\n if (!this.isSaving()) this.closed.emit();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAa,4BACX;AAgBF,MAAa,oCAAoD,CAAC;CAAE,OAAO;CAAY,OAAO;AAAU,GAAI;CAAE,OAAO;CAAW,OAAO;AAAS,CAAE;AAClJ,MAAa,mCAAmD,CAAC;CAAE,OAAO;CAAc,OAAO;AAAY,GAAI;CAAE,OAAO;CAAW,OAAO;AAAU,CAAE;AAEtJ,MAAM,cAAc,SAAiB,QAAgB,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,MAAM,GAAG,G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