@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.
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
2
2
  import { DestroyRef, InjectionToken, Provider, TemplateRef, WritableSignal } from "@angular/core";
3
3
  import { isDarkPage } from "@forgeroute/ui/utils";
4
4
  import { CheckPaymentStatusFn, HostResult, PaymentAllocation, PaymentAttempt, PaymentAttemptControls, PaymentAttemptOutcome, PaymentMethodBodyContext, PaymentMethodPlugin, PaymentPluginMethod, PaymentReadiness, PaymentReadinessResult, ReadinessCheckFn } from "@forgeroute/ui/payments";
5
- import { UiLabelsService } from "@forgeroute/ui/core";
5
+ import { UiLabelKey, UiLabelsService } from "@forgeroute/ui/core";
6
6
  import { Observable } from "rxjs";
7
7
  /**
8
8
  * The small part of Stripe.js the library calls, written as plain structural types so the library has NO compile-time or run-time
@@ -1742,7 +1742,7 @@ export declare class StripeConnectComponent {
1742
1742
  readonly navigateTab: import("@angular/core").InputSignal<((url: string) => void) | null>;
1743
1743
  protected readonly visible: import("@angular/core").Signal<boolean>;
1744
1744
  /** Which screen the card shows. */
1745
- protected readonly state: import("@angular/core").Signal<"complete" | "verifying" | "incomplete" | "none">;
1745
+ protected readonly state: import("@angular/core").Signal<"none" | "complete" | "verifying" | "incomplete">;
1746
1746
  /** What the persistent status region says: the current state, plus "Loading." while a request runs. Empty while nothing is shown. */
1747
1747
  protected readonly liveText: import("@angular/core").Signal<string>;
1748
1748
  /** The user pressed a button that started a request: when the screen then changes, focus moves to the new screen (the pressed button is gone). */
@@ -1927,6 +1927,278 @@ export declare const STRIPE_METHOD_TEXTS: {
1927
1927
  verificationMessage: (amount: string) => string;
1928
1928
  readonly receiptNote: string;
1929
1929
  };
1930
+ /**
1931
+ * Card-reader (Stripe Terminal smart reader) types of the library. They mirror the answers of the payments service (`GET /v1/terminal/readiness`,
1932
+ * `GET /v1/terminal/readers/:id/ready`, the `terminal` object of a card-present payment, `cardSave`; see forgeroute-payments `docs/API.md` section 16.3 and
1933
+ * `host-kit/contract/terminal-readiness.json`). The BROWSER never calls the service: every call below is a function the HOST supplies (it calls its own backend,
1934
+ * which calls the service), exactly like `ui-stripe-connect`.
1935
+ */
1936
+ /** The ONE state of the reader setup, chosen by the service with this fixed precedence (first match wins). `unknown` = the read was slow or failed (nothing is guessed). */
1937
+ type StripeReaderReadinessState = 'merchant_not_ready' | 'no_reader' | 'unsupported_only' | 'reader_ready' | 'reader_busy' | 'reader_offline' | 'unknown';
1938
+ /** The precedence of the service, first match wins (documentation and tests; the service already sends the winning state). */
1939
+ export declare const STRIPE_READER_STATE_PRECEDENCE: readonly Exclude<StripeReaderReadinessState, 'unknown'>[];
1940
+ type StripeReaderDeviceStatus = 'online' | 'offline' | 'registering';
1941
+ /** A reader as the service answers it (register / list / get / rename). */
1942
+ interface StripeReader {
1943
+ id: string;
1944
+ label?: string | null;
1945
+ status: StripeReaderDeviceStatus | string;
1946
+ locationId?: string | null;
1947
+ deviceType?: string | null;
1948
+ serialNumber?: string | null;
1949
+ pairingCode?: string | null;
1950
+ action?: 'idle' | 'in_progress' | 'failed' | null;
1951
+ actionIntentId?: string | null;
1952
+ /** One of the supported smart readers (S700, S710, WisePOS E). Anything else cannot take a payment. */
1953
+ supported: boolean;
1954
+ /** Human model name, e.g. `Stripe Reader S700`. */
1955
+ model?: string | null;
1956
+ /** A payment of this merchant waits on the reader, or the processor says it works on an action. */
1957
+ busy: boolean;
1958
+ /** Only names a payment of THIS merchant. */
1959
+ busyPaymentId?: string | null;
1960
+ }
1961
+ /** `GET /v1/terminal/readiness`. */
1962
+ interface StripeReaderReadiness {
1963
+ state: StripeReaderReadinessState;
1964
+ readers: StripeReader[];
1965
+ /** The single ready reader, else the most recently used ready reader, else null (the user picks). */
1966
+ defaultReaderId: string | null;
1967
+ checkedAt?: string;
1968
+ /** The processor read was slow or failed: nothing was guessed. */
1969
+ stale?: boolean;
1970
+ /** `merchant_not_ready` or `reconnect_required` with the state `merchant_not_ready`. */
1971
+ reason?: string;
1972
+ merchantStatus?: string;
1973
+ /** Why the processor read failed (`stale`): see {@link StripeReaderTerminal.degradedReason}. */
1974
+ degradedReason?: StripeReaderDegradedReason | string;
1975
+ }
1976
+ /** `GET /v1/terminal/readers/:id/ready` (the optional check right before a payment). */
1977
+ interface StripeReaderReady {
1978
+ ready: boolean;
1979
+ reason: 'ok' | 'offline' | 'busy' | 'unsupported' | 'merchant_not_ready' | 'reconnect_required' | 'unknown' | string;
1980
+ reader?: StripeReader | null;
1981
+ checkedAt?: string;
1982
+ stale?: boolean;
1983
+ degradedReason?: StripeReaderDegradedReason | string;
1984
+ }
1985
+ /**
1986
+ * Why the service could not read the processor (`terminal.degradedReason`): `processor_unreachable` / `processor_timeout` are transient (try again), `reconnect_required` (the processor refused our credentials) and
1987
+ * `processor_refused` (it refused the read) will NOT fix themselves: the payment account needs attention.
1988
+ */
1989
+ type StripeReaderDegradedReason = 'processor_unreachable' | 'processor_timeout' | 'reconnect_required' | 'processor_refused';
1990
+ type StripeReaderTerminalState = 'waiting' | 'declined' | 'failed' | 'succeeded' | 'canceled' | 'unknown';
1991
+ /** The `terminal` object of a card-present payment (also carried by a 409 `payment_in_flight`). */
1992
+ interface StripeReaderTerminal {
1993
+ readerId: string;
1994
+ state: StripeReaderTerminalState;
1995
+ declineCode?: string;
1996
+ message?: string;
1997
+ /** `false` with the state `waiting` = the reader dropped its connection while the payment waits. */
1998
+ readerOnline?: boolean;
1999
+ /** `unknown` + `stale`: the processor could not be read in time; the stored payment is answered. */
2000
+ stale?: boolean;
2001
+ checkedAt?: string;
2002
+ /** With `stale`: why the processor could not be read (transient or needs attention). */
2003
+ degradedReason?: StripeReaderDegradedReason | string;
2004
+ /** From the 3rd consecutive stale read: how many stale reads in a row. */
2005
+ staleReads?: number;
2006
+ /** From the 3rd consecutive stale read: ISO time of the first stale read of the run ("we cannot reach the processor since 10:42"). */
2007
+ staleSince?: string;
2008
+ }
2009
+ /** Whether the card was kept for later (`savePaymentMethod`). Never claim "saved" unless `saved` is true. */
2010
+ interface StripeReaderCardSave {
2011
+ requested: boolean;
2012
+ saved: boolean;
2013
+ /** `no_generated_card`: the issuer / network gave no reusable card; the payment still succeeded. */
2014
+ reason?: string;
2015
+ }
2016
+ /** What a card reader payment looks like (the service's payment view plus `terminal` / `cardSave`). Only the fields the library reads are typed. */
2017
+ interface StripeReaderPayment {
2018
+ id: string;
2019
+ status?: string;
2020
+ amountCents?: number;
2021
+ baseCents?: number;
2022
+ feeCents?: number;
2023
+ platformFeeCents?: number;
2024
+ brand?: string | null;
2025
+ last4?: string | null;
2026
+ attemptKey?: string;
2027
+ terminal?: StripeReaderTerminal | null;
2028
+ cardSave?: StripeReaderCardSave | null;
2029
+ /** `POST .../retry`: a second retry while the reader already waits is a replay. */
2030
+ replayed?: boolean;
2031
+ [key: string]: unknown;
2032
+ }
2033
+ /** The consent the STAFF records at the counter before a card is kept (`consent` of `POST /v1/terminal/payments`; the service adds `channel: "terminal"`). */
2034
+ interface StripeReaderConsent {
2035
+ textVersion: string;
2036
+ /** ISO time the staff ticked the box. */
2037
+ acceptedAt: string;
2038
+ recordedBy: string;
2039
+ }
2040
+ /** Host settings that turn on "keep the card for future payments" for a reader payment. */
2041
+ interface StripeReaderSaveCard {
2042
+ /** The customer the card is kept for (`customerRef` of the service). */
2043
+ customerRef: string;
2044
+ /** Version of the consent wording (the host stores the text it shows under this version). */
2045
+ textVersion: string;
2046
+ /** Who is at the counter (the staff member's id or e-mail). */
2047
+ recordedBy: string;
2048
+ /**
2049
+ * The exact sentence the staff attests by ticking the box (default: "The customer agreed to keep this payment method on file for later payments."). `textVersion` MUST name this exact text (the host
2050
+ * stores the text it shows under that version).
2051
+ */
2052
+ consentText?: string;
2053
+ /** The payer pays the processing fees: "Later charges will include processing fees." is added to the consent sentence (the same sentence as the contractor staff collect panel). */
2054
+ customerPaysFees?: boolean;
2055
+ }
2056
+ /** What `startPayment` receives (the host maps it to `POST /v1/terminal/payments`). The amount is in major units. */
2057
+ interface StripeReaderStartContext {
2058
+ readerId: string;
2059
+ /** The amount the customer owes before fees, major units (12.5 = $12.50). */
2060
+ amount: number;
2061
+ /** Stable per click and REUSED when the answer is lost; send it as the service's `attemptKey`. */
2062
+ attemptKey: string;
2063
+ payableRef: string | null;
2064
+ /** Always `'CARD_PRESENT'`. */
2065
+ paymentMethod: 'CARD_PRESENT';
2066
+ /**
2067
+ * The TOTAL in cents the payer saw (`Math.round(quote.totalAmount * 100)` of the CARD_PRESENT quote). Send it as the service's `expectedAmountCents`: a changed quote is refused with 409 `quote_changed` before the
2068
+ * reader is touched. Absent when the screen showed no quote.
2069
+ */
2070
+ expectedAmountCents?: number;
2071
+ savePaymentMethod?: boolean;
2072
+ customerRef?: string;
2073
+ consent?: StripeReaderConsent;
2074
+ /** Set only by the payment-panel integration: what the panel's other fields say. */
2075
+ receivedDate?: string;
2076
+ notes?: string | null;
2077
+ allocation?: PaymentAllocation;
2078
+ }
2079
+ /** What `estimateFees` receives for a reader payment. The quote is the CARD_PRESENT one and differs from the online card quote. */
2080
+ interface StripeReaderFeeContext {
2081
+ amount: number;
2082
+ paymentMethod: 'CARD_PRESENT';
2083
+ paymentMethodType: 'card_present';
2084
+ }
2085
+ /** `getPayment`: which payment to read. `paymentId` is known after the start answered; before that only the attempt key is. */
2086
+ interface StripeReaderPaymentRef {
2087
+ paymentId: string | null;
2088
+ attemptKey: string;
2089
+ }
2090
+ type StripeReaderGetReadinessFn = () => HostResult<StripeReaderReadiness>;
2091
+ type StripeReaderStartFn = (ctx: StripeReaderStartContext) => HostResult<StripeReaderPayment>;
2092
+ /** Reads one payment with its `terminal` object. Answer `null` (or reject with 404) when no payment exists for the attempt key. */
2093
+ type StripeReaderGetPaymentFn = (ref: StripeReaderPaymentRef) => HostResult<StripeReaderPayment | null>;
2094
+ type StripeReaderRetryFn = (paymentId: string) => HostResult<StripeReaderPayment>;
2095
+ type StripeReaderCancelFn = (paymentId: string) => HostResult<unknown>;
2096
+ type StripeReaderFeesFn = (ctx: StripeReaderFeeContext) => HostResult<StripeFees>;
2097
+ /** The one bundle of host callbacks that turns card-reader mode on in `ui-payment-stripe-method` (`[reader]`). */
2098
+ interface StripeReaderConfig {
2099
+ getReadiness: StripeReaderGetReadinessFn;
2100
+ startPayment: StripeReaderStartFn;
2101
+ getPayment: StripeReaderGetPaymentFn;
2102
+ retryPayment: StripeReaderRetryFn;
2103
+ cancelPayment: StripeReaderCancelFn;
2104
+ /** The CARD_PRESENT fee quote. REQUIRED: a reader payment shows the breakdown (and sends `expectedAmountCents`) before the tap. */
2105
+ estimateFees: StripeReaderFeesFn;
2106
+ /** The address of the receipt of a paid payment (host-built; only https or in-app `/paths` are linked). */
2107
+ receiptUrl?: (payment: StripeReaderPayment) => string | null | undefined;
2108
+ /** Turns on the "Save this card for future payments" choice. */
2109
+ saveCard?: StripeReaderSaveCard | null;
2110
+ }
2111
+ /** A refusal of `startPayment` / `retryPayment` the library words itself. */
2112
+ interface StripeReaderRefusal {
2113
+ code: string;
2114
+ /** The service's own text, shown only for a code the library has no wording for. */
2115
+ message: string;
2116
+ paymentId: string | null;
2117
+ terminal: StripeReaderTerminal | null;
2118
+ /** `quote_changed`: the new total / fees in cents, as the service answered them. */
2119
+ amountCents?: number | null;
2120
+ feeCents?: number | null;
2121
+ platformFeeCents?: number | null;
2122
+ }
2123
+ /** Reads the flat `code`, status, `paymentId` and `terminal` of a failed host call (the error itself or its `error` body). */
2124
+ export declare function readerErrorInfo(error: unknown): StripeReaderRefusal & {
2125
+ status: number | null;
2126
+ };
2127
+ /** A refusal without the HTTP status (the refusal the screen keeps is the same shape whatever the transport said). */
2128
+ export declare function toRefusal(info: StripeReaderRefusal & {
2129
+ status?: number | null;
2130
+ }): StripeReaderRefusal;
2131
+ /** What a payment was STARTED for (before fees, major units): `baseCents`, else the total minus the fees, else the total; `null` when the service gave no amount. Never 0 for a missing amount. */
2132
+ export declare function paymentBaseAmount(payment: StripeReaderPayment | null | undefined): number | null;
2133
+ /** How the screen words a terminal the service could not read (`unknown` / `stale`). */
2134
+ type StripeReaderDegraded = {
2135
+ kind: 'transient';
2136
+ } | {
2137
+ kind: 'since';
2138
+ since: string;
2139
+ } | {
2140
+ kind: 'attention';
2141
+ };
2142
+ /**
2143
+ * `null` when the terminal was read normally. Otherwise: `attention` for a reason that will not fix itself (`reconnect_required`, `processor_refused`: "the payment account needs attention"), `since` from the 3rd
2144
+ * consecutive stale read ("cannot reach the processor since 10:42") and `transient` for the rest (`processor_unreachable`, `processor_timeout`, none given). Never a resubmit in any of them.
2145
+ */
2146
+ export declare function readerDegraded(terminal: Pick<StripeReaderTerminal, 'state' | 'stale' | 'degradedReason' | 'staleReads' | 'staleSince'> | null | undefined, locale?: string): StripeReaderDegraded | null;
2147
+ /** The TOTAL a payment charged (major units), from the service's `amountCents`; `null` when absent. */
2148
+ export declare function paymentChargedAmount(payment: StripeReaderPayment | null | undefined): number | null;
2149
+ /** The label key of the wording of a reader refusal code, or null for a code the library does not know (the service's message is shown). */
2150
+ export declare function readerRefusalLabelKey(code: string): UiLabelKey | null;
2151
+ /** Codes that prove NOTHING was created or charged: the attempt is released (key kept) and the payer may start again. */
2152
+ export declare const STRIPE_READER_NOT_CREATED_CODES: readonly string[];
2153
+ /** The supported smart readers (the service refuses anything else with 400 `reader_not_supported`). */
2154
+ export declare const STRIPE_READER_MODELS: readonly {
2155
+ deviceType: string;
2156
+ model: string;
2157
+ }[];
2158
+ /** A defensive copy of an answer: an unknown state or a missing list becomes `unknown` / `[]` (nothing is ever guessed ready). */
2159
+ export declare function normalizeReadiness(raw: unknown): StripeReaderReadiness;
2160
+ /** The name a reader is shown under: its label, else its model, else its id. */
2161
+ export declare function readerDisplayName(reader: Pick<StripeReader, 'id' | 'label' | 'model' | 'deviceType'> | null | undefined): string;
2162
+ /** Can this reader take a payment right now (supported, online, free)? */
2163
+ export declare function isReaderFree(reader: StripeReader): boolean;
2164
+ /** Only an https address or an in-app `/path` is ever linked or opened (never `javascript:`, `data:`, `//host`). */
2165
+ export declare function isSafeReceiptUrl(url: string | null | undefined): url is string;
2166
+ /** `m:ss` of an elapsed time in ms (never negative). */
2167
+ export declare function formatElapsed(ms: number): string;
2168
+ /** A Stripe location a reader is registered to. */
2169
+ interface StripeReaderLocation {
2170
+ id: string;
2171
+ displayName: string;
2172
+ address?: {
2173
+ line1?: string;
2174
+ city?: string;
2175
+ state?: string;
2176
+ postalCode?: string;
2177
+ country?: string;
2178
+ } | null;
2179
+ }
2180
+ /** What `registerReader` receives. The registration code is typed once by the user and never kept: it is cleared from the form BEFORE the call and never echoed back. */
2181
+ interface StripeReaderRegisterContext {
2182
+ registrationCode: string;
2183
+ label: string;
2184
+ locationId: string;
2185
+ }
2186
+ /** What `createLocation` receives (the host maps it to `POST /v1/terminal/locations`). */
2187
+ interface StripeReaderCreateLocationContext {
2188
+ displayName: string;
2189
+ address: {
2190
+ line1: string;
2191
+ city: string;
2192
+ state: string;
2193
+ postalCode: string;
2194
+ country: string;
2195
+ };
2196
+ }
2197
+ type StripeReaderRegisterFn = (ctx: StripeReaderRegisterContext) => HostResult<StripeReader>;
2198
+ type StripeReaderRenameFn = (readerId: string, label: string) => HostResult<StripeReader>;
2199
+ type StripeReaderRemoveFn = (readerId: string) => HostResult<unknown>;
2200
+ type StripeReaderListLocationsFn = () => HostResult<readonly StripeReaderLocation[]>;
2201
+ type StripeReaderCreateLocationFn = (ctx: StripeReaderCreateLocationContext) => HostResult<StripeReaderLocation>;
1930
2202
  /**
1931
2203
  * Adds LIVE Card and ACH (Stripe) to `ui-payment-side-panel`. Put it inside the panel only for customers who use Stripe: its presence replaces the
1932
2204
  * record-only Card / ACH (last 4 digits) with the Payment Element; remove it and the panel is record-only again.
@@ -2002,6 +2274,20 @@ export declare class StripePaymentMethodComponent extends PaymentMethodPlugin {
2002
2274
  readonly readinessCheck: import("@angular/core").InputSignal<ReadinessCheckFn | null>;
2003
2275
  readonly readinessTimeoutMs: import("@angular/core").InputSignal<number>;
2004
2276
  readonly readinessEveryMs: import("@angular/core").InputSignal<number>;
2277
+ /**
2278
+ * The card-reader calls. With it, the method Card gets a choice "Card reader | Enter card manually" above the form and the READER is the default as soon as the first readiness answer says `reader_ready`
2279
+ * (`[readerFirst]`); otherwise manual stays the default and one reader banner explains why. The payer can always switch to the manual card; switching away while a reader payment waits first cancels it through
2280
+ * `reader.cancelPayment`. See docs/card-readers.md.
2281
+ */
2282
+ readonly reader: import("@angular/core").InputSignal<StripeReaderConfig | null>;
2283
+ /** The reader is the default when it is ready (default true). `false` keeps manual as the default and only offers the choice. */
2284
+ readonly readerFirst: import("@angular/core").InputSignal<boolean>;
2285
+ /** "Connect a reader": the host opens its pairing panel (`ui-stripe-readers`). */
2286
+ readonly readerConnect: import("@angular/core").OutputEmitterRef<void>;
2287
+ /** "Get a card reader": the host opens its order flow. */
2288
+ readonly readerOrder: import("@angular/core").OutputEmitterRef<void>;
2289
+ /** "Set up payments": the host opens payment setup. */
2290
+ readonly readerSetup: import("@angular/core").OutputEmitterRef<void>;
2005
2291
  readonly receiptNoteInput: import("@angular/core").InputSignal<string | null>;
