@forgeroute/ui 0.4.99 → 0.5.1

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.
@@ -0,0 +1,4953 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, Injector, ViewEncapsulation, afterNextRender, computed, effect, forwardRef, inject, input, isDevMode, model, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { AlertComponent, BadgeComponent, ButtonComponent, CheckboxComponent, DetailCardComponent, FormRowComponent, FormSectionComponent, HintComponent, KpiCardComponent, LiveRegionComponent, ModalComponent, PAYMENT_HOST_SILENCE_MS, PAYMENT_METHOD_PLUGIN, PAYMENT_READINESS_EVERY_MS, PAYMENT_READINESS_TIMEOUT_MS, PAYMENT_REQUEST_TIMEOUT_MS, PAYMENT_STATUS_CHECK_TIMEOUT_MS, PAYMENT_STATUS_FAIL_GRACE_MS, PAYMENT_STATUS_POLL_MAX_MS, PAYMENT_STATUS_POLL_MS, PaymentAttemptStatusComponent, PaymentMethodPlugin, PillTabsComponent, SelectComponent, SkeletonComponent, StackComponent, TextComponent, TextInputComponent, UiLabelsService, callHost, classifyHostError, createPaymentProtection, formatCurrency, hostErrorMessage, refusalLabelKey, uiText, warnQueuedPayment, wasQueuedOffline } from "@forgeroute/ui";
4
+ import * as i1 from "@angular/forms";
5
+ import { FormsModule } from "@angular/forms";
6
+ import { NgTemplateOutlet } from "@angular/common";
7
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
8
+ const QBO_TOKENS_TIMEOUT_MS = 3e4;
9
+ const QBO_TOKENS_PATH = "/quickbooks/v4/payments/tokens";
10
+ const QBO_PRODUCTION_ORIGIN = "https://api.intuit.com";
11
+ const QBO_SANDBOX_ORIGIN = "https://sandbox.api.intuit.com";
12
+ const qboTokensUrl = (environment) => `${environment === "production" ? QBO_PRODUCTION_ORIGIN : QBO_SANDBOX_ORIGIN}${QBO_TOKENS_PATH}`;
13
+ const text = (v) => typeof v === "string" && v ? v : void 0;
14
+ function readQboErrors(body) {
15
+ const list = body?.errors;
16
+ if (!Array.isArray(list)) return [];
17
+ return list.filter((e) => !!e && typeof e === "object").map((e) => {
18
+ const code = text(e["code"]);
19
+ const message = text(e["message"]);
20
+ const detail = text(e["detail"]);
21
+ const moreInfo = text(e["moreInfo"]);
22
+ return {
23
+ ...code ? { code } : {},
24
+ ...message ? { message } : {},
25
+ ...detail ? { detail } : {},
26
+ ...moreInfo ? { moreInfo } : {}
27
+ };
28
+ });
29
+ }
30
+ const defaultQboTokenizer = async (request, context) => {
31
+ const body = JSON.stringify(request.kind === "card" ? { card: request.card } : { bankAccount: request.bankAccount });
32
+ const controller = new AbortController();
33
+ const timer = setTimeout(() => controller.abort(), QBO_TOKENS_TIMEOUT_MS);
34
+ try {
35
+ let response;
36
+ try {
37
+ response = await fetch(qboTokensUrl(context.environment), {
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/json",
41
+ Accept: "application/json",
42
+ "Request-Id": context.requestId
43
+ },
44
+ body,
45
+ mode: "cors",
46
+ credentials: "omit",
47
+ cache: "no-store",
48
+ referrerPolicy: "no-referrer",
49
+ signal: controller.signal
50
+ });
51
+ } catch {
52
+ return {
53
+ ok: false,
54
+ status: 0,
55
+ errors: []
56
+ };
57
+ }
58
+ let answer = null;
59
+ try {
60
+ answer = await response.json();
61
+ } catch {
62
+ answer = null;
63
+ }
64
+ if (controller.signal.aborted) return {
65
+ ok: false,
66
+ status: 0,
67
+ errors: []
68
+ };
69
+ const value = answer?.value;
70
+ if (response.ok && typeof value === "string" && value) return {
71
+ ok: true,
72
+ token: value
73
+ };
74
+ return {
75
+ ok: false,
76
+ status: response.ok ? 502 : response.status,
77
+ errors: readQboErrors(answer)
78
+ };
79
+ } finally {
80
+ clearTimeout(timer);
81
+ }
82
+ };
83
+ const QBO_TOKENIZER = new InjectionToken("QBO_TOKENIZER", {
84
+ providedIn: "root",
85
+ factory: () => defaultQboTokenizer
86
+ });
87
+ const QBO_PAYMENT_DEFAULTS = new InjectionToken("QBO_PAYMENT_DEFAULTS", {
88
+ providedIn: "root",
89
+ factory: () => ({})
90
+ });
91
+ function provideQboPayment(options = {}) {
92
+ const { tokenizer, ...defaults } = options;
93
+ const providers = [{
94
+ provide: QBO_PAYMENT_DEFAULTS,
95
+ useValue: defaults
96
+ }];
97
+ if (tokenizer) providers.push({
98
+ provide: QBO_TOKENIZER,
99
+ useValue: tokenizer
100
+ });
101
+ return providers;
102
+ }
103
+ function newQboRequestId() {
104
+ const c = typeof crypto !== "undefined" ? crypto : void 0;
105
+ return c && "randomUUID" in c ? c.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;
106
+ }
107
+ const QBO_BANK_ACCOUNT_TYPES = [
108
+ "PERSONAL_CHECKING",
109
+ "PERSONAL_SAVINGS",
110
+ "BUSINESS_CHECKING",
111
+ "BUSINESS_SAVINGS"
112
+ ];
113
+ const digitsOnly = (value) => (value ?? "").replace(/\D/g, "");
114
+ function luhnValid(value) {
115
+ if (!/^\d+$/.test(value)) return false;
116
+ let sum = 0;
117
+ let double = false;
118
+ for (let i = value.length - 1; i >= 0; i--) {
119
+ let digit = value.charCodeAt(i) - 48;
120
+ if (double) {
121
+ digit *= 2;
122
+ if (digit > 9) digit -= 9;
123
+ }
124
+ sum += digit;
125
+ double = !double;
126
+ }
127
+ return sum % 10 === 0;
128
+ }
129
+ function detectCardBrand(value) {
130
+ const d = digitsOnly(value);
131
+ if (!d) return null;
132
+ if (/^3[47]/.test(d)) return "amex";
133
+ if (/^4/.test(d)) return "visa";
134
+ if (/^(5[1-5]|222[1-9]|22[3-9]\d|2[3-6]\d\d|27[01]\d|2720)/.test(d)) return "mastercard";
135
+ if (/^(6011|65|64[4-9]|622)/.test(d)) return "discover";
136
+ if (/^(30[0-5]|36|38|39)/.test(d)) return "diners";
137
+ if (/^35(2[89]|[3-8])/.test(d)) return "jcb";
138
+ return null;
139
+ }
140
+ function cardLengthsFor(brand) {
141
+ switch (brand) {
142
+ case "visa": return [
143
+ 13,
144
+ 16,
145
+ 19
146
+ ];
147
+ case "mastercard": return [16];
148
+ case "amex": return [15];
149
+ case "discover": return [
150
+ 16,
151
+ 17,
152
+ 18,
153
+ 19
154
+ ];
155
+ case "diners": return [
156
+ 14,
157
+ 15,
158
+ 16,
159
+ 17,
160
+ 18,
161
+ 19
162
+ ];
163
+ case "jcb": return [
164
+ 16,
165
+ 17,
166
+ 18,
167
+ 19
168
+ ];
169
+ default: return [
170
+ 13,
171
+ 14,
172
+ 15,
173
+ 16,
174
+ 17,
175
+ 18,
176
+ 19
177
+ ];
178
+ }
179
+ }
180
+ function formatCardNumber(value) {
181
+ const brand = detectCardBrand(value);
182
+ const d = digitsOnly(value).slice(0, brand === "amex" ? 15 : 19);
183
+ if (brand === "amex") return [
184
+ d.slice(0, 4),
185
+ d.slice(4, 10),
186
+ d.slice(10)
187
+ ].filter(Boolean).join(" ");
188
+ return (d.match(/.{1,4}/g) ?? []).join(" ");
189
+ }
190
+ function cardNumberIssue(value) {
191
+ const d = digitsOnly(value);
192
+ if (!d) return "required";
193
+ if (!cardLengthsFor(detectCardBrand(d)).includes(d.length)) return "length";
194
+ return luhnValid(d) ? null : "luhn";
195
+ }
196
+ function cvcLengthsFor(brand) {
197
+ return brand === "amex" ? [4] : brand ? [3] : [3, 4];
198
+ }
199
+ function cvcIssue(value, brand) {
200
+ const raw = (value ?? "").trim();
201
+ if (!raw) return "required";
202
+ return /^\d+$/.test(raw) && cvcLengthsFor(brand).includes(raw.length) ? null : "length";
203
+ }
204
+ function formatExpiry(value) {
205
+ let d = digitsOnly(value).slice(0, 6);
206
+ if (d.length === 1 && d > "1") d = `0${d}`;
207
+ return d.length >= 3 ? `${d.slice(0, 2)}/${d.slice(2)}` : d;
208
+ }
209
+ function parseExpiry(value) {
210
+ const text = (value ?? "").trim();
211
+ let month;
212
+ let year;
213
+ if (text.includes("/")) {
214
+ const parts = text.split("/");
215
+ if (parts.length !== 2) return null;
216
+ [month, year] = parts.map((p) => p.trim());
217
+ } else {
218
+ if (!/^\d{4}$|^\d{6}$/.test(text)) return null;
219
+ month = text.slice(0, 2);
220
+ year = text.slice(2);
221
+ }
222
+ if (!/^\d{1,2}$/.test(month) || !/^(\d{2}|\d{4})$/.test(year)) return null;
223
+ return {
224
+ month: Number(month),
225
+ year: year.length === 2 ? 2e3 + Number(year) : Number(year)
226
+ };
227
+ }
228
+ function expiryIssue(value, now = /* @__PURE__ */ new Date()) {
229
+ if (!(value ?? "").trim()) return "required";
230
+ const parsed = parseExpiry(value);
231
+ if (!parsed) return "format";
232
+ if (parsed.month < 1 || parsed.month > 12) return "month";
233
+ const thisYear = now.getFullYear();
234
+ const thisMonth = now.getMonth() + 1;
235
+ return parsed.year < thisYear || parsed.year === thisYear && parsed.month < thisMonth ? "past" : null;
236
+ }
237
+ function routingIssue(value) {
238
+ const raw = (value ?? "").trim();
239
+ if (!raw) return "required";
240
+ return /^\d{9}$/.test(raw) ? null : "length";
241
+ }
242
+ function accountNumberIssue(value) {
243
+ const raw = (value ?? "").trim();
244
+ if (!raw) return "required";
245
+ return /^\d{4,17}$/.test(raw) ? null : "length";
246
+ }
247
+ const CA_POSTAL = /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i;
248
+ function postalCodeIssue(value, required = false, country = "US") {
249
+ const raw = (value ?? "").trim();
250
+ if (!raw) return required ? "required" : null;
251
+ return (country === "CA" ? CA_POSTAL.test(raw) : /^\d{5}(-?\d{4})?$/.test(raw)) ? null : "format";
252
+ }
253
+ function scrubDigits(text) {
254
+ return (text ?? "").replace(/\d(?:[ -]?\d)+/g, (run) => run.replace(/\D/g, "").length >= 4 ? "•••" : run);
255
+ }
256
+ const QBO_FIELD_ERROR_KEYS = [
257
+ ["card.number", "qboErrors.field.cardNumber"],
258
+ ["card.expmonth", "qboErrors.field.expiry"],
259
+ ["card.expyear", "qboErrors.field.expiry"],
260
+ ["card.cvc", "qboErrors.field.cvc"],
261
+ ["postalcode", "qboErrors.field.postalCode"],
262
+ ["bankaccount.routingnumber", "qboErrors.field.routing"],
263
+ ["bankaccount.accountnumber", "qboErrors.field.account"],
264
+ ["bankaccount.accounttype", "qboErrors.field.accountType"],
265
+ ["bankaccount.name", "qboErrors.field.holder"]
266
+ ];
267
+ function qboStatusKey(status) {
268
+ if (status === 0) return "qboErrors.status.network";
269
+ if (status === 400 || status === 422) return "qboErrors.status.invalid";
270
+ if (status === 401 || status === 403) return "qboErrors.status.notAllowed";
271
+ if (status === 429) return "qboErrors.status.rateLimited";
272
+ return "qboErrors.status.unavailable";
273
+ }
274
+ function getQboErrorMessage(status, errors = [], options = {}) {
275
+ const first = errors[0];
276
+ if (options.display === "intuit") return first?.message ? scrubDigits(first.message) : options.fallback ?? uiText("qboErrors.defaultMessage");
277
+ for (const e of errors) if (e.code && options.overrides?.[e.code]) return options.overrides[e.code];
278
+ const haystack = `${first?.detail ?? ""} ${first?.message ?? ""}`.toLowerCase();
279
+ for (const [needle, key] of QBO_FIELD_ERROR_KEYS) if (haystack.includes(needle)) return uiText(key);
280
+ return uiText(qboStatusKey(status));
281
+ }
282
+ const QBO_A11Y_MESSAGES = {
283
+ get processing() {
284
+ return uiText("qboPayment.a11y.processing");
285
+ },
286
+ get tokenized() {
287
+ return uiText("qboPayment.a11y.tokenized");
288
+ }
289
+ };
290
+ let nextId = 0;
291
+ const digitsMax = (max) => (raw) => digitsOnly(raw).slice(0, max);
292
+ const zipFormatter = (raw) => raw.replace(/[^\d-]/g, "").slice(0, 10);
293
+ const caPostalFormatter = (raw) => raw.toUpperCase().replace(/[^A-Z0-9 -]/g, "").slice(0, 7);
294
+ var QboPaymentComponent = class QboPaymentComponent {
295
+ constructor() {
296
+ this.labels = inject(UiLabelsService);
297
+ this.tokenizer = inject(QBO_TOKENIZER);
298
+ this.defaults = inject(QBO_PAYMENT_DEFAULTS);
299
+ this.host = inject(ElementRef);
300
+ this.injector = inject(Injector);
301
+ this.mountOnly = input(false, ...ngDevMode ? [{ debugName: "mountOnly" }] : /* istanbul ignore next */ []);
302
+ this.mode = input("payment", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
303
+ this.method = model("card", ...ngDevMode ? [{ debugName: "method" }] : /* istanbul ignore next */ []);
304
+ this.methods = input(null, ...ngDevMode ? [{ debugName: "methods" }] : /* istanbul ignore next */ []);
305
+ this.environment = input(null, ...ngDevMode ? [{ debugName: "environment" }] : /* istanbul ignore next */ []);
306
+ this.cardholderName = input("", ...ngDevMode ? [{ debugName: "cardholderName" }] : /* istanbul ignore next */ []);
307
+ this.requireName = input(false, ...ngDevMode ? [{ debugName: "requireName" }] : /* istanbul ignore next */ []);
308
+ this.requirePostalCode = input(false, ...ngDevMode ? [{ debugName: "requirePostalCode" }] : /* istanbul ignore next */ []);
309
+ this.postalCountry = input("US", ...ngDevMode ? [{ debugName: "postalCountry" }] : /* istanbul ignore next */ []);
310
+ this.confirmAccountNumber = input(true, ...ngDevMode ? [{ debugName: "confirmAccountNumber" }] : /* istanbul ignore next */ []);
311
+ this.requireAchConsent = input(true, ...ngDevMode ? [{ debugName: "requireAchConsent" }] : /* istanbul ignore next */ []);
312
+ this.achConsentTextInput = input(null, {
313
+ ...ngDevMode ? { debugName: "achConsentTextInput" } : /* istanbul ignore next */ {},
314
+ alias: "achConsentText"
315
+ });
316
+ this.achConsent = computed(() => this.achConsentTextInput() ?? this.labels.t(this.mode() === "setup" ? "qboPayment.achConsentSetup" : "qboPayment.achConsent"), ...ngDevMode ? [{ debugName: "achConsent" }] : /* istanbul ignore next */ []);
317
+ this.showStatus = input(true, ...ngDevMode ? [{ debugName: "showStatus" }] : /* istanbul ignore next */ []);
318
+ this.payableRef = input(null, ...ngDevMode ? [{ debugName: "payableRef" }] : /* istanbul ignore next */ []);
319
+ this.attemptKey = input(null, ...ngDevMode ? [{ debugName: "attemptKey" }] : /* istanbul ignore next */ []);
320
+ this.checkStatus = input(null, ...ngDevMode ? [{ debugName: "checkStatus" }] : /* istanbul ignore next */ []);
321
+ this.paid = input(false, ...ngDevMode ? [{ debugName: "paid" }] : /* istanbul ignore next */ []);
322
+ this.hostPending = input(false, ...ngDevMode ? [{ debugName: "hostPending" }] : /* istanbul ignore next */ []);
323
+ this.statusPollMs = input(PAYMENT_STATUS_POLL_MS, ...ngDevMode ? [{ debugName: "statusPollMs" }] : /* istanbul ignore next */ []);
324
+ this.statusPollMaxMs = input(PAYMENT_STATUS_POLL_MAX_MS, ...ngDevMode ? [{ debugName: "statusPollMaxMs" }] : /* istanbul ignore next */ []);
325
+ this.statusCheckTimeoutMs = input(PAYMENT_STATUS_CHECK_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "statusCheckTimeoutMs" }] : /* istanbul ignore next */ []);
326
+ this.statusFailGraceMs = input(PAYMENT_STATUS_FAIL_GRACE_MS, ...ngDevMode ? [{ debugName: "statusFailGraceMs" }] : /* istanbul ignore next */ []);
327
+ this.allowStartOver = input(false, ...ngDevMode ? [{ debugName: "allowStartOver" }] : /* istanbul ignore next */ []);
328
+ this.offlineOverride = input(false, ...ngDevMode ? [{ debugName: "offlineOverride" }] : /* istanbul ignore next */ []);
329
+ this.hostSilenceMs = input(PAYMENT_HOST_SILENCE_MS, ...ngDevMode ? [{ debugName: "hostSilenceMs" }] : /* istanbul ignore next */ []);
330
+ this.readinessCheck = input(null, ...ngDevMode ? [{ debugName: "readinessCheck" }] : /* istanbul ignore next */ []);
331
+ this.readinessTimeoutMs = input(PAYMENT_READINESS_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "readinessTimeoutMs" }] : /* istanbul ignore next */ []);
332
+ this.readinessEveryMs = input(PAYMENT_READINESS_EVERY_MS, ...ngDevMode ? [{ debugName: "readinessEveryMs" }] : /* istanbul ignore next */ []);
333
+ this.submitLabel = input("", ...ngDevMode ? [{ debugName: "submitLabel" }] : /* istanbul ignore next */ []);
334
+ this.showSubmit = input(true, ...ngDevMode ? [{ debugName: "showSubmit" }] : /* istanbul ignore next */ []);
335
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
336
+ this.pending = input(false, ...ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []);
337
+ this.labelInput = input(null, {
338
+ ...ngDevMode ? { debugName: "labelInput" } : /* istanbul ignore next */ {},
339
+ alias: "label"
340
+ });
341
+ this.label = computed(() => this.labelInput() ?? this.labels.t("qboPayment.label"), ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
342
+ this.required = input(false, ...ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []);
343
+ this.showErrors = input(true, ...ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []);
344
+ this.errorDisplay = input("friendly", ...ngDevMode ? [{ debugName: "errorDisplay" }] : /* istanbul ignore next */ []);
345
+ this.errorMessages = input(null, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
346
+ this.errorFallback = input("", ...ngDevMode ? [{ debugName: "errorFallback" }] : /* istanbul ignore next */ []);
347
+ this.a11yMessages = input(null, ...ngDevMode ? [{ debugName: "a11yMessages" }] : /* istanbul ignore next */ []);
348
+ this.tokenized = output();
349
+ this.failed = output();
350
+ this.inFlightChange = output();
351
+ this.outcome = output();
352
+ this.attemptKeyChange = output();
353
+ this.readinessChange = output();
354
+ this.submitting = signal(false, ...ngDevMode ? [{ debugName: "submitting" }] : /* istanbul ignore next */ []);
355
+ this.errorText = signal("", ...ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []);
356
+ this.announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
357
+ this.attempted = signal(false, ...ngDevMode ? [{ debugName: "attempted" }] : /* istanbul ignore next */ []);
358
+ this.formKey = signal(0, ...ngDevMode ? [{ debugName: "formKey" }] : /* istanbul ignore next */ []);
359
+ this.formKeys = computed(() => [this.formKey()], ...ngDevMode ? [{ debugName: "formKeys" }] : /* istanbul ignore next */ []);
360
+ this.number = signal("", ...ngDevMode ? [{ debugName: "number" }] : /* istanbul ignore next */ []);
361
+ this.cardName = signal("", ...ngDevMode ? [{ debugName: "cardName" }] : /* istanbul ignore next */ []);
362
+ this.expiry = signal("", ...ngDevMode ? [{ debugName: "expiry" }] : /* istanbul ignore next */ []);
363
+ this.cvc = signal("", ...ngDevMode ? [{ debugName: "cvc" }] : /* istanbul ignore next */ []);
364
+ this.postal = signal("", ...ngDevMode ? [{ debugName: "postal" }] : /* istanbul ignore next */ []);
365
+ this.holder = signal("", ...ngDevMode ? [{ debugName: "holder" }] : /* istanbul ignore next */ []);
366
+ this.routing = signal("", ...ngDevMode ? [{ debugName: "routing" }] : /* istanbul ignore next */ []);
367
+ this.account = signal("", ...ngDevMode ? [{ debugName: "account" }] : /* istanbul ignore next */ []);
368
+ this.confirm = signal("", ...ngDevMode ? [{ debugName: "confirm" }] : /* istanbul ignore next */ []);
369
+ this.accountType = signal("PERSONAL_CHECKING", ...ngDevMode ? [{ debugName: "accountType" }] : /* istanbul ignore next */ []);
370
+ this.consent = signal(false, ...ngDevMode ? [{ debugName: "consent" }] : /* istanbul ignore next */ []);
371
+ this.errorId = `ui-qbo-error-${nextId++}`;
372
+ this.formatNumber = formatCardNumber;
373
+ this.formatExpiryText = formatExpiry;
374
+ this.cvcFormatter = digitsMax(4);
375
+ this.postalFormatter = computed(() => this.postalCountry() === "CA" ? caPostalFormatter : zipFormatter, ...ngDevMode ? [{ debugName: "postalFormatter" }] : /* istanbul ignore next */ []);
376
+ this.postalPlaceholder = computed(() => this.postalCountry() === "CA" ? "A1A 1A1" : "94086", ...ngDevMode ? [{ debugName: "postalPlaceholder" }] : /* istanbul ignore next */ []);
377
+ this.postalInputMode = computed(() => this.postalCountry() === "CA" ? "text" : "numeric", ...ngDevMode ? [{ debugName: "postalInputMode" }] : /* istanbul ignore next */ []);
378
+ this.postalMaxLength = computed(() => this.postalCountry() === "CA" ? 7 : 10, ...ngDevMode ? [{ debugName: "postalMaxLength" }] : /* istanbul ignore next */ []);
379
+ this.routingFormatter = digitsMax(9);
380
+ this.accountFormatter = digitsMax(17);
381
+ this.tabs = computed(() => {
382
+ const methods = this.methods();
383
+ if (!methods || methods.length < 2) return [];
384
+ return methods.map((m) => ({
385
+ key: m,
386
+ label: this.labels.t(m === "card" ? "qboPayment.method.card" : "qboPayment.method.ach")
387
+ }));
388
+ }, ...ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []);
389
+ this.accountTypeOptions = computed(() => QBO_BANK_ACCOUNT_TYPES.map((value) => ({
390
+ value,
391
+ label: this.labels.t(`qboPayment.bank.type.${value}`)
392
+ })), ...ngDevMode ? [{ debugName: "accountTypeOptions" }] : /* istanbul ignore next */ []);
393
+ this.locked = computed(() => this.disabled() || this.pending() || this.submitting() || this.attempt.locked(), ...ngDevMode ? [{ debugName: "locked" }] : /* istanbul ignore next */ []);
394
+ this.brand = computed(() => detectCardBrand(this.number()), ...ngDevMode ? [{ debugName: "brand" }] : /* istanbul ignore next */ []);
395
+ this.brandHint = computed(() => {
396
+ const brand = this.brand();
397
+ return brand ? this.labels.t(`qboPayment.brand.${brand}`) : "";
398
+ }, ...ngDevMode ? [{ debugName: "brandHint" }] : /* istanbul ignore next */ []);
399
+ this.effectiveSubmitLabel = computed(() => {
400
+ const given = this.submitLabel();
401
+ if (given) return given;
402
+ const setup = this.mode() === "setup";
403
+ return this.labels.t(this.method() === "ach" ? setup ? "qboPayment.submit.saveBank" : "qboPayment.submit.payBank" : setup ? "qboPayment.submit.saveCard" : "qboPayment.submit.pay");
404
+ }, ...ngDevMode ? [{ debugName: "effectiveSubmitLabel" }] : /* istanbul ignore next */ []);
405
+ this.messages = computed(() => {
406
+ const given = Object.fromEntries(Object.entries(this.a11yMessages() ?? {}).filter(([, text]) => typeof text === "string"));
407
+ return {
408
+ ...QBO_A11Y_MESSAGES,
409
+ ...given
410
+ };
411
+ }, ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
412
+ this.statusText = computed(() => this.submitting() ? this.messages().processing : this.announcement(), ...ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []);
413
+ this.destroyed = false;
414
+ this.shownMethod = null;
415
+ this.shownCountry = null;
416
+ this.numberError = computed(() => this.numberMessage(false), ...ngDevMode ? [{ debugName: "numberError" }] : /* istanbul ignore next */ []);
417
+ this.expiryError = computed(() => this.expiryMessage(false), ...ngDevMode ? [{ debugName: "expiryError" }] : /* istanbul ignore next */ []);
418
+ this.cvcError = computed(() => this.cvcMessage(false), ...ngDevMode ? [{ debugName: "cvcError" }] : /* istanbul ignore next */ []);
419
+ this.postalError = computed(() => this.postalMessage(false), ...ngDevMode ? [{ debugName: "postalError" }] : /* istanbul ignore next */ []);
420
+ this.routingError = computed(() => this.routingMessage(false), ...ngDevMode ? [{ debugName: "routingError" }] : /* istanbul ignore next */ []);
421
+ this.accountError = computed(() => this.accountMessage(false), ...ngDevMode ? [{ debugName: "accountError" }] : /* istanbul ignore next */ []);
422
+ this.confirmError = computed(() => this.confirmMessage(false), ...ngDevMode ? [{ debugName: "confirmError" }] : /* istanbul ignore next */ []);
423
+ const protection = createPaymentProtection(this, {
424
+ amount: () => null,
425
+ method: () => this.method(),
426
+ offlineMidFlight: false,
427
+ onOutcome: (o) => this.outcome.emit(o),
428
+ onInFlightChange: (v) => this.inFlightChange.emit(v),
429
+ onKeyChange: (k) => this.attemptKeyChange.emit(k),
430
+ onReadinessChange: (r) => this.readinessChange.emit(r)
431
+ });
432
+ this.attempt = protection.attempt;
433
+ this.readiness = protection.readiness;
434
+ effect(() => {
435
+ const name = this.cardholderName();
436
+ untracked(() => {
437
+ this.cardName.set(name);
438
+ this.holder.set(name);
439
+ });
440
+ });
441
+ effect(() => {
442
+ const method = this.method();
443
+ untracked(() => {
444
+ if (this.shownMethod !== null && this.shownMethod !== method) {
445
+ this.clearFields();
446
+ this.errorText.set("");
447
+ }
448
+ this.shownMethod = method;
449
+ });
450
+ });
451
+ effect(() => {
452
+ const country = this.postalCountry();
453
+ untracked(() => {
454
+ if (this.shownCountry !== null && this.shownCountry !== country) this.postal.set("");
455
+ this.shownCountry = country;
456
+ });
457
+ });
458
+ inject(DestroyRef).onDestroy(() => {
459
+ this.clearFields();
460
+ this.destroyed = true;
461
+ });
462
+ }
463
+ async tokenize() {
464
+ if (this.submitting() || this.disabled() || this.pending()) return null;
465
+ if (this.refusedByProtection()) return null;
466
+ this.attempted.set(true);
467
+ const method = this.method();
468
+ const issue = this.firstIssue(method);
469
+ if (issue) {
470
+ this.fail({
471
+ code: "validation",
472
+ message: issue.message,
473
+ stage: "validate",
474
+ field: issue.field
475
+ });
476
+ this.focusField(issue.field);
477
+ return null;
478
+ }
479
+ const kind = this.mode();
480
+ const environment = this.environment() ?? this.defaults.environment ?? "sandbox";
481
+ const begun = this.attempt.begin();
482
+ if (!begun.ok) return null;
483
+ const attemptKey = begun.key;
484
+ const payableRef = this.attempt.pinnedRef();
485
+ let handedToHost = false;
486
+ this.submitting.set(true);
487
+ this.errorText.set("");
488
+ this.announcement.set("");
489
+ const sent = this.dispatch(method, environment);
490
+ this.clearFields();
491
+ try {
492
+ const result = await sent.promise.catch(() => ({
493
+ ok: false,
494
+ status: 0,
495
+ errors: []
496
+ }));
497
+ if (this.destroyed) return null;
498
+ if (!result.ok) {
499
+ const errors = result.errors.map((e) => ({
500
+ ...e,
501
+ ...e.message ? { message: scrubDigits(e.message) } : {},
502
+ ...e.detail ? { detail: scrubDigits(e.detail) } : {},
503
+ ...e.moreInfo ? { moreInfo: scrubDigits(e.moreInfo) } : {}
504
+ }));
505
+ const options = {
506
+ display: this.errorDisplay(),
507
+ overrides: this.errorMessages(),
508
+ ...this.errorFallback() ? { fallback: this.errorFallback() } : {}
509
+ };
510
+ this.fail({
511
+ code: errors[0]?.code ?? (result.status === 0 ? "network" : "tokenize_failed"),
512
+ message: getQboErrorMessage(result.status, errors, options),
513
+ stage: "tokenize",
514
+ status: result.status,
515
+ ...errors.length ? { errors } : {}
516
+ });
517
+ return null;
518
+ }
519
+ const event = {
520
+ token: result.token,
521
+ method,
522
+ kind,
523
+ details: sent.details,
524
+ requestId: sent.requestId,
525
+ attemptKey,
526
+ payableRef
527
+ };
528
+ this.announcement.set(this.messages().tokenized);
529
+ if (kind === "payment") {
530
+ handedToHost = true;
531
+ this.attempt.markPending("token");
532
+ }
533
+ this.tokenized.emit(event);
534
+ return event;
535
+ } finally {
536
+ if (!this.destroyed) this.submitting.set(false);
537
+ if (!handedToHost) this.attempt.release();
538
+ }
539
+ }
540
+ markUnknown() {
541
+ this.attempt.markUnknown("host");
542
+ }
543
+ markSucceeded() {
544
+ this.attempt.succeed("host");
545
+ }
546
+ markFailed() {
547
+ this.attempt.fail("host");
548
+ }
549
+ markNotCharged() {
550
+ this.attempt.markNotCharged();
551
+ }
552
+ resetPaid() {
553
+ this.attempt.resetPaid();
554
+ }
555
+ refusedByProtection() {
556
+ if (!this.readiness.passSync()) {
557
+ const reason = this.readiness.reasons()[0] ?? "checking";
558
+ this.outcome.emit({
559
+ kind: "refused",
560
+ attemptKey: this.attempt.key(),
561
+ reason
562
+ });
563
+ this.fail({
564
+ code: reason,
565
+ message: this.labels.t(refusalLabelKey(reason)),
566
+ stage: "validate"
567
+ });
568
+ return true;
569
+ }
570
+ if (this.attempt.inFlight()) return true;
571
+ if (this.attempt.paidLocked() || this.attempt.unknown()) {
572
+ this.attempt.begin();
573
+ return true;
574
+ }
575
+ return false;
576
+ }
577
+ focusField(field) {
578
+ const query = {
579
+ number: "input[data-testid=\"qbo-card-number\"]",
580
+ name: "input[data-testid=\"qbo-card-name\"]",
581
+ expiry: "input[data-testid=\"qbo-card-expiry\"]",
582
+ cvc: "input[data-testid=\"qbo-card-cvc\"]",
583
+ postalCode: "input[data-testid=\"qbo-card-postal\"]",
584
+ holder: "input[data-testid=\"qbo-bank-holder\"]",
585
+ routing: "input[data-testid=\"qbo-bank-routing\"]",
586
+ account: "input[data-testid=\"qbo-bank-account\"]",
587
+ confirmAccount: "input[data-testid=\"qbo-bank-confirm\"]",
588
+ accountType: "[data-testid=\"qbo-bank-type\"] select",
589
+ consent: "input[data-testid=\"qbo-consent\"]"
590
+ }[field];
591
+ if (!query || this.destroyed) return;
592
+ afterNextRender(() => this.host.nativeElement.querySelector(query)?.focus(), { injector: this.injector });
593
+ }
594
+ reset() {
595
+ this.clearFields();
596
+ this.errorText.set("");
597
+ this.announcement.set("");
598
+ }
599
+ dispatch(method, environment) {
600
+ const requestId = newQboRequestId();
601
+ let request;
602
+ let details;
603
+ if (method === "card") {
604
+ const digits = digitsOnly(this.number());
605
+ const expiry = parseExpiry(this.expiry());
606
+ const name = this.cardName().trim();
607
+ const postal = this.postal().trim();
608
+ request = {
609
+ kind: "card",
610
+ card: {
611
+ number: digits,
612
+ expMonth: String(expiry.month).padStart(2, "0"),
613
+ expYear: String(expiry.year),
614
+ cvc: this.cvc().trim(),
615
+ ...name ? { name } : {},
616
+ ...postal ? { address: {
617
+ postalCode: postal,
618
+ ...this.postalCountry() === "CA" ? { country: "CA" } : {}
619
+ } } : {}
620
+ }
621
+ };
622
+ details = {
623
+ brand: detectCardBrand(digits),
624
+ last4: digits.slice(-4),
625
+ expMonth: expiry.month,
626
+ expYear: expiry.year,
627
+ accountType: null
628
+ };
629
+ } else {
630
+ const account = this.account().trim();
631
+ request = {
632
+ kind: "bank",
633
+ bankAccount: {
634
+ name: this.holder().trim(),
635
+ routingNumber: this.routing().trim(),
636
+ accountNumber: account,
637
+ accountType: this.accountType()
638
+ }
639
+ };
640
+ details = {
641
+ brand: null,
642
+ last4: account.slice(-4),
643
+ expMonth: null,
644
+ expYear: null,
645
+ accountType: this.accountType()
646
+ };
647
+ }
648
+ let promise;
649
+ try {
650
+ promise = this.tokenizer(request, {
651
+ environment,
652
+ requestId
653
+ });
654
+ } catch {
655
+ promise = Promise.resolve({
656
+ ok: false,
657
+ status: 0,
658
+ errors: []
659
+ });
660
+ }
661
+ return {
662
+ promise,
663
+ details,
664
+ requestId
665
+ };
666
+ }
667
+ clearFields() {
668
+ this.number.set("");
669
+ this.cvc.set("");
670
+ this.expiry.set("");
671
+ this.postal.set("");
672
+ this.cardName.set(this.cardholderName());
673
+ this.holder.set(this.cardholderName());
674
+ this.routing.set("");
675
+ this.account.set("");
676
+ this.confirm.set("");
677
+ this.accountType.set("PERSONAL_CHECKING");
678
+ this.consent.set(false);
679
+ this.attempted.set(false);
680
+ this.formKey.update((n) => n + 1);
681
+ }
682
+ fail(f) {
683
+ const override = this.errorMessages()?.[f.code];
684
+ if (override) f = {
685
+ ...f,
686
+ message: override
687
+ };
688
+ if (this.destroyed) return;
689
+ this.announcement.set("");
690
+ if (this.showErrors()) this.errorText.set(f.message);
691
+ this.failed.emit(f);
692
+ }
693
+ requiredText(key) {
694
+ return this.labels.t("qboPayment.err.required", { field: this.labels.t(key) });
695
+ }
696
+ numberMessage(forSubmit) {
697
+ const issue = cardNumberIssue(this.number());
698
+ if (issue === "required") return forSubmit ? this.requiredText("qboPayment.card.number") : "";
699
+ return issue === "length" ? this.labels.t("qboPayment.err.numberLength") : issue === "luhn" ? this.labels.t("qboPayment.err.numberLuhn") : "";
700
+ }
701
+ expiryMessage(forSubmit) {
702
+ const issue = expiryIssue(this.expiry());
703
+ if (issue === "required") return forSubmit ? this.requiredText("qboPayment.card.expiry") : "";
704
+ return issue === "format" ? this.labels.t("qboPayment.err.expiryFormat") : issue === "month" ? this.labels.t("qboPayment.err.expiryMonth") : issue === "past" ? this.labels.t("qboPayment.err.expiryPast") : "";
705
+ }
706
+ cvcMessage(forSubmit) {
707
+ const brand = this.brand();
708
+ const issue = cvcIssue(this.cvc(), brand);
709
+ if (issue === "required") return forSubmit ? this.requiredText("qboPayment.card.cvc") : "";
710
+ return issue === "length" ? this.labels.t("qboPayment.err.cvcLength", { length: cvcLengthsFor(brand).join(` ${this.labels.t("qboPayment.err.or")} `) }) : "";
711
+ }
712
+ postalMessage(forSubmit) {
713
+ const country = this.postalCountry();
714
+ const issue = postalCodeIssue(this.postal(), forSubmit && this.requirePostalCode(), country);
715
+ return issue === "required" ? this.requiredText("qboPayment.card.postal") : issue === "format" ? this.labels.t(country === "CA" ? "qboPayment.err.postalFormatCa" : "qboPayment.err.postalFormat") : "";
716
+ }
717
+ routingMessage(forSubmit) {
718
+ const issue = routingIssue(this.routing());
719
+ if (issue === "required") return forSubmit ? this.requiredText("qboPayment.bank.routing") : "";
720
+ return issue === "length" ? this.labels.t("qboPayment.err.routingLength") : "";
721
+ }
722
+ accountMessage(forSubmit) {
723
+ const issue = accountNumberIssue(this.account());
724
+ if (issue === "required") return forSubmit ? this.requiredText("qboPayment.bank.account") : "";
725
+ return issue === "length" ? this.labels.t("qboPayment.err.accountLength") : "";
726
+ }
727
+ confirmMessage(forSubmit) {
728
+ if (!this.confirmAccountNumber()) return "";
729
+ const value = this.confirm().trim();
730
+ if (!value) return forSubmit ? this.requiredText("qboPayment.bank.confirm") : "";
731
+ return value !== this.account().trim() ? this.labels.t("qboPayment.err.confirmMismatch") : "";
732
+ }
733
+ firstIssue(method) {
734
+ const hit = (method === "card" ? [
735
+ ["number", this.numberMessage(true)],
736
+ ["name", this.requireName() && !this.cardName().trim() ? this.requiredText("qboPayment.card.name") : ""],
737
+ ["expiry", this.expiryMessage(true)],
738
+ ["cvc", this.cvcMessage(true)],
739
+ ["postalCode", this.postalMessage(true)]
740
+ ] : [
741
+ ["holder", this.holder().trim() ? "" : this.requiredText("qboPayment.bank.holder")],
742
+ ["routing", this.routingMessage(true)],
743
+ ["account", this.accountMessage(true)],
744
+ ["confirmAccount", this.confirmMessage(true)],
745
+ ["accountType", QBO_BANK_ACCOUNT_TYPES.includes(this.accountType()) ? "" : this.requiredText("qboPayment.bank.type")],
746
+ ["consent", this.requireAchConsent() && !this.consent() ? this.labels.t("qboPayment.consentRequired") : ""]
747
+ ]).find(([, message]) => !!message);
748
+ return hit ? {
749
+ field: hit[0],
750
+ message: hit[1]
751
+ } : null;
752
+ }
753
+ onTab(key) {
754
+ if (this.submitting() || this.disabled() || this.pending() || this.attempt.locked() || key !== "card" && key !== "ach") return;
755
+ this.clearFields();
756
+ this.method.set(key);
757
+ this.errorText.set("");
758
+ this.attempted.set(false);
759
+ }
760
+ static {
761
+ this.ɵfac = i0.ɵɵngDeclareFactory({
762
+ minVersion: "12.0.0",
763
+ version: "22.2.2",
764
+ ngImport: i0,
765
+ type: QboPaymentComponent,
766
+ deps: [],
767
+ target: i0.ɵɵFactoryTarget.Component
768
+ });
769
+ }
770
+ static {
771
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
772
+ minVersion: "17.0.0",
773
+ version: "22.2.2",
774
+ type: QboPaymentComponent,
775
+ isStandalone: true,
776
+ selector: "ui-qbo-payment",
777
+ inputs: {
778
+ mountOnly: {
779
+ classPropertyName: "mountOnly",
780
+ publicName: "mountOnly",
781
+ isSignal: true,
782
+ isRequired: false,
783
+ transformFunction: null
784
+ },
785
+ mode: {
786
+ classPropertyName: "mode",
787
+ publicName: "mode",
788
+ isSignal: true,
789
+ isRequired: false,
790
+ transformFunction: null
791
+ },
792
+ method: {
793
+ classPropertyName: "method",
794
+ publicName: "method",
795
+ isSignal: true,
796
+ isRequired: false,
797
+ transformFunction: null
798
+ },
799
+ methods: {
800
+ classPropertyName: "methods",
801
+ publicName: "methods",
802
+ isSignal: true,
803
+ isRequired: false,
804
+ transformFunction: null
805
+ },
806
+ environment: {
807
+ classPropertyName: "environment",
808
+ publicName: "environment",
809
+ isSignal: true,
810
+ isRequired: false,
811
+ transformFunction: null
812
+ },
813
+ cardholderName: {
814
+ classPropertyName: "cardholderName",
815
+ publicName: "cardholderName",
816
+ isSignal: true,
817
+ isRequired: false,
818
+ transformFunction: null
819
+ },
820
+ requireName: {
821
+ classPropertyName: "requireName",
822
+ publicName: "requireName",
823
+ isSignal: true,
824
+ isRequired: false,
825
+ transformFunction: null
826
+ },
827
+ requirePostalCode: {
828
+ classPropertyName: "requirePostalCode",
829
+ publicName: "requirePostalCode",
830
+ isSignal: true,
831
+ isRequired: false,
832
+ transformFunction: null
833
+ },
834
+ postalCountry: {
835
+ classPropertyName: "postalCountry",
836
+ publicName: "postalCountry",
837
+ isSignal: true,
838
+ isRequired: false,
839
+ transformFunction: null
840
+ },
841
+ confirmAccountNumber: {
842
+ classPropertyName: "confirmAccountNumber",
843
+ publicName: "confirmAccountNumber",
844
+ isSignal: true,
845
+ isRequired: false,
846
+ transformFunction: null
847
+ },
848
+ requireAchConsent: {
849
+ classPropertyName: "requireAchConsent",
850
+ publicName: "requireAchConsent",
851
+ isSignal: true,
852
+ isRequired: false,
853
+ transformFunction: null
854
+ },
855
+ achConsentTextInput: {
856
+ classPropertyName: "achConsentTextInput",
857
+ publicName: "achConsentText",
858
+ isSignal: true,
859
+ isRequired: false,
860
+ transformFunction: null
861
+ },
862
+ showStatus: {
863
+ classPropertyName: "showStatus",
864
+ publicName: "showStatus",
865
+ isSignal: true,
866
+ isRequired: false,
867
+ transformFunction: null
868
+ },
869
+ payableRef: {
870
+ classPropertyName: "payableRef",
871
+ publicName: "payableRef",
872
+ isSignal: true,
873
+ isRequired: false,
874
+ transformFunction: null
875
+ },
876
+ attemptKey: {
877
+ classPropertyName: "attemptKey",
878
+ publicName: "attemptKey",
879
+ isSignal: true,
880
+ isRequired: false,
881
+ transformFunction: null
882
+ },
883
+ checkStatus: {
884
+ classPropertyName: "checkStatus",
885
+ publicName: "checkStatus",
886
+ isSignal: true,
887
+ isRequired: false,
888
+ transformFunction: null
889
+ },
890
+ paid: {
891
+ classPropertyName: "paid",
892
+ publicName: "paid",
893
+ isSignal: true,
894
+ isRequired: false,
895
+ transformFunction: null
896
+ },
897
+ hostPending: {
898
+ classPropertyName: "hostPending",
899
+ publicName: "hostPending",
900
+ isSignal: true,
901
+ isRequired: false,
902
+ transformFunction: null
903
+ },
904
+ statusPollMs: {
905
+ classPropertyName: "statusPollMs",
906
+ publicName: "statusPollMs",
907
+ isSignal: true,
908
+ isRequired: false,
909
+ transformFunction: null
910
+ },
911
+ statusPollMaxMs: {
912
+ classPropertyName: "statusPollMaxMs",
913
+ publicName: "statusPollMaxMs",
914
+ isSignal: true,
915
+ isRequired: false,
916
+ transformFunction: null
917
+ },
918
+ statusCheckTimeoutMs: {
919
+ classPropertyName: "statusCheckTimeoutMs",
920
+ publicName: "statusCheckTimeoutMs",
921
+ isSignal: true,
922
+ isRequired: false,
923
+ transformFunction: null
924
+ },
925
+ statusFailGraceMs: {
926
+ classPropertyName: "statusFailGraceMs",
927
+ publicName: "statusFailGraceMs",
928
+ isSignal: true,
929
+ isRequired: false,
930
+ transformFunction: null
931
+ },
932
+ allowStartOver: {
933
+ classPropertyName: "allowStartOver",
934
+ publicName: "allowStartOver",
935
+ isSignal: true,
936
+ isRequired: false,
937
+ transformFunction: null
938
+ },
939
+ offlineOverride: {
940
+ classPropertyName: "offlineOverride",
941
+ publicName: "offlineOverride",
942
+ isSignal: true,
943
+ isRequired: false,
944
+ transformFunction: null
945
+ },
946
+ hostSilenceMs: {
947
+ classPropertyName: "hostSilenceMs",
948
+ publicName: "hostSilenceMs",
949
+ isSignal: true,
950
+ isRequired: false,
951
+ transformFunction: null
952
+ },
953
+ readinessCheck: {
954
+ classPropertyName: "readinessCheck",
955
+ publicName: "readinessCheck",
956
+ isSignal: true,
957
+ isRequired: false,
958
+ transformFunction: null
959
+ },
960
+ readinessTimeoutMs: {
961
+ classPropertyName: "readinessTimeoutMs",
962
+ publicName: "readinessTimeoutMs",
963
+ isSignal: true,
964
+ isRequired: false,
965
+ transformFunction: null
966
+ },
967
+ readinessEveryMs: {
968
+ classPropertyName: "readinessEveryMs",
969
+ publicName: "readinessEveryMs",
970
+ isSignal: true,
971
+ isRequired: false,
972
+ transformFunction: null
973
+ },
974
+ submitLabel: {
975
+ classPropertyName: "submitLabel",
976
+ publicName: "submitLabel",
977
+ isSignal: true,
978
+ isRequired: false,
979
+ transformFunction: null
980
+ },
981
+ showSubmit: {
982
+ classPropertyName: "showSubmit",
983
+ publicName: "showSubmit",
984
+ isSignal: true,
985
+ isRequired: false,
986
+ transformFunction: null
987
+ },
988
+ disabled: {
989
+ classPropertyName: "disabled",
990
+ publicName: "disabled",
991
+ isSignal: true,
992
+ isRequired: false,
993
+ transformFunction: null
994
+ },
995
+ pending: {
996
+ classPropertyName: "pending",
997
+ publicName: "pending",
998
+ isSignal: true,
999
+ isRequired: false,
1000
+ transformFunction: null
1001
+ },
1002
+ labelInput: {
1003
+ classPropertyName: "labelInput",
1004
+ publicName: "label",
1005
+ isSignal: true,
1006
+ isRequired: false,
1007
+ transformFunction: null
1008
+ },
1009
+ required: {
1010
+ classPropertyName: "required",
1011
+ publicName: "required",
1012
+ isSignal: true,
1013
+ isRequired: false,
1014
+ transformFunction: null
1015
+ },
1016
+ showErrors: {
1017
+ classPropertyName: "showErrors",
1018
+ publicName: "showErrors",
1019
+ isSignal: true,
1020
+ isRequired: false,
1021
+ transformFunction: null
1022
+ },
1023
+ errorDisplay: {
1024
+ classPropertyName: "errorDisplay",
1025
+ publicName: "errorDisplay",
1026
+ isSignal: true,
1027
+ isRequired: false,
1028
+ transformFunction: null
1029
+ },
1030
+ errorMessages: {
1031
+ classPropertyName: "errorMessages",
1032
+ publicName: "errorMessages",
1033
+ isSignal: true,
1034
+ isRequired: false,
1035
+ transformFunction: null
1036
+ },
1037
+ errorFallback: {
1038
+ classPropertyName: "errorFallback",
1039
+ publicName: "errorFallback",
1040
+ isSignal: true,
1041
+ isRequired: false,
1042
+ transformFunction: null
1043
+ },
1044
+ a11yMessages: {
1045
+ classPropertyName: "a11yMessages",
1046
+ publicName: "a11yMessages",
1047
+ isSignal: true,
1048
+ isRequired: false,
1049
+ transformFunction: null
1050
+ }
1051
+ },
1052
+ outputs: {
1053
+ method: "methodChange",
1054
+ tokenized: "tokenized",
1055
+ failed: "failed",
1056
+ inFlightChange: "inFlightChange",
1057
+ outcome: "outcome",
1058
+ attemptKeyChange: "attemptKeyChange",
1059
+ readinessChange: "readinessChange"
1060
+ },
1061
+ host: { properties: { "attr.aria-busy": "!mountOnly() && submitting() ? \"true\" : null" } },
1062
+ ngImport: i0,
1063
+ template: `
1064
+ <div class="qbp">
1065
+ @if (!mountOnly() && showStatus()) {
1066
+ <ui-payment-attempt-status [attempt]="attempt" [readiness]="readiness" [allowStartOver]="allowStartOver()" />
1067
+ }
1068
+ @if (!mountOnly() || a11yMessages()) {
1069
+ <ui-live-region data-testid="qbo-status" [message]="statusText()" />
1070
+ }
1071
+ @if (!mountOnly() && required()) {
1072
+ <div class="qbp-label" data-testid="qbo-required-label">{{ label() }}<span class="qbp-required" aria-hidden="true">*</span></div>
1073
+ }
1074
+ @if (tabs().length > 1) {
1075
+ <div class="qbp-block"><ui-pill-tabs [ariaLabel]="labels.t('qboPayment.method.group')" [tabs]="tabs()" [activeKey]="method()" (tabChange)="onTab($event)" /></div>
1076
+ }
1077
+ @for (key of formKeys(); track key) {
1078
+ <div class="qbp-form" role="group" [attr.aria-label]="label()" [attr.data-testid]="method() === 'card' ? 'qbo-card-form' : 'qbo-bank-form'">
1079
+ @if (method() === 'card') {
1080
+ <ui-form-section>
1081
+ <ui-text-input [label]="labels.t('qboPayment.card.number')" [inputTestId]="'qbo-card-number'" placeholder="1234 5678 9012 3456" inputmode="numeric" autocomplete="cc-number"
1082
+ [required]="true" [maxlength]="23" [formatter]="formatNumber" [error]="numberError()" [showErrors]="attempted()" [disabled]="locked()" [hint]="brandHint()"
1083
+ [ngModel]="number()" (ngModelChange)="number.set($event ?? '')" />
1084
+ <ui-text-input [label]="labels.t(requireName() ? 'qboPayment.card.name' : 'qboPayment.card.nameOptional')" [inputTestId]="'qbo-card-name'" autocomplete="cc-name" [required]="requireName()"
1085
+ [maxlength]="255" [showErrors]="attempted()" [disabled]="locked()" [ngModel]="cardName()" (ngModelChange)="cardName.set($event ?? '')" />
1086
+ <ui-form-row>
1087
+ <ui-text-input [label]="labels.t('qboPayment.card.expiry')" [inputTestId]="'qbo-card-expiry'" [placeholder]="labels.t('qboPayment.card.expiryPlaceholder')" inputmode="numeric" autocomplete="cc-exp"
1088
+ [required]="true" [maxlength]="7" [formatter]="formatExpiryText" [error]="expiryError()" [showErrors]="attempted()" [disabled]="locked()"
1089
+ [ngModel]="expiry()" (ngModelChange)="expiry.set($event ?? '')" />
1090
+ <ui-text-input [label]="labels.t('qboPayment.card.cvc')" [inputTestId]="'qbo-card-cvc'" placeholder="123" inputmode="numeric" autocomplete="cc-csc"
1091
+ [required]="true" [maxlength]="4" [formatter]="cvcFormatter" [error]="cvcError()" [showErrors]="attempted()" [disabled]="locked()"
1092
+ [ngModel]="cvc()" (ngModelChange)="cvc.set($event ?? '')" />
1093
+ </ui-form-row>
1094
+ <ui-text-input [label]="labels.t(requirePostalCode() ? 'qboPayment.card.postal' : 'qboPayment.card.postalOptional')" [inputTestId]="'qbo-card-postal'" [placeholder]="postalPlaceholder()" [inputmode]="postalInputMode()"
1095
+ autocomplete="postal-code" [required]="requirePostalCode()" [maxlength]="postalMaxLength()" [formatter]="postalFormatter()" [error]="postalError()" [showErrors]="attempted()" [disabled]="locked()"
1096
+ [ngModel]="postal()" (ngModelChange)="postal.set($event ?? '')" />
1097
+ </ui-form-section>
1098
+ } @else {
1099
+ <ui-form-section>
1100
+ <ui-text data-testid="qbo-bank-info" size="sm" tone="muted" [text]="labels.t('qboPayment.bank.info')" />
1101
+ <ui-text-input [label]="labels.t('qboPayment.bank.holder')" [inputTestId]="'qbo-bank-holder'" autocomplete="name" [required]="true" [maxlength]="255"
1102
+ [showErrors]="attempted()" [disabled]="locked()" [ngModel]="holder()" (ngModelChange)="holder.set($event ?? '')" />
1103
+ <ui-form-row>
1104
+ <ui-text-input [label]="labels.t('qboPayment.bank.routing')" [inputTestId]="'qbo-bank-routing'" [placeholder]="labels.t('qboPayment.bank.routingPlaceholder')" inputmode="numeric" autocomplete="off"
1105
+ [required]="true" [maxlength]="9" [formatter]="routingFormatter" [error]="routingError()" [showErrors]="attempted()" [disabled]="locked()"
1106
+ [ngModel]="routing()" (ngModelChange)="routing.set($event ?? '')" />
1107
+ <ui-text-input [label]="labels.t('qboPayment.bank.account')" [inputTestId]="'qbo-bank-account'" inputmode="numeric" autocomplete="off"
1108
+ [required]="true" [maxlength]="17" [formatter]="accountFormatter" [error]="accountError()" [showErrors]="attempted()" [disabled]="locked()"
1109
+ [ngModel]="account()" (ngModelChange)="account.set($event ?? '')" />
1110
+ </ui-form-row>
1111
+ @if (confirmAccountNumber()) {
1112
+ <ui-text-input [label]="labels.t('qboPayment.bank.confirm')" [inputTestId]="'qbo-bank-confirm'" inputmode="numeric" autocomplete="off"
1113
+ [required]="true" [maxlength]="17" [formatter]="accountFormatter" [error]="confirmError()" [showErrors]="attempted()" [disabled]="locked()"
1114
+ [ngModel]="confirm()" (ngModelChange)="confirm.set($event ?? '')" />
1115
+ }
1116
+ <ui-select [label]="labels.t('qboPayment.bank.type')" data-testid="qbo-bank-type" [options]="accountTypeOptions()" [required]="true" [showErrors]="attempted()" [disabled]="locked()"
1117
+ [ngModel]="accountType()" (ngModelChange)="accountType.set($event)" />
1118
+ @if (requireAchConsent()) {
1119
+ <ui-checkbox testId="qbo-consent" [label]="achConsent()" [required]="true" [requiredMessage]="labels.t('qboPayment.consentRequired')" [showErrors]="attempted()"
1120
+ [disabled]="locked()" [ngModel]="consent()" (ngModelChange)="consent.set(!!$event)" />
1121
+ }
1122
+ </ui-form-section>
1123
+ }
1124
+ </div>
1125
+ }
1126
+ @if (!mountOnly()) {
1127
+ <ui-hint class="qbp-secure" data-testid="qbo-secure-note">{{ labels.t('qboPayment.secureNote') }}</ui-hint>
1128
+ }
1129
+ @if (!mountOnly() && errorText(); as text) {
1130
+ <div class="qbp-block" [id]="errorId" data-testid="qbo-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1131
+ }
1132
+ @if (!mountOnly() && showSubmit()) {
1133
+ <div class="qbp-actions">
1134
+ <ui-button variant="primary" type="button" [fullWidth]="true" [loading]="submitting()" [disabled]="disabled() || pending() || attempt.locked() || !readiness.ready()" [ariaDescribedBy]="errorText() ? errorId : undefined"
1135
+ data-testid="qbo-submit" (click)="tokenize()">{{ effectiveSubmitLabel() }}</ui-button>
1136
+ </div>
1137
+ }
1138
+ </div>
1139
+ `,
1140
+ isInline: true,
1141
+ styles: ["ui-qbo-payment{display:block;min-width:0}ui-qbo-payment .qbp{position:relative}ui-qbo-payment .qbp-block{margin-top:12px}ui-qbo-payment .qbp-label{font-size:.875rem;font-weight:500;color:var(--ui-text, #1e293b);margin-bottom:6px}ui-qbo-payment .qbp-required{color:var(--ui-danger, #dc2626);margin-left:2px}ui-qbo-payment .qbp-form{margin-top:12px}ui-qbo-payment .qbp-secure{margin-top:12px}ui-qbo-payment .qbp-actions{margin-top:16px;display:flex;flex-direction:column;align-items:stretch}\n"],
1142
+ dependencies: [
1143
+ {
1144
+ kind: "component",
1145
+ type: AlertComponent,
1146
+ selector: "ui-alert",
1147
+ inputs: [
1148
+ "variant",
1149
+ "title",
1150
+ "dismissible",
1151
+ "dismissAriaLabel",
1152
+ "quiet",
1153
+ "compact",
1154
+ "inline",
1155
+ "fill"
1156
+ ],
1157
+ outputs: ["dismissed"]
1158
+ },
1159
+ {
1160
+ kind: "component",
1161
+ type: ButtonComponent,
1162
+ selector: "ui-button",
1163
+ inputs: [
1164
+ "variant",
1165
+ "routerLink",
1166
+ "queryParams",
1167
+ "fragment",
1168
+ "state",
1169
+ "href",
1170
+ "target",
1171
+ "rel",
1172
+ "shortLabel",
1173
+ "shortBelow",
1174
+ "color",
1175
+ "active",
1176
+ "size",
1177
+ "type",
1178
+ "disabled",
1179
+ "loading",
1180
+ "fullWidth",
1181
+ "ariaLabel",
1182
+ "ariaExpanded",
1183
+ "ariaPressed",
1184
+ "ariaDescribedBy",
1185
+ "modal-footer-left",
1186
+ "modal-footer-right"
1187
+ ]
1188
+ },
1189
+ {
1190
+ kind: "component",
1191
+ type: CheckboxComponent,
1192
+ selector: "ui-checkbox, ui-checkbox-group",
1193
+ inputs: [
1194
+ "label",
1195
+ "ariaLabel",
1196
+ "testId",
1197
+ "labelTestId",
1198
+ "headingLevel",
1199
+ "indeterminate",
1200
+ "checked",
1201
+ "options",
1202
+ "legend",
1203
+ "orientation",
1204
+ "values",
1205
+ "labelLinks",
1206
+ "description",
1207
+ "indent",
1208
+ "required",
1209
+ "requiredMessage",
1210
+ "hint",
1211
+ "error",
1212
+ "showErrors",
1213
+ "disabled"
1214
+ ],
1215
+ outputs: [
1216
+ "checkedChange",
1217
+ "valuesChange",
1218
+ "invalidChange"
1219
+ ]
1220
+ },
1221
+ {
1222
+ kind: "component",
1223
+ type: FormRowComponent,
1224
+ selector: "ui-form-row",
1225
+ inputs: ["cols"]
1226
+ },
1227
+ {
1228
+ kind: "component",
1229
+ type: FormSectionComponent,
1230
+ selector: "ui-form-section",
1231
+ inputs: ["label", "divider"]
1232
+ },
1233
+ {
1234
+ kind: "ngmodule",
1235
+ type: FormsModule
1236
+ },
1237
+ {
1238
+ kind: "directive",
1239
+ type: i1.NgControlStatus,
1240
+ selector: "[formControlName],[ngModel],[formControl]"
1241
+ },
1242
+ {
1243
+ kind: "directive",
1244
+ type: i1.RequiredValidator,
1245
+ selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
1246
+ inputs: ["required"]
1247
+ },
1248
+ {
1249
+ kind: "directive",
1250
+ type: i1.MaxLengthValidator,
1251
+ selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
1252
+ inputs: ["maxlength"]
1253
+ },
1254
+ {
1255
+ kind: "directive",
1256
+ type: i1.NgModel,
1257
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
1258
+ inputs: [
1259
+ "name",
1260
+ "disabled",
1261
+ "ngModel",
1262
+ "ngModelOptions"
1263
+ ],
1264
+ outputs: ["ngModelChange"],
1265
+ exportAs: ["ngModel"]
1266
+ },
1267
+ {
1268
+ kind: "component",
1269
+ type: HintComponent,
1270
+ selector: "ui-hint"
1271
+ },
1272
+ {
1273
+ kind: "component",
1274
+ type: LiveRegionComponent,
1275
+ selector: "ui-live-region",
1276
+ inputs: [
1277
+ "message",
1278
+ "politeness",
1279
+ "atomic",
1280
+ "visible"
1281
+ ]
1282
+ },
1283
+ {
1284
+ kind: "component",
1285
+ type: PaymentAttemptStatusComponent,
1286
+ selector: "ui-payment-attempt-status",
1287
+ inputs: [
1288
+ "attempt",
1289
+ "showPaid",
1290
+ "allowStartOver",
1291
+ "readiness"
1292
+ ],
1293
+ outputs: ["retryLoad"]
1294
+ },
1295
+ {
1296
+ kind: "component",
1297
+ type: PillTabsComponent,
1298
+ selector: "ui-pill-tabs",
1299
+ inputs: [
1300
+ "tabs",
1301
+ "activeKey",
1302
+ "ariaLabel",
1303
+ "name",
1304
+ "noWrap",
1305
+ "orientation",
1306
+ "controlsPanels",
1307
+ "showDescription",
1308
+ "headingLevel"
1309
+ ],
1310
+ outputs: ["tabChange"]
1311
+ },
1312
+ {
1313
+ kind: "component",
1314
+ type: SelectComponent,
1315
+ selector: "ui-select",
1316
+ inputs: [
1317
+ "label",
1318
+ "ariaLabel",
1319
+ "labelHidden",
1320
+ "inputName",
1321
+ "placeholder",
1322
+ "options",
1323
+ "valueType",
1324
+ "required",
1325
+ "hint",
1326
+ "ariaDescribedBy",
1327
+ "error",
1328
+ "showErrors",
1329
+ "size",
1330
+ "disabled"
1331
+ ],
1332
+ outputs: ["invalidChange", "valueChange"]
1333
+ },
1334
+ {
1335
+ kind: "component",
1336
+ type: TextComponent,
1337
+ selector: "ui-text",
1338
+ inputs: [
1339
+ "text",
1340
+ "size",
1341
+ "tone",
1342
+ "color",
1343
+ "strong",
1344
+ "weight"
1345
+ ]
1346
+ },
1347
+ {
1348
+ kind: "component",
1349
+ type: TextInputComponent,
1350
+ selector: "ui-text-input",
1351
+ inputs: [
1352
+ "label",
1353
+ "ariaLabel",
1354
+ "inputTestId",
1355
+ "inputName",
1356
+ "placeholder",
1357
+ "prefix",
1358
+ "leadingIcon",
1359
+ "revealable",
1360
+ "passwordRequirements",
1361
+ "passwordRules",
1362
+ "type",
1363
+ "maxlength",
1364
+ "required",
1365
+ "autocomplete",
1366
+ "inputmode",
1367
+ "readonly",
1368
+ "hint",
1369
+ "ariaDescribedBy",
1370
+ "error",
1371
+ "phoneFormat",
1372
+ "min",
1373
+ "max",
1374
+ "maxDecimals",
1375
+ "step",
1376
+ "valueType",
1377
+ "formatter",
1378
+ "integer",
1379
+ "showErrors",
1380
+ "disabled"
1381
+ ],
1382
+ outputs: [
1383
+ "valueChange",
1384
+ "focused",
1385
+ "blurred",
1386
+ "invalidChange"
1387
+ ]
1388
+ }
1389
+ ],
1390
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1391
+ encapsulation: i0.ViewEncapsulation.None
1392
+ });
1393
+ }
1394
+ };
1395
+ i0.ɵɵngDeclareClassMetadata({
1396
+ minVersion: "12.0.0",
1397
+ version: "22.2.2",
1398
+ ngImport: i0,
1399
+ type: QboPaymentComponent,
1400
+ decorators: [{
1401
+ type: Component,
1402
+ args: [{
1403
+ selector: "ui-qbo-payment",
1404
+ standalone: true,
1405
+ changeDetection: ChangeDetectionStrategy.OnPush,
1406
+ encapsulation: ViewEncapsulation.None,
1407
+ imports: [
1408
+ AlertComponent,
1409
+ ButtonComponent,
1410
+ CheckboxComponent,
1411
+ FormRowComponent,
1412
+ FormSectionComponent,
1413
+ FormsModule,
1414
+ HintComponent,
1415
+ LiveRegionComponent,
1416
+ PaymentAttemptStatusComponent,
1417
+ PillTabsComponent,
1418
+ SelectComponent,
1419
+ TextComponent,
1420
+ TextInputComponent
1421
+ ],
1422
+ host: { "[attr.aria-busy]": "!mountOnly() && submitting() ? \"true\" : null" },
1423
+ template: `
1424
+ <div class="qbp">
1425
+ @if (!mountOnly() && showStatus()) {
1426
+ <ui-payment-attempt-status [attempt]="attempt" [readiness]="readiness" [allowStartOver]="allowStartOver()" />
1427
+ }
1428
+ @if (!mountOnly() || a11yMessages()) {
1429
+ <ui-live-region data-testid="qbo-status" [message]="statusText()" />
1430
+ }
1431
+ @if (!mountOnly() && required()) {
1432
+ <div class="qbp-label" data-testid="qbo-required-label">{{ label() }}<span class="qbp-required" aria-hidden="true">*</span></div>
1433
+ }
1434
+ @if (tabs().length > 1) {
1435
+ <div class="qbp-block"><ui-pill-tabs [ariaLabel]="labels.t('qboPayment.method.group')" [tabs]="tabs()" [activeKey]="method()" (tabChange)="onTab($event)" /></div>
1436
+ }
1437
+ @for (key of formKeys(); track key) {
1438
+ <div class="qbp-form" role="group" [attr.aria-label]="label()" [attr.data-testid]="method() === 'card' ? 'qbo-card-form' : 'qbo-bank-form'">
1439
+ @if (method() === 'card') {
1440
+ <ui-form-section>
1441
+ <ui-text-input [label]="labels.t('qboPayment.card.number')" [inputTestId]="'qbo-card-number'" placeholder="1234 5678 9012 3456" inputmode="numeric" autocomplete="cc-number"
1442
+ [required]="true" [maxlength]="23" [formatter]="formatNumber" [error]="numberError()" [showErrors]="attempted()" [disabled]="locked()" [hint]="brandHint()"
1443
+ [ngModel]="number()" (ngModelChange)="number.set($event ?? '')" />
1444
+ <ui-text-input [label]="labels.t(requireName() ? 'qboPayment.card.name' : 'qboPayment.card.nameOptional')" [inputTestId]="'qbo-card-name'" autocomplete="cc-name" [required]="requireName()"
1445
+ [maxlength]="255" [showErrors]="attempted()" [disabled]="locked()" [ngModel]="cardName()" (ngModelChange)="cardName.set($event ?? '')" />
1446
+ <ui-form-row>
1447
+ <ui-text-input [label]="labels.t('qboPayment.card.expiry')" [inputTestId]="'qbo-card-expiry'" [placeholder]="labels.t('qboPayment.card.expiryPlaceholder')" inputmode="numeric" autocomplete="cc-exp"
1448
+ [required]="true" [maxlength]="7" [formatter]="formatExpiryText" [error]="expiryError()" [showErrors]="attempted()" [disabled]="locked()"
1449
+ [ngModel]="expiry()" (ngModelChange)="expiry.set($event ?? '')" />
1450
+ <ui-text-input [label]="labels.t('qboPayment.card.cvc')" [inputTestId]="'qbo-card-cvc'" placeholder="123" inputmode="numeric" autocomplete="cc-csc"
1451
+ [required]="true" [maxlength]="4" [formatter]="cvcFormatter" [error]="cvcError()" [showErrors]="attempted()" [disabled]="locked()"
1452
+ [ngModel]="cvc()" (ngModelChange)="cvc.set($event ?? '')" />
1453
+ </ui-form-row>
1454
+ <ui-text-input [label]="labels.t(requirePostalCode() ? 'qboPayment.card.postal' : 'qboPayment.card.postalOptional')" [inputTestId]="'qbo-card-postal'" [placeholder]="postalPlaceholder()" [inputmode]="postalInputMode()"
1455
+ autocomplete="postal-code" [required]="requirePostalCode()" [maxlength]="postalMaxLength()" [formatter]="postalFormatter()" [error]="postalError()" [showErrors]="attempted()" [disabled]="locked()"
1456
+ [ngModel]="postal()" (ngModelChange)="postal.set($event ?? '')" />
1457
+ </ui-form-section>
1458
+ } @else {
1459
+ <ui-form-section>
1460
+ <ui-text data-testid="qbo-bank-info" size="sm" tone="muted" [text]="labels.t('qboPayment.bank.info')" />
1461
+ <ui-text-input [label]="labels.t('qboPayment.bank.holder')" [inputTestId]="'qbo-bank-holder'" autocomplete="name" [required]="true" [maxlength]="255"
1462
+ [showErrors]="attempted()" [disabled]="locked()" [ngModel]="holder()" (ngModelChange)="holder.set($event ?? '')" />
1463
+ <ui-form-row>
1464
+ <ui-text-input [label]="labels.t('qboPayment.bank.routing')" [inputTestId]="'qbo-bank-routing'" [placeholder]="labels.t('qboPayment.bank.routingPlaceholder')" inputmode="numeric" autocomplete="off"
1465
+ [required]="true" [maxlength]="9" [formatter]="routingFormatter" [error]="routingError()" [showErrors]="attempted()" [disabled]="locked()"
1466
+ [ngModel]="routing()" (ngModelChange)="routing.set($event ?? '')" />
1467
+ <ui-text-input [label]="labels.t('qboPayment.bank.account')" [inputTestId]="'qbo-bank-account'" inputmode="numeric" autocomplete="off"
1468
+ [required]="true" [maxlength]="17" [formatter]="accountFormatter" [error]="accountError()" [showErrors]="attempted()" [disabled]="locked()"
1469
+ [ngModel]="account()" (ngModelChange)="account.set($event ?? '')" />
1470
+ </ui-form-row>
1471
+ @if (confirmAccountNumber()) {
1472
+ <ui-text-input [label]="labels.t('qboPayment.bank.confirm')" [inputTestId]="'qbo-bank-confirm'" inputmode="numeric" autocomplete="off"
1473
+ [required]="true" [maxlength]="17" [formatter]="accountFormatter" [error]="confirmError()" [showErrors]="attempted()" [disabled]="locked()"
1474
+ [ngModel]="confirm()" (ngModelChange)="confirm.set($event ?? '')" />
1475
+ }
1476
+ <ui-select [label]="labels.t('qboPayment.bank.type')" data-testid="qbo-bank-type" [options]="accountTypeOptions()" [required]="true" [showErrors]="attempted()" [disabled]="locked()"
1477
+ [ngModel]="accountType()" (ngModelChange)="accountType.set($event)" />
1478
+ @if (requireAchConsent()) {
1479
+ <ui-checkbox testId="qbo-consent" [label]="achConsent()" [required]="true" [requiredMessage]="labels.t('qboPayment.consentRequired')" [showErrors]="attempted()"
1480
+ [disabled]="locked()" [ngModel]="consent()" (ngModelChange)="consent.set(!!$event)" />
1481
+ }
1482
+ </ui-form-section>
1483
+ }
1484
+ </div>
1485
+ }
1486
+ @if (!mountOnly()) {
1487
+ <ui-hint class="qbp-secure" data-testid="qbo-secure-note">{{ labels.t('qboPayment.secureNote') }}</ui-hint>
1488
+ }
1489
+ @if (!mountOnly() && errorText(); as text) {
1490
+ <div class="qbp-block" [id]="errorId" data-testid="qbo-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1491
+ }
1492
+ @if (!mountOnly() && showSubmit()) {
1493
+ <div class="qbp-actions">
1494
+ <ui-button variant="primary" type="button" [fullWidth]="true" [loading]="submitting()" [disabled]="disabled() || pending() || attempt.locked() || !readiness.ready()" [ariaDescribedBy]="errorText() ? errorId : undefined"
1495
+ data-testid="qbo-submit" (click)="tokenize()">{{ effectiveSubmitLabel() }}</ui-button>
1496
+ </div>
1497
+ }
1498
+ </div>
1499
+ `,
1500
+ styles: ["ui-qbo-payment{display:block;min-width:0}ui-qbo-payment .qbp{position:relative}ui-qbo-payment .qbp-block{margin-top:12px}ui-qbo-payment .qbp-label{font-size:.875rem;font-weight:500;color:var(--ui-text, #1e293b);margin-bottom:6px}ui-qbo-payment .qbp-required{color:var(--ui-danger, #dc2626);margin-left:2px}ui-qbo-payment .qbp-form{margin-top:12px}ui-qbo-payment .qbp-secure{margin-top:12px}ui-qbo-payment .qbp-actions{margin-top:16px;display:flex;flex-direction:column;align-items:stretch}\n"]
1501
+ }]
1502
+ }],
1503
+ ctorParameters: () => [],
1504
+ propDecorators: {
1505
+ mountOnly: [{
1506
+ type: i0.Input,
1507
+ args: [{
1508
+ isSignal: true,
1509
+ alias: "mountOnly",
1510
+ required: false
1511
+ }]
1512
+ }],
1513
+ mode: [{
1514
+ type: i0.Input,
1515
+ args: [{
1516
+ isSignal: true,
1517
+ alias: "mode",
1518
+ required: false
1519
+ }]
1520
+ }],
1521
+ method: [{
1522
+ type: i0.Input,
1523
+ args: [{
1524
+ isSignal: true,
1525
+ alias: "method",
1526
+ required: false
1527
+ }]
1528
+ }, {
1529
+ type: i0.Output,
1530
+ args: ["methodChange"]
1531
+ }],
1532
+ methods: [{
1533
+ type: i0.Input,
1534
+ args: [{
1535
+ isSignal: true,
1536
+ alias: "methods",
1537
+ required: false
1538
+ }]
1539
+ }],
1540
+ environment: [{
1541
+ type: i0.Input,
1542
+ args: [{
1543
+ isSignal: true,
1544
+ alias: "environment",
1545
+ required: false
1546
+ }]
1547
+ }],
1548
+ cardholderName: [{
1549
+ type: i0.Input,
1550
+ args: [{
1551
+ isSignal: true,
1552
+ alias: "cardholderName",
1553
+ required: false
1554
+ }]
1555
+ }],
1556
+ requireName: [{
1557
+ type: i0.Input,
1558
+ args: [{
1559
+ isSignal: true,
1560
+ alias: "requireName",
1561
+ required: false
1562
+ }]
1563
+ }],
1564
+ requirePostalCode: [{
1565
+ type: i0.Input,
1566
+ args: [{
1567
+ isSignal: true,
1568
+ alias: "requirePostalCode",
1569
+ required: false
1570
+ }]
1571
+ }],
1572
+ postalCountry: [{
1573
+ type: i0.Input,
1574
+ args: [{
1575
+ isSignal: true,
1576
+ alias: "postalCountry",
1577
+ required: false
1578
+ }]
1579
+ }],
1580
+ confirmAccountNumber: [{
1581
+ type: i0.Input,
1582
+ args: [{
1583
+ isSignal: true,
1584
+ alias: "confirmAccountNumber",
1585
+ required: false
1586
+ }]
1587
+ }],
1588
+ requireAchConsent: [{
1589
+ type: i0.Input,
1590
+ args: [{
1591
+ isSignal: true,
1592
+ alias: "requireAchConsent",
1593
+ required: false
1594
+ }]
1595
+ }],
1596
+ achConsentTextInput: [{
1597
+ type: i0.Input,
1598
+ args: [{
1599
+ isSignal: true,
1600
+ alias: "achConsentText",
1601
+ required: false
1602
+ }]
1603
+ }],
1604
+ showStatus: [{
1605
+ type: i0.Input,
1606
+ args: [{
1607
+ isSignal: true,
1608
+ alias: "showStatus",
1609
+ required: false
1610
+ }]
1611
+ }],
1612
+ payableRef: [{
1613
+ type: i0.Input,
1614
+ args: [{
1615
+ isSignal: true,
1616
+ alias: "payableRef",
1617
+ required: false
1618
+ }]
1619
+ }],
1620
+ attemptKey: [{
1621
+ type: i0.Input,
1622
+ args: [{
1623
+ isSignal: true,
1624
+ alias: "attemptKey",
1625
+ required: false
1626
+ }]
1627
+ }],
1628
+ checkStatus: [{
1629
+ type: i0.Input,
1630
+ args: [{
1631
+ isSignal: true,
1632
+ alias: "checkStatus",
1633
+ required: false
1634
+ }]
1635
+ }],
1636
+ paid: [{
1637
+ type: i0.Input,
1638
+ args: [{
1639
+ isSignal: true,
1640
+ alias: "paid",
1641
+ required: false
1642
+ }]
1643
+ }],
1644
+ hostPending: [{
1645
+ type: i0.Input,
1646
+ args: [{
1647
+ isSignal: true,
1648
+ alias: "hostPending",
1649
+ required: false
1650
+ }]
1651
+ }],
1652
+ statusPollMs: [{
1653
+ type: i0.Input,
1654
+ args: [{
1655
+ isSignal: true,
1656
+ alias: "statusPollMs",
1657
+ required: false
1658
+ }]
1659
+ }],
1660
+ statusPollMaxMs: [{
1661
+ type: i0.Input,
1662
+ args: [{
1663
+ isSignal: true,
1664
+ alias: "statusPollMaxMs",
1665
+ required: false
1666
+ }]
1667
+ }],
1668
+ statusCheckTimeoutMs: [{
1669
+ type: i0.Input,
1670
+ args: [{
1671
+ isSignal: true,
1672
+ alias: "statusCheckTimeoutMs",
1673
+ required: false
1674
+ }]
1675
+ }],
1676
+ statusFailGraceMs: [{
1677
+ type: i0.Input,
1678
+ args: [{
1679
+ isSignal: true,
1680
+ alias: "statusFailGraceMs",
1681
+ required: false
1682
+ }]
1683
+ }],
1684
+ allowStartOver: [{
1685
+ type: i0.Input,
1686
+ args: [{
1687
+ isSignal: true,
1688
+ alias: "allowStartOver",
1689
+ required: false
1690
+ }]
1691
+ }],
1692
+ offlineOverride: [{
1693
+ type: i0.Input,
1694
+ args: [{
1695
+ isSignal: true,
1696
+ alias: "offlineOverride",
1697
+ required: false
1698
+ }]
1699
+ }],
1700
+ hostSilenceMs: [{
1701
+ type: i0.Input,
1702
+ args: [{
1703
+ isSignal: true,
1704
+ alias: "hostSilenceMs",
1705
+ required: false
1706
+ }]
1707
+ }],
1708
+ readinessCheck: [{
1709
+ type: i0.Input,
1710
+ args: [{
1711
+ isSignal: true,
1712
+ alias: "readinessCheck",
1713
+ required: false
1714
+ }]
1715
+ }],
1716
+ readinessTimeoutMs: [{
1717
+ type: i0.Input,
1718
+ args: [{
1719
+ isSignal: true,
1720
+ alias: "readinessTimeoutMs",
1721
+ required: false
1722
+ }]
1723
+ }],
1724
+ readinessEveryMs: [{
1725
+ type: i0.Input,
1726
+ args: [{
1727
+ isSignal: true,
1728
+ alias: "readinessEveryMs",
1729
+ required: false
1730
+ }]
1731
+ }],
1732
+ submitLabel: [{
1733
+ type: i0.Input,
1734
+ args: [{
1735
+ isSignal: true,
1736
+ alias: "submitLabel",
1737
+ required: false
1738
+ }]
1739
+ }],
1740
+ showSubmit: [{
1741
+ type: i0.Input,
1742
+ args: [{
1743
+ isSignal: true,
1744
+ alias: "showSubmit",
1745
+ required: false
1746
+ }]
1747
+ }],
1748
+ disabled: [{
1749
+ type: i0.Input,
1750
+ args: [{
1751
+ isSignal: true,
1752
+ alias: "disabled",
1753
+ required: false
1754
+ }]
1755
+ }],
1756
+ pending: [{
1757
+ type: i0.Input,
1758
+ args: [{
1759
+ isSignal: true,
1760
+ alias: "pending",
1761
+ required: false
1762
+ }]
1763
+ }],
1764
+ labelInput: [{
1765
+ type: i0.Input,
1766
+ args: [{
1767
+ isSignal: true,
1768
+ alias: "label",
1769
+ required: false
1770
+ }]
1771
+ }],
1772
+ required: [{
1773
+ type: i0.Input,
1774
+ args: [{
1775
+ isSignal: true,
1776
+ alias: "required",
1777
+ required: false
1778
+ }]
1779
+ }],
1780
+ showErrors: [{
1781
+ type: i0.Input,
1782
+ args: [{
1783
+ isSignal: true,
1784
+ alias: "showErrors",
1785
+ required: false
1786
+ }]
1787
+ }],
1788
+ errorDisplay: [{
1789
+ type: i0.Input,
1790
+ args: [{
1791
+ isSignal: true,
1792
+ alias: "errorDisplay",
1793
+ required: false
1794
+ }]
1795
+ }],
1796
+ errorMessages: [{
1797
+ type: i0.Input,
1798
+ args: [{
1799
+ isSignal: true,
1800
+ alias: "errorMessages",
1801
+ required: false
1802
+ }]
1803
+ }],
1804
+ errorFallback: [{
1805
+ type: i0.Input,
1806
+ args: [{
1807
+ isSignal: true,
1808
+ alias: "errorFallback",
1809
+ required: false
1810
+ }]
1811
+ }],
1812
+ a11yMessages: [{
1813
+ type: i0.Input,
1814
+ args: [{
1815
+ isSignal: true,
1816
+ alias: "a11yMessages",
1817
+ required: false
1818
+ }]
1819
+ }],
1820
+ tokenized: [{
1821
+ type: i0.Output,
1822
+ args: ["tokenized"]
1823
+ }],
1824
+ failed: [{
1825
+ type: i0.Output,
1826
+ args: ["failed"]
1827
+ }],
1828
+ inFlightChange: [{
1829
+ type: i0.Output,
1830
+ args: ["inFlightChange"]
1831
+ }],
1832
+ outcome: [{
1833
+ type: i0.Output,
1834
+ args: ["outcome"]
1835
+ }],
1836
+ attemptKeyChange: [{
1837
+ type: i0.Output,
1838
+ args: ["attemptKeyChange"]
1839
+ }],
1840
+ readinessChange: [{
1841
+ type: i0.Output,
1842
+ args: ["readinessChange"]
1843
+ }]
1844
+ }
1845
+ });
1846
+ function isQboUrl(url) {
1847
+ if (!url) return false;
1848
+ try {
1849
+ const u = new URL(url);
1850
+ return u.protocol === "https:" && ["intuit.com", "quickbooks.com"].some((d) => u.hostname === d || u.hostname.endsWith(`.${d}`));
1851
+ } catch {
1852
+ return false;
1853
+ }
1854
+ }
1855
+ var QboConnectFlow = class {
1856
+ constructor(o) {
1857
+ this.o = o;
1858
+ this.tabOpened = false;
1859
+ }
1860
+ get blocked() {
1861
+ return this.o.state.loading() || !!this.o.disabled?.();
1862
+ }
1863
+ startConnect() {
1864
+ const start = this.o.start();
1865
+ if (!start || this.blocked) return;
1866
+ this.o.state.loading.set(true);
1867
+ const tab = this.openBlankTab();
1868
+ start().pipe(takeUntilDestroyed(this.o.destroyRef)).subscribe({
1869
+ next: (result) => {
1870
+ this.o.state.loading.set(false);
1871
+ this.openQbo(tab, result?.authUrl ?? result?.url);
1872
+ },
1873
+ error: (error) => {
1874
+ this.closeTab(tab);
1875
+ this.o.state.loading.set(false);
1876
+ this.o.emit({
1877
+ kind: "failed",
1878
+ action: "start",
1879
+ error
1880
+ });
1881
+ }
1882
+ });
1883
+ }
1884
+ check() {
1885
+ const status = this.o.getStatus();
1886
+ if (!status || this.blocked) return;
1887
+ this.o.state.loading.set(true);
1888
+ status().pipe(takeUntilDestroyed(this.o.destroyRef)).subscribe({
1889
+ next: (s) => {
1890
+ this.o.state.status.set(s);
1891
+ this.o.state.loading.set(false);
1892
+ if (s.connected && s.needsReconnect) this.o.emit({
1893
+ kind: "needs-reconnect",
1894
+ source: "check"
1895
+ });
1896
+ else if (s.connected) this.o.emit({
1897
+ kind: "connected",
1898
+ source: "check"
1899
+ });
1900
+ else this.o.emit({ kind: "not-connected" });
1901
+ },
1902
+ error: (error) => {
1903
+ this.o.state.loading.set(false);
1904
+ this.o.emit({
1905
+ kind: "failed",
1906
+ action: "check",
1907
+ error
1908
+ });
1909
+ }
1910
+ });
1911
+ }
1912
+ disconnect() {
1913
+ const disconnect = this.o.disconnect();
1914
+ if (!disconnect || this.blocked) return;
1915
+ this.o.state.loading.set(true);
1916
+ disconnect().pipe(takeUntilDestroyed(this.o.destroyRef)).subscribe({
1917
+ next: () => {
1918
+ this.o.state.status.set({ connected: false });
1919
+ this.o.state.loading.set(false);
1920
+ this.o.emit({ kind: "disconnected" });
1921
+ },
1922
+ error: (error) => {
1923
+ this.o.state.loading.set(false);
1924
+ this.o.emit({
1925
+ kind: "failed",
1926
+ action: "disconnect",
1927
+ error
1928
+ });
1929
+ }
1930
+ });
1931
+ }
1932
+ readStatusOnReturn() {
1933
+ const status = this.o.getStatus();
1934
+ if (!status) return;
1935
+ status().pipe(takeUntilDestroyed(this.o.destroyRef)).subscribe({
1936
+ next: (s) => {
1937
+ this.o.state.status.set(s);
1938
+ if (s.connected && s.needsReconnect) this.o.emit({
1939
+ kind: "needs-reconnect",
1940
+ source: "return"
1941
+ });
1942
+ else if (s.connected) this.o.emit({
1943
+ kind: "connected",
1944
+ source: "return"
1945
+ });
1946
+ },
1947
+ error: () => {}
1948
+ });
1949
+ }
1950
+ openQbo(tab, url) {
1951
+ if (isQboUrl(url) && tab && !tab.closed) {
1952
+ tab.location.href = url;
1953
+ this.tabOpened = true;
1954
+ this.o.onOpened?.();
1955
+ } else if (isQboUrl(url)) this.navigateCurrentTab(url);
1956
+ else {
1957
+ this.closeTab(tab);
1958
+ this.o.emit({ kind: "link-unavailable" });
1959
+ }
1960
+ }
1961
+ openBlankTab() {
1962
+ const tab = window.open("about:blank", "_blank");
1963
+ if (tab) try {
1964
+ tab.opener = null;
1965
+ } catch {}
1966
+ return tab;
1967
+ }
1968
+ navigateCurrentTab(url) {
1969
+ if (this.o.navigate) this.o.navigate(url);
1970
+ else window.location.href = url;
1971
+ }
1972
+ closeTab(tab) {
1973
+ try {
1974
+ tab?.close();
1975
+ } catch {}
1976
+ }
1977
+ };
1978
+ function qboConnectNotice(outcome) {
1979
+ switch (outcome.kind) {
1980
+ case "connected": return {
1981
+ variant: "success",
1982
+ message: uiText("qboConnect.noticeConnected")
1983
+ };
1984
+ case "needs-reconnect": return {
1985
+ variant: "error",
1986
+ message: uiText("qboConnect.noticeReconnect")
1987
+ };
1988
+ case "not-connected": return {
1989
+ variant: "info",
1990
+ message: uiText("qboConnect.noticeNotConnected")
1991
+ };
1992
+ case "disconnected": return {
1993
+ variant: "success",
1994
+ message: uiText("qboConnect.noticeDisconnected")
1995
+ };
1996
+ case "link-unavailable": return {
1997
+ variant: "error",
1998
+ message: uiText("qboConnect.noticeLinkUnavailable")
1999
+ };
2000
+ case "failed": return {
2001
+ variant: "error",
2002
+ message: uiText(outcome.action === "start" ? "qboConnect.failedStart" : outcome.action === "check" ? "qboConnect.failedCheck" : "qboConnect.failedDisconnect")
2003
+ };
2004
+ }
2005
+ }
2006
+ let nextConnectId = 0;
2007
+ var QboConnectComponent = class QboConnectComponent {
2008
+ constructor() {
2009
+ this.confirmMessageId = `qbc-disconnect-msg-${nextConnectId++}`;
2010
+ this.labels = inject(UiLabelsService);
2011
+ this.destroyRef = inject(DestroyRef);
2012
+ this.injector = inject(Injector);
2013
+ this.host = inject(ElementRef);
2014
+ this.startConnect = input(null, ...ngDevMode ? [{ debugName: "startConnect" }] : /* istanbul ignore next */ []);
2015
+ this.getStatus = input(null, ...ngDevMode ? [{ debugName: "getStatus" }] : /* istanbul ignore next */ []);
2016
+ this.disconnect = input(null, ...ngDevMode ? [{ debugName: "disconnect" }] : /* istanbul ignore next */ []);
2017
+ this.status = model(null, ...ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []);
2018
+ this.titleInput = input(null, {
2019
+ ...ngDevMode ? { debugName: "titleInput" } : /* istanbul ignore next */ {},
2020
+ alias: "title"
2021
+ });
2022
+ this.title = computed(() => this.titleInput() ?? this.labels.t("qboConnect.title"), ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
2023
+ this.bare = input(false, ...ngDevMode ? [{ debugName: "bare" }] : /* istanbul ignore next */ []);
2024
+ this.startTitleInput = input(null, {
2025
+ ...ngDevMode ? { debugName: "startTitleInput" } : /* istanbul ignore next */ {},
2026
+ alias: "startTitle"
2027
+ });
2028
+ this.startTitle = computed(() => this.startTitleInput() ?? this.labels.t("qboConnect.startTitle"), ...ngDevMode ? [{ debugName: "startTitle" }] : /* istanbul ignore next */ []);
2029
+ this.startTextInput = input(null, {
2030
+ ...ngDevMode ? { debugName: "startTextInput" } : /* istanbul ignore next */ {},
2031
+ alias: "startText"
2032
+ });
2033
+ this.startText = computed(() => this.startTextInput() ?? this.labels.t("qboConnect.startText"), ...ngDevMode ? [{ debugName: "startText" }] : /* istanbul ignore next */ []);
2034
+ this.startLabelInput = input(null, {
2035
+ ...ngDevMode ? { debugName: "startLabelInput" } : /* istanbul ignore next */ {},
2036
+ alias: "startLabel"
2037
+ });
2038
+ this.startLabel = computed(() => this.startLabelInput() ?? this.labels.t("qboConnect.startLabel"), ...ngDevMode ? [{ debugName: "startLabel" }] : /* istanbul ignore next */ []);
2039
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
2040
+ this.confirmDisconnect = input(true, ...ngDevMode ? [{ debugName: "confirmDisconnect" }] : /* istanbul ignore next */ []);
2041
+ this.refreshOnReturn = input(false, ...ngDevMode ? [{ debugName: "refreshOnReturn" }] : /* istanbul ignore next */ []);
2042
+ this.navigateTab = input(null, ...ngDevMode ? [{ debugName: "navigateTab" }] : /* istanbul ignore next */ []);
2043
+ this.outcome = output();
2044
+ this.loading = model(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
2045
+ this.awaiting = signal(false, ...ngDevMode ? [{ debugName: "awaiting" }] : /* istanbul ignore next */ []);
2046
+ this.confirming = signal(false, ...ngDevMode ? [{ debugName: "confirming" }] : /* istanbul ignore next */ []);
2047
+ this.state = computed(() => {
2048
+ const s = this.status();
2049
+ return !s?.connected ? "none" : s.needsReconnect ? "reconnect" : "connected";
2050
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
2051
+ this.company = computed(() => this.status()?.companyName || this.status()?.realmId || "", ...ngDevMode ? [{ debugName: "company" }] : /* istanbul ignore next */ []);
2052
+ this.connectedOn = computed(() => this.labels.formatDate(this.status()?.connectedAt ?? null, "mediumDate"), ...ngDevMode ? [{ debugName: "connectedOn" }] : /* istanbul ignore next */ []);
2053
+ this.liveText = computed(() => {
2054
+ const text = this.labels.t({
2055
+ none: "qboConnect.live.none",
2056
+ connected: "qboConnect.live.connected",
2057
+ reconnect: "qboConnect.live.reconnect"
2058
+ }[this.state()]);
2059
+ return this.loading() ? this.labels.t("qboConnect.live.loading", { text }) : text;
2060
+ }, ...ngDevMode ? [{ debugName: "liveText" }] : /* istanbul ignore next */ []);
2061
+ this.acted = false;
2062
+ this.lastState = this.state();
2063
+ this.flow = new QboConnectFlow({
2064
+ start: () => this.startConnect(),
2065
+ getStatus: () => this.getStatus(),
2066
+ disconnect: () => this.disconnect(),
2067
+ state: {
2068
+ status: this.status,
2069
+ loading: this.loading
2070
+ },
2071
+ emit: (outcome) => this.outcome.emit(outcome),
2072
+ disabled: () => this.disabled(),
2073
+ navigate: (url) => this.navigateCurrentTab(url),
2074
+ onOpened: () => this.awaiting.set(true),
2075
+ destroyRef: this.destroyRef
2076
+ });
2077
+ effect(() => {
2078
+ const state = this.state();
2079
+ if (this.loading()) return;
2080
+ const changed = state !== this.lastState;
2081
+ this.lastState = state;
2082
+ const focusIt = changed && this.acted;
2083
+ this.acted = false;
2084
+ if (state === "connected") this.awaiting.set(false);
2085
+ if (focusIt) afterNextRender(() => this.host.nativeElement.querySelector(".qbc-state")?.focus(), { injector: this.injector });
2086
+ });
2087
+ if (typeof document !== "undefined") {
2088
+ const onVisible = () => {
2089
+ if (document.visibilityState !== "visible" || !this.flow.tabOpened || !this.refreshOnReturn() || this.loading()) return;
2090
+ this.flow.tabOpened = false;
2091
+ this.flow.readStatusOnReturn();
2092
+ };
2093
+ document.addEventListener("visibilitychange", onVisible);
2094
+ this.destroyRef.onDestroy(() => document.removeEventListener("visibilitychange", onVisible));
2095
+ }
2096
+ }
2097
+ start() {
2098
+ const run = this.canRun(this.startConnect());
2099
+ this.flow.startConnect();
2100
+ this.acted ||= run;
2101
+ }
2102
+ check() {
2103
+ const run = this.canRun(this.getStatus());
2104
+ this.flow.check();
2105
+ this.acted ||= run;
2106
+ }
2107
+ askDisconnect() {
2108
+ if (this.disabled() || this.loading() || !this.disconnect()) return;
2109
+ if (this.confirmDisconnect()) this.confirming.set(true);
2110
+ else this.doDisconnect();
2111
+ }
2112
+ cancelDisconnect() {
2113
+ if (!this.loading()) this.confirming.set(false);
2114
+ }
2115
+ doDisconnect() {
2116
+ const run = this.canRun(this.disconnect());
2117
+ this.flow.disconnect();
2118
+ this.acted ||= run;
2119
+ this.confirming.set(false);
2120
+ }
2121
+ canRun(call) {
2122
+ return !!call && !this.loading() && !this.disabled();
2123
+ }
2124
+ navigateCurrentTab(url) {
2125
+ const navigate = this.navigateTab();
2126
+ if (navigate) navigate(url);
2127
+ else window.location.href = url;
2128
+ }
2129
+ static {
2130
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2131
+ minVersion: "12.0.0",
2132
+ version: "22.2.2",
2133
+ ngImport: i0,
2134
+ type: QboConnectComponent,
2135
+ deps: [],
2136
+ target: i0.ɵɵFactoryTarget.Component
2137
+ });
2138
+ }
2139
+ static {
2140
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
2141
+ minVersion: "17.0.0",
2142
+ version: "22.2.2",
2143
+ type: QboConnectComponent,
2144
+ isStandalone: true,
2145
+ selector: "ui-qbo-connect",
2146
+ inputs: {
2147
+ startConnect: {
2148
+ classPropertyName: "startConnect",
2149
+ publicName: "startConnect",
2150
+ isSignal: true,
2151
+ isRequired: false,
2152
+ transformFunction: null
2153
+ },
2154
+ getStatus: {
2155
+ classPropertyName: "getStatus",
2156
+ publicName: "getStatus",
2157
+ isSignal: true,
2158
+ isRequired: false,
2159
+ transformFunction: null
2160
+ },
2161
+ disconnect: {
2162
+ classPropertyName: "disconnect",
2163
+ publicName: "disconnect",
2164
+ isSignal: true,
2165
+ isRequired: false,
2166
+ transformFunction: null
2167
+ },
2168
+ status: {
2169
+ classPropertyName: "status",
2170
+ publicName: "status",
2171
+ isSignal: true,
2172
+ isRequired: false,
2173
+ transformFunction: null
2174
+ },
2175
+ titleInput: {
2176
+ classPropertyName: "titleInput",
2177
+ publicName: "title",
2178
+ isSignal: true,
2179
+ isRequired: false,
2180
+ transformFunction: null
2181
+ },
2182
+ bare: {
2183
+ classPropertyName: "bare",
2184
+ publicName: "bare",
2185
+ isSignal: true,
2186
+ isRequired: false,
2187
+ transformFunction: null
2188
+ },
2189
+ startTitleInput: {
2190
+ classPropertyName: "startTitleInput",
2191
+ publicName: "startTitle",
2192
+ isSignal: true,
2193
+ isRequired: false,
2194
+ transformFunction: null
2195
+ },
2196
+ startTextInput: {
2197
+ classPropertyName: "startTextInput",
2198
+ publicName: "startText",
2199
+ isSignal: true,
2200
+ isRequired: false,
2201
+ transformFunction: null
2202
+ },
2203
+ startLabelInput: {
2204
+ classPropertyName: "startLabelInput",
2205
+ publicName: "startLabel",
2206
+ isSignal: true,
2207
+ isRequired: false,
2208
+ transformFunction: null
2209
+ },
2210
+ disabled: {
2211
+ classPropertyName: "disabled",
2212
+ publicName: "disabled",
2213
+ isSignal: true,
2214
+ isRequired: false,
2215
+ transformFunction: null
2216
+ },
2217
+ confirmDisconnect: {
2218
+ classPropertyName: "confirmDisconnect",
2219
+ publicName: "confirmDisconnect",
2220
+ isSignal: true,
2221
+ isRequired: false,
2222
+ transformFunction: null
2223
+ },
2224
+ refreshOnReturn: {
2225
+ classPropertyName: "refreshOnReturn",
2226
+ publicName: "refreshOnReturn",
2227
+ isSignal: true,
2228
+ isRequired: false,
2229
+ transformFunction: null
2230
+ },
2231
+ navigateTab: {
2232
+ classPropertyName: "navigateTab",
2233
+ publicName: "navigateTab",
2234
+ isSignal: true,
2235
+ isRequired: false,
2236
+ transformFunction: null
2237
+ },
2238
+ loading: {
2239
+ classPropertyName: "loading",
2240
+ publicName: "loading",
2241
+ isSignal: true,
2242
+ isRequired: false,
2243
+ transformFunction: null
2244
+ }
2245
+ },
2246
+ outputs: {
2247
+ status: "statusChange",
2248
+ outcome: "outcome",
2249
+ loading: "loadingChange"
2250
+ },
2251
+ ngImport: i0,
2252
+ template: `
2253
+ <!-- Persistent live region: present before the state changes, so every new state is announced (and "Loading" while a request runs). -->
2254
+ <ui-live-region data-testid="qbo-connect-live" [message]="liveText()" />
2255
+ @if (bare()) {
2256
+ <ng-container *ngTemplateOutlet="body" />
2257
+ } @else {
2258
+ <ui-detail-card [collapsible]="false" [title]="title()" [headingLevel]="3" data-testid="qbo-connect-card">
2259
+ <ng-container *ngTemplateOutlet="body" />
2260
+ </ui-detail-card>
2261
+ }
2262
+
2263
+ <ng-template #body>
2264
+ @if (state() === 'none') {
2265
+ <ui-stack gap="sm" class="qbc-state" tabindex="-1" data-testid="qbo-connect-status-none" [attr.aria-busy]="loading() ? 'true' : null">
2266
+ <ui-text size="lg" weight="semibold" [text]="startTitle()" />
2267
+ <ui-text size="sm" [text]="startText()" />
2268
+ <ui-stack direction="horizontal">
2269
+ <ui-button variant="primary" size="sm" data-testid="qbo-connect-start-button" [disabled]="disabled()" (click)="start()">@if (loading()) {<span aria-hidden="true">{{ labels.t('common.loadingellipsis') }}</span><span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabBusy', { label: startLabel() }) }}</span>} @else { {{ startLabel() }}<span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabSr') }}</span>}</ui-button>
2270
+ @if (awaiting()) {
2271
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-check-status-button" [disabled]="disabled() || loading()" (click)="check()">{{ labels.t(loading() ? 'qboConnect.checking' : 'qboConnect.checkStatus') }}</ui-button>
2272
+ }
2273
+ </ui-stack>
2274
+ </ui-stack>
2275
+ } @else if (state() === 'reconnect') {
2276
+ <ui-stack gap="sm" class="qbc-state" tabindex="-1" data-testid="qbo-connect-status-reconnect" [attr.aria-busy]="loading() ? 'true' : null">
2277
+ <span class="qbc-badge"><ui-badge [label]="labels.t('qboConnect.needsReconnect')" variant="red" data-testid="qbo-connect-reconnect-badge" /></span>
2278
+ <ui-text size="sm" [text]="labels.t('qboConnect.reconnectText')" />
2279
+ <ui-stack direction="horizontal">
2280
+ <ui-button variant="primary" size="sm" data-testid="qbo-connect-reconnect-button" [disabled]="disabled()" (click)="start()">@if (loading()) {<span aria-hidden="true">{{ labels.t('common.loadingellipsis') }}</span><span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabBusy', { label: labels.t('qboConnect.reconnect') }) }}</span>} @else { {{ labels.t('qboConnect.reconnect') }}<span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabSr') }}</span>}</ui-button>
2281
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-disconnect-button" [disabled]="disabled() || loading()" (click)="askDisconnect()">{{ labels.t('qboConnect.disconnect') }}</ui-button>
2282
+ </ui-stack>
2283
+ </ui-stack>
2284
+ } @else {
2285
+ <ui-stack gap="sm" class="qbc-state" tabindex="-1" data-testid="qbo-connect-status-connected" [attr.aria-busy]="loading() ? 'true' : null">
2286
+ <ui-text size="lg" weight="semibold" [text]="labels.t('qboConnect.connected')" />
2287
+ @if (company(); as company) { <ui-text size="sm" tone="muted" data-testid="qbo-connect-company" [text]="labels.t('qboConnect.companyLine', { company })" /> }
2288
+ @if (connectedOn(); as date) { <ui-text size="sm" tone="muted" data-testid="qbo-connect-date" [text]="labels.t('qboConnect.connectedOn', { date })" /> }
2289
+ <ui-stack direction="horizontal">
2290
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-check-status-button" [disabled]="disabled() || loading()" (click)="check()">{{ labels.t(loading() ? 'qboConnect.checking' : 'qboConnect.checkStatus') }}</ui-button>
2291
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-disconnect-button" [disabled]="disabled() || loading()" (click)="askDisconnect()">{{ labels.t('qboConnect.disconnect') }}</ui-button>
2292
+ </ui-stack>
2293
+ </ui-stack>
2294
+ }
2295
+ </ng-template>
2296
+
2297
+ <ui-modal [open]="confirming()" [title]="labels.t('qboConnect.disconnectTitle')" maxWidth="440px" [describedBy]="confirmMessageId" [busy]="loading()" dialogTestId="qbo-connect-confirm" (close)="cancelDisconnect()">
2298
+ <p [id]="confirmMessageId" class="qbc-confirm" data-testid="qbo-connect-confirm-message">{{ labels.t('qboConnect.disconnectMessage') }}</p>
2299
+ <ui-button modal-footer-left variant="secondary" size="sm" data-testid="qbo-connect-confirm-cancel" [disabled]="loading()" (click)="cancelDisconnect()">{{ labels.t('common.cancel') }}</ui-button>
2300
+ <ui-button modal-footer-right variant="danger" size="sm" data-testid="qbo-connect-confirm-accept" [loading]="loading()" (click)="doDisconnect()">{{ labels.t('qboConnect.disconnect') }}</ui-button>
2301
+ </ui-modal>
2302
+ `,
2303
+ isInline: true,
2304
+ styles: ["ui-qbo-connect{display:block;min-width:0}ui-qbo-connect .qbc-badge{display:flex}ui-qbo-connect .qbc-confirm{margin:0;font-size:.9375rem;line-height:1.5}ui-qbo-connect .qbc-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"],
2305
+ dependencies: [
2306
+ {
2307
+ kind: "directive",
2308
+ type: NgTemplateOutlet,
2309
+ selector: "[ngTemplateOutlet]",
2310
+ inputs: [
2311
+ "ngTemplateOutletContext",
2312
+ "ngTemplateOutlet",
2313
+ "ngTemplateOutletInjector"
2314
+ ]
2315
+ },
2316
+ {
2317
+ kind: "component",
2318
+ type: BadgeComponent,
2319
+ selector: "ui-badge",
2320
+ inputs: [
2321
+ "label",
2322
+ "variant",
2323
+ "color"
2324
+ ]
2325
+ },
2326
+ {
2327
+ kind: "component",
2328
+ type: ButtonComponent,
2329
+ selector: "ui-button",
2330
+ inputs: [
2331
+ "variant",
2332
+ "routerLink",
2333
+ "queryParams",
2334
+ "fragment",
2335
+ "state",
2336
+ "href",
2337
+ "target",
2338
+ "rel",
2339
+ "shortLabel",
2340
+ "shortBelow",
2341
+ "color",
2342
+ "active",
2343
+ "size",
2344
+ "type",
2345
+ "disabled",
2346
+ "loading",
2347
+ "fullWidth",
2348
+ "ariaLabel",
2349
+ "ariaExpanded",
2350
+ "ariaPressed",
2351
+ "ariaDescribedBy",
2352
+ "modal-footer-left",
2353
+ "modal-footer-right"
2354
+ ]
2355
+ },
2356
+ {
2357
+ kind: "component",
2358
+ type: DetailCardComponent,
2359
+ selector: "ui-detail-card",
2360
+ inputs: [
2361
+ "title",
2362
+ "uppercaseTitle",
2363
+ "headingLevel",
2364
+ "titleId",
2365
+ "ariaLabel",
2366
+ "subtitle",
2367
+ "background",
2368
+ "headerBackground",
2369
+ "footerBackground",
2370
+ "footerAlign",
2371
+ "textColor",
2372
+ "showHeader",
2373
+ "collapsible",
2374
+ "expanded",
2375
+ "showEdit",
2376
+ "editLabel",
2377
+ "editTestId",
2378
+ "editIcon",
2379
+ "editAriaLabel",
2380
+ "fill",
2381
+ "noPadding",
2382
+ "maxBodyHeight",
2383
+ "selectable",
2384
+ "selected",
2385
+ "selectedColor",
2386
+ "selectedBackground"
2387
+ ],
2388
+ outputs: [
2389
+ "expandedChange",
2390
+ "editClick",
2391
+ "selectedChange"
2392
+ ]
2393
+ },
2394
+ {
2395
+ kind: "component",
2396
+ type: ModalComponent,
2397
+ selector: "ui-modal",
2398
+ inputs: [
2399
+ "open",
2400
+ "title",
2401
+ "description",
2402
+ "describedBy",
2403
+ "maxWidth",
2404
+ "bodyOverflow",
2405
+ "dialogTestId",
2406
+ "hideClose",
2407
+ "closable",
2408
+ "layout",
2409
+ "closeOnBackdrop",
2410
+ "closeOnEscape",
2411
+ "busy",
2412
+ "returnFocusTo"
2413
+ ],
2414
+ outputs: ["close"]
2415
+ },
2416
+ {
2417
+ kind: "component",
2418
+ type: LiveRegionComponent,
2419
+ selector: "ui-live-region",
2420
+ inputs: [
2421
+ "message",
2422
+ "politeness",
2423
+ "atomic",
2424
+ "visible"
2425
+ ]
2426
+ },
2427
+ {
2428
+ kind: "component",
2429
+ type: StackComponent,
2430
+ selector: "ui-stack",
2431
+ inputs: [
2432
+ "gap",
2433
+ "direction",
2434
+ "align",
2435
+ "justify",
2436
+ "wrap",
2437
+ "minHeight",
2438
+ "width",
2439
+ "maxWidth",
2440
+ "padding",
2441
+ "centered"
2442
+ ]
2443
+ },
2444
+ {
2445
+ kind: "component",
2446
+ type: TextComponent,
2447
+ selector: "ui-text",
2448
+ inputs: [
2449
+ "text",
2450
+ "size",
2451
+ "tone",
2452
+ "color",
2453
+ "strong",
2454
+ "weight"
2455
+ ]
2456
+ }
2457
+ ],
2458
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2459
+ encapsulation: i0.ViewEncapsulation.None
2460
+ });
2461
+ }
2462
+ };
2463
+ i0.ɵɵngDeclareClassMetadata({
2464
+ minVersion: "12.0.0",
2465
+ version: "22.2.2",
2466
+ ngImport: i0,
2467
+ type: QboConnectComponent,
2468
+ decorators: [{
2469
+ type: Component,
2470
+ args: [{
2471
+ selector: "ui-qbo-connect",
2472
+ standalone: true,
2473
+ changeDetection: ChangeDetectionStrategy.OnPush,
2474
+ imports: [
2475
+ NgTemplateOutlet,
2476
+ BadgeComponent,
2477
+ ButtonComponent,
2478
+ DetailCardComponent,
2479
+ ModalComponent,
2480
+ LiveRegionComponent,
2481
+ StackComponent,
2482
+ TextComponent
2483
+ ],
2484
+ template: `
2485
+ <!-- Persistent live region: present before the state changes, so every new state is announced (and "Loading" while a request runs). -->
2486
+ <ui-live-region data-testid="qbo-connect-live" [message]="liveText()" />
2487
+ @if (bare()) {
2488
+ <ng-container *ngTemplateOutlet="body" />
2489
+ } @else {
2490
+ <ui-detail-card [collapsible]="false" [title]="title()" [headingLevel]="3" data-testid="qbo-connect-card">
2491
+ <ng-container *ngTemplateOutlet="body" />
2492
+ </ui-detail-card>
2493
+ }
2494
+
2495
+ <ng-template #body>
2496
+ @if (state() === 'none') {
2497
+ <ui-stack gap="sm" class="qbc-state" tabindex="-1" data-testid="qbo-connect-status-none" [attr.aria-busy]="loading() ? 'true' : null">
2498
+ <ui-text size="lg" weight="semibold" [text]="startTitle()" />
2499
+ <ui-text size="sm" [text]="startText()" />
2500
+ <ui-stack direction="horizontal">
2501
+ <ui-button variant="primary" size="sm" data-testid="qbo-connect-start-button" [disabled]="disabled()" (click)="start()">@if (loading()) {<span aria-hidden="true">{{ labels.t('common.loadingellipsis') }}</span><span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabBusy', { label: startLabel() }) }}</span>} @else { {{ startLabel() }}<span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabSr') }}</span>}</ui-button>
2502
+ @if (awaiting()) {
2503
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-check-status-button" [disabled]="disabled() || loading()" (click)="check()">{{ labels.t(loading() ? 'qboConnect.checking' : 'qboConnect.checkStatus') }}</ui-button>
2504
+ }
2505
+ </ui-stack>
2506
+ </ui-stack>
2507
+ } @else if (state() === 'reconnect') {
2508
+ <ui-stack gap="sm" class="qbc-state" tabindex="-1" data-testid="qbo-connect-status-reconnect" [attr.aria-busy]="loading() ? 'true' : null">
2509
+ <span class="qbc-badge"><ui-badge [label]="labels.t('qboConnect.needsReconnect')" variant="red" data-testid="qbo-connect-reconnect-badge" /></span>
2510
+ <ui-text size="sm" [text]="labels.t('qboConnect.reconnectText')" />
2511
+ <ui-stack direction="horizontal">
2512
+ <ui-button variant="primary" size="sm" data-testid="qbo-connect-reconnect-button" [disabled]="disabled()" (click)="start()">@if (loading()) {<span aria-hidden="true">{{ labels.t('common.loadingellipsis') }}</span><span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabBusy', { label: labels.t('qboConnect.reconnect') }) }}</span>} @else { {{ labels.t('qboConnect.reconnect') }}<span class="qbc-sr">{{ labels.t('qboConnect.opensInNewTabSr') }}</span>}</ui-button>
2513
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-disconnect-button" [disabled]="disabled() || loading()" (click)="askDisconnect()">{{ labels.t('qboConnect.disconnect') }}</ui-button>
2514
+ </ui-stack>
2515
+ </ui-stack>
2516
+ } @else {
2517
+ <ui-stack gap="sm" class="qbc-state" tabindex="-1" data-testid="qbo-connect-status-connected" [attr.aria-busy]="loading() ? 'true' : null">
2518
+ <ui-text size="lg" weight="semibold" [text]="labels.t('qboConnect.connected')" />
2519
+ @if (company(); as company) { <ui-text size="sm" tone="muted" data-testid="qbo-connect-company" [text]="labels.t('qboConnect.companyLine', { company })" /> }
2520
+ @if (connectedOn(); as date) { <ui-text size="sm" tone="muted" data-testid="qbo-connect-date" [text]="labels.t('qboConnect.connectedOn', { date })" /> }
2521
+ <ui-stack direction="horizontal">
2522
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-check-status-button" [disabled]="disabled() || loading()" (click)="check()">{{ labels.t(loading() ? 'qboConnect.checking' : 'qboConnect.checkStatus') }}</ui-button>
2523
+ <ui-button variant="secondary" size="sm" data-testid="qbo-connect-disconnect-button" [disabled]="disabled() || loading()" (click)="askDisconnect()">{{ labels.t('qboConnect.disconnect') }}</ui-button>
2524
+ </ui-stack>
2525
+ </ui-stack>
2526
+ }
2527
+ </ng-template>
2528
+
2529
+ <ui-modal [open]="confirming()" [title]="labels.t('qboConnect.disconnectTitle')" maxWidth="440px" [describedBy]="confirmMessageId" [busy]="loading()" dialogTestId="qbo-connect-confirm" (close)="cancelDisconnect()">
2530
+ <p [id]="confirmMessageId" class="qbc-confirm" data-testid="qbo-connect-confirm-message">{{ labels.t('qboConnect.disconnectMessage') }}</p>
2531
+ <ui-button modal-footer-left variant="secondary" size="sm" data-testid="qbo-connect-confirm-cancel" [disabled]="loading()" (click)="cancelDisconnect()">{{ labels.t('common.cancel') }}</ui-button>
2532
+ <ui-button modal-footer-right variant="danger" size="sm" data-testid="qbo-connect-confirm-accept" [loading]="loading()" (click)="doDisconnect()">{{ labels.t('qboConnect.disconnect') }}</ui-button>
2533
+ </ui-modal>
2534
+ `,
2535
+ encapsulation: ViewEncapsulation.None,
2536
+ styles: ["ui-qbo-connect{display:block;min-width:0}ui-qbo-connect .qbc-badge{display:flex}ui-qbo-connect .qbc-confirm{margin:0;font-size:.9375rem;line-height:1.5}ui-qbo-connect .qbc-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"]
2537
+ }]
2538
+ }],
2539
+ ctorParameters: () => [],
2540
+ propDecorators: {
2541
+ startConnect: [{
2542
+ type: i0.Input,
2543
+ args: [{
2544
+ isSignal: true,
2545
+ alias: "startConnect",
2546
+ required: false
2547
+ }]
2548
+ }],
2549
+ getStatus: [{
2550
+ type: i0.Input,
2551
+ args: [{
2552
+ isSignal: true,
2553
+ alias: "getStatus",
2554
+ required: false
2555
+ }]
2556
+ }],
2557
+ disconnect: [{
2558
+ type: i0.Input,
2559
+ args: [{
2560
+ isSignal: true,
2561
+ alias: "disconnect",
2562
+ required: false
2563
+ }]
2564
+ }],
2565
+ status: [{
2566
+ type: i0.Input,
2567
+ args: [{
2568
+ isSignal: true,
2569
+ alias: "status",
2570
+ required: false
2571
+ }]
2572
+ }, {
2573
+ type: i0.Output,
2574
+ args: ["statusChange"]
2575
+ }],
2576
+ titleInput: [{
2577
+ type: i0.Input,
2578
+ args: [{
2579
+ isSignal: true,
2580
+ alias: "title",
2581
+ required: false
2582
+ }]
2583
+ }],
2584
+ bare: [{
2585
+ type: i0.Input,
2586
+ args: [{
2587
+ isSignal: true,
2588
+ alias: "bare",
2589
+ required: false
2590
+ }]
2591
+ }],
2592
+ startTitleInput: [{
2593
+ type: i0.Input,
2594
+ args: [{
2595
+ isSignal: true,
2596
+ alias: "startTitle",
2597
+ required: false
2598
+ }]
2599
+ }],
2600
+ startTextInput: [{
2601
+ type: i0.Input,
2602
+ args: [{
2603
+ isSignal: true,
2604
+ alias: "startText",
2605
+ required: false
2606
+ }]
2607
+ }],
2608
+ startLabelInput: [{
2609
+ type: i0.Input,
2610
+ args: [{
2611
+ isSignal: true,
2612
+ alias: "startLabel",
2613
+ required: false
2614
+ }]
2615
+ }],
2616
+ disabled: [{
2617
+ type: i0.Input,
2618
+ args: [{
2619
+ isSignal: true,
2620
+ alias: "disabled",
2621
+ required: false
2622
+ }]
2623
+ }],
2624
+ confirmDisconnect: [{
2625
+ type: i0.Input,
2626
+ args: [{
2627
+ isSignal: true,
2628
+ alias: "confirmDisconnect",
2629
+ required: false
2630
+ }]
2631
+ }],
2632
+ refreshOnReturn: [{
2633
+ type: i0.Input,
2634
+ args: [{
2635
+ isSignal: true,
2636
+ alias: "refreshOnReturn",
2637
+ required: false
2638
+ }]
2639
+ }],
2640
+ navigateTab: [{
2641
+ type: i0.Input,
2642
+ args: [{
2643
+ isSignal: true,
2644
+ alias: "navigateTab",
2645
+ required: false
2646
+ }]
2647
+ }],
2648
+ outcome: [{
2649
+ type: i0.Output,
2650
+ args: ["outcome"]
2651
+ }],
2652
+ loading: [{
2653
+ type: i0.Input,
2654
+ args: [{
2655
+ isSignal: true,
2656
+ alias: "loading",
2657
+ required: false
2658
+ }]
2659
+ }, {
2660
+ type: i0.Output,
2661
+ args: ["loadingChange"]
2662
+ }]
2663
+ }
2664
+ });
2665
+ const PAID = /* @__PURE__ */ new Set([
2666
+ "CAPTURED",
2667
+ "SUCCEEDED",
2668
+ "COMPLETED",
2669
+ "PAID",
2670
+ "SETTLED"
2671
+ ]);
2672
+ const FAILED = /* @__PURE__ */ new Set([
2673
+ "DECLINED",
2674
+ "FAILED",
2675
+ "CANCELLED",
2676
+ "CANCELED",
2677
+ "VOIDED",
2678
+ "REJECTED",
2679
+ "ERROR"
2680
+ ]);
2681
+ function qboOutcomeOf(status, method = "card") {
2682
+ const value = (status ?? "").trim().toUpperCase();
2683
+ if (!value) return method === "ach" ? "processing" : "paid";
2684
+ if (PAID.has(value)) return "paid";
2685
+ if (FAILED.has(value)) return "failed";
2686
+ return "processing";
2687
+ }
2688
+ const QBO_PAYMENT_METHOD_VALUES = ["CARD", "ACH"];
2689
+ const qboMethodLabel = (value) => value === "CARD" ? uiText("qboPaymentMethod.methodCard") : value === "ACH" ? uiText("qboPaymentMethod.methodAch") : value;
2690
+ const qboMethodOf = (method) => method === "ACH" ? "ach" : "card";
2691
+ const QBO_METHOD_TEXTS = {
2692
+ get amountNeeded() {
2693
+ return uiText("qboPaymentMethod.amountNeeded");
2694
+ },
2695
+ get notCompleted() {
2696
+ return uiText("qboPaymentMethod.notCompleted");
2697
+ },
2698
+ get achTitle() {
2699
+ return uiText("qboPaymentMethod.achTitle");
2700
+ },
2701
+ achMessage: (amount) => uiText("qboPaymentMethod.achMessage", { amount }),
2702
+ get pendingTitle() {
2703
+ return uiText("qboPaymentMethod.pendingTitle");
2704
+ },
2705
+ pendingMessage: (amount) => uiText("qboPaymentMethod.pendingMessage", { amount }),
2706
+ get receiptNote() {
2707
+ return uiText("qboPaymentMethod.receiptNote");
2708
+ }
2709
+ };
2710
+ var PaymentQboBodyComponent = class PaymentQboBodyComponent {
2711
+ constructor() {
2712
+ this.labels = inject(UiLabelsService);
2713
+ this.injector = inject(Injector);
2714
+ this.host = inject(ElementRef);
2715
+ this.ctx = input.required(...ngDevMode ? [{ debugName: "ctx" }] : /* istanbul ignore next */ []);
2716
+ this.config = input.required(...ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []);
2717
+ this.payment = viewChild(QboPaymentComponent, ...ngDevMode ? [{ debugName: "payment" }] : /* istanbul ignore next */ []);
2718
+ this.texts = QBO_METHOD_TEXTS;
2719
+ this.processing = signal(false, ...ngDevMode ? [{ debugName: "processing" }] : /* istanbul ignore next */ []);
2720
+ this.done = signal(false, ...ngDevMode ? [{ debugName: "done" }] : /* istanbul ignore next */ []);
2721
+ this.error = signal("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
2722
+ this.estimate = signal(null, ...ngDevMode ? [{ debugName: "estimate" }] : /* istanbul ignore next */ []);
2723
+ this.estimating = signal(false, ...ngDevMode ? [{ debugName: "estimating" }] : /* istanbul ignore next */ []);
2724
+ this.estimateError = signal("", ...ngDevMode ? [{ debugName: "estimateError" }] : /* istanbul ignore next */ []);
2725
+ this.estimateTick = signal(0, ...ngDevMode ? [{ debugName: "estimateTick" }] : /* istanbul ignore next */ []);
2726
+ this.resultFees = signal(null, ...ngDevMode ? [{ debugName: "resultFees" }] : /* istanbul ignore next */ []);
2727
+ this.confirmation = signal(null, ...ngDevMode ? [{ debugName: "confirmation" }] : /* istanbul ignore next */ []);
2728
+ this.lastAmount = signal(null, ...ngDevMode ? [{ debugName: "lastAmount" }] : /* istanbul ignore next */ []);
2729
+ this.payAmount = null;
2730
+ this.payMethod = null;
2731
+ this.doneAmount = null;
2732
+ this.doneMethod = null;
2733
+ this.estimateRun = 0;
2734
+ this.amountValue = computed(() => this.ctx().amount, ...ngDevMode ? [{ debugName: "amountValue" }] : /* istanbul ignore next */ []);
2735
+ this.methodValue = computed(() => this.ctx().method, ...ngDevMode ? [{ debugName: "methodValue" }] : /* istanbul ignore next */ []);
2736
+ this.qboMethod = computed(() => qboMethodOf(this.ctx().method), ...ngDevMode ? [{ debugName: "qboMethod" }] : /* istanbul ignore next */ []);
2737
+ this.total = computed(() => this.resultFees()?.totalAmount ?? this.estimate()?.totalAmount ?? this.lastAmount() ?? 0, ...ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []);
2738
+ this.receiptNote = computed(() => this.config().receiptNote(), ...ngDevMode ? [{ debugName: "receiptNote" }] : /* istanbul ignore next */ []);
2739
+ this.feeRows = computed(() => {
2740
+ const fees = this.resultFees() ?? this.estimate();
2741
+ const amount = this.lastAmount();
2742
+ if (!fees || amount == null || fees.processingFee === void 0 && fees.platformFee === void 0) return [];
2743
+ const money = (n) => formatCurrency(n, { currency: this.ctx().currency });
2744
+ const rows = [{
2745
+ key: "amount",
2746
+ label: this.labels.t("qboPaymentMethod.paymentAmount"),
2747
+ value: money(amount)
2748
+ }];
2749
+ if (fees.processingFee !== void 0) rows.push({
2750
+ key: "processing",
2751
+ label: `${this.labels.t("qboPaymentMethod.processingFee")}${fees.processingFeeLabel ? ` (${fees.processingFeeLabel})` : ""}`,
2752
+ value: money(fees.processingFee)
2753
+ });
2754
+ if (fees.platformFee !== void 0) rows.push({
2755
+ key: "platform",
2756
+ label: `${this.labels.t("qboPaymentMethod.platformFee")}${fees.platformFeeLabel ? ` (${fees.platformFeeLabel})` : ""}`,
2757
+ value: money(fees.platformFee)
2758
+ });
2759
+ return rows;
2760
+ }, ...ngDevMode ? [{ debugName: "feeRows" }] : /* istanbul ignore next */ []);
2761
+ this.totalCard = computed(() => {
2762
+ const fees = this.resultFees() ?? this.estimate();
2763
+ if (!fees || this.lastAmount() == null || fees.totalAmount === void 0) return null;
2764
+ return {
2765
+ value: formatCurrency(fees.totalAmount, { currency: this.ctx().currency }),
2766
+ subtitle: this.labels.t("qboPaymentMethod.amountPlusFees")
2767
+ };
2768
+ }, ...ngDevMode ? [{ debugName: "totalCard" }] : /* istanbul ignore next */ []);
2769
+ this.gone = false;
2770
+ const configured = (read) => computed(() => read(this.config()));
2771
+ const inputs = {
2772
+ payableRef: configured((c) => c.payableRef()),
2773
+ attemptKey: configured((c) => c.attemptKey()),
2774
+ checkStatus: configured((c) => c.checkStatus()),
2775
+ paid: configured((c) => c.paid()),
2776
+ hostPending: configured((c) => c.hostPending()),
2777
+ statusPollMs: configured((c) => c.statusPollMs()),
2778
+ statusPollMaxMs: configured((c) => c.statusPollMaxMs()),
2779
+ statusCheckTimeoutMs: configured((c) => c.statusCheckTimeoutMs()),
2780
+ statusFailGraceMs: configured((c) => c.statusFailGraceMs()),
2781
+ readinessCheck: configured((c) => c.readinessCheck()),
2782
+ readinessTimeoutMs: configured((c) => c.readinessTimeoutMs()),
2783
+ readinessEveryMs: configured((c) => c.readinessEveryMs()),
2784
+ offlineOverride: configured((c) => c.offlineOverride())
2785
+ };
2786
+ const protection = createPaymentProtection(inputs, {
2787
+ amount: () => this.ctx().amount,
2788
+ method: () => this.ctx().method,
2789
+ onOutcome: (o) => this.onAttemptOutcome(o)
2790
+ });
2791
+ this.attempt = protection.attempt;
2792
+ this.readiness = protection.readiness;
2793
+ inject(DestroyRef).onDestroy(() => {
2794
+ this.gone = true;
2795
+ });
2796
+ const controls = {
2797
+ markUnknown: () => this.attempt.markUnknown("host"),
2798
+ markSucceeded: () => this.attempt.succeed("host"),
2799
+ markFailed: () => this.attempt.fail("host"),
2800
+ resetPaid: () => {
2801
+ this.attempt.resetPaid();
2802
+ this.done.set(false);
2803
+ this.confirmation.set(null);
2804
+ this.error.set("");
2805
+ this.ctx().setExclusive(false);
2806
+ },
2807
+ markNotCharged: () => {
2808
+ this.attempt.markNotCharged();
2809
+ this.payment()?.markNotCharged();
2810
+ this.processing.set(false);
2811
+ this.ctx().setBusy(false);
2812
+ }
2813
+ };
2814
+ effect(() => {
2815
+ const config = this.config();
2816
+ untracked(() => config.attachControls(controls));
2817
+ });
2818
+ inject(DestroyRef).onDestroy(() => this.config().detachControls(controls));
2819
+ effect(() => {
2820
+ const amount = this.amountValue();
2821
+ if (amount != null) untracked(() => this.lastAmount.set(amount));
2822
+ });
2823
+ effect(() => {
2824
+ const ctx = this.ctx();
2825
+ const processing = this.processing();
2826
+ const notice = this.confirmation();
2827
+ const estimating = this.estimating();
2828
+ const done = this.done();
2829
+ const estimateFailed = !!this.estimateError();
2830
+ const unknown = this.attempt.unknown();
2831
+ const paidLocked = this.attempt.paidLocked();
2832
+ const gateReady = this.readiness.ready();
2833
+ const label = notice ? this.labels.t("common.done") : ctx.amount != null ? `${this.labels.t("qboPaymentMethod.pay")} ${formatCurrency(this.total(), { currency: ctx.currency })}` : this.labels.t("qboPaymentMethod.pay");
2834
+ untracked(() => ctx.setPrimary({
2835
+ label,
2836
+ loading: processing && !notice,
2837
+ disabled: notice ? done : processing || estimating || estimateFailed || ctx.amount == null || done || unknown || paidLocked || !gateReady,
2838
+ onClick: () => notice ? this.finish() : void this.pay()
2839
+ }));
2840
+ });
2841
+ effect((onCleanup) => {
2842
+ const estimate = this.config().estimateFees();
2843
+ const amount = this.amountValue();
2844
+ const method = this.methodValue();
2845
+ this.estimateTick();
2846
+ const run = ++this.estimateRun;
2847
+ untracked(() => {
2848
+ this.estimate.set(null);
2849
+ this.resultFees.set(null);
2850
+ this.estimateError.set("");
2851
+ });
2852
+ if (!estimate || amount == null) {
2853
+ untracked(() => this.estimating.set(false));
2854
+ return;
2855
+ }
2856
+ untracked(() => this.estimating.set(true));
2857
+ let hung = null;
2858
+ const failure = this.labels.t("qboPaymentMethod.feesFailed");
2859
+ const timer = setTimeout(async () => {
2860
+ hung = setTimeout(() => {
2861
+ if (run !== this.estimateRun) return;
2862
+ this.estimating.set(false);
2863
+ if (this.config().feesRequired()) this.estimateError.set(failure);
2864
+ }, Math.max(1, this.config().estimateTimeoutMs()));
2865
+ let fees = null;
2866
+ try {
2867
+ fees = await callHost(() => estimate({
2868
+ amount,
2869
+ paymentMethod: method,
2870
+ method: qboMethodOf(method)
2871
+ })) ?? null;
2872
+ } catch {
2873
+ fees = null;
2874
+ }
2875
+ if (hung) {
2876
+ clearTimeout(hung);
2877
+ hung = null;
2878
+ }
2879
+ if (run !== this.estimateRun) return;
2880
+ this.estimating.set(false);
2881
+ if (fees) {
2882
+ this.estimate.set(fees);
2883
+ this.estimateError.set("");
2884
+ } else {
2885
+ this.estimate.set(null);
2886
+ this.estimateError.set(this.config().feesRequired() ? failure : "");
2887
+ }
2888
+ }, 300);
2889
+ onCleanup(() => {
2890
+ clearTimeout(timer);
2891
+ if (hung) clearTimeout(hung);
2892
+ });
2893
+ });
2894
+ effect(() => {
2895
+ this.methodValue();
2896
+ untracked(() => this.error.set(""));
2897
+ });
2898
+ effect(() => {
2899
+ const ctx = this.ctx();
2900
+ untracked(() => ctx.onCancel(() => {
2901
+ if (this.confirmation()) this.finish();
2902
+ }));
2903
+ });
2904
+ inject(DestroyRef).onDestroy(() => {
2905
+ this.estimateRun++;
2906
+ });
2907
+ }
2908
+ retryEstimate() {
2909
+ this.estimateTick.update((n) => n + 1);
2910
+ }
2911
+ onFailed(failure) {
2912
+ this.error.set(failure.message);
2913
+ this.processing.set(false);
2914
+ this.ctx().report("failed", { message: failure.message });
2915
+ }
2916
+ async pay() {
2917
+ const ctx = this.ctx();
2918
+ const payment = this.payment();
2919
+ if (this.processing() || this.estimating() || this.done() || !payment) return;
2920
+ if (this.refused(ctx)) return;
2921
+ if (!ctx.validate() || ctx.amount == null) return;
2922
+ this.payAmount = ctx.amount;
2923
+ this.payMethod = ctx.method;
2924
+ const attemptAmount = ctx.amount;
2925
+ const attemptMethod = ctx.method;
2926
+ const create = this.config().createPayment();
2927
+ if (!create) {
2928
+ this.onFailed({
2929
+ code: "not_configured",
2930
+ message: this.labels.t("qboPaymentMethod.unavailable"),
2931
+ stage: "tokenize"
2932
+ });
2933
+ return;
2934
+ }
2935
+ this.error.set("");
2936
+ this.processing.set(true);
2937
+ ctx.setBusy(true);
2938
+ ctx.announce(this.labels.t("qboPaymentMethod.announceProcessing"));
2939
+ let finished = false;
2940
+ const run = await this.attempt.run(async (key) => {
2941
+ const live = () => this.attempt.isLive(key);
2942
+ try {
2943
+ const event = await payment.tokenize();
2944
+ if (!event) return { kind: "released" };
2945
+ if (this.gone) return {
2946
+ kind: "released",
2947
+ reason: "destroyed"
2948
+ };
2949
+ const request = {
2950
+ amount: attemptAmount,
2951
+ paymentMethod: attemptMethod,
2952
+ method: event.method,
2953
+ receivedDate: ctx.receivedDate,
2954
+ notes: ctx.note || null,
2955
+ ...ctx.allocation,
2956
+ token: event.token,
2957
+ details: event.details,
2958
+ requestId: event.requestId,
2959
+ attemptKey: key,
2960
+ payableRef: this.attempt.pinnedRef()
2961
+ };
2962
+ let result;
2963
+ try {
2964
+ result = await callHost(() => create(request));
2965
+ } catch (err) {
2966
+ const kind = classifyHostError(err);
2967
+ if (kind === "unknown") return {
2968
+ kind: "unknown",
2969
+ reason: "host_error"
2970
+ };
2971
+ const message = hostErrorMessage(err, this.labels.t("qboPaymentMethod.paymentFailed"));
2972
+ if (kind === "not_sent") {
2973
+ if (live()) {
2974
+ this.error.set(message);
2975
+ ctx.report("refused", { message });
2976
+ }
2977
+ return {
2978
+ kind: "released",
2979
+ reason: "not_sent"
2980
+ };
2981
+ }
2982
+ if (live()) {
2983
+ this.error.set(message);
2984
+ ctx.report("failed", { message });
2985
+ }
2986
+ return {
2987
+ kind: "failure",
2988
+ reason: "host_refused"
2989
+ };
2990
+ }
2991
+ if (wasQueuedOffline(result)) {
2992
+ warnQueuedPayment();
2993
+ const message = this.labels.t("paymentAttempt.queuedOffline");
2994
+ if (live()) {
2995
+ this.error.set(message);
2996
+ ctx.report("refused", { message });
2997
+ }
2998
+ return {
2999
+ kind: "released",
3000
+ reason: "not_sent"
3001
+ };
3002
+ }
3003
+ if (this.gone) return {
3004
+ kind: qboOutcomeOf(result?.status, qboMethodOf(attemptMethod)) === "failed" ? "failure" : "success",
3005
+ value: result ?? null,
3006
+ reason: "created"
3007
+ };
3008
+ finished = this.afterCreate(result ?? null, ctx, live(), attemptAmount, attemptMethod);
3009
+ return {
3010
+ kind: qboOutcomeOf(result?.status, qboMethodOf(attemptMethod)) === "failed" ? "failure" : "success",
3011
+ value: result ?? null,
3012
+ reason: "created"
3013
+ };
3014
+ } finally {
3015
+ if (live()) payment.markNotCharged();
3016
+ }
3017
+ }, { timeoutMs: this.config().paymentTimeoutMs() });
3018
+ this.processing.set(false);
3019
+ if ("refused" in run && run.refused) {
3020
+ ctx.setBusy(false);
3021
+ return;
3022
+ }
3023
+ if (run.kind === "unknown") return;
3024
+ if (!finished) ctx.setBusy(false);
3025
+ }
3026
+ refused(ctx) {
3027
+ if (!this.readiness.passSync()) {
3028
+ const reason = this.readiness.reasons()[0] ?? "checking";
3029
+ const message = this.labels.t(refusalLabelKey(reason));
3030
+ this.error.set(message);
3031
+ ctx.report("refused", { message });
3032
+ ctx.announce(message);
3033
+ return true;
3034
+ }
3035
+ if (this.attempt.paidLocked() || this.attempt.unknown()) {
3036
+ this.attempt.begin();
3037
+ return true;
3038
+ }
3039
+ return false;
3040
+ }
3041
+ onAttemptOutcome(outcome) {
3042
+ const ctx = this.ctx();
3043
+ if (outcome.kind === "unknown" && outcome.reason === "duplicate_suspected") {
3044
+ const message = this.labels.t("paymentAttempt.duplicate");
3045
+ this.error.set(message);
3046
+ ctx.report("duplicate_suspected", {
3047
+ message,
3048
+ attemptKey: outcome.attemptKey
3049
+ });
3050
+ ctx.announce(message);
3051
+ } else if (outcome.kind === "unknown") {
3052
+ this.payAmount = this.attempt.pinnedAmount() ?? this.payAmount;
3053
+ this.payMethod = this.attempt.pinnedMethod() ?? this.payMethod;
3054
+ const message = this.labels.t(outcome.reason === "offline" ? "paymentAttempt.offlineInFlight" : outcome.reason === "timeout" ? "paymentAttempt.timeout" : "paymentAttempt.checking");
3055
+ ctx.report("unknown", { message });
3056
+ ctx.announce(message);
3057
+ } else if (outcome.kind === "refused") ctx.report("refused", { message: this.labels.t(refusalLabelKey(outcome.reason ?? "")) });
3058
+ else if (outcome.kind === "succeeded" && outcome.reason === "other_tab") ctx.report("paid_elsewhere", {
3059
+ message: this.labels.t("paymentAttempt.paid"),
3060
+ attemptKey: outcome.attemptKey,
3061
+ ...outcome.method !== void 0 ? { paid: {
3062
+ amount: outcome.amount ?? null,
3063
+ method: outcome.method
3064
+ } } : {}
3065
+ });
3066
+ else if (outcome.kind === "succeeded" && (outcome.reason === "status_check" || outcome.reason === "host") && !this.done()) {
3067
+ const paid = {
3068
+ type: "stripe",
3069
+ paymentMethod: outcome.method ?? this.payMethod ?? ctx.method,
3070
+ amount: outcome.amount ?? this.payAmount ?? ctx.amount ?? this.lastAmount() ?? 0,
3071
+ processor: "quickbooks"
3072
+ };
3073
+ this.doneAmount = paid.amount;
3074
+ this.doneMethod = paid.paymentMethod;
3075
+ ctx.report("paid", { result: paid });
3076
+ ctx.announce(this.labels.t("paymentAttempt.succeededAfterCheck"));
3077
+ this.done.set(true);
3078
+ ctx.setBusy(false);
3079
+ ctx.complete(paid);
3080
+ } else if (outcome.kind === "failed") {
3081
+ if (outcome.reason === "status_check" || outcome.reason === "host") {
3082
+ const message = this.labels.t("paymentAttempt.failedAfterCheck");
3083
+ this.error.set(message);
3084
+ ctx.report("failed", { message });
3085
+ }
3086
+ this.payment()?.markNotCharged();
3087
+ ctx.setBusy(false);
3088
+ }
3089
+ }
3090
+ afterCreate(result, ctx, live, amount, method) {
3091
+ if (this.done() || this.confirmation()) return true;
3092
+ const money = formatCurrency(amount, { currency: ctx.currency });
3093
+ const outcome = qboOutcomeOf(result?.status, qboMethodOf(method));
3094
+ if (outcome === "failed") {
3095
+ if (live) {
3096
+ const message = result?.failureMessage || this.texts.notCompleted;
3097
+ this.error.set(message);
3098
+ ctx.report("failed", { message });
3099
+ }
3100
+ return false;
3101
+ }
3102
+ if (live && result && (result.processingFee !== void 0 || result.platformFee !== void 0 || result.totalAmount !== void 0)) this.resultFees.set({
3103
+ processingFee: result.processingFee,
3104
+ platformFee: result.platformFee,
3105
+ totalAmount: result.totalAmount,
3106
+ processingFeeLabel: result.processingFeeLabel,
3107
+ platformFeeLabel: result.platformFeeLabel
3108
+ });
3109
+ const paid = {
3110
+ type: "stripe",
3111
+ paymentMethod: method,
3112
+ amount,
3113
+ processor: "quickbooks"
3114
+ };
3115
+ this.doneAmount = amount;
3116
+ this.doneMethod = method;
3117
+ if (outcome === "paid") {
3118
+ ctx.report("paid", { result: paid });
3119
+ this.done.set(true);
3120
+ ctx.complete(paid);
3121
+ return true;
3122
+ }
3123
+ ctx.report("processing", { result: paid });
3124
+ this.confirmation.set(qboMethodOf(method) === "ach" ? {
3125
+ title: this.texts.achTitle,
3126
+ message: this.texts.achMessage(money)
3127
+ } : {
3128
+ title: this.texts.pendingTitle,
3129
+ message: this.texts.pendingMessage(money)
3130
+ });
3131
+ ctx.setExclusive(true);
3132
+ ctx.setBusy(false);
3133
+ afterNextRender(() => this.host.nativeElement.querySelector(".pqb-notice")?.focus(), { injector: this.injector });
3134
+ return true;
3135
+ }
3136
+ finish() {
3137
+ const ctx = this.ctx();
3138
+ if (this.done()) return;
3139
+ this.done.set(true);
3140
+ ctx.complete({
3141
+ type: "stripe",
3142
+ paymentMethod: this.doneMethod ?? this.payMethod ?? ctx.method,
3143
+ amount: this.doneAmount ?? this.payAmount ?? ctx.amount ?? this.lastAmount() ?? 0,
3144
+ processor: "quickbooks"
3145
+ });
3146
+ }
3147
+ static {
3148
+ this.ɵfac = i0.ɵɵngDeclareFactory({
3149
+ minVersion: "12.0.0",
3150
+ version: "22.2.2",
3151
+ ngImport: i0,
3152
+ type: PaymentQboBodyComponent,
3153
+ deps: [],
3154
+ target: i0.ɵɵFactoryTarget.Component
3155
+ });
3156
+ }
3157
+ static {
3158
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
3159
+ minVersion: "17.0.0",
3160
+ version: "22.2.2",
3161
+ type: PaymentQboBodyComponent,
3162
+ isStandalone: true,
3163
+ selector: "ui-payment-qbo-body",
3164
+ inputs: {
3165
+ ctx: {
3166
+ classPropertyName: "ctx",
3167
+ publicName: "ctx",
3168
+ isSignal: true,
3169
+ isRequired: true,
3170
+ transformFunction: null
3171
+ },
3172
+ config: {
3173
+ classPropertyName: "config",
3174
+ publicName: "config",
3175
+ isSignal: true,
3176
+ isRequired: true,
3177
+ transformFunction: null
3178
+ }
3179
+ },
3180
+ viewQueries: [{
3181
+ propertyName: "payment",
3182
+ first: true,
3183
+ predicate: QboPaymentComponent,
3184
+ descendants: true,
3185
+ isSignal: true
3186
+ }],
3187
+ ngImport: i0,
3188
+ template: `
3189
+ <div class="pqb">
3190
+ @if (confirmation(); as notice) {
3191
+ <ui-alert variant="success" [title]="notice.title" tabindex="-1" class="pqb-notice" data-testid="qbo-method-confirmation">
3192
+ <p>{{ notice.message }}</p>
3193
+ <p>{{ receiptNote() }}</p>
3194
+ </ui-alert>
3195
+ } @else {
3196
+ <ui-payment-attempt-status [attempt]="attempt" [readiness]="readiness" [allowStartOver]="config().allowStartOver()" [showPaid]="!confirmation() && !done()" />
3197
+ @if (ctx().amount == null) {
3198
+ <ui-hint data-testid="qbo-method-amount-needed">{{ texts.amountNeeded }}</ui-hint>
3199
+ }
3200
+ @if (estimateError()) {
3201
+ <div class="pqb-error">
3202
+ <ui-alert variant="warning" data-testid="qbo-method-estimate-error">{{ estimateError() }}
3203
+ <ui-button variant="secondary" size="sm" data-testid="qbo-method-estimate-retry" (click)="retryEstimate()">{{ labels.t('common.tryAgain') }}</ui-button>
3204
+ </ui-alert>
3205
+ </div>
3206
+ }
3207
+ @if (lastAmount() != null) {
3208
+ <ui-qbo-payment #payment mode="payment" [method]="qboMethod()" [environment]="config().environment()" [cardholderName]="config().cardholderName()"
3209
+ [requireName]="config().requireName()" [requirePostalCode]="config().requirePostalCode()" [postalCountry]="config().postalCountry()" [requireAchConsent]="config().requireAchConsent()" [showSubmit]="false" [showErrors]="false"
3210
+ [showStatus]="false" [offlineOverride]="config().offlineOverride()" [disabled]="processing() || done() || attempt.unknown() || attempt.paidLocked()" [label]="labels.t('qboPaymentMethod.paymentDetails')" (failed)="onFailed($event)" />
3211
+ @if (totalCard(); as card) {
3212
+ <ui-kpi-card class="pqb-total" data-testid="qbo-method-total" [label]="labels.t('qboPaymentMethod.totalCharged')" [value]="card.value" [subtitle]="card.subtitle" icon="dollar" color="blue" valueColor="blue" />
3213
+ }
3214
+ @if (feeRows().length) {
3215
+ <dl class="pqb-fees" data-testid="qbo-method-fees" [attr.aria-label]="labels.t('qboPaymentMethod.paymentTotal')">
3216
+ @for (row of feeRows(); track row.key) {
3217
+ <div class="pqb-fee" [attr.data-testid]="'qbo-fee-' + row.key"><dt>{{ row.label }}</dt><dd>{{ row.value }}</dd></div>
3218
+ }
3219
+ </dl>
3220
+ }
3221
+ @if (error()) { <div class="pqb-error"><ui-alert variant="danger" data-testid="qbo-method-error">{{ error() }}</ui-alert></div> }
3222
+ }
3223
+ }
3224
+ </div>
3225
+ `,
3226
+ isInline: true,
3227
+ styles: ["ui-payment-qbo-body{display:block;min-width:0}ui-payment-qbo-body .pqb-error{margin-top:12px}ui-payment-qbo-body .pqb-total{display:block;margin-top:16px}ui-payment-qbo-body .pqb-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-qbo-body .pqb-fee{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-qbo-body .pqb-fee dt,ui-payment-qbo-body .pqb-fee dd{margin:0}ui-payment-qbo-body .pqb-notice:focus{outline:none}ui-payment-qbo-body .pqb-notice p{margin:0 0 6px}\n"],
3228
+ dependencies: [
3229
+ {
3230
+ kind: "component",
3231
+ type: AlertComponent,
3232
+ selector: "ui-alert",
3233
+ inputs: [
3234
+ "variant",
3235
+ "title",
3236
+ "dismissible",
3237
+ "dismissAriaLabel",
3238
+ "quiet",
3239
+ "compact",
3240
+ "inline",
3241
+ "fill"
3242
+ ],
3243
+ outputs: ["dismissed"]
3244
+ },
3245
+ {
3246
+ kind: "component",
3247
+ type: ButtonComponent,
3248
+ selector: "ui-button",
3249
+ inputs: [
3250
+ "variant",
3251
+ "routerLink",
3252
+ "queryParams",
3253
+ "fragment",
3254
+ "state",
3255
+ "href",
3256
+ "target",
3257
+ "rel",
3258
+ "shortLabel",
3259
+ "shortBelow",
3260
+ "color",
3261
+ "active",
3262
+ "size",
3263
+ "type",
3264
+ "disabled",
3265
+ "loading",
3266
+ "fullWidth",
3267
+ "ariaLabel",
3268
+ "ariaExpanded",
3269
+ "ariaPressed",
3270
+ "ariaDescribedBy",
3271
+ "modal-footer-left",
3272
+ "modal-footer-right"
3273
+ ]
3274
+ },
3275
+ {
3276
+ kind: "component",
3277
+ type: HintComponent,
3278
+ selector: "ui-hint"
3279
+ },
3280
+ {
3281
+ kind: "component",
3282
+ type: KpiCardComponent,
3283
+ selector: "ui-kpi-card",
3284
+ inputs: [
3285
+ "label",
3286
+ "value",
3287
+ "subtitle",
3288
+ "icon",
3289
+ "color",
3290
+ "highlight",
3291
+ "clickable",
3292
+ "valueColor",
3293
+ "loading",
3294
+ "loadingLabel",
3295
+ "background",
3296
+ "progress",
3297
+ "progressMax",
3298
+ "progressSize",
3299
+ "progressStrokeWidth",
3300
+ "progressVariant",
3301
+ "progressAriaLabel",
3302
+ "progressValueText"
3303
+ ]
3304
+ },
3305
+ {
3306
+ kind: "component",
3307
+ type: PaymentAttemptStatusComponent,
3308
+ selector: "ui-payment-attempt-status",
3309
+ inputs: [
3310
+ "attempt",
3311
+ "showPaid",
3312
+ "allowStartOver",
3313
+ "readiness"
3314
+ ],
3315
+ outputs: ["retryLoad"]
3316
+ },
3317
+ {
3318
+ kind: "component",
3319
+ type: QboPaymentComponent,
3320
+ selector: "ui-qbo-payment",
3321
+ inputs: [
3322
+ "mountOnly",
3323
+ "mode",
3324
+ "method",
3325
+ "methods",
3326
+ "environment",
3327
+ "cardholderName",
3328
+ "requireName",
3329
+ "requirePostalCode",
3330
+ "postalCountry",
3331
+ "confirmAccountNumber",
3332
+ "requireAchConsent",
3333
+ "achConsentText",
3334
+ "showStatus",
3335
+ "payableRef",
3336
+ "attemptKey",
3337
+ "checkStatus",
3338
+ "paid",
3339
+ "hostPending",
3340
+ "statusPollMs",
3341
+ "statusPollMaxMs",
3342
+ "statusCheckTimeoutMs",
3343
+ "statusFailGraceMs",
3344
+ "allowStartOver",
3345
+ "offlineOverride",
3346
+ "hostSilenceMs",
3347
+ "readinessCheck",
3348
+ "readinessTimeoutMs",
3349
+ "readinessEveryMs",
3350
+ "submitLabel",
3351
+ "showSubmit",
3352
+ "disabled",
3353
+ "pending",
3354
+ "label",
3355
+ "required",
3356
+ "showErrors",
3357
+ "errorDisplay",
3358
+ "errorMessages",
3359
+ "errorFallback",
3360
+ "a11yMessages"
3361
+ ],
3362
+ outputs: [
3363
+ "methodChange",
3364
+ "tokenized",
3365
+ "failed",
3366
+ "inFlightChange",
3367
+ "outcome",
3368
+ "attemptKeyChange",
3369
+ "readinessChange"
3370
+ ]
3371
+ }
3372
+ ],
3373
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
3374
+ encapsulation: i0.ViewEncapsulation.None
3375
+ });
3376
+ }
3377
+ };
3378
+ i0.ɵɵngDeclareClassMetadata({
3379
+ minVersion: "12.0.0",
3380
+ version: "22.2.2",
3381
+ ngImport: i0,
3382
+ type: PaymentQboBodyComponent,
3383
+ decorators: [{
3384
+ type: Component,
3385
+ args: [{
3386
+ selector: "ui-payment-qbo-body",
3387
+ standalone: true,
3388
+ changeDetection: ChangeDetectionStrategy.OnPush,
3389
+ encapsulation: ViewEncapsulation.None,
3390
+ imports: [
3391
+ AlertComponent,
3392
+ ButtonComponent,
3393
+ HintComponent,
3394
+ KpiCardComponent,
3395
+ PaymentAttemptStatusComponent,
3396
+ QboPaymentComponent
3397
+ ],
3398
+ template: `
3399
+ <div class="pqb">
3400
+ @if (confirmation(); as notice) {
3401
+ <ui-alert variant="success" [title]="notice.title" tabindex="-1" class="pqb-notice" data-testid="qbo-method-confirmation">
3402
+ <p>{{ notice.message }}</p>
3403
+ <p>{{ receiptNote() }}</p>
3404
+ </ui-alert>
3405
+ } @else {
3406
+ <ui-payment-attempt-status [attempt]="attempt" [readiness]="readiness" [allowStartOver]="config().allowStartOver()" [showPaid]="!confirmation() && !done()" />
3407
+ @if (ctx().amount == null) {
3408
+ <ui-hint data-testid="qbo-method-amount-needed">{{ texts.amountNeeded }}</ui-hint>
3409
+ }
3410
+ @if (estimateError()) {
3411
+ <div class="pqb-error">
3412
+ <ui-alert variant="warning" data-testid="qbo-method-estimate-error">{{ estimateError() }}
3413
+ <ui-button variant="secondary" size="sm" data-testid="qbo-method-estimate-retry" (click)="retryEstimate()">{{ labels.t('common.tryAgain') }}</ui-button>
3414
+ </ui-alert>
3415
+ </div>
3416
+ }
3417
+ @if (lastAmount() != null) {
3418
+ <ui-qbo-payment #payment mode="payment" [method]="qboMethod()" [environment]="config().environment()" [cardholderName]="config().cardholderName()"
3419
+ [requireName]="config().requireName()" [requirePostalCode]="config().requirePostalCode()" [postalCountry]="config().postalCountry()" [requireAchConsent]="config().requireAchConsent()" [showSubmit]="false" [showErrors]="false"
3420
+ [showStatus]="false" [offlineOverride]="config().offlineOverride()" [disabled]="processing() || done() || attempt.unknown() || attempt.paidLocked()" [label]="labels.t('qboPaymentMethod.paymentDetails')" (failed)="onFailed($event)" />
3421
+ @if (totalCard(); as card) {
3422
+ <ui-kpi-card class="pqb-total" data-testid="qbo-method-total" [label]="labels.t('qboPaymentMethod.totalCharged')" [value]="card.value" [subtitle]="card.subtitle" icon="dollar" color="blue" valueColor="blue" />
3423
+ }
3424
+ @if (feeRows().length) {
3425
+ <dl class="pqb-fees" data-testid="qbo-method-fees" [attr.aria-label]="labels.t('qboPaymentMethod.paymentTotal')">
3426
+ @for (row of feeRows(); track row.key) {
3427
+ <div class="pqb-fee" [attr.data-testid]="'qbo-fee-' + row.key"><dt>{{ row.label }}</dt><dd>{{ row.value }}</dd></div>
3428
+ }
3429
+ </dl>
3430
+ }
3431
+ @if (error()) { <div class="pqb-error"><ui-alert variant="danger" data-testid="qbo-method-error">{{ error() }}</ui-alert></div> }
3432
+ }
3433
+ }
3434
+ </div>
3435
+ `,
3436
+ styles: ["ui-payment-qbo-body{display:block;min-width:0}ui-payment-qbo-body .pqb-error{margin-top:12px}ui-payment-qbo-body .pqb-total{display:block;margin-top:16px}ui-payment-qbo-body .pqb-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-qbo-body .pqb-fee{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-qbo-body .pqb-fee dt,ui-payment-qbo-body .pqb-fee dd{margin:0}ui-payment-qbo-body .pqb-notice:focus{outline:none}ui-payment-qbo-body .pqb-notice p{margin:0 0 6px}\n"]
3437
+ }]
3438
+ }],
3439
+ ctorParameters: () => [],
3440
+ propDecorators: {
3441
+ ctx: [{
3442
+ type: i0.Input,
3443
+ args: [{
3444
+ isSignal: true,
3445
+ alias: "ctx",
3446
+ required: true
3447
+ }]
3448
+ }],
3449
+ config: [{
3450
+ type: i0.Input,
3451
+ args: [{
3452
+ isSignal: true,
3453
+ alias: "config",
3454
+ required: true
3455
+ }]
3456
+ }],
3457
+ payment: [{
3458
+ type: i0.ViewChild,
3459
+ args: [i0.forwardRef(() => QboPaymentComponent), { isSignal: true }]
3460
+ }]
3461
+ }
3462
+ });
3463
+ var QboPaymentMethodComponent = class QboPaymentMethodComponent extends PaymentMethodPlugin {
3464
+ constructor() {
3465
+ super(...arguments);
3466
+ this.self = this;
3467
+ this.createPayment = input(null, ...ngDevMode ? [{ debugName: "createPayment" }] : /* istanbul ignore next */ []);
3468
+ this.estimateFees = input(null, ...ngDevMode ? [{ debugName: "estimateFees" }] : /* istanbul ignore next */ []);
3469
+ this.environment = input(null, ...ngDevMode ? [{ debugName: "environment" }] : /* istanbul ignore next */ []);
3470
+ this.cardholderName = input("", ...ngDevMode ? [{ debugName: "cardholderName" }] : /* istanbul ignore next */ []);
3471
+ this.requireName = input(false, ...ngDevMode ? [{ debugName: "requireName" }] : /* istanbul ignore next */ []);
3472
+ this.requirePostalCode = input(false, ...ngDevMode ? [{ debugName: "requirePostalCode" }] : /* istanbul ignore next */ []);
3473
+ this.postalCountry = input("US", ...ngDevMode ? [{ debugName: "postalCountry" }] : /* istanbul ignore next */ []);
3474
+ this.requireAchConsent = input(true, ...ngDevMode ? [{ debugName: "requireAchConsent" }] : /* istanbul ignore next */ []);
3475
+ this.methodListInput = input(null, {
3476
+ ...ngDevMode ? { debugName: "methodListInput" } : /* istanbul ignore next */ {},
3477
+ alias: "methodList"
3478
+ });
3479
+ this.methodList = computed(() => this.methodListInput() ?? QBO_PAYMENT_METHOD_VALUES.map((value) => ({
3480
+ value,
3481
+ label: qboMethodLabel(value)
3482
+ })), ...ngDevMode ? [{ debugName: "methodList" }] : /* istanbul ignore next */ []);
3483
+ this.estimateTimeoutMs = input(1e4, ...ngDevMode ? [{ debugName: "estimateTimeoutMs" }] : /* istanbul ignore next */ []);
3484
+ this.payableRef = input(null, ...ngDevMode ? [{ debugName: "payableRef" }] : /* istanbul ignore next */ []);
3485
+ this.attemptKey = input(null, ...ngDevMode ? [{ debugName: "attemptKey" }] : /* istanbul ignore next */ []);
3486
+ this.checkStatus = input(null, ...ngDevMode ? [{ debugName: "checkStatus" }] : /* istanbul ignore next */ []);
3487
+ this.paid = input(false, ...ngDevMode ? [{ debugName: "paid" }] : /* istanbul ignore next */ []);
3488
+ this.hostPending = input(false, ...ngDevMode ? [{ debugName: "hostPending" }] : /* istanbul ignore next */ []);
3489
+ this.statusPollMs = input(PAYMENT_STATUS_POLL_MS, ...ngDevMode ? [{ debugName: "statusPollMs" }] : /* istanbul ignore next */ []);
3490
+ this.statusPollMaxMs = input(PAYMENT_STATUS_POLL_MAX_MS, ...ngDevMode ? [{ debugName: "statusPollMaxMs" }] : /* istanbul ignore next */ []);
3491
+ this.statusCheckTimeoutMs = input(PAYMENT_STATUS_CHECK_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "statusCheckTimeoutMs" }] : /* istanbul ignore next */ []);
3492
+ this.statusFailGraceMs = input(PAYMENT_STATUS_FAIL_GRACE_MS, ...ngDevMode ? [{ debugName: "statusFailGraceMs" }] : /* istanbul ignore next */ []);
3493
+ this.allowStartOver = input(false, ...ngDevMode ? [{ debugName: "allowStartOver" }] : /* istanbul ignore next */ []);
3494
+ this.offlineOverride = input(false, ...ngDevMode ? [{ debugName: "offlineOverride" }] : /* istanbul ignore next */ []);
3495
+ this.paymentTimeoutMs = input(PAYMENT_REQUEST_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "paymentTimeoutMs" }] : /* istanbul ignore next */ []);
3496
+ this.readinessCheck = input(null, ...ngDevMode ? [{ debugName: "readinessCheck" }] : /* istanbul ignore next */ []);
3497
+ this.readinessTimeoutMs = input(PAYMENT_READINESS_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "readinessTimeoutMs" }] : /* istanbul ignore next */ []);
3498
+ this.readinessEveryMs = input(PAYMENT_READINESS_EVERY_MS, ...ngDevMode ? [{ debugName: "readinessEveryMs" }] : /* istanbul ignore next */ []);
3499
+ this.feesRequired = input(false, ...ngDevMode ? [{ debugName: "feesRequired" }] : /* istanbul ignore next */ []);
3500
+ this.receiptNoteInput = input(null, {
3501
+ ...ngDevMode ? { debugName: "receiptNoteInput" } : /* istanbul ignore next */ {},
3502
+ alias: "receiptNote"
3503
+ });
3504
+ this.receiptNote = computed(() => this.receiptNoteInput() ?? QBO_METHOD_TEXTS.receiptNote, ...ngDevMode ? [{ debugName: "receiptNote" }] : /* istanbul ignore next */ []);
3505
+ this.body = viewChild("body", ...ngDevMode ? [{ debugName: "body" }] : /* istanbul ignore next */ []);
3506
+ this.controls = signal(null, ...ngDevMode ? [{ debugName: "controls" }] : /* istanbul ignore next */ []);
3507
+ this.methods = this.methodList;
3508
+ this.template = this.body;
3509
+ }
3510
+ attachControls(controls) {
3511
+ this.controls.set(controls);
3512
+ }
3513
+ detachControls(controls) {
3514
+ if (this.controls() === controls) this.controls.set(null);
3515
+ }
3516
+ markUnknown() {
3517
+ this.controls()?.markUnknown();
3518
+ }
3519
+ markSucceeded() {
3520
+ this.controls()?.markSucceeded();
3521
+ }
3522
+ markFailed() {
3523
+ this.controls()?.markFailed();
3524
+ }
3525
+ markNotCharged() {
3526
+ this.controls()?.markNotCharged();
3527
+ }
3528
+ resetPaid() {
3529
+ this.controls()?.resetPaid();
3530
+ }
3531
+ static {
3532
+ this.ɵfac = i0.ɵɵngDeclareFactory({
3533
+ minVersion: "12.0.0",
3534
+ version: "22.2.2",
3535
+ ngImport: i0,
3536
+ type: QboPaymentMethodComponent,
3537
+ deps: null,
3538
+ target: i0.ɵɵFactoryTarget.Component
3539
+ });
3540
+ }
3541
+ static {
3542
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
3543
+ minVersion: "17.2.0",
3544
+ version: "22.2.2",
3545
+ type: QboPaymentMethodComponent,
3546
+ isStandalone: true,
3547
+ selector: "ui-qbo-payment-method",
3548
+ inputs: {
3549
+ createPayment: {
3550
+ classPropertyName: "createPayment",
3551
+ publicName: "createPayment",
3552
+ isSignal: true,
3553
+ isRequired: false,
3554
+ transformFunction: null
3555
+ },
3556
+ estimateFees: {
3557
+ classPropertyName: "estimateFees",
3558
+ publicName: "estimateFees",
3559
+ isSignal: true,
3560
+ isRequired: false,
3561
+ transformFunction: null
3562
+ },
3563
+ environment: {
3564
+ classPropertyName: "environment",
3565
+ publicName: "environment",
3566
+ isSignal: true,
3567
+ isRequired: false,
3568
+ transformFunction: null
3569
+ },
3570
+ cardholderName: {
3571
+ classPropertyName: "cardholderName",
3572
+ publicName: "cardholderName",
3573
+ isSignal: true,
3574
+ isRequired: false,
3575
+ transformFunction: null
3576
+ },
3577
+ requireName: {
3578
+ classPropertyName: "requireName",
3579
+ publicName: "requireName",
3580
+ isSignal: true,
3581
+ isRequired: false,
3582
+ transformFunction: null
3583
+ },
3584
+ requirePostalCode: {
3585
+ classPropertyName: "requirePostalCode",
3586
+ publicName: "requirePostalCode",
3587
+ isSignal: true,
3588
+ isRequired: false,
3589
+ transformFunction: null
3590
+ },
3591
+ postalCountry: {
3592
+ classPropertyName: "postalCountry",
3593
+ publicName: "postalCountry",
3594
+ isSignal: true,
3595
+ isRequired: false,
3596
+ transformFunction: null
3597
+ },
3598
+ requireAchConsent: {
3599
+ classPropertyName: "requireAchConsent",
3600
+ publicName: "requireAchConsent",
3601
+ isSignal: true,
3602
+ isRequired: false,
3603
+ transformFunction: null
3604
+ },
3605
+ methodListInput: {
3606
+ classPropertyName: "methodListInput",
3607
+ publicName: "methodList",
3608
+ isSignal: true,
3609
+ isRequired: false,
3610
+ transformFunction: null
3611
+ },
3612
+ estimateTimeoutMs: {
3613
+ classPropertyName: "estimateTimeoutMs",
3614
+ publicName: "estimateTimeoutMs",
3615
+ isSignal: true,
3616
+ isRequired: false,
3617
+ transformFunction: null
3618
+ },
3619
+ payableRef: {
3620
+ classPropertyName: "payableRef",
3621
+ publicName: "payableRef",
3622
+ isSignal: true,
3623
+ isRequired: false,
3624
+ transformFunction: null
3625
+ },
3626
+ attemptKey: {
3627
+ classPropertyName: "attemptKey",
3628
+ publicName: "attemptKey",
3629
+ isSignal: true,
3630
+ isRequired: false,
3631
+ transformFunction: null
3632
+ },
3633
+ checkStatus: {
3634
+ classPropertyName: "checkStatus",
3635
+ publicName: "checkStatus",
3636
+ isSignal: true,
3637
+ isRequired: false,
3638
+ transformFunction: null
3639
+ },
3640
+ paid: {
3641
+ classPropertyName: "paid",
3642
+ publicName: "paid",
3643
+ isSignal: true,
3644
+ isRequired: false,
3645
+ transformFunction: null
3646
+ },
3647
+ hostPending: {
3648
+ classPropertyName: "hostPending",
3649
+ publicName: "hostPending",
3650
+ isSignal: true,
3651
+ isRequired: false,
3652
+ transformFunction: null
3653
+ },
3654
+ statusPollMs: {
3655
+ classPropertyName: "statusPollMs",
3656
+ publicName: "statusPollMs",
3657
+ isSignal: true,
3658
+ isRequired: false,
3659
+ transformFunction: null
3660
+ },
3661
+ statusPollMaxMs: {
3662
+ classPropertyName: "statusPollMaxMs",
3663
+ publicName: "statusPollMaxMs",
3664
+ isSignal: true,
3665
+ isRequired: false,
3666
+ transformFunction: null
3667
+ },
3668
+ statusCheckTimeoutMs: {
3669
+ classPropertyName: "statusCheckTimeoutMs",
3670
+ publicName: "statusCheckTimeoutMs",
3671
+ isSignal: true,
3672
+ isRequired: false,
3673
+ transformFunction: null
3674
+ },
3675
+ statusFailGraceMs: {
3676
+ classPropertyName: "statusFailGraceMs",
3677
+ publicName: "statusFailGraceMs",
3678
+ isSignal: true,
3679
+ isRequired: false,
3680
+ transformFunction: null
3681
+ },
3682
+ allowStartOver: {
3683
+ classPropertyName: "allowStartOver",
3684
+ publicName: "allowStartOver",
3685
+ isSignal: true,
3686
+ isRequired: false,
3687
+ transformFunction: null
3688
+ },
3689
+ offlineOverride: {
3690
+ classPropertyName: "offlineOverride",
3691
+ publicName: "offlineOverride",
3692
+ isSignal: true,
3693
+ isRequired: false,
3694
+ transformFunction: null
3695
+ },
3696
+ paymentTimeoutMs: {
3697
+ classPropertyName: "paymentTimeoutMs",
3698
+ publicName: "paymentTimeoutMs",
3699
+ isSignal: true,
3700
+ isRequired: false,
3701
+ transformFunction: null
3702
+ },
3703
+ readinessCheck: {
3704
+ classPropertyName: "readinessCheck",
3705
+ publicName: "readinessCheck",
3706
+ isSignal: true,
3707
+ isRequired: false,
3708
+ transformFunction: null
3709
+ },
3710
+ readinessTimeoutMs: {
3711
+ classPropertyName: "readinessTimeoutMs",
3712
+ publicName: "readinessTimeoutMs",
3713
+ isSignal: true,
3714
+ isRequired: false,
3715
+ transformFunction: null
3716
+ },
3717
+ readinessEveryMs: {
3718
+ classPropertyName: "readinessEveryMs",
3719
+ publicName: "readinessEveryMs",
3720
+ isSignal: true,
3721
+ isRequired: false,
3722
+ transformFunction: null
3723
+ },
3724
+ feesRequired: {
3725
+ classPropertyName: "feesRequired",
3726
+ publicName: "feesRequired",
3727
+ isSignal: true,
3728
+ isRequired: false,
3729
+ transformFunction: null
3730
+ },
3731
+ receiptNoteInput: {
3732
+ classPropertyName: "receiptNoteInput",
3733
+ publicName: "receiptNote",
3734
+ isSignal: true,
3735
+ isRequired: false,
3736
+ transformFunction: null
3737
+ }
3738
+ },
3739
+ host: { styleAttribute: "display: none" },
3740
+ providers: [{
3741
+ provide: PAYMENT_METHOD_PLUGIN,
3742
+ useExisting: forwardRef(() => QboPaymentMethodComponent)
3743
+ }],
3744
+ viewQueries: [{
3745
+ propertyName: "body",
3746
+ first: true,
3747
+ predicate: ["body"],
3748
+ descendants: true,
3749
+ isSignal: true
3750
+ }],
3751
+ usesInheritance: true,
3752
+ ngImport: i0,
3753
+ template: `<ng-template #body let-ctx><ui-payment-qbo-body [ctx]="ctx" [config]="self" /></ng-template>`,
3754
+ isInline: true,
3755
+ dependencies: [{
3756
+ kind: "component",
3757
+ type: PaymentQboBodyComponent,
3758
+ selector: "ui-payment-qbo-body",
3759
+ inputs: ["ctx", "config"]
3760
+ }],
3761
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3762
+ });
3763
+ }
3764
+ };
3765
+ i0.ɵɵngDeclareClassMetadata({
3766
+ minVersion: "12.0.0",
3767
+ version: "22.2.2",
3768
+ ngImport: i0,
3769
+ type: QboPaymentMethodComponent,
3770
+ decorators: [{
3771
+ type: Component,
3772
+ args: [{
3773
+ selector: "ui-qbo-payment-method",
3774
+ standalone: true,
3775
+ changeDetection: ChangeDetectionStrategy.OnPush,
3776
+ imports: [PaymentQboBodyComponent],
3777
+ providers: [{
3778
+ provide: PAYMENT_METHOD_PLUGIN,
3779
+ useExisting: forwardRef(() => QboPaymentMethodComponent)
3780
+ }],
3781
+ host: { style: "display: none" },
3782
+ template: `<ng-template #body let-ctx><ui-payment-qbo-body [ctx]="ctx" [config]="self" /></ng-template>`
3783
+ }]
3784
+ }],
3785
+ propDecorators: {
3786
+ createPayment: [{
3787
+ type: i0.Input,
3788
+ args: [{
3789
+ isSignal: true,
3790
+ alias: "createPayment",
3791
+ required: false
3792
+ }]
3793
+ }],
3794
+ estimateFees: [{
3795
+ type: i0.Input,
3796
+ args: [{
3797
+ isSignal: true,
3798
+ alias: "estimateFees",
3799
+ required: false
3800
+ }]
3801
+ }],
3802
+ environment: [{
3803
+ type: i0.Input,
3804
+ args: [{
3805
+ isSignal: true,
3806
+ alias: "environment",
3807
+ required: false
3808
+ }]
3809
+ }],
3810
+ cardholderName: [{
3811
+ type: i0.Input,
3812
+ args: [{
3813
+ isSignal: true,
3814
+ alias: "cardholderName",
3815
+ required: false
3816
+ }]
3817
+ }],
3818
+ requireName: [{
3819
+ type: i0.Input,
3820
+ args: [{
3821
+ isSignal: true,
3822
+ alias: "requireName",
3823
+ required: false
3824
+ }]
3825
+ }],
3826
+ requirePostalCode: [{
3827
+ type: i0.Input,
3828
+ args: [{
3829
+ isSignal: true,
3830
+ alias: "requirePostalCode",
3831
+ required: false
3832
+ }]
3833
+ }],
3834
+ postalCountry: [{
3835
+ type: i0.Input,
3836
+ args: [{
3837
+ isSignal: true,
3838
+ alias: "postalCountry",
3839
+ required: false
3840
+ }]
3841
+ }],
3842
+ requireAchConsent: [{
3843
+ type: i0.Input,
3844
+ args: [{
3845
+ isSignal: true,
3846
+ alias: "requireAchConsent",
3847
+ required: false
3848
+ }]
3849
+ }],
3850
+ methodListInput: [{
3851
+ type: i0.Input,
3852
+ args: [{
3853
+ isSignal: true,
3854
+ alias: "methodList",
3855
+ required: false
3856
+ }]
3857
+ }],
3858
+ estimateTimeoutMs: [{
3859
+ type: i0.Input,
3860
+ args: [{
3861
+ isSignal: true,
3862
+ alias: "estimateTimeoutMs",
3863
+ required: false
3864
+ }]
3865
+ }],
3866
+ payableRef: [{
3867
+ type: i0.Input,
3868
+ args: [{
3869
+ isSignal: true,
3870
+ alias: "payableRef",
3871
+ required: false
3872
+ }]
3873
+ }],
3874
+ attemptKey: [{
3875
+ type: i0.Input,
3876
+ args: [{
3877
+ isSignal: true,
3878
+ alias: "attemptKey",
3879
+ required: false
3880
+ }]
3881
+ }],
3882
+ checkStatus: [{
3883
+ type: i0.Input,
3884
+ args: [{
3885
+ isSignal: true,
3886
+ alias: "checkStatus",
3887
+ required: false
3888
+ }]
3889
+ }],
3890
+ paid: [{
3891
+ type: i0.Input,
3892
+ args: [{
3893
+ isSignal: true,
3894
+ alias: "paid",
3895
+ required: false
3896
+ }]
3897
+ }],
3898
+ hostPending: [{
3899
+ type: i0.Input,
3900
+ args: [{
3901
+ isSignal: true,
3902
+ alias: "hostPending",
3903
+ required: false
3904
+ }]
3905
+ }],
3906
+ statusPollMs: [{
3907
+ type: i0.Input,
3908
+ args: [{
3909
+ isSignal: true,
3910
+ alias: "statusPollMs",
3911
+ required: false
3912
+ }]
3913
+ }],
3914
+ statusPollMaxMs: [{
3915
+ type: i0.Input,
3916
+ args: [{
3917
+ isSignal: true,
3918
+ alias: "statusPollMaxMs",
3919
+ required: false
3920
+ }]
3921
+ }],
3922
+ statusCheckTimeoutMs: [{
3923
+ type: i0.Input,
3924
+ args: [{
3925
+ isSignal: true,
3926
+ alias: "statusCheckTimeoutMs",
3927
+ required: false
3928
+ }]
3929
+ }],
3930
+ statusFailGraceMs: [{
3931
+ type: i0.Input,
3932
+ args: [{
3933
+ isSignal: true,
3934
+ alias: "statusFailGraceMs",
3935
+ required: false
3936
+ }]
3937
+ }],
3938
+ allowStartOver: [{
3939
+ type: i0.Input,
3940
+ args: [{
3941
+ isSignal: true,
3942
+ alias: "allowStartOver",
3943
+ required: false
3944
+ }]
3945
+ }],
3946
+ offlineOverride: [{
3947
+ type: i0.Input,
3948
+ args: [{
3949
+ isSignal: true,
3950
+ alias: "offlineOverride",
3951
+ required: false
3952
+ }]
3953
+ }],
3954
+ paymentTimeoutMs: [{
3955
+ type: i0.Input,
3956
+ args: [{
3957
+ isSignal: true,
3958
+ alias: "paymentTimeoutMs",
3959
+ required: false
3960
+ }]
3961
+ }],
3962
+ readinessCheck: [{
3963
+ type: i0.Input,
3964
+ args: [{
3965
+ isSignal: true,
3966
+ alias: "readinessCheck",
3967
+ required: false
3968
+ }]
3969
+ }],
3970
+ readinessTimeoutMs: [{
3971
+ type: i0.Input,
3972
+ args: [{
3973
+ isSignal: true,
3974
+ alias: "readinessTimeoutMs",
3975
+ required: false
3976
+ }]
3977
+ }],
3978
+ readinessEveryMs: [{
3979
+ type: i0.Input,
3980
+ args: [{
3981
+ isSignal: true,
3982
+ alias: "readinessEveryMs",
3983
+ required: false
3984
+ }]
3985
+ }],
3986
+ feesRequired: [{
3987
+ type: i0.Input,
3988
+ args: [{
3989
+ isSignal: true,
3990
+ alias: "feesRequired",
3991
+ required: false
3992
+ }]
3993
+ }],
3994
+ receiptNoteInput: [{
3995
+ type: i0.Input,
3996
+ args: [{
3997
+ isSignal: true,
3998
+ alias: "receiptNote",
3999
+ required: false
4000
+ }]
4001
+ }],
4002
+ body: [{
4003
+ type: i0.ViewChild,
4004
+ args: ["body", { isSignal: true }]
4005
+ }]
4006
+ }
4007
+ });
4008
+ var QboHostedPayComponent = class QboHostedPayComponent {
4009
+ constructor() {
4010
+ this.labels = inject(UiLabelsService);
4011
+ this.state = input("loading", ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
4012
+ this.companyName = input("", ...ngDevMode ? [{ debugName: "companyName" }] : /* istanbul ignore next */ []);
4013
+ this.amountLabel = input("", ...ngDevMode ? [{ debugName: "amountLabel" }] : /* istanbul ignore next */ []);
4014
+ this.description = input("", ...ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []);
4015
+ this.errorMessage = input("", ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
4016
+ this.environment = input(null, ...ngDevMode ? [{ debugName: "environment" }] : /* istanbul ignore next */ []);
4017
+ this.methods = input(null, ...ngDevMode ? [{ debugName: "methods" }] : /* istanbul ignore next */ []);
4018
+ this.method = input("card", ...ngDevMode ? [{ debugName: "method" }] : /* istanbul ignore next */ []);
4019
+ this.cardholderName = input("", ...ngDevMode ? [{ debugName: "cardholderName" }] : /* istanbul ignore next */ []);
4020
+ this.requirePostalCode = input(false, ...ngDevMode ? [{ debugName: "requirePostalCode" }] : /* istanbul ignore next */ []);
4021
+ this.requireName = input(false, ...ngDevMode ? [{ debugName: "requireName" }] : /* istanbul ignore next */ []);
4022
+ this.postalCountry = input("US", ...ngDevMode ? [{ debugName: "postalCountry" }] : /* istanbul ignore next */ []);
4023
+ this.confirmAccountNumber = input(true, ...ngDevMode ? [{ debugName: "confirmAccountNumber" }] : /* istanbul ignore next */ []);
4024
+ this.achConsentText = input(null, ...ngDevMode ? [{ debugName: "achConsentText" }] : /* istanbul ignore next */ []);
4025
+ this.requireAchConsent = input(true, ...ngDevMode ? [{ debugName: "requireAchConsent" }] : /* istanbul ignore next */ []);
4026
+ this.mode = input("payment", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
4027
+ this.errorDisplay = input("friendly", ...ngDevMode ? [{ debugName: "errorDisplay" }] : /* istanbul ignore next */ []);
4028
+ this.errorMessages = input(null, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
4029
+ this.errorFallback = input("", ...ngDevMode ? [{ debugName: "errorFallback" }] : /* istanbul ignore next */ []);
4030
+ this.a11yMessages = input(null, ...ngDevMode ? [{ debugName: "a11yMessages" }] : /* istanbul ignore next */ []);
4031
+ this.label = input(null, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
4032
+ this.formLabel = computed(() => this.label() ?? this.labels.t("qboPayment.label"), ...ngDevMode ? [{ debugName: "formLabel" }] : /* istanbul ignore next */ []);
4033
+ this.successKind = input(null, ...ngDevMode ? [{ debugName: "successKind" }] : /* istanbul ignore next */ []);
4034
+ this.lastMethod = signal(null, ...ngDevMode ? [{ debugName: "lastMethod" }] : /* istanbul ignore next */ []);
4035
+ this.effectiveSuccessKind = computed(() => this.successKind() ?? (this.lastMethod() === "ach" ? "submitted" : "received"), ...ngDevMode ? [{ debugName: "effectiveSuccessKind" }] : /* istanbul ignore next */ []);
4036
+ this.titleInput = input(null, {
4037
+ ...ngDevMode ? { debugName: "titleInput" } : /* istanbul ignore next */ {},
4038
+ alias: "title"
4039
+ });
4040
+ this.title = computed(() => this.titleInput() ?? (this.amountLabel() ? this.labels.t("qboHostedPay.title", { amount: this.amountLabel() }) : this.labels.t("qboHostedPay.titleNoAmount")), ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
4041
+ this.submitText = computed(() => this.amountLabel() ? this.labels.t("qboHostedPay.pay", { amount: this.amountLabel() }) : "", ...ngDevMode ? [{ debugName: "submitText" }] : /* istanbul ignore next */ []);
4042
+ this.payableRef = input(null, ...ngDevMode ? [{ debugName: "payableRef" }] : /* istanbul ignore next */ []);
4043
+ this.attemptKey = input(null, ...ngDevMode ? [{ debugName: "attemptKey" }] : /* istanbul ignore next */ []);
4044
+ this.checkStatus = input(null, ...ngDevMode ? [{ debugName: "checkStatus" }] : /* istanbul ignore next */ []);
4045
+ this.paid = input(false, ...ngDevMode ? [{ debugName: "paid" }] : /* istanbul ignore next */ []);
4046
+ this.hostPending = input(false, ...ngDevMode ? [{ debugName: "hostPending" }] : /* istanbul ignore next */ []);
4047
+ this.statusPollMs = input(PAYMENT_STATUS_POLL_MS, ...ngDevMode ? [{ debugName: "statusPollMs" }] : /* istanbul ignore next */ []);
4048
+ this.statusPollMaxMs = input(PAYMENT_STATUS_POLL_MAX_MS, ...ngDevMode ? [{ debugName: "statusPollMaxMs" }] : /* istanbul ignore next */ []);
4049
+ this.statusCheckTimeoutMs = input(PAYMENT_STATUS_CHECK_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "statusCheckTimeoutMs" }] : /* istanbul ignore next */ []);
4050
+ this.statusFailGraceMs = input(PAYMENT_STATUS_FAIL_GRACE_MS, ...ngDevMode ? [{ debugName: "statusFailGraceMs" }] : /* istanbul ignore next */ []);
4051
+ this.allowStartOver = input(false, ...ngDevMode ? [{ debugName: "allowStartOver" }] : /* istanbul ignore next */ []);
4052
+ this.offlineOverride = input(false, ...ngDevMode ? [{ debugName: "offlineOverride" }] : /* istanbul ignore next */ []);
4053
+ this.hostSilenceMs = input(PAYMENT_HOST_SILENCE_MS, ...ngDevMode ? [{ debugName: "hostSilenceMs" }] : /* istanbul ignore next */ []);
4054
+ this.readinessCheck = input(null, ...ngDevMode ? [{ debugName: "readinessCheck" }] : /* istanbul ignore next */ []);
4055
+ this.readinessTimeoutMs = input(PAYMENT_READINESS_TIMEOUT_MS, ...ngDevMode ? [{ debugName: "readinessTimeoutMs" }] : /* istanbul ignore next */ []);
4056
+ this.readinessEveryMs = input(PAYMENT_READINESS_EVERY_MS, ...ngDevMode ? [{ debugName: "readinessEveryMs" }] : /* istanbul ignore next */ []);
4057
+ this.inFlightChange = output();
4058
+ this.outcome = output();
4059
+ this.attemptKeyChange = output();
4060
+ this.readinessChange = output();
4061
+ this.form = viewChild(QboPaymentComponent, ...ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []);
4062
+ this.tokenized = output();
4063
+ this.failed = output();
4064
+ this.localError = signal("", ...ngDevMode ? [{ debugName: "localError" }] : /* istanbul ignore next */ []);
4065
+ effect(() => {
4066
+ if (this.state() === "success") untracked(() => this.form()?.markSucceeded());
4067
+ });
4068
+ effect(() => {
4069
+ const state = this.state();
4070
+ untracked(() => {
4071
+ const attempt = this.form()?.attempt;
4072
+ if (isDevMode() && state === "form" && attempt && (attempt.waitingForHost() || attempt.inFlight())) console.warn("ui-qbo-hosted-pay: state went back to \"form\" while the attempt is still locked: call markFailed() (declined), markNotCharged() (nothing was sent) or markUnknown() on the page first");
4073
+ });
4074
+ });
4075
+ }
4076
+ markUnknown() {
4077
+ this.form()?.markUnknown();
4078
+ }
4079
+ markSucceeded() {
4080
+ this.form()?.markSucceeded();
4081
+ }
4082
+ markFailed() {
4083
+ this.form()?.markFailed();
4084
+ }
4085
+ markNotCharged() {
4086
+ this.form()?.markNotCharged();
4087
+ }
4088
+ resetPaid() {
4089
+ this.form()?.resetPaid();
4090
+ }
4091
+ onFailed(failure) {
4092
+ this.localError.set(failure.message);
4093
+ this.failed.emit(failure);
4094
+ }
4095
+ onTokenized(event) {
4096
+ this.localError.set("");
4097
+ this.lastMethod.set(event.method);
4098
+ this.tokenized.emit(event);
4099
+ }
4100
+ static {
4101
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4102
+ minVersion: "12.0.0",
4103
+ version: "22.2.2",
4104
+ ngImport: i0,
4105
+ type: QboHostedPayComponent,
4106
+ deps: [],
4107
+ target: i0.ɵɵFactoryTarget.Component
4108
+ });
4109
+ }
4110
+ static {
4111
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
4112
+ minVersion: "17.0.0",
4113
+ version: "22.2.2",
4114
+ type: QboHostedPayComponent,
4115
+ isStandalone: true,
4116
+ selector: "ui-qbo-hosted-pay",
4117
+ inputs: {
4118
+ state: {
4119
+ classPropertyName: "state",
4120
+ publicName: "state",
4121
+ isSignal: true,
4122
+ isRequired: false,
4123
+ transformFunction: null
4124
+ },
4125
+ companyName: {
4126
+ classPropertyName: "companyName",
4127
+ publicName: "companyName",
4128
+ isSignal: true,
4129
+ isRequired: false,
4130
+ transformFunction: null
4131
+ },
4132
+ amountLabel: {
4133
+ classPropertyName: "amountLabel",
4134
+ publicName: "amountLabel",
4135
+ isSignal: true,
4136
+ isRequired: false,
4137
+ transformFunction: null
4138
+ },
4139
+ description: {
4140
+ classPropertyName: "description",
4141
+ publicName: "description",
4142
+ isSignal: true,
4143
+ isRequired: false,
4144
+ transformFunction: null
4145
+ },
4146
+ errorMessage: {
4147
+ classPropertyName: "errorMessage",
4148
+ publicName: "errorMessage",
4149
+ isSignal: true,
4150
+ isRequired: false,
4151
+ transformFunction: null
4152
+ },
4153
+ environment: {
4154
+ classPropertyName: "environment",
4155
+ publicName: "environment",
4156
+ isSignal: true,
4157
+ isRequired: false,
4158
+ transformFunction: null
4159
+ },
4160
+ methods: {
4161
+ classPropertyName: "methods",
4162
+ publicName: "methods",
4163
+ isSignal: true,
4164
+ isRequired: false,
4165
+ transformFunction: null
4166
+ },
4167
+ method: {
4168
+ classPropertyName: "method",
4169
+ publicName: "method",
4170
+ isSignal: true,
4171
+ isRequired: false,
4172
+ transformFunction: null
4173
+ },
4174
+ cardholderName: {
4175
+ classPropertyName: "cardholderName",
4176
+ publicName: "cardholderName",
4177
+ isSignal: true,
4178
+ isRequired: false,
4179
+ transformFunction: null
4180
+ },
4181
+ requirePostalCode: {
4182
+ classPropertyName: "requirePostalCode",
4183
+ publicName: "requirePostalCode",
4184
+ isSignal: true,
4185
+ isRequired: false,
4186
+ transformFunction: null
4187
+ },
4188
+ requireName: {
4189
+ classPropertyName: "requireName",
4190
+ publicName: "requireName",
4191
+ isSignal: true,
4192
+ isRequired: false,
4193
+ transformFunction: null
4194
+ },
4195
+ postalCountry: {
4196
+ classPropertyName: "postalCountry",
4197
+ publicName: "postalCountry",
4198
+ isSignal: true,
4199
+ isRequired: false,
4200
+ transformFunction: null
4201
+ },
4202
+ confirmAccountNumber: {
4203
+ classPropertyName: "confirmAccountNumber",
4204
+ publicName: "confirmAccountNumber",
4205
+ isSignal: true,
4206
+ isRequired: false,
4207
+ transformFunction: null
4208
+ },
4209
+ achConsentText: {
4210
+ classPropertyName: "achConsentText",
4211
+ publicName: "achConsentText",
4212
+ isSignal: true,
4213
+ isRequired: false,
4214
+ transformFunction: null
4215
+ },
4216
+ requireAchConsent: {
4217
+ classPropertyName: "requireAchConsent",
4218
+ publicName: "requireAchConsent",
4219
+ isSignal: true,
4220
+ isRequired: false,
4221
+ transformFunction: null
4222
+ },
4223
+ mode: {
4224
+ classPropertyName: "mode",
4225
+ publicName: "mode",
4226
+ isSignal: true,
4227
+ isRequired: false,
4228
+ transformFunction: null
4229
+ },
4230
+ errorDisplay: {
4231
+ classPropertyName: "errorDisplay",
4232
+ publicName: "errorDisplay",
4233
+ isSignal: true,
4234
+ isRequired: false,
4235
+ transformFunction: null
4236
+ },
4237
+ errorMessages: {
4238
+ classPropertyName: "errorMessages",
4239
+ publicName: "errorMessages",
4240
+ isSignal: true,
4241
+ isRequired: false,
4242
+ transformFunction: null
4243
+ },
4244
+ errorFallback: {
4245
+ classPropertyName: "errorFallback",
4246
+ publicName: "errorFallback",
4247
+ isSignal: true,
4248
+ isRequired: false,
4249
+ transformFunction: null
4250
+ },
4251
+ a11yMessages: {
4252
+ classPropertyName: "a11yMessages",
4253
+ publicName: "a11yMessages",
4254
+ isSignal: true,
4255
+ isRequired: false,
4256
+ transformFunction: null
4257
+ },
4258
+ label: {
4259
+ classPropertyName: "label",
4260
+ publicName: "label",
4261
+ isSignal: true,
4262
+ isRequired: false,
4263
+ transformFunction: null
4264
+ },
4265
+ successKind: {
4266
+ classPropertyName: "successKind",
4267
+ publicName: "successKind",
4268
+ isSignal: true,
4269
+ isRequired: false,
4270
+ transformFunction: null
4271
+ },
4272
+ titleInput: {
4273
+ classPropertyName: "titleInput",
4274
+ publicName: "title",
4275
+ isSignal: true,
4276
+ isRequired: false,
4277
+ transformFunction: null
4278
+ },
4279
+ payableRef: {
4280
+ classPropertyName: "payableRef",
4281
+ publicName: "payableRef",
4282
+ isSignal: true,
4283
+ isRequired: false,
4284
+ transformFunction: null
4285
+ },
4286
+ attemptKey: {
4287
+ classPropertyName: "attemptKey",
4288
+ publicName: "attemptKey",
4289
+ isSignal: true,
4290
+ isRequired: false,
4291
+ transformFunction: null
4292
+ },
4293
+ checkStatus: {
4294
+ classPropertyName: "checkStatus",
4295
+ publicName: "checkStatus",
4296
+ isSignal: true,
4297
+ isRequired: false,
4298
+ transformFunction: null
4299
+ },
4300
+ paid: {
4301
+ classPropertyName: "paid",
4302
+ publicName: "paid",
4303
+ isSignal: true,
4304
+ isRequired: false,
4305
+ transformFunction: null
4306
+ },
4307
+ hostPending: {
4308
+ classPropertyName: "hostPending",
4309
+ publicName: "hostPending",
4310
+ isSignal: true,
4311
+ isRequired: false,
4312
+ transformFunction: null
4313
+ },
4314
+ statusPollMs: {
4315
+ classPropertyName: "statusPollMs",
4316
+ publicName: "statusPollMs",
4317
+ isSignal: true,
4318
+ isRequired: false,
4319
+ transformFunction: null
4320
+ },
4321
+ statusPollMaxMs: {
4322
+ classPropertyName: "statusPollMaxMs",
4323
+ publicName: "statusPollMaxMs",
4324
+ isSignal: true,
4325
+ isRequired: false,
4326
+ transformFunction: null
4327
+ },
4328
+ statusCheckTimeoutMs: {
4329
+ classPropertyName: "statusCheckTimeoutMs",
4330
+ publicName: "statusCheckTimeoutMs",
4331
+ isSignal: true,
4332
+ isRequired: false,
4333
+ transformFunction: null
4334
+ },
4335
+ statusFailGraceMs: {
4336
+ classPropertyName: "statusFailGraceMs",
4337
+ publicName: "statusFailGraceMs",
4338
+ isSignal: true,
4339
+ isRequired: false,
4340
+ transformFunction: null
4341
+ },
4342
+ allowStartOver: {
4343
+ classPropertyName: "allowStartOver",
4344
+ publicName: "allowStartOver",
4345
+ isSignal: true,
4346
+ isRequired: false,
4347
+ transformFunction: null
4348
+ },
4349
+ offlineOverride: {
4350
+ classPropertyName: "offlineOverride",
4351
+ publicName: "offlineOverride",
4352
+ isSignal: true,
4353
+ isRequired: false,
4354
+ transformFunction: null
4355
+ },
4356
+ hostSilenceMs: {
4357
+ classPropertyName: "hostSilenceMs",
4358
+ publicName: "hostSilenceMs",
4359
+ isSignal: true,
4360
+ isRequired: false,
4361
+ transformFunction: null
4362
+ },
4363
+ readinessCheck: {
4364
+ classPropertyName: "readinessCheck",
4365
+ publicName: "readinessCheck",
4366
+ isSignal: true,
4367
+ isRequired: false,
4368
+ transformFunction: null
4369
+ },
4370
+ readinessTimeoutMs: {
4371
+ classPropertyName: "readinessTimeoutMs",
4372
+ publicName: "readinessTimeoutMs",
4373
+ isSignal: true,
4374
+ isRequired: false,
4375
+ transformFunction: null
4376
+ },
4377
+ readinessEveryMs: {
4378
+ classPropertyName: "readinessEveryMs",
4379
+ publicName: "readinessEveryMs",
4380
+ isSignal: true,
4381
+ isRequired: false,
4382
+ transformFunction: null
4383
+ }
4384
+ },
4385
+ outputs: {
4386
+ inFlightChange: "inFlightChange",
4387
+ outcome: "outcome",
4388
+ attemptKeyChange: "attemptKeyChange",
4389
+ readinessChange: "readinessChange",
4390
+ tokenized: "tokenized",
4391
+ failed: "failed"
4392
+ },
4393
+ host: { properties: { "attr.aria-busy": "state() === \"loading\" || state() === \"processing\" ? \"true\" : null" } },
4394
+ viewQueries: [{
4395
+ propertyName: "form",
4396
+ first: true,
4397
+ predicate: QboPaymentComponent,
4398
+ descendants: true,
4399
+ isSignal: true
4400
+ }],
4401
+ ngImport: i0,
4402
+ template: `
4403
+ <section class="qbh" [attr.aria-label]="title()" data-testid="qbo-hosted-pay">
4404
+ <header class="qbh-header">
4405
+ <h1 class="qbh-title" data-testid="qbo-hosted-title">{{ title() }}</h1>
4406
+ @if (companyName()) { <p class="qbh-company" data-testid="qbo-hosted-company">{{ companyName() }}</p> }
4407
+ @if (description()) { <p class="qbh-desc" data-testid="qbo-hosted-description">{{ description() }}</p> }
4408
+ </header>
4409
+ @switch (state()) {
4410
+ @case ('loading') {
4411
+ <div class="qbh-body" data-testid="qbo-hosted-loading">
4412
+ <ui-live-region data-testid="qbo-hosted-loading-status" [message]="labels.t('qboHostedPay.loading')" />
4413
+ <div aria-hidden="true"><ui-skeleton [height]="44" [mb]="10" /><ui-skeleton [height]="44" [mb]="10" /><ui-skeleton [height]="44" width="60%" /></div>
4414
+ </div>
4415
+ }
4416
+ @case ('expired') {
4417
+ <ui-alert variant="warning" [title]="labels.t('qboHostedPay.expiredTitle')" data-testid="qbo-hosted-expired">{{ labels.t('qboHostedPay.expired') }}</ui-alert>
4418
+ }
4419
+ @case ('used') {
4420
+ <ui-alert variant="success" [title]="labels.t('qboHostedPay.usedTitle')" data-testid="qbo-hosted-used">{{ labels.t('qboHostedPay.used') }}</ui-alert>
4421
+ }
4422
+ @case ('success') {
4423
+ <ui-alert variant="success" [title]="labels.t(effectiveSuccessKind() === 'submitted' ? 'qboHostedPay.submittedTitle' : 'qboHostedPay.successTitle')" data-testid="qbo-hosted-success">{{ labels.t(effectiveSuccessKind() === 'submitted' ? 'qboHostedPay.submitted' : 'qboHostedPay.success', { amount: amountLabel() }) }}</ui-alert>
4424
+ }
4425
+ @case ('error') {
4426
+ <ui-alert variant="danger" [title]="labels.t('qboHostedPay.errorTitle')" data-testid="qbo-hosted-error">{{ errorMessage() }}</ui-alert>
4427
+ }
4428
+ @default {
4429
+ <div class="qbh-body">
4430
+ @if (errorMessage() && !localError()) { <ui-alert variant="danger" data-testid="qbo-hosted-form-error">{{ errorMessage() }}</ui-alert> }
4431
+ <ui-qbo-payment [mode]="mode()" [environment]="environment()" [methods]="methods()" [method]="method()" [pending]="state() === 'processing'" [submitLabel]="submitText()" [showErrors]="false"
4432
+ [label]="formLabel()" [cardholderName]="cardholderName()" [requireName]="requireName()" [requirePostalCode]="requirePostalCode()" [postalCountry]="postalCountry()"
4433
+ [confirmAccountNumber]="confirmAccountNumber()" [requireAchConsent]="requireAchConsent()" [achConsentText]="achConsentText()" [errorDisplay]="errorDisplay()" [errorMessages]="errorMessages()"
4434
+ [errorFallback]="errorFallback()" [a11yMessages]="a11yMessages()"
4435
+ [payableRef]="payableRef()" [attemptKey]="attemptKey()" [checkStatus]="checkStatus()" [paid]="paid()" [hostPending]="hostPending()" [statusPollMs]="statusPollMs()" [statusPollMaxMs]="statusPollMaxMs()" [statusCheckTimeoutMs]="statusCheckTimeoutMs()" [statusFailGraceMs]="statusFailGraceMs()" [hostSilenceMs]="hostSilenceMs()" [allowStartOver]="allowStartOver()" [offlineOverride]="offlineOverride()"
4436
+ [readinessCheck]="readinessCheck()" [readinessTimeoutMs]="readinessTimeoutMs()" [readinessEveryMs]="readinessEveryMs()"
4437
+ (tokenized)="onTokenized($event)" (failed)="onFailed($event)" (inFlightChange)="inFlightChange.emit($event)" (outcome)="outcome.emit($event)"
4438
+ (attemptKeyChange)="attemptKeyChange.emit($event)" (readinessChange)="readinessChange.emit($event)" />
4439
+ @if (localError()) { <ui-alert variant="danger" data-testid="qbo-hosted-field-error">{{ localError() }}</ui-alert> }
4440
+ </div>
4441
+ }
4442
+ }
4443
+ <footer class="qbh-footer" data-testid="qbo-hosted-footer">{{ labels.t('qboHostedPay.footer') }}</footer>
4444
+ </section>
4445
+ `,
4446
+ isInline: true,
4447
+ styles: ["ui-qbo-hosted-pay{display:block;min-width:0}ui-qbo-hosted-pay .qbh{max-width:440px;margin:0 auto;padding:24px 16px}ui-qbo-hosted-pay .qbh-header{text-align:center;margin-bottom:16px}ui-qbo-hosted-pay .qbh-title{overflow-wrap:anywhere;margin:0;font-size:1.5rem;font-weight:700;color:var(--ui-text, #0f172a)}ui-qbo-hosted-pay .qbh-company{overflow-wrap:anywhere;margin:4px 0 0;font-size:.9375rem;color:var(--ui-text-muted, #475569)}ui-qbo-hosted-pay .qbh-desc{overflow-wrap:anywhere;margin:4px 0 0;font-size:.875rem;color:var(--ui-text-muted, #64748b)}ui-qbo-hosted-pay .qbh-body{display:flex;flex-direction:column;gap:12px}ui-qbo-hosted-pay .qbh-footer{margin-top:20px;text-align:center;font-size:.75rem;color:var(--ui-text-muted, #64748b)}\n"],
4448
+ dependencies: [
4449
+ {
4450
+ kind: "component",
4451
+ type: AlertComponent,
4452
+ selector: "ui-alert",
4453
+ inputs: [
4454
+ "variant",
4455
+ "title",
4456
+ "dismissible",
4457
+ "dismissAriaLabel",
4458
+ "quiet",
4459
+ "compact",
4460
+ "inline",
4461
+ "fill"
4462
+ ],
4463
+ outputs: ["dismissed"]
4464
+ },
4465
+ {
4466
+ kind: "component",
4467
+ type: LiveRegionComponent,
4468
+ selector: "ui-live-region",
4469
+ inputs: [
4470
+ "message",
4471
+ "politeness",
4472
+ "atomic",
4473
+ "visible"
4474
+ ]
4475
+ },
4476
+ {
4477
+ kind: "component",
4478
+ type: QboPaymentComponent,
4479
+ selector: "ui-qbo-payment",
4480
+ inputs: [
4481
+ "mountOnly",
4482
+ "mode",
4483
+ "method",
4484
+ "methods",
4485
+ "environment",
4486
+ "cardholderName",
4487
+ "requireName",
4488
+ "requirePostalCode",
4489
+ "postalCountry",
4490
+ "confirmAccountNumber",
4491
+ "requireAchConsent",
4492
+ "achConsentText",
4493
+ "showStatus",
4494
+ "payableRef",
4495
+ "attemptKey",
4496
+ "checkStatus",
4497
+ "paid",
4498
+ "hostPending",
4499
+ "statusPollMs",
4500
+ "statusPollMaxMs",
4501
+ "statusCheckTimeoutMs",
4502
+ "statusFailGraceMs",
4503
+ "allowStartOver",
4504
+ "offlineOverride",
4505
+ "hostSilenceMs",
4506
+ "readinessCheck",
4507
+ "readinessTimeoutMs",
4508
+ "readinessEveryMs",
4509
+ "submitLabel",
4510
+ "showSubmit",
4511
+ "disabled",
4512
+ "pending",
4513
+ "label",
4514
+ "required",
4515
+ "showErrors",
4516
+ "errorDisplay",
4517
+ "errorMessages",
4518
+ "errorFallback",
4519
+ "a11yMessages"
4520
+ ],
4521
+ outputs: [
4522
+ "methodChange",
4523
+ "tokenized",
4524
+ "failed",
4525
+ "inFlightChange",
4526
+ "outcome",
4527
+ "attemptKeyChange",
4528
+ "readinessChange"
4529
+ ]
4530
+ },
4531
+ {
4532
+ kind: "component",
4533
+ type: SkeletonComponent,
4534
+ selector: "ui-skeleton",
4535
+ inputs: [
4536
+ "height",
4537
+ "width",
4538
+ "radius",
4539
+ "mb",
4540
+ "ariaLabel"
4541
+ ]
4542
+ }
4543
+ ],
4544
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
4545
+ encapsulation: i0.ViewEncapsulation.None
4546
+ });
4547
+ }
4548
+ };
4549
+ i0.ɵɵngDeclareClassMetadata({
4550
+ minVersion: "12.0.0",
4551
+ version: "22.2.2",
4552
+ ngImport: i0,
4553
+ type: QboHostedPayComponent,
4554
+ decorators: [{
4555
+ type: Component,
4556
+ args: [{
4557
+ selector: "ui-qbo-hosted-pay",
4558
+ standalone: true,
4559
+ changeDetection: ChangeDetectionStrategy.OnPush,
4560
+ encapsulation: ViewEncapsulation.None,
4561
+ imports: [
4562
+ AlertComponent,
4563
+ LiveRegionComponent,
4564
+ QboPaymentComponent,
4565
+ SkeletonComponent
4566
+ ],
4567
+ host: { "[attr.aria-busy]": "state() === \"loading\" || state() === \"processing\" ? \"true\" : null" },
4568
+ template: `
4569
+ <section class="qbh" [attr.aria-label]="title()" data-testid="qbo-hosted-pay">
4570
+ <header class="qbh-header">
4571
+ <h1 class="qbh-title" data-testid="qbo-hosted-title">{{ title() }}</h1>
4572
+ @if (companyName()) { <p class="qbh-company" data-testid="qbo-hosted-company">{{ companyName() }}</p> }
4573
+ @if (description()) { <p class="qbh-desc" data-testid="qbo-hosted-description">{{ description() }}</p> }
4574
+ </header>
4575
+ @switch (state()) {
4576
+ @case ('loading') {
4577
+ <div class="qbh-body" data-testid="qbo-hosted-loading">
4578
+ <ui-live-region data-testid="qbo-hosted-loading-status" [message]="labels.t('qboHostedPay.loading')" />
4579
+ <div aria-hidden="true"><ui-skeleton [height]="44" [mb]="10" /><ui-skeleton [height]="44" [mb]="10" /><ui-skeleton [height]="44" width="60%" /></div>
4580
+ </div>
4581
+ }
4582
+ @case ('expired') {
4583
+ <ui-alert variant="warning" [title]="labels.t('qboHostedPay.expiredTitle')" data-testid="qbo-hosted-expired">{{ labels.t('qboHostedPay.expired') }}</ui-alert>
4584
+ }
4585
+ @case ('used') {
4586
+ <ui-alert variant="success" [title]="labels.t('qboHostedPay.usedTitle')" data-testid="qbo-hosted-used">{{ labels.t('qboHostedPay.used') }}</ui-alert>
4587
+ }
4588
+ @case ('success') {
4589
+ <ui-alert variant="success" [title]="labels.t(effectiveSuccessKind() === 'submitted' ? 'qboHostedPay.submittedTitle' : 'qboHostedPay.successTitle')" data-testid="qbo-hosted-success">{{ labels.t(effectiveSuccessKind() === 'submitted' ? 'qboHostedPay.submitted' : 'qboHostedPay.success', { amount: amountLabel() }) }}</ui-alert>
4590
+ }
4591
+ @case ('error') {
4592
+ <ui-alert variant="danger" [title]="labels.t('qboHostedPay.errorTitle')" data-testid="qbo-hosted-error">{{ errorMessage() }}</ui-alert>
4593
+ }
4594
+ @default {
4595
+ <div class="qbh-body">
4596
+ @if (errorMessage() && !localError()) { <ui-alert variant="danger" data-testid="qbo-hosted-form-error">{{ errorMessage() }}</ui-alert> }
4597
+ <ui-qbo-payment [mode]="mode()" [environment]="environment()" [methods]="methods()" [method]="method()" [pending]="state() === 'processing'" [submitLabel]="submitText()" [showErrors]="false"
4598
+ [label]="formLabel()" [cardholderName]="cardholderName()" [requireName]="requireName()" [requirePostalCode]="requirePostalCode()" [postalCountry]="postalCountry()"
4599
+ [confirmAccountNumber]="confirmAccountNumber()" [requireAchConsent]="requireAchConsent()" [achConsentText]="achConsentText()" [errorDisplay]="errorDisplay()" [errorMessages]="errorMessages()"
4600
+ [errorFallback]="errorFallback()" [a11yMessages]="a11yMessages()"
4601
+ [payableRef]="payableRef()" [attemptKey]="attemptKey()" [checkStatus]="checkStatus()" [paid]="paid()" [hostPending]="hostPending()" [statusPollMs]="statusPollMs()" [statusPollMaxMs]="statusPollMaxMs()" [statusCheckTimeoutMs]="statusCheckTimeoutMs()" [statusFailGraceMs]="statusFailGraceMs()" [hostSilenceMs]="hostSilenceMs()" [allowStartOver]="allowStartOver()" [offlineOverride]="offlineOverride()"
4602
+ [readinessCheck]="readinessCheck()" [readinessTimeoutMs]="readinessTimeoutMs()" [readinessEveryMs]="readinessEveryMs()"
4603
+ (tokenized)="onTokenized($event)" (failed)="onFailed($event)" (inFlightChange)="inFlightChange.emit($event)" (outcome)="outcome.emit($event)"
4604
+ (attemptKeyChange)="attemptKeyChange.emit($event)" (readinessChange)="readinessChange.emit($event)" />
4605
+ @if (localError()) { <ui-alert variant="danger" data-testid="qbo-hosted-field-error">{{ localError() }}</ui-alert> }
4606
+ </div>
4607
+ }
4608
+ }
4609
+ <footer class="qbh-footer" data-testid="qbo-hosted-footer">{{ labels.t('qboHostedPay.footer') }}</footer>
4610
+ </section>
4611
+ `,
4612
+ styles: ["ui-qbo-hosted-pay{display:block;min-width:0}ui-qbo-hosted-pay .qbh{max-width:440px;margin:0 auto;padding:24px 16px}ui-qbo-hosted-pay .qbh-header{text-align:center;margin-bottom:16px}ui-qbo-hosted-pay .qbh-title{overflow-wrap:anywhere;margin:0;font-size:1.5rem;font-weight:700;color:var(--ui-text, #0f172a)}ui-qbo-hosted-pay .qbh-company{overflow-wrap:anywhere;margin:4px 0 0;font-size:.9375rem;color:var(--ui-text-muted, #475569)}ui-qbo-hosted-pay .qbh-desc{overflow-wrap:anywhere;margin:4px 0 0;font-size:.875rem;color:var(--ui-text-muted, #64748b)}ui-qbo-hosted-pay .qbh-body{display:flex;flex-direction:column;gap:12px}ui-qbo-hosted-pay .qbh-footer{margin-top:20px;text-align:center;font-size:.75rem;color:var(--ui-text-muted, #64748b)}\n"]
4613
+ }]
4614
+ }],
4615
+ ctorParameters: () => [],
4616
+ propDecorators: {
4617
+ state: [{
4618
+ type: i0.Input,
4619
+ args: [{
4620
+ isSignal: true,
4621
+ alias: "state",
4622
+ required: false
4623
+ }]
4624
+ }],
4625
+ companyName: [{
4626
+ type: i0.Input,
4627
+ args: [{
4628
+ isSignal: true,
4629
+ alias: "companyName",
4630
+ required: false
4631
+ }]
4632
+ }],
4633
+ amountLabel: [{
4634
+ type: i0.Input,
4635
+ args: [{
4636
+ isSignal: true,
4637
+ alias: "amountLabel",
4638
+ required: false
4639
+ }]
4640
+ }],
4641
+ description: [{
4642
+ type: i0.Input,
4643
+ args: [{
4644
+ isSignal: true,
4645
+ alias: "description",
4646
+ required: false
4647
+ }]
4648
+ }],
4649
+ errorMessage: [{
4650
+ type: i0.Input,
4651
+ args: [{
4652
+ isSignal: true,
4653
+ alias: "errorMessage",
4654
+ required: false
4655
+ }]
4656
+ }],
4657
+ environment: [{
4658
+ type: i0.Input,
4659
+ args: [{
4660
+ isSignal: true,
4661
+ alias: "environment",
4662
+ required: false
4663
+ }]
4664
+ }],
4665
+ methods: [{
4666
+ type: i0.Input,
4667
+ args: [{
4668
+ isSignal: true,
4669
+ alias: "methods",
4670
+ required: false
4671
+ }]
4672
+ }],
4673
+ method: [{
4674
+ type: i0.Input,
4675
+ args: [{
4676
+ isSignal: true,
4677
+ alias: "method",
4678
+ required: false
4679
+ }]
4680
+ }],
4681
+ cardholderName: [{
4682
+ type: i0.Input,
4683
+ args: [{
4684
+ isSignal: true,
4685
+ alias: "cardholderName",
4686
+ required: false
4687
+ }]
4688
+ }],
4689
+ requirePostalCode: [{
4690
+ type: i0.Input,
4691
+ args: [{
4692
+ isSignal: true,
4693
+ alias: "requirePostalCode",
4694
+ required: false
4695
+ }]
4696
+ }],
4697
+ requireName: [{
4698
+ type: i0.Input,
4699
+ args: [{
4700
+ isSignal: true,
4701
+ alias: "requireName",
4702
+ required: false
4703
+ }]
4704
+ }],
4705
+ postalCountry: [{
4706
+ type: i0.Input,
4707
+ args: [{
4708
+ isSignal: true,
4709
+ alias: "postalCountry",
4710
+ required: false
4711
+ }]
4712
+ }],
4713
+ confirmAccountNumber: [{
4714
+ type: i0.Input,
4715
+ args: [{
4716
+ isSignal: true,
4717
+ alias: "confirmAccountNumber",
4718
+ required: false
4719
+ }]
4720
+ }],
4721
+ achConsentText: [{
4722
+ type: i0.Input,
4723
+ args: [{
4724
+ isSignal: true,
4725
+ alias: "achConsentText",
4726
+ required: false
4727
+ }]
4728
+ }],
4729
+ requireAchConsent: [{
4730
+ type: i0.Input,
4731
+ args: [{
4732
+ isSignal: true,
4733
+ alias: "requireAchConsent",
4734
+ required: false
4735
+ }]
4736
+ }],
4737
+ mode: [{
4738
+ type: i0.Input,
4739
+ args: [{
4740
+ isSignal: true,
4741
+ alias: "mode",
4742
+ required: false
4743
+ }]
4744
+ }],
4745
+ errorDisplay: [{
4746
+ type: i0.Input,
4747
+ args: [{
4748
+ isSignal: true,
4749
+ alias: "errorDisplay",
4750
+ required: false
4751
+ }]
4752
+ }],
4753
+ errorMessages: [{
4754
+ type: i0.Input,
4755
+ args: [{
4756
+ isSignal: true,
4757
+ alias: "errorMessages",
4758
+ required: false
4759
+ }]
4760
+ }],
4761
+ errorFallback: [{
4762
+ type: i0.Input,
4763
+ args: [{
4764
+ isSignal: true,
4765
+ alias: "errorFallback",
4766
+ required: false
4767
+ }]
4768
+ }],
4769
+ a11yMessages: [{
4770
+ type: i0.Input,
4771
+ args: [{
4772
+ isSignal: true,
4773
+ alias: "a11yMessages",
4774
+ required: false
4775
+ }]
4776
+ }],
4777
+ label: [{
4778
+ type: i0.Input,
4779
+ args: [{
4780
+ isSignal: true,
4781
+ alias: "label",
4782
+ required: false
4783
+ }]
4784
+ }],
4785
+ successKind: [{
4786
+ type: i0.Input,
4787
+ args: [{
4788
+ isSignal: true,
4789
+ alias: "successKind",
4790
+ required: false
4791
+ }]
4792
+ }],
4793
+ titleInput: [{
4794
+ type: i0.Input,
4795
+ args: [{
4796
+ isSignal: true,
4797
+ alias: "title",
4798
+ required: false
4799
+ }]
4800
+ }],
4801
+ payableRef: [{
4802
+ type: i0.Input,
4803
+ args: [{
4804
+ isSignal: true,
4805
+ alias: "payableRef",
4806
+ required: false
4807
+ }]
4808
+ }],
4809
+ attemptKey: [{
4810
+ type: i0.Input,
4811
+ args: [{
4812
+ isSignal: true,
4813
+ alias: "attemptKey",
4814
+ required: false
4815
+ }]
4816
+ }],
4817
+ checkStatus: [{
4818
+ type: i0.Input,
4819
+ args: [{
4820
+ isSignal: true,
4821
+ alias: "checkStatus",
4822
+ required: false
4823
+ }]
4824
+ }],
4825
+ paid: [{
4826
+ type: i0.Input,
4827
+ args: [{
4828
+ isSignal: true,
4829
+ alias: "paid",
4830
+ required: false
4831
+ }]
4832
+ }],
4833
+ hostPending: [{
4834
+ type: i0.Input,
4835
+ args: [{
4836
+ isSignal: true,
4837
+ alias: "hostPending",
4838
+ required: false
4839
+ }]
4840
+ }],
4841
+ statusPollMs: [{
4842
+ type: i0.Input,
4843
+ args: [{
4844
+ isSignal: true,
4845
+ alias: "statusPollMs",
4846
+ required: false
4847
+ }]
4848
+ }],
4849
+ statusPollMaxMs: [{
4850
+ type: i0.Input,
4851
+ args: [{
4852
+ isSignal: true,
4853
+ alias: "statusPollMaxMs",
4854
+ required: false
4855
+ }]
4856
+ }],
4857
+ statusCheckTimeoutMs: [{
4858
+ type: i0.Input,
4859
+ args: [{
4860
+ isSignal: true,
4861
+ alias: "statusCheckTimeoutMs",
4862
+ required: false
4863
+ }]
4864
+ }],
4865
+ statusFailGraceMs: [{
4866
+ type: i0.Input,
4867
+ args: [{
4868
+ isSignal: true,
4869
+ alias: "statusFailGraceMs",
4870
+ required: false
4871
+ }]
4872
+ }],
4873
+ allowStartOver: [{
4874
+ type: i0.Input,
4875
+ args: [{
4876
+ isSignal: true,
4877
+ alias: "allowStartOver",
4878
+ required: false
4879
+ }]
4880
+ }],
4881
+ offlineOverride: [{
4882
+ type: i0.Input,
4883
+ args: [{
4884
+ isSignal: true,
4885
+ alias: "offlineOverride",
4886
+ required: false
4887
+ }]
4888
+ }],
4889
+ hostSilenceMs: [{
4890
+ type: i0.Input,
4891
+ args: [{
4892
+ isSignal: true,
4893
+ alias: "hostSilenceMs",
4894
+ required: false
4895
+ }]
4896
+ }],
4897
+ readinessCheck: [{
4898
+ type: i0.Input,
4899
+ args: [{
4900
+ isSignal: true,
4901
+ alias: "readinessCheck",
4902
+ required: false
4903
+ }]
4904
+ }],
4905
+ readinessTimeoutMs: [{
4906
+ type: i0.Input,
4907
+ args: [{
4908
+ isSignal: true,
4909
+ alias: "readinessTimeoutMs",
4910
+ required: false
4911
+ }]
4912
+ }],
4913
+ readinessEveryMs: [{
4914
+ type: i0.Input,
4915
+ args: [{
4916
+ isSignal: true,
4917
+ alias: "readinessEveryMs",
4918
+ required: false
4919
+ }]
4920
+ }],
4921
+ inFlightChange: [{
4922
+ type: i0.Output,
4923
+ args: ["inFlightChange"]
4924
+ }],
4925
+ outcome: [{
4926
+ type: i0.Output,
4927
+ args: ["outcome"]
4928
+ }],
4929
+ attemptKeyChange: [{
4930
+ type: i0.Output,
4931
+ args: ["attemptKeyChange"]
4932
+ }],
4933
+ readinessChange: [{
4934
+ type: i0.Output,
4935
+ args: ["readinessChange"]
4936
+ }],
4937
+ form: [{
4938
+ type: i0.ViewChild,
4939
+ args: [i0.forwardRef(() => QboPaymentComponent), { isSignal: true }]
4940
+ }],
4941
+ tokenized: [{
4942
+ type: i0.Output,
4943
+ args: ["tokenized"]
4944
+ }],
4945
+ failed: [{
4946
+ type: i0.Output,
4947
+ args: ["failed"]
4948
+ }]
4949
+ }
4950
+ });
4951
+ export { QBO_A11Y_MESSAGES, QBO_BANK_ACCOUNT_TYPES, QBO_FIELD_ERROR_KEYS, QBO_METHOD_TEXTS, QBO_PAYMENT_DEFAULTS, QBO_PAYMENT_METHOD_VALUES, QBO_PRODUCTION_ORIGIN, QBO_SANDBOX_ORIGIN, QBO_TOKENIZER, QBO_TOKENS_PATH, QboConnectComponent, QboConnectFlow, QboHostedPayComponent, QboPaymentComponent, QboPaymentMethodComponent, accountNumberIssue, cardLengthsFor, cardNumberIssue, cvcIssue, cvcLengthsFor, defaultQboTokenizer, detectCardBrand, expiryIssue, formatCardNumber, formatExpiry, getQboErrorMessage, isQboUrl, luhnValid, newQboRequestId, parseExpiry, postalCodeIssue, provideQboPayment, qboConnectNotice, qboMethodLabel, qboOutcomeOf, qboStatusKey, qboTokensUrl, readQboErrors, routingIssue, scrubDigits };
4952
+
4953
+ //# sourceMappingURL=forgeroute-ui-quickbooks.mjs.map