2006
2292
  readonly receiptNote: import("@angular/core").Signal<string>;
2007
2293
  private readonly body;
@@ -2169,11 +2455,1178 @@ export declare class StripePaymentMethodComponent extends PaymentMethodPlugin {
2169
2455
  "required": false;
2170
2456
  "isSignal": true;
2171
2457
  };
2458
+ "reader": {
2459
+ "alias": "reader";
2460
+ "required": false;
2461
+ "isSignal": true;
2462
+ };
2463
+ "readerFirst": {
2464
+ "alias": "readerFirst";
2465
+ "required": false;
2466
+ "isSignal": true;
2467
+ };
2172
2468
  "receiptNoteInput": {
2173
2469
  "alias": "receiptNote";
2174
2470
  "required": false;
2175
2471
  "isSignal": true;
2176
2472
  };
2473
+ }, {
2474
+ "readerConnect": "readerConnect";
2475
+ "readerOrder": "readerOrder";
2476
+ "readerSetup": "readerSetup";
2477
+ }, never, never, true, never>;
2478
+ }
2479
+ /**
2480
+ * Where a card reader payment is. One value, always:
2481
+ * - `idle`: nothing started (or an earlier payment ended: canceled / failed / refused);
2482
+ * - `starting`: the click was accepted and the payment is on its way to the service (the answer is not here yet);
2483
+ * - `recovering`: the answer of `starting` was lost (timeout, connection): the attempt key is looked up until the payment is found (or, after the grace period, the service still has none: then `recoveryExpired` is set and
2484
+ * the payer is asked to check again; only a second "none" answer, asked by the payer, releases the attempt). NEVER a second start;
2485
+ * - `waiting`: the reader waits for the customer to tap, insert or swipe;
2486
+ * - `declined`: the card was declined; the payment stays open (retry the SAME payment or cancel it);
2487
+ * - `stopped`: the reader stopped waiting without a decline; the payment stays open (retry or cancel);
2488
+ * - `retrying`: the same payment is being sent to the reader again;
2489
+ * - `cancelling`: a cancel is running (the payment is canceled ONLY when the service confirms);
2490
+ * - `succeeded`, `canceled`, `failed`: final.
2491
+ */
2492
+ type StripeReaderPhase = 'idle' | 'starting' | 'recovering' | 'waiting' | 'declined' | 'stopped' | 'retrying' | 'cancelling' | 'succeeded' | 'canceled' | 'failed';
2493
+ /** What the flow needs of the payment-attempt machine (`PaymentAttempt` of `@forgeroute/ui/payments` fits it; specs use a fake). */
2494
+ interface StripeReaderAttemptPort {
2495
+ begin(): {
2496
+ ok: true;
2497
+ key: string;
2498
+ } | {
2499
+ ok: false;
2500
+ reason: 'locked' | 'paid' | 'unknown' | 'offline';
2501
+ };
2502
+ /** The key of the attempt in effect. */
2503
+ key(): string;
2504
+ /** The payment succeeded: locks the payable as paid. */
2505
+ succeed(reason?: string): void;
2506
+ /** A DEFINITIVE end without money (canceled, failed): unlocks with a NEW key. */
2507
+ fail(reason?: string): void;
2508
+ /** Nothing was created at the service: unlock, KEEP the key. */
2509
+ markNotCharged(): void;
2510
+ /** The answer of the start was lost: lock (key kept) until the payment is found. */
2511
+ markUnknown(reason: string): void;
2512
+ }
2513
+ type StripeReaderFlowEvent = {
2514
+ kind: 'started';
2515
+ payment: StripeReaderPayment;
2516
+ attemptKey: string;
2517
+ } | {
2518
+ kind: 'declined';
2519
+ payment: StripeReaderPayment;
2520
+ } | {
2521
+ kind: 'succeeded';
2522
+ payment: StripeReaderPayment;
2523
+ attemptKey: string;
2524
+ } | {
2525
+ kind: 'canceled';
2526
+ payment: StripeReaderPayment | null;
2527
+ } | {
2528
+ kind: 'failed';
2529
+ payment: StripeReaderPayment | null;
2530
+ } | {
2531
+ kind: 'refused';
2532
+ refusal: StripeReaderRefusal;
2533
+ } | {
2534
+ kind: 'connection-lost';
2535
+ } | {
2536
+ kind: 'connection-restored';
2537
+ };
2538
+ interface StripeReaderFlowOptions {
2539
+ attempt: StripeReaderAttemptPort;
2540
+ /** The calls are read at call time (a host may swap them); null = not provided (the action does nothing). */
2541
+ start: () => StripeReaderStartFn | null;
2542
+ getPayment: () => StripeReaderGetPaymentFn | null;
2543
+ retry: () => StripeReaderRetryFn | null;
2544
+ cancel: () => StripeReaderCancelFn | null;
2545
+ /** How often the open payment is read (default 2000 ms). */
2546
+ pollMs?: () => number;
2547
+ /** A poll slower than this counts as a lost connection (default 8000 ms). */
2548
+ pollTimeoutMs?: () => number;
2549
+ /** One start / retry / cancel call slower than this is treated as unreachable: a start becomes a lost answer (looked up by its attempt key, never re-sent), a retry / cancel leaves the payment as it was (default 60 000 ms). */
2550
+ requestTimeoutMs?: () => number;
2551
+ /** After a lost start answer (or an adopted attempt), "no payment for this attempt key" is believed only after this long, MEASURED FROM THE MOMENT RECOVERY STARTS (default 360 000 ms: the service may take up to 5 minutes to create the payment
2552
+ * of a request whose answer the browser gave up on, API.md 16.3, plus 1 minute of margin). */
2553
+ lostAnswerGraceMs?: () => number;
2554
+ now?: () => number;
2555
+ onEvent?: (event: StripeReaderFlowEvent) => void;
2556
+ }
2557
+ /** What the screen passes to `start()`. */
2558
+ interface StripeReaderStartInput {
2559
+ readerId: string;
2560
+ /** Major units. */
2561
+ amount: number;
2562
+ payableRef: string | null;
2563
+ /** The total in cents the payer saw (the CARD_PRESENT quote); sent as `expectedAmountCents`. */
2564
+ expectedAmountCents?: number;
2565
+ save?: {
2566
+ customerRef: string;
2567
+ consent: StripeReaderConsent;
2568
+ } | null;
2569
+ extras?: Pick<StripeReaderStartContext, 'receivedDate' | 'notes' | 'allocation'>;
2570
+ }
2571
+ export declare const STRIPE_READER_POLL_MS = 2000;
2572
+ export declare const STRIPE_READER_POLL_TIMEOUT_MS = 8000;
2573
+ /** The service's create window (5 minutes) plus a minute of margin: "no payment for this key" earlier than this may only mean the payment is not created yet. */
2574
+ export declare const STRIPE_READER_LOST_ANSWER_GRACE_MS: number;
2575
+ /** A start / retry / cancel call that has not answered by then is unreachable (the library's request timeout). */
2576
+ export declare const STRIPE_READER_REQUEST_TIMEOUT_MS = 60000;
2577
+ /**
2578
+ * The card reader payment flow as a plain class (no view): readiness is the screen's job, this starts ONE payment on a reader, follows it by polling the service through the host's calls, and lets the payer retry
2579
+ * (the SAME payment, never a new charge) or cancel it. `ui-stripe-reader-payment` runs it; specs drive it with fake calls and a fake clock.
2580
+ *
2581
+ * Money rules it enforces:
2582
+ * - ONE payment at a time: `start()` is synchronous up to the attempt's `begin()` (a double click / second tab is refused) and every state in {@link OPEN} refuses another start;
2583
+ * - the attempt key is the one the attempt machine pinned at the click and is REUSED when the answer is lost (the service answers the same attempt key with the same payment, one intent, one reader action);
2584
+ * - a lost answer is never "failed": it is `recovering` (polling by attempt key) until the payment shows up, or the grace period has passed with the service still saying "no payment for this key";
2585
+ * - a cancel never claims success unless the service confirmed it (`reader_unreachable` leaves the payment open and says so);
2586
+ * - a poll that fails (connection lost) never changes the payment's state: it is reported and polling continues; the state shown on reconnect is the service's truth;
2587
+ * - the service's `terminal.state` `unknown` / `stale` is "still checking" (never an error, never a resubmit).
2588
+ */
2589
+ export declare class StripeReaderFlow {
2590
+ private readonly o;
2591
+ readonly phase: import("@angular/core").WritableSignal<StripeReaderPhase>;
2592
+ readonly payment: import("@angular/core").WritableSignal<StripeReaderPayment | null>;
2593
+ readonly terminal: import("@angular/core").Signal<StripeReaderTerminal | null>;
2594
+ /** The service could not read the processor (`terminal.state` `unknown` or `stale`): "still checking". */
2595
+ readonly checking: import("@angular/core").WritableSignal<boolean>;
2596
+ /** The browser could not reach the host while a payment is open: the reader may still take the payment. */
2597
+ readonly connectionLost: import("@angular/core").WritableSignal<boolean>;
2598
+ /** `recovering` only: the grace period is over and the service still has no payment for the attempt key. Polling stops; the payer is asked to "Check again" (`recheck()`), and only another "none" releases the attempt. */
2599
+ readonly recoveryExpired: import("@angular/core").WritableSignal<boolean>;
2600
+ /** `recheck()` is running. */
2601
+ readonly rechecking: import("@angular/core").WritableSignal<boolean>;
2602
+ /** The reader dropped its connection while the payment waits (`terminal.readerOnline === false`). */
2603
+ readonly readerOffline: import("@angular/core").WritableSignal<boolean>;
2604
+ /** The last refusal of a start / retry (worded by the screen); cleared by the next start. */
2605
+ readonly refusal: import("@angular/core").WritableSignal<StripeReaderRefusal | null>;
2606
+ /** A cancel could not be confirmed (the reader or the processor was unreachable): the payment is STILL open. */
2607
+ readonly cancelUnreachable: import("@angular/core").WritableSignal<boolean>;
2608
+ readonly cardSave: import("@angular/core").WritableSignal<StripeReaderCardSave | null>;
2609
+ readonly elapsedMs: import("@angular/core").WritableSignal<number>;
2610
+ /** What the last start (or the adopted payment) is for, before fees (major units); `null` until known. */
2611
+ readonly baseAmount: import("@angular/core").Signal<number | null>;
2612
+ /** The input of the last start (a signal, so the screen follows it). */
2613
+ readonly startInput: import("@angular/core").WritableSignal<StripeReaderStartInput | null>;
2614
+ /** The attempt key of the payment being started / followed. */
2615
+ readonly attemptKey: import("@angular/core").WritableSignal<string | null>;
2616
+ /** No other payment may be started and the payer must not leave. */
2617
+ readonly locked: import("@angular/core").Signal<boolean>;
2618
+ /** A payment exists at the service and is not decided (cancel is possible). */
2619
+ readonly cancellable: import("@angular/core").Signal<boolean>;
2620
+ readonly retryable: import("@angular/core").Signal<boolean>;
2621
+ private disposed;
2622
+ private pollTimer;
2623
+ private tickTimer;
2624
+ private pollGen;
2625
+ private polling;
2626
+ private startedAt;
2627
+ /** When recovery began (a lost start answer, or an adopted attempt): the grace is counted from here, never from the click. */
2628
+ private recoverStartedAt;
2629
+ private explicitCheck;
2630
+ /** The payment id the service named in a 409 `request_in_progress` (the same attempt key is being created): used to read the payment while the answer of the start is lost. Never used to cancel. */
2631
+ private adoptedPaymentId;
2632
+ private cancelRun;
2633
+ /** The phase to go back to when a retry or a cancel did not change anything. */
2634
+ private before;
2635
+ constructor(o: StripeReaderFlowOptions);
2636
+ private now;
2637
+ private emit;
2638
+ /** Starts ONE payment on a reader. Synchronous up to the attempt's `begin()`: a second click in the same tick is refused. */
2639
+ start(input: StripeReaderStartInput): Promise<void>;
2640
+ private onStartError;
2641
+ /** Follows an open reader payment of another attempt (the service said so with `payment_in_flight` + `terminal`): the screen shows it like its own, with its refusal text above. */
2642
+ private follow;
2643
+ /**
2644
+ * A reload or a second tab found an UNDECIDED attempt of this payable (the attempt machine is `unknown`): the payment may be waiting on a reader right now. The attempt key is looked up (never a new start)
2645
+ * until the payment shows up (then it is followed like any other) or, after the grace period, the service still has none.
2646
+ */
2647
+ adopt(): void;
2648
+ private endNotCreated;
2649
+ private refuse;
2650
+ /** The answer of the start is lost: lock with the key kept and look the attempt key up until the payment shows up. */
2651
+ private lostAnswer;
2652
+ /** Reads the payment now (also after the browser says it is back online). */
2653
+ pollNow(): void;
2654
+ /** The browser reports offline / online. Offline only marks the loss; the next successful poll restores. */
2655
+ markConnection(online: boolean): void;
2656
+ private shouldPoll;
2657
+ private schedulePoll;
2658
+ private stopPolling;
2659
+ private pollOnce;
2660
+ /**
2661
+ * "Check again" of an unconfirmed payment (`recoveryExpired`): reads the attempt key once more. Found: followed like any payment. Still none (the grace is over): the attempt is released and the payer may start again (the same key is
2662
+ * idempotent at the service). A failed read changes nothing (connection lost) and the payer can check again.
2663
+ */
2664
+ recheck(): Promise<void>;
2665
+ private setConnectionLost;
2666
+ /** Applies a payment answer (a start / read / retry answer). Only an OPEN phase follows it: a late answer after a final state changes nothing. */
2667
+ private apply;
2668
+ private settle;
2669
+ /** After a decline (or a stop): sends the SAME payment to the reader again. Never creates a payment. */
2670
+ retry(): Promise<void>;
2671
+ /**
2672
+ * Cancels the payment at the service. Resolves true only when the service confirmed the cancel (or already reports the payment canceled). While it runs the payment is `cancelling`; when the
2673
+ * service cannot reach the reader or the processor (503 `reader_unreachable`, a lost connection) the payment STAYS open, `cancelUnreachable` is set and the payer may cancel again.
2674
+ */
2675
+ cancel(): Promise<boolean>;
2676
+ private runCancel;
2677
+ /** Runs one host call raced against the request timeout: a call that never answers cannot lock the flow forever. A late answer after the timeout is ignored (the next poll reads the truth). */
2678
+ private call;
2679
+ /** From `canceled` / `failed`: back to a fresh start (a NEW key, the attempt machine already renewed it). */
2680
+ reset(): void;
2681
+ /** The input of the last start (the screen re-sends it after "Start again"). */
2682
+ lastStartInput(): StripeReaderStartInput | null;
2683
+ private startTick;
2684
+ private stopTick;
2685
+ /** The screen is gone: timers stop. Nothing is cancelled here (the screen decides; a payment that is open stays open at the service and is found again by its attempt key). */
2686
+ dispose(): void;
2687
+ }
2688
+ /** The state the banner shows: the service's single readiness state, `unknown` when it could not be read, `loading` before the first answer. */
2689
+ type StripeReaderBannerState = StripeReaderReadinessState | 'loading';
2690
+ /**
2691
+ * The ONE card-reader banner. It is rendered from the service's single readiness `state` (never from several flags), so a payment screen can never show two reader messages at once:
2692
+ *
2693
+ * - `merchant_not_ready`: payments are not set up (action: open payment setup); with the reason `reconnect_required` the payment account must be reconnected ("Reconnect payments", the same `openSetup` output: the host opens the place where the account is set up / reconnected);
2694
+ * - `no_reader` / `unsupported_only`: "No card reader set up" with the two actions "Connect a reader" (the host opens its pairing panel) and "Get a card reader" (the host opens its order flow);
2695
+ * - `reader_busy`: "A payment is waiting on <reader>" (+ "Cancel that payment" when the payment is this screen's own);
2696
+ * - `reader_offline`: "Card reader not connected" + "Check again";
2697
+ * - `unknown`: the check failed or was too slow (nothing is guessed) + "Check again"; when the service says WHY and it will not fix itself (`degradedReason` `reconnect_required` / `processor_refused`) the banner says the payment account needs attention (+ "Reconnect payments");
2698
+ * - `reader_ready`: no banner (a polite announcement only).
2699
+ *
2700
+ * The component has no HTTP: the host reads the readiness (see `ui-stripe-reader-payment` / `ui-stripe-readers`) and passes it in; the buttons are outputs.
2701
+ *
2702
+ * <ui-stripe-reader-status [readiness]="readiness()" [loading]="loading()" (connectReader)="openPairing()" (getReader)="openOrder()" (recheck)="reload()" />
2703
+ */
2704
+ export declare class StripeReaderStatusComponent {
2705
+ protected readonly labels: UiLabelsService;
2706
+ /** The service's last readiness answer (`null` = none yet or the read failed). */
2707
+ readonly readiness: import("@angular/core").InputSignal<StripeReaderReadiness | null>;
2708
+ /** A read is running and there is no answer to show yet: a skeleton. */
2709
+ readonly loading: import("@angular/core").InputSignal<boolean>;
2710
+ /** The id of a payment THIS screen started and that holds the reader: the banner then offers "Cancel that payment". */
2711
+ readonly ownBusyPaymentId: import("@angular/core").InputSignal<string | null>;
2712
+ /** That cancel is running. */
2713
+ readonly cancelling: import("@angular/core").InputSignal<boolean>;
2714
+ /** Adds "Take a manual payment instead" (a payment screen that has a manual path). */
2715
+ readonly showManual: import("@angular/core").InputSignal<boolean>;
2716
+ /** Hides "Connect a reader" (the pairing screen itself shows the banner). */
2717
+ readonly hideConnect: import("@angular/core").InputSignal<boolean>;
2718
+ /** "Connect a reader": the host opens its pairing panel (`ui-stripe-readers`). */
2719
+ readonly connectReader: import("@angular/core").OutputEmitterRef<void>;
2720
+ /** "Get a card reader": the host opens its order flow. */
2721
+ readonly getReader: import("@angular/core").OutputEmitterRef<void>;
2722
+ /** "Check again". */
2723
+ readonly recheck: import("@angular/core").OutputEmitterRef<void>;
2724
+ /** "Set up payments": the host opens payment setup. */
2725
+ readonly openSetup: import("@angular/core").OutputEmitterRef<void>;
2726
+ /** "Cancel that payment" (the payment id). */
2727
+ readonly cancelBusy: import("@angular/core").OutputEmitterRef<string>;
2728
+ /** "Take a manual payment instead". */
2729
+ readonly manual: import("@angular/core").OutputEmitterRef<void>;
2730
+ /** Which banner: no answer and loading = `loading`; no answer and not loading = `unknown` (the check failed); else the service's state. */
2731
+ readonly state: import("@angular/core").Signal<StripeReaderBannerState>;
2732
+ protected readonly variant: import("@angular/core").Signal<"info" | "warning">;
2733
+ private readonly busyName;
2734
+ /** `merchant_not_ready` because the payment account must be reconnected (the service's `reason`). Any other merchant status (onboarding, disconnected...) is "not set up". */
2735
+ protected readonly reconnect: import("@angular/core").Signal<boolean>;
2736
+ /** `unknown` because of a reason that will not fix itself (`reconnect_required`, `processor_refused`): the account needs attention. Transient reasons (and none) stay "could not check, check again". */
2737
+ protected readonly attention: import("@angular/core").Signal<boolean>;
2738
+ /** The label group of the banner: the state, or a more exact one for a reconnect / attention case. */
2739
+ private readonly textKey;
2740
+ protected readonly title: import("@angular/core").Signal<string>;
2741
+ protected readonly text: import("@angular/core").Signal<string>;
2742
+ /** What the polite region says: the banner's title (a change of state is announced), "ready" for a ready reader, nothing while loading. */
2743
+ protected readonly liveText: import("@angular/core").Signal<string>;
2744
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReaderStatusComponent, never>;
2745
+ static ɵcmp: i0.ɵɵComponentDeclaration<StripeReaderStatusComponent, "ui-stripe-reader-status", never, {
2746
+ "readiness": {
2747
+ "alias": "readiness";
2748
+ "required": false;
2749
+ "isSignal": true;
2750
+ };
2751
+ "loading": {
2752
+ "alias": "loading";
2753
+ "required": false;
2754
+ "isSignal": true;
2755
+ };
2756
+ "ownBusyPaymentId": {
2757
+ "alias": "ownBusyPaymentId";
2758
+ "required": false;
2759
+ "isSignal": true;
2760
+ };
2761
+ "cancelling": {
2762
+ "alias": "cancelling";
2763
+ "required": false;
2764
+ "isSignal": true;
2765
+ };
2766
+ "showManual": {
2767
+ "alias": "showManual";
2768
+ "required": false;
2769
+ "isSignal": true;
2770
+ };
2771
+ "hideConnect": {
2772
+ "alias": "hideConnect";
2773
+ "required": false;
2774
+ "isSignal": true;
2775
+ };
2776
+ }, {
2777
+ "connectReader": "connectReader";
2778
+ "getReader": "getReader";
2779
+ "recheck": "recheck";
2780
+ "openSetup": "openSetup";
2781
+ "cancelBusy": "cancelBusy";
2782
+ "manual": "manual";
2783
+ }, never, never, true, never>;
2784
+ }
2785
+ /** What `(succeeded)` reports. */
2786
+ interface StripeReaderSucceededEvent {
2787
+ payment: StripeReaderPayment;
2788
+ attemptKey: string;
2789
+ /** The amount the payment was STARTED with (major units, before fees). */
2790
+ amount: number;
2791
+ readerId: string;
2792
+ }
2793
+ /** What `(outcome)` reports, for a host that wants to word a toast or log (the component never toasts). */
2794
+ type StripeReaderOutcome = {
2795
+ kind: 'started';
2796
+ payment: StripeReaderPayment;
2797
+ } | {
2798
+ kind: 'declined';
2799
+ payment: StripeReaderPayment;
2800
+ } | {
2801
+ kind: 'canceled';
2802
+ } | {
2803
+ kind: 'failed';
2804
+ } | {
2805
+ kind: 'refused';
2806
+ code: string;
2807
+ } | {
2808
+ kind: 'connection-lost';
2809
+ } | {
2810
+ kind: 'connection-restored';
2811
+ } |
2812
+ /** The panel was closed while the answer of the start was still on its way / lost: the payment is looked up again when the screen opens. The host may word it ("We are still confirming your payment"). */
2813
+ {
2814
+ kind: 'left-pending';
2815
+ };
2816
+ /**
2817
+ * Takes a card payment on a Stripe smart reader (S700, S710, WisePOS E): the card reader flow of the payment screen. The HOST owns the calls (it calls its own backend, which calls the
2818
+ * payments service; the browser never talks to the service), the component owns the screen and the flow ({@link StripeReaderFlow}):
2819
+ *
2820
+ * 1. it reads the readiness (ONE state, see `ui-stripe-reader-status`) now and every `readinessEveryMs`, and shows the ONE banner when the reader cannot be used;
2821
+ * 2. with `reader_ready` it shows the reader, the amount and the card-reader FEE quote (`estimateFees`, method CARD_PRESENT: cleared at once when the amount changes, "Send to the reader"
2822
+ * stays off until the quote for the current amount is here), the optional "Save this card" consent and "Send to the reader";
2823
+ * 3. while a payment waits: "Waiting for the customer to tap, insert or swipe their card on <reader>", the amount, the fees, the elapsed time and ONLY "Cancel payment";
2824
+ * 4. a decline shows "Card declined" with "Try again" (the SAME payment) / "Cancel payment" / "Take a manual payment instead"; a success shows the receipt link and whether the card was saved.
2825
+ *
2826
+ * Nothing else can start a payment while one is open (every start button is off, a double click and a second tab are refused by the attempt machine), the attempt key is stable per click and
2827
+ * REUSED when the answer is lost, and a lost connection never changes the state shown: the payment is read again by its attempt key when the connection is back. Offline / slow connections
2828
+ * block "Send to the reader" before it starts (payments are never queued). A manual payment is always one click away (`(manual)`).
2829
+ *
2830
+ * <ui-stripe-reader-payment [amount]="amount()" payableRef="unit:42" [getReadiness]="readiness" [startPayment]="start" [getPayment]="read" [retryPayment]="retry" [cancelPayment]="cancel"
2831
+ * [estimateFees]="fees" (manual)="useManual()" (connectReader)="openPairing()" (getReader)="openOrder()" (succeeded)="onPaid($event)" />
2832
+ */
2833
+ export declare class StripeReaderPaymentComponent {
2834
+ protected readonly labels: UiLabelsService;
2835
+ private readonly destroyRef;
2836
+ private readonly injector;
2837
+ private readonly host;
2838
+ private readonly storage;
2839
+ /** The amount the customer owes before fees, major units. `null` = nothing to take yet. */
2840
+ readonly amount: import("@angular/core").InputSignal<number | null>;
2841
+ readonly currency: import("@angular/core").InputSignal<string>;
2842
+ /** The payable (an invoice, a balance): the attempt marker is stored under it, so a reload or a second tab finds an open payment instead of starting another. */
2843
+ readonly payableRef: import("@angular/core").InputSignal<string | null>;
2844
+ /** A key the host supplies; empty = derived from the payable / generated by the attempt machine. */
2845
+ readonly attemptKey: import("@angular/core").InputSignal<string | null>;
2846
+ /** The payable is paid (host re-render): no payment can start. */
2847
+ readonly paid: import("@angular/core").InputSignal<boolean>;
2848
+ /** Extra fields the host's backend wants with the start (the payment panel passes its date, note and allocation). */
2849
+ readonly startExtras: import("@angular/core").InputSignal<{
2850
+ receivedDate?: string;
2851
+ notes?: string | null;
2852
+ allocation?: PaymentAllocation;
2853
+ } | null>;
2854
+ readonly getReadiness: import("@angular/core").InputSignal<StripeReaderGetReadinessFn | null>;
2855
+ readonly startPayment: import("@angular/core").InputSignal<StripeReaderStartFn | null>;
2856
+ readonly getPayment: import("@angular/core").InputSignal<StripeReaderGetPaymentFn | null>;
2857
+ readonly retryPayment: import("@angular/core").InputSignal<StripeReaderRetryFn | null>;
2858
+ readonly cancelPaymentFn: import("@angular/core").InputSignal<StripeReaderCancelFn | null>;
2859
+ /** The CARD_PRESENT fee quote. REQUIRED: a reader payment always shows the card reader fee breakdown before the tap, so without it "Send to the reader" stays off and says the fees are not available. */
2860
+ readonly estimateFees: import("@angular/core").InputSignal<StripeReaderFeesFn | null>;
2861
+ readonly receiptUrl: import("@angular/core").InputSignal<((payment: StripeReaderPayment) => string | null | undefined) | null>;
2862
+ /** Turns on "Save this card for future payments" (the consent the staff records at the counter). */
2863
+ readonly saveCard: import("@angular/core").InputSignal<StripeReaderSaveCard | null>;
2864
+ /** The id of an open reader payment THIS user owns (from the host's records): with it the "reader busy" banner offers "Cancel that payment". */
2865
+ readonly ownPaymentId: import("@angular/core").InputSignal<string | null>;
2866
+ /** `true` = the full reader screen; `false` = only the banner (the payment screen is in manual mode but still tells that a reader could be used). */
2867
+ readonly active: import("@angular/core").InputSignal<boolean>;
2868
+ /** A manual payment path exists: "Enter the card manually instead" / "Take a manual payment instead" show and the offline text says a manual payment can still be recorded. */
2869
+ readonly manualAvailable: import("@angular/core").InputSignal<boolean>;
2870
+ /** The buttons that start something do nothing (a read-only user). Cancel stays possible. */
2871
+ readonly disabled: import("@angular/core").InputSignal<boolean>;
2872
+ /** Asked right before "Send to the reader" starts anything; `false` = do not start (the payment panel validates its own fields here and shows their messages). */
2873
+ readonly beforeStart: import("@angular/core").InputSignal<(() => boolean) | null>;
2874
+ readonly readinessEveryMs: import("@angular/core").InputSignal<number>;
2875
+ readonly readinessTimeoutMs: import("@angular/core").InputSignal<number>;
2876
+ readonly pollMs: import("@angular/core").InputSignal<number>;
2877
+ readonly pollTimeoutMs: import("@angular/core").InputSignal<number>;
2878
+ /** After a lost start answer (or an adopted attempt) the service's "no payment for this attempt key" is believed only after this long, counted from the moment recovery starts. Default 6 minutes: the service's 5-minute create window plus a minute (ms). */
2879
+ readonly lostAnswerGraceMs: import("@angular/core").InputSignal<number>;
2880
+ /** A start / retry / cancel call slower than this is unreachable (ms): a start is looked up by its attempt key, a retry / cancel leaves the payment as it was. */
2881
+ readonly requestTimeoutMs: import("@angular/core").InputSignal<number>;
2882
+ /** A quote slower than this: "Try again" is offered and Send stays off (ms). */
2883
+ readonly feeTimeoutMs: import("@angular/core").InputSignal<number>;
2884
+ /** Managed environments where `navigator.onLine === false` is a false negative: the browser's offline flag does not block (default false). */
2885
+ readonly offlineOverride: import("@angular/core").InputSignal<boolean>;
2886
+ /** The user wants to enter the card manually (the host switches its method). Emitted only when nothing is waiting on the reader. */
2887
+ readonly manual: import("@angular/core").OutputEmitterRef<void>;
2888
+ /** "Connect a reader": the host opens its pairing panel. */
2889
+ readonly connectReader: import("@angular/core").OutputEmitterRef<void>;
2890
+ /** "Get a card reader": the host opens its order flow. */
2891
+ readonly getReader: import("@angular/core").OutputEmitterRef<void>;
2892
+ /** "Set up payments": the host opens payment setup. */
2893
+ readonly openSetup: import("@angular/core").OutputEmitterRef<void>;
2894
+ /** The payment succeeded. */
2895
+ readonly succeeded: import("@angular/core").OutputEmitterRef<StripeReaderSucceededEvent>;
2896
+ /** Everything else that happened, for the host to word. */
2897
+ readonly outcome: import("@angular/core").OutputEmitterRef<StripeReaderOutcome>;
2898
+ /** A readiness read finished: its state (`null` = no answer / the read failed). The payment panel's FIRST answer decides whether the reader is the default. */
2899
+ readonly readinessChange: import("@angular/core").OutputEmitterRef<StripeReaderReadinessState | null>;
2900
+ /** A payment is open on the reader (starting, waiting, declined, cancelling...): the host locks everything else. */
2901
+ readonly busyChange: import("@angular/core").OutputEmitterRef<boolean>;
2902
+ readonly readiness: import("@angular/core").WritableSignal<StripeReaderReadiness | null>;
2903
+ protected readonly readinessLoading: import("@angular/core").WritableSignal<boolean>;
2904
+ readonly selectedReaderId: import("@angular/core").WritableSignal<string>;
2905
+ readonly saveChecked: import("@angular/core").WritableSignal<boolean>;
2906
+ /** The card cannot be kept on this account (`terminal_save_needs_direct`): the choice is hidden, the payment can still be taken. */
2907
+ protected readonly saveUnavailable: import("@angular/core").WritableSignal<boolean>;
2908
+ /** `quote_changed`: the total shown is not the total any more; Send stays off until the payer confirms the new one. */
2909
+ protected readonly quoteChanged: import("@angular/core").WritableSignal<{
2910
+ total: number | null;
2911
+ } | null>;
2912
+ readonly closeBlocked: import("@angular/core").WritableSignal<boolean>;
2913
+ protected readonly cancellingBusy: import("@angular/core").WritableSignal<boolean>;
2914
+ /** The "Cancel that payment" call did not answer in time: the payment may still be open (a notice with "Check again" shows instead of the banner). */
2915
+ protected readonly cancelTimedOut: import("@angular/core").WritableSignal<boolean>;
2916
+ protected readonly quote: import("@angular/core").WritableSignal<StripeFees | null>;
2917
+ /** The amount the quote was asked for (a quote is shown only while it matches the amount on screen). */
2918
+ private readonly quotedFor;
2919
+ protected readonly quoting: import("@angular/core").WritableSignal<boolean>;
2920
+ protected readonly quoteFailed: import("@angular/core").WritableSignal<boolean>;
2921
+ private readonly quoteTick;
2922
+ private quoteRun;
2923
+ /** What the held quote was asked for: a phase change alone (a refusal, a canceled payment) keeps a held quote of the same amount; the service still checks the total (`quote_changed`). */
2924
+ private heldEstimate;
2925
+ private heldAmount;
2926
+ private heldTick;
2927
+ private readonly builtIns;
2928
+ readonly attempt: PaymentAttempt;
2929
+ readonly flow: StripeReaderFlow;
2930
+ /** The user pressed a button that changes the screen: when the phase changes, focus moves to the new box (the pressed button is gone). */
2931
+ private acted;
2932
+ private lastPhase;
2933
+ private destroyed;
2934
+ private readRun;
2935
+ private readTimer;
2936
+ protected readonly ready: import("@angular/core").Signal<boolean>;
2937
+ protected readonly freeReaders: import("@angular/core").Signal<import("@forgeroute/ui/stripe").StripeReader[]>;
2938
+ protected readonly readerId: import("@angular/core").Signal<string>;
2939
+ protected readonly readerOptions: import("@angular/core").Signal<{
2940
+ value: string;
2941
+ label: string;
2942
+ }[]>;
2943
+ /** The name of the reader the payment is (or would be) on. */
2944
+ protected readonly readerName: import("@angular/core").Signal<string>;
2945
+ /** Why a reader payment cannot be started before it starts: offline, a slow connection, a browser that cannot pay safely. Empty = none. */
2946
+ protected readonly blockReason: import("@angular/core").Signal<"" | "offline" | "slow_connection" | "unsupported_browser">;
2947
+ protected readonly blockText: import("@angular/core").Signal<string>;
2948
+ /** No fee quote call: a reader payment must always show the CARD_PRESENT breakdown before the tap, so nothing can be sent. */
2949
+ protected readonly feesMissing: import("@angular/core").Signal<boolean>;
2950
+ /**
2951
+ * The ONE message block of the idle screen, by precedence: already paid > an earlier payment still being confirmed > a cancel that timed out > the total changed > a refusal of the last start. The readiness banner and
2952
+ * the "blocked" notice show only when none of these does (and never in the canceled / failed boxes).
2953
+ */
2954
+ protected readonly idleNotice: import("@angular/core").Signal<"paid" | "pending-other" | "cancel-timeout" | "quote-changed" | "refusal" | null>;
2955
+ protected readonly showBlocked: import("@angular/core").Signal<boolean>;
2956
+ protected readonly showReadiness: import("@angular/core").Signal<boolean>;
2957
+ /** The own payment that holds a reader, when the host knows it. */
2958
+ protected readonly busyOwnPaymentId: import("@angular/core").Signal<string | null>;
2959
+ private readonly amountValid;
2960
+ /** The quote of the amount on screen (a quote for another amount is never shown). */
2961
+ protected readonly currentQuote: import("@angular/core").Signal<StripeFees | null>;
2962
+ protected readonly feeRows: import("@angular/core").Signal<{
2963
+ key: string;
2964
+ label: string;
2965
+ value: string;
2966
+ }[]>;
2967
+ /** Everything that must be true before "Send to the reader" works. */
2968
+ readonly canStart: import("@angular/core").Signal<boolean>;
2969
+ protected readonly startLabel: import("@angular/core").Signal<string>;
2970
+ /** The sentence the staff attests by ticking the box (the host's `consentText`, else the library default) plus the fee clause when the payer pays fees. `saveCard.textVersion` must name exactly this text. */
2971
+ protected readonly consentText: import("@angular/core").Signal<string>;
2972
+ /** A reload / second tab found an undecided attempt of ANOTHER method (a manual card): it is never followed as a reader payment, only worded. */
2973
+ protected readonly foreignPending: import("@angular/core").Signal<boolean>;
2974
+ protected readonly degraded: import("@angular/core").Signal<import("@forgeroute/ui/stripe").StripeReaderDegraded | null>;
2975
+ protected readonly checkingText: import("@angular/core").Signal<string>;
2976
+ /** What was actually charged (the service's `amountCents`), else the quote total of the open payment; `null` when neither is known. */
2977
+ private readonly chargedTotal;
2978
+ /** The amount line of the waiting screen: the total when known, else the base amount (fees may be added). Always present once an amount is known, quote or not (also after a reload that adopted the payment). */
2979
+ protected readonly waitAmount: import("@angular/core").Signal<string>;
2980
+ protected readonly confirmTotalText: import("@angular/core").Signal<string>;
2981
+ protected readonly existingPaymentHref: import("@angular/core").Signal<string | null>;
2982
+ protected readonly elapsedText: import("@angular/core").Signal<string>;
2983
+ protected readonly waitTitle: import("@angular/core").Signal<string>;
2984
+ protected readonly waitText: import("@angular/core").Signal<string>;
2985
+ private readonly waitKey;
2986
+ protected readonly refusalText: import("@angular/core").Signal<string>;
2987
+ protected readonly succeededText: import("@angular/core").Signal<string>;
2988
+ protected readonly cardLine: import("@angular/core").Signal<string>;
2989
+ /** What happened to the "save this card" choice: never "saved" unless the service says so. */
2990
+ protected readonly cardSaveText: import("@angular/core").Signal<string>;
2991
+ protected readonly receiptHref: import("@angular/core").Signal<string | null>;
2992
+ /** What the polite region says: one text, the most important thing first, changing with every state. */
2993
+ protected readonly announcement: import("@angular/core").Signal<string>;
2994
+ constructor();
2995
+ private refreshBuiltIns;
2996
+ /** Reads the readiness now ("Check again"). A slow (over `readinessTimeoutMs`) or failed read leaves NO answer: the banner says it could not be checked and nothing is started. */
2997
+ loadReadiness(): Promise<void>;
2998
+ private scheduleReadiness;
2999
+ /** "Send to the reader". Synchronous up to the attempt lock: a double click sends ONE payment. */
3000
+ start(): void;
3001
+ protected onSaveChange(checked: boolean): void;
3002
+ /** "Confirm the new total": the payer saw the new total, Send is available again. */
3003
+ protected confirmNewTotal(): void;
3004
+ protected retry(): void;
3005
+ /** "Check again" of an unconfirmed payment: reads the attempt key once more (found: followed; still none after the grace: released, "Start again"). */
3006
+ protected recheck(): void;
3007
+ protected dismissCancelTimeout(): void;
3008
+ protected cancelPayment(): void;
3009
+ protected startAgain(): void;
3010
+ protected retryQuote(): void;
3011
+ /** "Take a manual payment instead" while a payment is open: the payment is canceled FIRST; the host is told only when the service confirmed it. */
3012
+ protected switchToManual(): Promise<void>;
3013
+ /** Cancels an open reader payment and resolves true when nothing is open any more (nothing was waiting, or the service confirmed the cancel). False = the payment is STILL open. */
3014
+ cancelAndWait(): Promise<boolean>;
3015
+ /** Is a reader payment open (starting, waiting, declined, cancelling...)? */
3016
+ isLocked(): boolean;
3017
+ /** The panel wants to close: allowed (true) only when nothing is open. Otherwise the warning shows and focus goes to "Cancel payment". */
3018
+ requestClose(): boolean;
3019
+ /** Fire-and-forget cancel of an open payment (the host closed the panel anyway). Never claims the payment is canceled. */
3020
+ cancelBestEffort(): void;
3021
+ /** "Cancel that payment" of the busy banner: cancels the user's own payment that holds the reader, then reads the readiness again. */
3022
+ protected cancelBusy(id: string): Promise<void>;
3023
+ private onFlowEvent;
3024
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReaderPaymentComponent, never>;
3025
+ static ɵcmp: i0.ɵɵComponentDeclaration<StripeReaderPaymentComponent, "ui-stripe-reader-payment", never, {
3026
+ "amount": {
3027
+ "alias": "amount";
3028
+ "required": false;
3029
+ "isSignal": true;
3030
+ };
3031
+ "currency": {
3032
+ "alias": "currency";
3033
+ "required": false;
3034
+ "isSignal": true;
3035
+ };
3036
+ "payableRef": {
3037
+ "alias": "payableRef";
3038
+ "required": false;
3039
+ "isSignal": true;
3040
+ };
3041
+ "attemptKey": {
3042
+ "alias": "attemptKey";
3043
+ "required": false;
3044
+ "isSignal": true;
3045
+ };
3046
+ "paid": {
3047
+ "alias": "paid";
3048
+ "required": false;
3049
+ "isSignal": true;
3050
+ };
3051
+ "startExtras": {
3052
+ "alias": "startExtras";
3053
+ "required": false;
3054
+ "isSignal": true;
3055
+ };
3056
+ "getReadiness": {
3057
+ "alias": "getReadiness";
3058
+ "required": false;
3059
+ "isSignal": true;
3060
+ };
3061
+ "startPayment": {
3062
+ "alias": "startPayment";
3063
+ "required": false;
3064
+ "isSignal": true;
3065
+ };
3066
+ "getPayment": {
3067
+ "alias": "getPayment";
3068
+ "required": false;
3069
+ "isSignal": true;
3070
+ };
3071
+ "retryPayment": {
3072
+ "alias": "retryPayment";
3073
+ "required": false;
3074
+ "isSignal": true;
3075
+ };
3076
+ "cancelPaymentFn": {
3077
+ "alias": "cancelPayment";
3078
+ "required": false;
3079
+ "isSignal": true;
3080
+ };
3081
+ "estimateFees": {
3082
+ "alias": "estimateFees";
3083
+ "required": false;
3084
+ "isSignal": true;
3085
+ };
3086
+ "receiptUrl": {
3087
+ "alias": "receiptUrl";
3088
+ "required": false;
3089
+ "isSignal": true;
3090
+ };
3091
+ "saveCard": {
3092
+ "alias": "saveCard";
3093
+ "required": false;
3094
+ "isSignal": true;
3095
+ };
3096
+ "ownPaymentId": {
3097
+ "alias": "ownPaymentId";
3098
+ "required": false;
3099
+ "isSignal": true;
3100
+ };
3101
+ "active": {
3102
+ "alias": "active";
3103
+ "required": false;
3104
+ "isSignal": true;
3105
+ };
3106
+ "manualAvailable": {
3107
+ "alias": "manualAvailable";
3108
+ "required": false;
3109
+ "isSignal": true;
3110
+ };
3111
+ "disabled": {
3112
+ "alias": "disabled";
3113
+ "required": false;
3114
+ "isSignal": true;
3115
+ };
3116
+ "beforeStart": {
3117
+ "alias": "beforeStart";
3118
+ "required": false;
3119
+ "isSignal": true;
3120
+ };
3121
+ "readinessEveryMs": {
3122
+ "alias": "readinessEveryMs";
3123
+ "required": false;
3124
+ "isSignal": true;
3125
+ };
3126
+ "readinessTimeoutMs": {
3127
+ "alias": "readinessTimeoutMs";
3128
+ "required": false;
3129
+ "isSignal": true;
3130
+ };
3131
+ "pollMs": {
3132
+ "alias": "pollMs";
3133
+ "required": false;
3134
+ "isSignal": true;
3135
+ };
3136
+ "pollTimeoutMs": {
3137
+ "alias": "pollTimeoutMs";
3138
+ "required": false;
3139
+ "isSignal": true;
3140
+ };
3141
+ "lostAnswerGraceMs": {
3142
+ "alias": "lostAnswerGraceMs";
3143
+ "required": false;
3144
+ "isSignal": true;
3145
+ };
3146
+ "requestTimeoutMs": {
3147
+ "alias": "requestTimeoutMs";
3148
+ "required": false;
3149
+ "isSignal": true;
3150
+ };
3151
+ "feeTimeoutMs": {
3152
+ "alias": "feeTimeoutMs";
3153
+ "required": false;
3154
+ "isSignal": true;
3155
+ };
3156
+ "offlineOverride": {
3157
+ "alias": "offlineOverride";
3158
+ "required": false;
3159
+ "isSignal": true;
3160
+ };
3161
+ }, {
3162
+ "manual": "manual";
3163
+ "connectReader": "connectReader";
3164
+ "getReader": "getReader";
3165
+ "openSetup": "openSetup";
3166
+ "succeeded": "succeeded";
3167
+ "outcome": "outcome";
3168
+ "readinessChange": "readinessChange";
3169
+ "busyChange": "busyChange";
3170
+ }, never, never, true, never>;
3171
+ }
3172
+ /** What `(outcome)` reports. */
3173
+ type StripeReadersOutcome = {
3174
+ kind: 'registered';
3175
+ reader: StripeReader;
3176
+ } | {
3177
+ kind: 'renamed';
3178
+ reader: StripeReader;
3179
+ } | {
3180
+ kind: 'removed';
3181
+ readerId: string;
3182
+ } | {
3183
+ kind: 'location-created';
3184
+ location: StripeReaderLocation;
3185
+ } | {
3186
+ kind: 'failed';
3187
+ action: 'load' | 'register' | 'rename' | 'remove' | 'location';
3188
+ code: string;
3189
+ message: string;
3190
+ };
3191
+ type Busy = '' | 'load' | 'register' | 'rename' | 'remove' | 'location';
3192
+ /**
3193
+ * Staff screen to connect and manage card readers (put it inside the host's own side panel). Everything is a host call (the browser never talks to the payments service):
3194
+ *
3195
+ * - the banner is the SAME single readiness state as the payment screen (`ui-stripe-reader-status`, without "Connect a reader": you are already here);
3196
+ * - "Connect a reader": the registration code the reader shows (Stripe Reader S700 / S710: Settings, generate a pairing code; BBPOS WisePOS E: press 0-7-1-3-9 on the home screen), a name and a
3197
+ * location. The code is typed once, cleared from the form BEFORE the call and never shown, stored or logged again, success or failure;
3198
+ * - the list shows each reader with its model and a status badge (Online / Offline / Registering, Busy, Not supported) and lets staff rename or remove it (removing asks for confirmation; a reader that
3199
+ * holds a payment is refused with `reader_busy`: cancel the payment first);
3200
+ * - "Get a card reader" is an output: the host opens its order flow.
3201
+ *
3202
+ * <ui-stripe-readers [getReadiness]="readiness" [registerReader]="register" [renameReader]="rename" [removeReader]="remove" [listLocations]="locations" [createLocation]="createLocation"
3203
+ * (getReader)="openOrder()" (changed)="refreshPayments()" />
3204
+ */
3205
+ export declare class StripeReadersComponent {
3206
+ protected readonly labels: UiLabelsService;
3207
+ private readonly destroyRef;
3208
+ private static seq;
3209
+ /** Unique per instance: two screens on one page never share an id. */
3210
+ protected readonly ids: string;
3211
+ /** Reads `GET /v1/terminal/readiness` through the host: the readers and the ONE state. */
3212
+ readonly getReadiness: import("@angular/core").InputSignal<StripeReaderGetReadinessFn | null>;
3213
+ /** Registers a reader (`POST /v1/terminal/readers`). */
3214
+ readonly registerReader: import("@angular/core").InputSignal<StripeReaderRegisterFn | null>;
3215
+ readonly renameReader: import("@angular/core").InputSignal<StripeReaderRenameFn | null>;
3216
+ /** Deletes a reader. Refused with 409 `reader_busy` while a payment waits on it. */
3217
+ readonly removeReader: import("@angular/core").InputSignal<StripeReaderRemoveFn | null>;
3218
+ /** The locations a reader can be registered to (`GET /v1/terminal/locations`). */
3219
+ readonly listLocations: import("@angular/core").InputSignal<StripeReaderListLocationsFn | null>;
3220
+ /** Creates a location (`POST /v1/terminal/locations`); without it only existing locations can be chosen. */
3221
+ readonly createLocation: import("@angular/core").InputSignal<StripeReaderCreateLocationFn | null>;
3222
+ /** The label the new reader's name starts with (empty by default). */
3223
+ readonly defaultLabel: import("@angular/core").InputSignal<string>;
3224
+ /** The value the address country is created with. */
3225
+ readonly country: import("@angular/core").InputSignal<string>;
3226
+ /** A host call (read, register, rename, remove, create location) slower than this is unreachable (ms): the screen says so, becomes usable again and reads the list again (the call may have gone through). */
3227
+ readonly requestTimeoutMs: import("@angular/core").InputSignal<number>;
3228
+ /** "Get a card reader": the host opens its order flow. */
3229
+ readonly getReader: import("@angular/core").OutputEmitterRef<void>;
3230
+ /** "Set up payments". */
3231
+ readonly openSetup: import("@angular/core").OutputEmitterRef<void>;
3232
+ /** A reader was added, renamed or removed (the host refreshes whatever shows readers). */
3233
+ readonly changed: import("@angular/core").OutputEmitterRef<void>;
3234
+ readonly outcome: import("@angular/core").OutputEmitterRef<StripeReadersOutcome>;
3235
+ protected readonly readiness: import("@angular/core").WritableSignal<StripeReaderReadiness | null>;
3236
+ protected readonly readers: import("@angular/core").Signal<StripeReader[]>;
3237
+ protected readonly locations: import("@angular/core").WritableSignal<readonly StripeReaderLocation[]>;
3238
+ protected readonly busy: import("@angular/core").WritableSignal<Busy>;
3239
+ protected readonly error: import("@angular/core").WritableSignal<{
3240
+ action: string;
3241
+ text: string;
3242
+ } | null>;
3243
+ protected readonly announcement: import("@angular/core").WritableSignal<string>;
3244
+ protected readonly supportedModels: string;
3245
+ protected readonly code: import("@angular/core").WritableSignal<string>;
3246
+ protected readonly label: import("@angular/core").WritableSignal<string>;
3247
+ protected readonly locationId: import("@angular/core").WritableSignal<string>;
3248
+ protected readonly touched: import("@angular/core").WritableSignal<boolean>;
3249
+ protected readonly showNewLocation: import("@angular/core").WritableSignal<boolean>;
3250
+ protected readonly locName: import("@angular/core").WritableSignal<string>;
3251
+ protected readonly locLine1: import("@angular/core").WritableSignal<string>;
3252
+ protected readonly locCity: import("@angular/core").WritableSignal<string>;
3253
+ protected readonly locState: import("@angular/core").WritableSignal<string>;
3254
+ protected readonly locPostal: import("@angular/core").WritableSignal<string>;
3255
+ protected readonly locTouched: import("@angular/core").WritableSignal<boolean>;
3256
+ protected readonly renamingId: import("@angular/core").WritableSignal<string>;
3257
+ protected readonly renameValue: import("@angular/core").WritableSignal<string>;
3258
+ protected readonly renameTouched: import("@angular/core").WritableSignal<boolean>;
3259
+ protected readonly removing: import("@angular/core").WritableSignal<StripeReader | null>;
3260
+ protected readonly removeError: import("@angular/core").WritableSignal<string>;
3261
+ private readonly fields;
3262
+ /** The same rule as the service (`registrationCode`: 3 to 100 letters, digits or hyphens): an invalid code is never sent. Empty is the built-in "required" message. */
3263
+ protected readonly codeError: import("@angular/core").Signal<string>;
3264
+ protected readonly hasInvalid: import("@angular/core").Signal<boolean>;
3265
+ protected readonly locationOptions: import("@angular/core").Signal<{
3266
+ value: string;
3267
+ label: string;
3268
+ }[]>;
3269
+ protected readonly removeText: import("@angular/core").Signal<string>;
3270
+ private destroyed;
3271
+ private loadRun;
3272
+ /** Runs one host call raced against the request timeout (a call that never answers cannot leave the screen busy forever); a timeout rejects with `code: 'request_timeout'`. */
3273
+ private call;
3274
+ constructor();
3275
+ protected name(reader: StripeReader): string;
3276
+ protected model(reader: StripeReader): string;
3277
+ protected statusLabel(reader: StripeReader): string;
3278
+ protected statusVariant(reader: StripeReader): 'green' | 'slate' | 'sky';
3279
+ /** Reads the readiness (the list and the banner). A failed or slow read leaves the list as it was and says so. */
3280
+ load(quiet?: boolean): Promise<void>;
3281
+ private loadLocations;
3282
+ private fail;
3283
+ /** "Connect reader". The code is read, then cleared from the form BEFORE the call: it is never shown or kept again, whatever the answer. */
3284
+ register(): Promise<void>;
3285
+ protected startRename(reader: StripeReader): void;
3286
+ protected saveRename(reader: StripeReader): Promise<void>;
3287
+ protected askRemove(reader: StripeReader): void;
3288
+ protected cancelRemove(): void;
3289
+ protected confirmRemove(): Promise<void>;
3290
+ protected createNewLocation(): Promise<void>;
3291
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReadersComponent, never>;
3292
+ static ɵcmp: i0.ɵɵComponentDeclaration<StripeReadersComponent, "ui-stripe-readers", never, {
3293
+ "getReadiness": {
3294
+ "alias": "getReadiness";
3295
+ "required": false;
3296
+ "isSignal": true;
3297
+ };
3298
+ "registerReader": {
3299
+ "alias": "registerReader";
3300
+ "required": false;
3301
+ "isSignal": true;
3302
+ };
3303
+ "renameReader": {
3304
+ "alias": "renameReader";
3305
+ "required": false;
3306
+ "isSignal": true;
3307
+ };
3308
+ "removeReader": {
3309
+ "alias": "removeReader";
3310
+ "required": false;
3311
+ "isSignal": true;
3312
+ };
3313
+ "listLocations": {
3314
+ "alias": "listLocations";
3315
+ "required": false;
3316
+ "isSignal": true;
3317
+ };
3318
+ "createLocation": {
3319
+ "alias": "createLocation";
3320
+ "required": false;
3321
+ "isSignal": true;
3322
+ };
3323
+ "defaultLabel": {
3324
+ "alias": "defaultLabel";
3325
+ "required": false;
3326
+ "isSignal": true;
3327
+ };
3328
+ "country": {
3329
+ "alias": "country";
3330
+ "required": false;
3331
+ "isSignal": true;
3332
+ };
3333
+ "requestTimeoutMs": {
3334
+ "alias": "requestTimeoutMs";
3335
+ "required": false;
3336
+ "isSignal": true;
3337
+ };
3338
+ }, {
3339
+ "getReader": "getReader";
3340
+ "openSetup": "openSetup";
3341
+ "changed": "changed";
3342
+ "outcome": "outcome";
3343
+ }, never, never, true, never>;
3344
+ }
3345
+ /**
3346
+ * Stripe Connect embedded components of the card reader ordering flow (D-R6). The library holds NO `@stripe/connect-js` types or code of its own: the types below are the minimal shape it uses, and the SDK is an
3347
+ * OPTIONAL peer that is only imported lazily (a dynamic import in the default loader), so an app that never orders readers never downloads it and the library builds without the package installed.
3348
+ *
3349
+ * Content-Security-Policy: Connect.js loads from `https://connect-js.stripe.com` and the embedded component runs in frames of `https://js.stripe.com` (and `https://connect-js.stripe.com`): the host app must allow them
3350
+ * (`script-src`, `frame-src`, `connect-src` as its policy requires). See docs/card-readers.md.
3351
+ */
3352
+ /** The Connect embedded components this library mounts (the names of the account session's `components`). */
3353
+ type StripeConnectEmbedName = 'terminal_hardware_shop' | 'terminal_hardware_orders';
3354
+ /** The element a Connect component creates (a web component). Only the setters the library calls are typed; every one is optional (a missing one is skipped). */
3355
+ interface StripeConnectEmbedElement extends HTMLElement {
3356
+ /** The customer finished the checkout (an order was placed). */
3357
+ setOnCheckoutFinished?(handler: (event?: unknown) => void): void;
3358
+ /** The component failed to load. */
3359
+ setOnLoadError?(handler: (event?: unknown) => void): void;
3360
+ /** The component started loading. */
3361
+ setOnLoaderStart?(handler: (event?: unknown) => void): void;
3362
+ }
3363
+ /** What `loadConnectAndInitialize` returns, as far as the library uses it. */
3364
+ interface StripeConnectInstanceLike {
3365
+ create(component: StripeConnectEmbedName): StripeConnectEmbedElement;
3366
+ logout?(): void | Promise<void>;
3367
+ }
3368
+ /** What the loader is given. `fetchClientSecret` is called by Connect.js whenever it needs a (new) account session secret; the library never keeps what it returns. */
3369
+ interface StripeConnectInitOptions {
3370
+ publishableKey: string;
3371
+ fetchClientSecret: () => Promise<string>;
3372
+ appearance?: Record<string, unknown> | null;
3373
+ }
3374
+ /** Loads and initialises Connect.js: resolves the instance (or `null` when it could not be created). Replaceable (tests, a self-hosted loader). */
3375
+ type StripeConnectLoaderFn = (options: StripeConnectInitOptions) => Promise<StripeConnectInstanceLike | null>;
3376
+ interface ConnectSdkLike {
3377
+ loadConnectAndInitialize(options: {
3378
+ publishableKey: string;
3379
+ fetchClientSecret: () => Promise<string>;
3380
+ appearance?: Record<string, unknown>;
3381
+ }): {
3382
+ create(tag: string): unknown;
3383
+ logout?(): void | Promise<void>;
3384
+ };
3385
+ }
3386
+ /** The dynamic import of the Connect.js SDK, behind an object so a spec can replace it (internal: not part of the public API). */
3387
+ declare const connectSdkImporter: {
3388
+ load: () => Promise<ConnectSdkLike>;
3389
+ };
3390
+ /** The default loader: imports Connect.js lazily and maps the component name to Connect.js's tag (`terminal_hardware_shop` -> `terminal-hardware-shop`; verify against Stripe's current Connect.js docs). */
3391
+ export declare const defaultStripeConnectLoader: StripeConnectLoaderFn;
3392
+ /** How Connect.js is loaded. Provide your own to fake it in tests or to load it differently. Defaults to {@link defaultStripeConnectLoader}. */
3393
+ export declare const STRIPE_CONNECT_LOADER: InjectionToken<StripeConnectLoaderFn>;
3394
+ /**
3395
+ * Ordering card readers inside the app (D-R6): the host's backend calls the payments service (`POST /v1/terminal/hardware/account-session` `{ merchantId }` -> `{ clientSecret, expiresAt, components }`) and hands the
3396
+ * browser the short-lived Connect account session secret; the BROWSER NEVER talks to the payments service. The components below embed Stripe's Connect components `terminal_hardware_shop` / `terminal_hardware_orders`.
3397
+ */
3398
+ /** What the host's `getAccountSession` answers. The secret goes to Connect.js and is never rendered, logged, stored or kept after use. */
3399
+ interface StripeReaderAccountSession {
3400
+ clientSecret: string;
3401
+ /** ISO time the session ends; a session that is already over is never handed to Connect.js (the host is asked for a new one). */
3402
+ expiresAt?: string;
3403
+ }
3404
+ type StripeReaderAccountSessionFn = () => HostResult<StripeReaderAccountSession>;
3405
+ /** Why the shop cannot be shown (the service's `hardware_shop_unavailable` `reason`, or `not_enabled_for_app` when the host says the capability flag `terminalHardwareShop` is off). */
3406
+ type StripeReaderShopUnavailableReason = 'platform_not_enabled' | 'account_not_eligible' | 'processor_refused' | 'not_enabled_for_app' | 'other';
3407
+ /** Where the embedded component is. `placed`: the checkout finished (an order was placed). */
3408
+ type StripeReaderEmbedState = 'loading' | 'ready' | 'unavailable' | 'error' | 'offline' | 'placed';
3409
+ /** Reads a failed `getAccountSession`: `unavailable` (with the reason) when the service said so (`hardware_shop_unavailable`, or the account is not ready to take payments), else a plain error (Retry is offered). */
3410
+ export declare function readerShopFailure(error: unknown): {
3411
+ kind: 'unavailable';
3412
+ reason: StripeReaderShopUnavailableReason;
3413
+ } | {
3414
+ kind: 'error';
3415
+ };
3416
+ /**
3417
+ * Shared behaviour of the two embed components (an abstract directive, not a component of its own): it asks the host for an account session when it mounts, hands the secret to Connect.js (and asks the host again
3418
+ * when Connect.js needs a fresh one), mounts the embedded component and words every state. The secret is passed on and forgotten: never rendered, logged, stored in a signal or kept after use.
3419
+ */
3420
+ export declare abstract class StripeReaderEmbedBase {
3421
+ protected readonly labels: UiLabelsService;
3422
+ private readonly loader;
3423
+ private readonly destroyRef;
3424
+ private readonly container;
3425
+ private static seq;
3426
+ protected readonly ids: string;
3427
+ protected readonly models: {
3428
+ key: "stripeReaderShop.model.s700" | "stripeReaderShop.model.s710" | "stripeReaderShop.model.wisepos";
3429
+ deviceType: string;
3430
+ model: string;
3431
+ }[];
3432
+ /** The publishable key (`pk_...`) of the platform: not a secret. */
3433
+ readonly publishableKey: import("@angular/core").InputSignal<string | null>;
3434
+ /** The host's call to ITS backend, which calls the payments service (`POST /v1/terminal/hardware/account-session`). Called when the component mounts and whenever Connect.js asks for a refreshed secret. */
3435
+ readonly getAccountSession: import("@angular/core").InputSignal<StripeReaderAccountSessionFn | null>;
3436
+ /** The merchant capability flag `terminalHardwareShop`: `false` shows the "how to order" card at once (nothing is requested). */
3437
+ readonly enabled: import("@angular/core").InputSignal<boolean>;
3438
+ /** An address that explains how to order a reader (only https or in-app `/paths` are linked). */
3439
+ readonly orderHelpUrl: import("@angular/core").InputSignal<string | null>;
3440
+ /** Connect.js appearance (variables / overlays), passed through. */
3441
+ readonly appearance: import("@angular/core").InputSignal<Record<string, unknown> | null>;
3442
+ /** Managed environments where `navigator.onLine === false` is a false negative (default false). */
3443
+ readonly offlineOverride: import("@angular/core").InputSignal<boolean>;
3444
+ /** An account session call slower than this is an error with "Try again" (ms). */
3445
+ readonly requestTimeoutMs: import("@angular/core").InputSignal<number>;
3446
+ /** The checkout finished (an order was placed). */
3447
+ readonly checkoutFinished: import("@angular/core").OutputEmitterRef<void>;
3448
+ /** The user closed the shop (the host closes its panel). */
3449
+ readonly closed: import("@angular/core").OutputEmitterRef<void>;
3450
+ /** "Connect a reader": the host opens its pairing panel (`ui-stripe-readers`). */
3451
+ readonly connectReader: import("@angular/core").OutputEmitterRef<void>;
3452
+ readonly state: import("@angular/core").WritableSignal<StripeReaderEmbedState>;
3453
+ /** The embedded component reported that it started its own loading (`setOnLoaderStart`); "ready" is announced only then (an element without that setter is announced when it is mounted: nothing better is known). */
3454
+ private readonly loaded;
3455
+ /** Only whether a session call exists is a reason to mount: a host that passes a NEW function on every change detection pass must not remount the shop in a loop. The latest function is read (untracked) when it is called. */
3456
+ private readonly hasSession;
3457
+ readonly unavailableReason: import("@angular/core").WritableSignal<StripeReaderShopUnavailableReason>;
3458
+ private readonly retryTick;
3459
+ private runId;
3460
+ private instance;
3461
+ private element;
3462
+ /** The secret of the first session of THIS mount, handed to Connect.js once and then dropped (never a signal, never rendered; a newer mount has its own holder). */
3463
+ private secretHolder;
3464
+ private destroyed;
3465
+ /** The Connect component this one mounts. */
3466
+ protected abstract component(): StripeConnectEmbedName;
3467
+ protected readonly loadingText: import("@angular/core").Signal<string>;
3468
+ protected readonly unavailableText: import("@angular/core").Signal<string>;
3469
+ protected readonly helpHref: import("@angular/core").Signal<string | null>;
3470
+ protected readonly announcement: import("@angular/core").Signal<string>;
3471
+ constructor();
3472
+ /** "Try again". */
3473
+ retry(): void;
3474
+ private offlineNow;
3475
+ private mount;
3476
+ /** Asks the host for an account session within the request timeout; returns ONLY the secret (a session that is already over, or one without a secret, is refused). */
3477
+ private fetchSecret;
3478
+ private onFailure;
3479
+ private unavailable;
3480
+ private onCheckoutFinished;
3481
+ /** Removes the embedded component and forgets the session (the secret is never kept). */
3482
+ private teardown;
3483
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReaderEmbedBase, never>;
3484
+ static ɵdir: i0.ɵɵDirectiveDeclaration<StripeReaderEmbedBase, never, never, {
3485
+ "publishableKey": {
3486
+ "alias": "publishableKey";
3487
+ "required": false;
3488
+ "isSignal": true;
3489
+ };
3490
+ "getAccountSession": {
3491
+ "alias": "getAccountSession";
3492
+ "required": false;
3493
+ "isSignal": true;
3494
+ };
3495
+ "enabled": {
3496
+ "alias": "enabled";
3497
+ "required": false;
3498
+ "isSignal": true;
3499
+ };
3500
+ "orderHelpUrl": {
3501
+ "alias": "orderHelpUrl";
3502
+ "required": false;
3503
+ "isSignal": true;
3504
+ };
3505
+ "appearance": {
3506
+ "alias": "appearance";
3507
+ "required": false;
3508
+ "isSignal": true;
3509
+ };
3510
+ "offlineOverride": {
3511
+ "alias": "offlineOverride";
3512
+ "required": false;
3513
+ "isSignal": true;
3514
+ };
3515
+ "requestTimeoutMs": {
3516
+ "alias": "requestTimeoutMs";
3517
+ "required": false;
3518
+ "isSignal": true;
3519
+ };
3520
+ }, {
3521
+ "checkoutFinished": "checkoutFinished";
3522
+ "closed": "closed";
3523
+ "connectReader": "connectReader";
3524
+ }, never, never, true, never>;
3525
+ }
3526
+ /**
3527
+ * The card reader SHOP of the app: Stripe's Connect embedded component `terminal_hardware_shop` (or, with `mode="orders"`, `terminal_hardware_orders`, the order history). The host supplies the account session
3528
+ * (`getAccountSession` calls its OWN backend, which calls the payments service; the browser never talks to the service) and the publishable key. States: loading skeleton, ready, unavailable (a "how to order" card with
3529
+ * the supported models, the user is never blocked), error with Try again, offline (nothing is requested) and placed ("Your order was placed. When the reader arrives, choose Connect a reader and enter the code the
3530
+ * device shows", output `connectReader`). Put it in the host's side panel, or use `ui-stripe-reader-order-panel`.
3531
+ *
3532
+ * <ui-stripe-reader-shop [publishableKey]="pk" [getAccountSession]="session" [enabled]="merchant.terminalHardwareShop" orderHelpUrl="https://example.com/readers"
3533
+ * (checkoutFinished)="refresh()" (connectReader)="openPairing()" (closed)="close()" />
3534
+ */
3535
+ export declare class StripeReaderShopComponent extends StripeReaderEmbedBase {
3536
+ /** `shop` (default) mounts `terminal_hardware_shop`; `orders` mounts `terminal_hardware_orders` (the order history). */
3537
+ readonly mode: import("@angular/core").InputSignal<"shop" | "orders">;
3538
+ protected component(): StripeConnectEmbedName;
3539
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReaderShopComponent, never>;
3540
+ static ɵcmp: i0.ɵɵComponentDeclaration<StripeReaderShopComponent, "ui-stripe-reader-shop", never, {
3541
+ "mode": {
3542
+ "alias": "mode";
3543
+ "required": false;
3544
+ "isSignal": true;
3545
+ };
2177
3546
  }, {}, never, never, true, never>;
2178
3547
  }
2179
- export { type HandleReturnOptions, type MicrodepositStartedBy, type MicrodepositStepsContext, type MicrodepositType, type MicrodepositVerifyData, type MicrodepositVerifyEvent, type ProvideStripePaymentOptions, type StripeA11yMessages, type StripeAppearance, type StripeBillingDetails, type StripeCardFunding, type StripeConfirmResult, type StripeConfirmationTokenEvent, type StripeConfirmationTokenLike, type StripeConfirmedEvent, type StripeConnectAccount, type StripeConnectFlowOptions, type StripeConnectOutcome, type StripeConnectState, type StripeConnectStatus, type StripeConnection, type StripeCreateIntentFn, type StripeDeferredIntent, type StripeElementChange, type StripeElementsLike, type StripeErrorDisplay, type StripeErrorLike, type StripeErrorMessageOptions, type StripeFailure, type StripeFailureStage, type StripeFeeContext, type StripeFees, type StripeIntentContext, type StripeIntentInfo, type StripeIntentKind, type StripeIntentLike, type StripeLike, type StripeLikeWithBankSetup, type StripeLoadOptions, type StripeLoaderFn, type StripeMicrodepositNextAction, type StripeMicrodepositResult, type StripeOutcome, type StripePaymentDefaults, type StripePaymentElementLike, type StripeReadyEvent, type StripeReturnParams, type StripeReturnResult, type StripeThemeTokens, type StripeVerification, isDarkPage };
3548
+ /** The order history of the card readers: Stripe's Connect embedded component `terminal_hardware_orders`, with the same loader, states and host contract as `ui-stripe-reader-shop`. */
3549
+ export declare class StripeReaderOrdersComponent extends StripeReaderEmbedBase {
3550
+ protected component(): StripeConnectEmbedName;
3551
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReaderOrdersComponent, never>;
3552
+ static ɵcmp: i0.ɵɵComponentDeclaration<StripeReaderOrdersComponent, "ui-stripe-reader-orders", never, {}, {}, never, never, true, never>;
3553
+ }
3554
+ /**
3555
+ * The ready-made side panel for ordering card readers: a `ui-side-panel` ("Get a card reader" / "Card reader orders") that mounts `ui-stripe-reader-shop` only while it is open (nothing is requested while it is
3556
+ * closed, and the account session secret is dropped as soon as it closes). The host opens it from the `getReader` / `readerOrder` outputs and opens its pairing panel from `(connectReader)`.
3557
+ *
3558
+ * @defer (when orderOpen()) {
3559
+ * <ui-stripe-reader-order-panel [open]="orderOpen()" [publishableKey]="pk" [getAccountSession]="session" [enabled]="merchant.terminalHardwareShop"
3560
+ * (closed)="orderOpen.set(false)" (checkoutFinished)="refreshReaders()" (connectReader)="orderOpen.set(false); pairingOpen.set(true)" />
3561
+ * }
3562
+ */
3563
+ export declare class StripeReaderOrderPanelComponent {
3564
+ protected readonly labels: UiLabelsService;
3565
+ readonly open: import("@angular/core").InputSignal<boolean>;
3566
+ /** `shop` (default): order a reader; `orders`: the order history. */
3567
+ readonly mode: import("@angular/core").InputSignal<"shop" | "orders">;
3568
+ readonly publishableKey: import("@angular/core").InputSignal<string | null>;
3569
+ readonly getAccountSession: import("@angular/core").InputSignal<StripeReaderAccountSessionFn | null>;
3570
+ readonly enabled: import("@angular/core").InputSignal<boolean>;
3571
+ readonly orderHelpUrl: import("@angular/core").InputSignal<string | null>;
3572
+ readonly appearance: import("@angular/core").InputSignal<Record<string, unknown> | null>;
3573
+ readonly offlineOverride: import("@angular/core").InputSignal<boolean>;
3574
+ readonly requestTimeoutMs: import("@angular/core").InputSignal<number>;
3575
+ readonly closed: import("@angular/core").OutputEmitterRef<void>;
3576
+ readonly checkoutFinished: import("@angular/core").OutputEmitterRef<void>;
3577
+ readonly connectReader: import("@angular/core").OutputEmitterRef<void>;
3578
+ protected readonly title: import("@angular/core").Signal<string>;
3579
+ static ɵfac: i0.ɵɵFactoryDeclaration<StripeReaderOrderPanelComponent, never>;
3580
+ static ɵcmp: i0.ɵɵComponentDeclaration<StripeReaderOrderPanelComponent, "ui-stripe-reader-order-panel", never, {
3581
+ "open": {
3582
+ "alias": "open";
3583
+ "required": false;
3584
+ "isSignal": true;
3585
+ };
3586
+ "mode": {
3587
+ "alias": "mode";
3588
+ "required": false;
3589
+ "isSignal": true;
3590
+ };
3591
+ "publishableKey": {
3592
+ "alias": "publishableKey";
3593
+ "required": false;
3594
+ "isSignal": true;
3595
+ };
3596
+ "getAccountSession": {
3597
+ "alias": "getAccountSession";
3598
+ "required": false;
3599
+ "isSignal": true;
3600
+ };
3601
+ "enabled": {
3602
+ "alias": "enabled";
3603
+ "required": false;
3604
+ "isSignal": true;
3605
+ };
3606
+ "orderHelpUrl": {
3607
+ "alias": "orderHelpUrl";
3608
+ "required": false;
3609
+ "isSignal": true;
3610
+ };
3611
+ "appearance": {
3612
+ "alias": "appearance";
3613
+ "required": false;
3614
+ "isSignal": true;
3615
+ };
3616
+ "offlineOverride": {
3617
+ "alias": "offlineOverride";
3618
+ "required": false;
3619
+ "isSignal": true;
3620
+ };
3621
+ "requestTimeoutMs": {
3622
+ "alias": "requestTimeoutMs";
3623
+ "required": false;
3624
+ "isSignal": true;
3625
+ };
3626
+ }, {
3627
+ "closed": "closed";
3628
+ "checkoutFinished": "checkoutFinished";
3629
+ "connectReader": "connectReader";
3630
+ }, never, never, true, never>;
3631
+ }
3632
+ export { type HandleReturnOptions, type MicrodepositStartedBy, type MicrodepositStepsContext, type MicrodepositType, type MicrodepositVerifyData, type MicrodepositVerifyEvent, type ProvideStripePaymentOptions, type StripeA11yMessages, type StripeAppearance, type StripeBillingDetails, type StripeCardFunding, type StripeConfirmResult, type StripeConfirmationTokenEvent, type StripeConfirmationTokenLike, type StripeConfirmedEvent, type StripeConnectAccount, type StripeConnectEmbedElement, type StripeConnectEmbedName, type StripeConnectFlowOptions, type StripeConnectInitOptions, type StripeConnectInstanceLike, type StripeConnectLoaderFn, type StripeConnectOutcome, type StripeConnectState, type StripeConnectStatus, type StripeConnection, type StripeCreateIntentFn, type StripeDeferredIntent, type StripeElementChange, type StripeElementsLike, type StripeErrorDisplay, type StripeErrorLike, type StripeErrorMessageOptions, type StripeFailure, type StripeFailureStage, type StripeFeeContext, type StripeFees, type StripeIntentContext, type StripeIntentInfo, type StripeIntentKind, type StripeIntentLike, type StripeLike, type StripeLikeWithBankSetup, type StripeLoadOptions, type StripeLoaderFn, type StripeMicrodepositNextAction, type StripeMicrodepositResult, type StripeOutcome, type StripePaymentDefaults, type StripePaymentElementLike, type StripeReader, type StripeReaderAccountSession, type StripeReaderAccountSessionFn, type StripeReaderAttemptPort, type StripeReaderBannerState, type StripeReaderCancelFn, type StripeReaderCardSave, type StripeReaderConfig, type StripeReaderConsent, type StripeReaderCreateLocationContext, type StripeReaderCreateLocationFn, type StripeReaderDegraded, type StripeReaderDegradedReason, type StripeReaderDeviceStatus, type StripeReaderEmbedState, type StripeReaderFeeContext, type StripeReaderFeesFn, type StripeReaderFlowEvent, type StripeReaderFlowOptions, type StripeReaderGetPaymentFn, type StripeReaderGetReadinessFn, type StripeReaderListLocationsFn, type StripeReaderLocation, type StripeReaderOutcome, type StripeReaderPayment, type StripeReaderPaymentRef, type StripeReaderPhase, type StripeReaderReadiness, type StripeReaderReadinessState, type StripeReaderReady, type StripeReaderRefusal, type StripeReaderRegisterContext, type StripeReaderRegisterFn, type StripeReaderRemoveFn, type StripeReaderRenameFn, type StripeReaderRetryFn, type StripeReaderSaveCard, type StripeReaderShopUnavailableReason, type StripeReaderStartContext, type StripeReaderStartFn, type StripeReaderStartInput, type StripeReaderSucceededEvent, type StripeReaderTerminal, type StripeReaderTerminalState, type StripeReadersOutcome, type StripeReadyEvent, type StripeReturnParams, type StripeReturnResult, type StripeThemeTokens, type StripeVerification, isDarkPage };