@forgeroute/ui 0.4.3 → 0.4.5

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,2805 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, Injectable, InjectionToken, PLATFORM_ID, computed, effect, inject, input, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { DOCUMENT, isPlatformBrowser } from "@angular/common";
4
+ import { AlertComponent, BadgeComponent, ButtonComponent, FormRowComponent, FormSectionComponent, ModalComponent, SkeletonComponent, TextComponent, TextInputComponent } from "@forgeroute/ui";
5
+ import * as i1 from "@angular/forms";
6
+ import { FormsModule } from "@angular/forms";
7
+ const sdkImporter = { load: () => import("@stripe/stripe-js") };
8
+ const defaultStripeLoader = async (publishableKey, options) => {
9
+ const sdk = await sdkImporter.load();
10
+ return options === void 0 ? await sdk.loadStripe(publishableKey) : await sdk.loadStripe(publishableKey, options);
11
+ };
12
+ const STRIPE_LOADER = new InjectionToken("STRIPE_LOADER", {
13
+ providedIn: "root",
14
+ factory: () => defaultStripeLoader
15
+ });
16
+ const STRIPE_PAYMENT_DEFAULTS = new InjectionToken("STRIPE_PAYMENT_DEFAULTS", {
17
+ providedIn: "root",
18
+ factory: () => ({})
19
+ });
20
+ function provideStripePayment(options = {}) {
21
+ const { loader, ...defaults } = options;
22
+ const providers = [{
23
+ provide: STRIPE_PAYMENT_DEFAULTS,
24
+ useValue: defaults
25
+ }];
26
+ if (loader) providers.push({
27
+ provide: STRIPE_LOADER,
28
+ useValue: loader
29
+ });
30
+ return providers;
31
+ }
32
+ function buildLoadOptions(stripeAccount, locale, extra) {
33
+ const options = { ...extra ?? {} };
34
+ if (locale) options.locale = locale;
35
+ if (stripeAccount) options.stripeAccount = stripeAccount;
36
+ return Object.keys(options).length ? options : void 0;
37
+ }
38
+ const STRIPE_ERROR_MESSAGES = {
39
+ stolen_card: "This card has been reported as stolen. Please use a different payment method.",
40
+ lost_card: "This card has been reported as lost. Please use a different payment method.",
41
+ card_declined: "Your card was declined. Please contact your bank or use a different card.",
42
+ generic_decline: "Your card was declined. Please contact your bank or try a different card.",
43
+ insufficient_funds: "Your card has insufficient funds. Please use a different card or add funds to your account.",
44
+ do_not_honor: "Your bank has declined this transaction. Please contact your bank or use a different card.",
45
+ card_not_supported: "This card does not support this type of purchase. Please use a different card.",
46
+ currency_not_supported: "This card does not support the requested currency. Please use a different card.",
47
+ duplicate_transaction: "A duplicate transaction was detected. Please wait a few minutes before trying again.",
48
+ expired_card: "Your card has expired. Please use a different card.",
49
+ incorrect_cvc: "The security code (CVC) is incorrect. Please check and try again.",
50
+ incorrect_number: "The card number is incorrect. Please check and try again.",
51
+ invalid_cvc: "The security code (CVC) is invalid. Please check and try again.",
52
+ invalid_expiry_month: "The expiration month is invalid. Please check and try again.",
53
+ invalid_expiry_year: "The expiration year is invalid. Please check and try again.",
54
+ invalid_number: "The card number is invalid. Please check and try again.",
55
+ processing_error: "An error occurred while processing your card. Please try again.",
56
+ incorrect_zip: "The ZIP/postal code is incorrect. Please check and try again.",
57
+ card_velocity_exceeded: "You have exceeded the balance or credit limit on your card. Please contact your bank.",
58
+ withdrawal_count_limit_exceeded: "You have exceeded the allowed number of transactions. Please try again later or use a different card.",
59
+ authentication_required: "This card requires authentication. Please try again and complete the verification step.",
60
+ fraudulent: "This transaction has been flagged by your bank. Please contact your bank or use a different card.",
61
+ merchant_blacklist: "This card cannot be used for this transaction. Please use a different card.",
62
+ pickup_card: "This card cannot be used. Please contact your bank or use a different card.",
63
+ restricted_card: "This card has restrictions that prevent this transaction. Please contact your bank or use a different card.",
64
+ security_violation: "This card has been flagged for a security violation. Please contact your bank.",
65
+ issuer_not_available: "Your card issuer could not be reached. Please try again later.",
66
+ new_account_information_available: "Your card details have changed. Please update your card information and try again.",
67
+ try_again_later: "Your card issuer is temporarily unable to process this transaction. Please try again later.",
68
+ reenter_transaction: "The transaction could not be processed. Please try again.",
69
+ approve_with_id: "The payment cannot be authorized. Please contact your bank.",
70
+ call_issuer: "Your bank has declined this transaction. Please call your bank for more information.",
71
+ do_not_try_again: "Your bank has permanently declined this card. Please use a different payment method.",
72
+ no_action_taken: "Your bank could not process this transaction. Please contact your bank.",
73
+ not_permitted: "This transaction is not permitted on this card. Please contact your bank or use a different card.",
74
+ revocation_of_all_authorizations: "All authorizations have been revoked for this card. Please contact your bank.",
75
+ revocation_of_authorization: "The authorization for this card has been revoked. Please contact your bank.",
76
+ stop_payment_order: "Your bank has stopped this payment. Please contact your bank.",
77
+ testmode_decline: "This is a test decline. No real charge was attempted.",
78
+ bank_account_declined: "Your bank account could not be used. Please try a different account.",
79
+ debit_not_authorized: "The debit was not authorized. Please contact your bank.",
80
+ payment_intent_unexpected_state: "This payment has already been processed. Please refresh the page and try again.",
81
+ payment_intent_authentication_failure: "Payment authentication failed. Please try again.",
82
+ payment_intent_incompatible_payment_method: "This payment method is not compatible. Please use a different payment method.",
83
+ payment_intent_payment_attempt_failed: "The payment attempt failed. Please try again or use a different payment method.",
84
+ payment_method_unactivated: "This payment method is not activated. Please use a different payment method.",
85
+ payment_method_unexpected_state: "There was an issue with your payment method. Please try again.",
86
+ setup_intent_unexpected_state: "This payment setup has already been completed. Please refresh the page.",
87
+ amount_too_small: "The payment amount is too small to process. Please contact the business.",
88
+ amount_too_large: "The payment amount exceeds the maximum allowed. Please contact the business.",
89
+ balance_insufficient: "Insufficient balance to complete this payment. Please use a different payment method.",
90
+ resource_missing: "The payment session has expired. Please refresh the page and try again."
91
+ };
92
+ const STRIPE_TECHNICAL_ERROR_MESSAGES = {
93
+ api_connection_error: "We could not reach the payment service. Please check your connection and try again.",
94
+ rate_limit_error: "Too many requests. Please wait a moment and try again.",
95
+ api_error: "Something went wrong while processing the payment. Please try again.",
96
+ authentication_error: "Something went wrong while processing the payment. Please try again.",
97
+ invalid_request_error: "Something went wrong while processing the payment. Please try again."
98
+ };
99
+ const STRIPE_DEFAULT_ERROR_MESSAGE = "Payment failed. Please try again.";
100
+ const STRIPE_SESSION_EXPIRED_MESSAGE = "Your payment session has expired. Please refresh the page and try again.";
101
+ function getStripeErrorMessage(error, options = {}) {
102
+ const fallback = options.fallback ?? "Payment failed. Please try again.";
103
+ if (!error) return fallback;
104
+ if (options.display === "stripe") return error.message || fallback;
105
+ const table = {
106
+ ...STRIPE_ERROR_MESSAGES,
107
+ ...options.overrides ?? {}
108
+ };
109
+ if (error.decline_code && table[error.decline_code]) return table[error.decline_code];
110
+ if (error.code && table[error.code]) return table[error.code];
111
+ const message = error.message;
112
+ if (message) {
113
+ if (message.includes("already succeeded") || message.includes("previously confirmed")) return options.overrides?.["payment_intent_unexpected_state"] ?? "This payment has already been processed. Please refresh the page and try again.";
114
+ if (message.includes("expired")) return STRIPE_SESSION_EXPIRED_MESSAGE;
115
+ }
116
+ const technical = options.display === "table" || !error.type ? void 0 : STRIPE_TECHNICAL_ERROR_MESSAGES[error.type];
117
+ if (technical) return technical;
118
+ return message || fallback;
119
+ }
120
+ const MSG_NOT_INITIALIZED = "Payment system not initialized";
121
+ const MSG_INTENT_FAILED = "Failed to create payment intent";
122
+ const MSG_NOT_COMPLETED = "Payment was not completed";
123
+ const MSG_REQUIRES_PAYMENT_METHOD = "Payment failed. Please try a different payment method.";
124
+ const MSG_NO_PAYMENT_METHOD = "No payment method returned from Stripe";
125
+ const MSG_AUTH_FAILED = "Payment authentication failed";
126
+ const MSG_AUTH_NOT_COMPLETED = "Payment authentication was not completed";
127
+ const MSG_KEY_MISSING = "A Stripe publishable key is required";
128
+ const MSG_LOAD_FAILED = "Failed to load Stripe";
129
+ function paymentMethodIdOf(intent) {
130
+ const pm = intent?.payment_method;
131
+ if (!pm) return null;
132
+ return typeof pm === "string" ? pm : pm.id || null;
133
+ }
134
+ function verificationOf(intent) {
135
+ const action = intent?.next_action;
136
+ if (action?.type !== "verify_with_microdeposits") return null;
137
+ const details = action.verify_with_microdeposits ?? {};
138
+ const arrival = typeof details.arrival_date === "number" ? details.arrival_date : null;
139
+ const type = details.microdeposit_type === "amounts" || details.microdeposit_type === "descriptor_code" ? details.microdeposit_type : null;
140
+ const url = typeof details.hosted_verification_url === "string" && details.hosted_verification_url ? details.hosted_verification_url : null;
141
+ return {
142
+ type,
143
+ arrivalDate: arrival,
144
+ arrivalDateIso: arrival === null ? null : (/* @__PURE__ */ new Date(arrival * 1e3)).toISOString(),
145
+ hostedVerificationUrl: url
146
+ };
147
+ }
148
+ function outcomeOf(intent) {
149
+ switch (intent.status) {
150
+ case "succeeded": return "succeeded";
151
+ case "processing": return "processing";
152
+ case "requires_capture": return "requires_capture";
153
+ case "requires_action": return intent.next_action?.type === "verify_with_microdeposits" ? "requires_verification" : "requires_action";
154
+ case "requires_payment_method": return "requires_payment_method";
155
+ case "canceled": return "canceled";
156
+ default: return "unknown";
157
+ }
158
+ }
159
+ function normalizeIntent(kind, intent) {
160
+ const outcome = outcomeOf(intent);
161
+ return {
162
+ kind,
163
+ status: intent.status,
164
+ outcome,
165
+ intent,
166
+ ...kind === "setup" ? { setupIntent: intent } : { paymentIntent: intent },
167
+ intentId: intent.id,
168
+ paymentMethodId: paymentMethodIdOf(intent),
169
+ verification: outcome === "requires_verification" ? verificationOf(intent) : null,
170
+ actionHandled: false
171
+ };
172
+ }
173
+ function failureFromError(error, stage, options = {}) {
174
+ return {
175
+ code: error?.code || error?.type || "unknown_error",
176
+ message: getStripeErrorMessage(error, options),
177
+ stripeMessage: error?.message ?? "",
178
+ ...error?.decline_code ? { declineCode: error.decline_code } : {},
179
+ ...error?.type ? { type: error.type } : {},
180
+ stage,
181
+ ...error ? { error } : {}
182
+ };
183
+ }
184
+ function failure(code, message, stage, stripeMessage = "") {
185
+ return {
186
+ code,
187
+ message,
188
+ stripeMessage,
189
+ stage
190
+ };
191
+ }
192
+ function messageOfThrown(err, fallback) {
193
+ const e = err;
194
+ if (typeof e?.error?.message === "string" && e.error.message) return e.error.message;
195
+ if (typeof e?.message === "string" && e.message) return e.message;
196
+ return fallback;
197
+ }
198
+ function readStripeReturnParams(search) {
199
+ const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
200
+ const payment = params.get("payment_intent_client_secret");
201
+ const setup = params.get("setup_intent_client_secret");
202
+ const kind = payment ? "payment" : setup ? "setup" : null;
203
+ if (!kind) return null;
204
+ return {
205
+ kind,
206
+ clientSecret: payment ?? setup,
207
+ redirectStatus: params.get("redirect_status")
208
+ };
209
+ }
210
+ const MSG_VERIFY_FAILED = "Verification failed";
211
+ const MSG_VERIFY_THROWN = "Verification failed. Please check the code and try again.";
212
+ const MSG_RETURN_FAILED = "We could not check the status of this payment. Please contact support before trying again.";
213
+ async function verifyMicrodeposits(stripe, flow, clientSecret, data) {
214
+ const call = flow === "payment" ? stripe.verifyMicrodepositsForPayment : stripe.verifyMicrodepositsForSetup;
215
+ if (typeof call !== "function") return {
216
+ ok: false,
217
+ outcome: null,
218
+ intent: null,
219
+ failure: failure("unsupported", MSG_VERIFY_FAILED, "verify")
220
+ };
221
+ try {
222
+ const result = await call.call(stripe, clientSecret, data);
223
+ if (result.error) return {
224
+ ok: false,
225
+ outcome: null,
226
+ intent: null,
227
+ failure: failureFromError(result.error, "verify", {
228
+ display: "stripe",
229
+ fallback: MSG_VERIFY_FAILED
230
+ })
231
+ };
232
+ const intent = (flow === "payment" ? result.paymentIntent : result.setupIntent) ?? null;
233
+ const event = intent ? normalizeIntent(flow, intent) : null;
234
+ if (event && (event.outcome === "processing" || event.outcome === "succeeded")) return {
235
+ ok: true,
236
+ outcome: event.outcome,
237
+ intent,
238
+ failure: null
239
+ };
240
+ return {
241
+ ok: false,
242
+ outcome: event?.outcome ?? null,
243
+ intent,
244
+ failure: failure("verification_incomplete", MSG_VERIFY_FAILED, "verify")
245
+ };
246
+ } catch (err) {
247
+ return {
248
+ ok: false,
249
+ outcome: null,
250
+ intent: null,
251
+ failure: failure("verification_failed", messageOfThrown(err, MSG_VERIFY_THROWN), "verify", messageOfThrown(err, ""))
252
+ };
253
+ }
254
+ }
255
+ async function retrieveIntent(stripe, kind, clientSecret) {
256
+ const call = kind === "payment" ? stripe.retrievePaymentIntent : stripe.retrieveSetupIntent;
257
+ if (typeof call !== "function") return {
258
+ event: null,
259
+ failure: failure("unsupported", MSG_RETURN_FAILED, "return")
260
+ };
261
+ try {
262
+ const result = await call.call(stripe, clientSecret);
263
+ if (result.error) return {
264
+ event: null,
265
+ failure: failureFromError(result.error, "return")
266
+ };
267
+ const intent = kind === "payment" ? result.paymentIntent : result.setupIntent;
268
+ if (!intent) return {
269
+ event: null,
270
+ failure: failure("no_intent", MSG_RETURN_FAILED, "return")
271
+ };
272
+ return {
273
+ event: normalizeIntent(kind, intent),
274
+ failure: null
275
+ };
276
+ } catch (err) {
277
+ return {
278
+ event: null,
279
+ failure: failure("return_failed", MSG_RETURN_FAILED, "return", messageOfThrown(err, ""))
280
+ };
281
+ }
282
+ }
283
+ var StripePaymentService = class StripePaymentService {
284
+ constructor() {
285
+ this.loader = inject(STRIPE_LOADER);
286
+ this.defaults = inject(STRIPE_PAYMENT_DEFAULTS);
287
+ }
288
+ async load(connection = {}) {
289
+ const key = connection.publishableKey || this.defaults.publishableKey;
290
+ if (!key) throw new Error(MSG_KEY_MISSING);
291
+ const stripe = await this.loader(key, buildLoadOptions(connection.stripeAccount, connection.locale ?? this.defaults.locale, connection.options));
292
+ if (!stripe) throw new Error(MSG_LOAD_FAILED);
293
+ return stripe;
294
+ }
295
+ async verifyMicrodepositsForPayment(clientSecret, data, connection = {}) {
296
+ return this.verify("payment", clientSecret, data, connection);
297
+ }
298
+ async verifyMicrodepositsForSetup(clientSecret, data, connection = {}) {
299
+ return this.verify("setup", clientSecret, data, connection);
300
+ }
301
+ async handleReturn(options = {}) {
302
+ const fromUrl = options.clientSecret ? null : readStripeReturnParams(options.search ?? (typeof window === "undefined" ? "" : window.location.search));
303
+ const clientSecret = options.clientSecret ?? fromUrl?.clientSecret;
304
+ if (!clientSecret) return {
305
+ event: null,
306
+ failure: null
307
+ };
308
+ const kind = options.kind ?? fromUrl?.kind ?? "payment";
309
+ let stripe;
310
+ try {
311
+ stripe = await this.load(options);
312
+ } catch (err) {
313
+ return {
314
+ event: null,
315
+ failure: failure("load_error", messageOfThrown(err, MSG_LOAD_FAILED), "load", messageOfThrown(err, ""))
316
+ };
317
+ }
318
+ return retrieveIntent(stripe, kind, clientSecret);
319
+ }
320
+ async verify(flow, clientSecret, data, connection) {
321
+ let stripe;
322
+ try {
323
+ stripe = await this.load(connection);
324
+ } catch (err) {
325
+ return {
326
+ ok: false,
327
+ outcome: null,
328
+ intent: null,
329
+ failure: failure("load_error", messageOfThrown(err, MSG_LOAD_FAILED), "load", messageOfThrown(err, ""))
330
+ };
331
+ }
332
+ return verifyMicrodeposits(stripe, flow, clientSecret, data);
333
+ }
334
+ static {
335
+ this.ɵfac = i0.ɵɵngDeclareFactory({
336
+ minVersion: "12.0.0",
337
+ version: "22.2.2",
338
+ ngImport: i0,
339
+ type: StripePaymentService,
340
+ deps: [],
341
+ target: i0.ɵɵFactoryTarget.Injectable
342
+ });
343
+ }
344
+ static {
345
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
346
+ minVersion: "12.0.0",
347
+ version: "22.2.2",
348
+ ngImport: i0,
349
+ type: StripePaymentService,
350
+ providedIn: "root"
351
+ });
352
+ }
353
+ };
354
+ i0.ɵɵngDeclareClassMetadata({
355
+ minVersion: "12.0.0",
356
+ version: "22.2.2",
357
+ ngImport: i0,
358
+ type: StripePaymentService,
359
+ decorators: [{
360
+ type: Injectable,
361
+ args: [{ providedIn: "root" }]
362
+ }]
363
+ });
364
+ const TOKENS = [
365
+ ["--ui-stripe-color-primary", "colorPrimary"],
366
+ ["--ui-stripe-color-background", "colorBackground"],
367
+ ["--ui-stripe-color-text", "colorText"],
368
+ ["--ui-stripe-color-danger", "colorDanger"],
369
+ ["--ui-stripe-font-family", "fontFamily"],
370
+ ["--ui-stripe-border-radius", "borderRadius"],
371
+ ["--ui-stripe-font-size-base", "fontSizeBase"]
372
+ ];
373
+ function isDarkPage(doc) {
374
+ const forced = doc.documentElement.getAttribute("data-theme");
375
+ if (forced === "dark") return true;
376
+ if (forced === "light") return false;
377
+ try {
378
+ return !!doc.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches;
379
+ } catch {
380
+ return false;
381
+ }
382
+ }
383
+ function readStripeAppearance(doc, element = doc.documentElement) {
384
+ const view = doc.defaultView;
385
+ const variables = {};
386
+ if (view) {
387
+ const style = view.getComputedStyle(element);
388
+ for (const [token, variable] of TOKENS) {
389
+ const value = style.getPropertyValue(token).trim();
390
+ if (value) variables[variable] = value;
391
+ }
392
+ }
393
+ return {
394
+ theme: isDarkPage(doc) ? "night" : "stripe",
395
+ ...Object.keys(variables).length ? { variables } : {}
396
+ };
397
+ }
398
+ const STRIPE_A11Y_MESSAGES = {
399
+ loading: "Loading payment form",
400
+ savingMethod: "Saving payment method",
401
+ processingPayment: "Processing payment",
402
+ methodSaved: "Payment method saved",
403
+ paymentReceived: "Payment received",
404
+ paymentProcessing: "Payment is processing",
405
+ paymentAuthorized: "Payment authorized",
406
+ verificationNeeded: "Bank account added. It needs to be verified with small deposits.",
407
+ actionRequired: "Further action is required to complete the payment"
408
+ };
409
+ const STRIPE_ACH_NOTICE = "Signing in to your bank account lets you pay right away. Entering your routing and account numbers instead requires verification with two small deposits, which typically take a couple of days to arrive in your account.";
410
+ let nextId = 0;
411
+ const jsonEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
412
+ var StripePaymentComponent = class StripePaymentComponent {
413
+ constructor() {
414
+ this.loader = inject(STRIPE_LOADER);
415
+ this.defaults = inject(STRIPE_PAYMENT_DEFAULTS);
416
+ this.doc = inject(DOCUMENT);
417
+ this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
418
+ this.host = inject(ElementRef);
419
+ this.mountOnly = input(false, ...ngDevMode ? [{ debugName: "mountOnly" }] : /* istanbul ignore next */ []);
420
+ this.mode = input("payment", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
421
+ this.publishableKey = input(null, ...ngDevMode ? [{ debugName: "publishableKey" }] : /* istanbul ignore next */ []);
422
+ this.clientSecret = input(null, ...ngDevMode ? [{ debugName: "clientSecret" }] : /* istanbul ignore next */ []);
423
+ this.deferred = input(null, ...ngDevMode ? [{ debugName: "deferred" }] : /* istanbul ignore next */ []);
424
+ this.createIntent = input(null, ...ngDevMode ? [{ debugName: "createIntent" }] : /* istanbul ignore next */ []);
425
+ this.stripeAccount = input(null, ...ngDevMode ? [{ debugName: "stripeAccount" }] : /* istanbul ignore next */ []);
426
+ this.locale = input(null, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
427
+ this.stripeOptions = input(null, ...ngDevMode ? [{ debugName: "stripeOptions" }] : /* istanbul ignore next */ []);
428
+ this.paymentMethodTypes = input(null, ...ngDevMode ? [{ debugName: "paymentMethodTypes" }] : /* istanbul ignore next */ []);
429
+ this.elementsOptions = input(null, ...ngDevMode ? [{ debugName: "elementsOptions" }] : /* istanbul ignore next */ []);
430
+ this.layout = input("tabs", ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
431
+ this.paymentMethodOrder = input(null, ...ngDevMode ? [{ debugName: "paymentMethodOrder" }] : /* istanbul ignore next */ []);
432
+ this.wallets = input(null, ...ngDevMode ? [{ debugName: "wallets" }] : /* istanbul ignore next */ []);
433
+ this.fields = input(null, ...ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []);
434
+ this.defaultValues = input(null, ...ngDevMode ? [{ debugName: "defaultValues" }] : /* istanbul ignore next */ []);
435
+ this.business = input(null, ...ngDevMode ? [{ debugName: "business" }] : /* istanbul ignore next */ []);
436
+ this.terms = input(null, ...ngDevMode ? [{ debugName: "terms" }] : /* istanbul ignore next */ []);
437
+ this.paymentElementOptions = input(null, ...ngDevMode ? [{ debugName: "paymentElementOptions" }] : /* istanbul ignore next */ []);
438
+ this.appearance = input(null, ...ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []);
439
+ this.appearanceFromTokens = input(false, ...ngDevMode ? [{ debugName: "appearanceFromTokens" }] : /* istanbul ignore next */ []);
440
+ this.returnUrl = input(void 0, ...ngDevMode ? [{ debugName: "returnUrl" }] : /* istanbul ignore next */ []);
441
+ this.billingDetails = input(null, ...ngDevMode ? [{ debugName: "billingDetails" }] : /* istanbul ignore next */ []);
442
+ this.confirmParams = input(null, ...ngDevMode ? [{ debugName: "confirmParams" }] : /* istanbul ignore next */ []);
443
+ this.redirect = input("if_required", ...ngDevMode ? [{ debugName: "redirect" }] : /* istanbul ignore next */ []);
444
+ this.submitBeforeConfirm = input(null, ...ngDevMode ? [{ debugName: "submitBeforeConfirm" }] : /* istanbul ignore next */ []);
445
+ this.autoHandleCardAction = input(false, ...ngDevMode ? [{ debugName: "autoHandleCardAction" }] : /* istanbul ignore next */ []);
446
+ this.submitLabel = input("", ...ngDevMode ? [{ debugName: "submitLabel" }] : /* istanbul ignore next */ []);
447
+ this.showSubmit = input(true, ...ngDevMode ? [{ debugName: "showSubmit" }] : /* istanbul ignore next */ []);
448
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
449
+ this.pending = input(false, ...ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []);
450
+ this.label = input("Payment details", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
451
+ this.mountId = input("", ...ngDevMode ? [{ debugName: "mountId" }] : /* istanbul ignore next */ []);
452
+ this.mountClass = input("", ...ngDevMode ? [{ debugName: "mountClass" }] : /* istanbul ignore next */ []);
453
+ this.showAchNotice = input(true, ...ngDevMode ? [{ debugName: "showAchNotice" }] : /* istanbul ignore next */ []);
454
+ this.achNotice = input(STRIPE_ACH_NOTICE, ...ngDevMode ? [{ debugName: "achNotice" }] : /* istanbul ignore next */ []);
455
+ this.achNoticeTestId = input("stripe-ach-notice", ...ngDevMode ? [{ debugName: "achNoticeTestId" }] : /* istanbul ignore next */ []);
456
+ this.initialPaymentMethodType = input("card", ...ngDevMode ? [{ debugName: "initialPaymentMethodType" }] : /* istanbul ignore next */ []);
457
+ this.showErrors = input(true, ...ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []);
458
+ this.errorDisplay = input("friendly", ...ngDevMode ? [{ debugName: "errorDisplay" }] : /* istanbul ignore next */ []);
459
+ this.errorDisplayByStage = input(null, ...ngDevMode ? [{ debugName: "errorDisplayByStage" }] : /* istanbul ignore next */ []);
460
+ this.errorFallback = input("", ...ngDevMode ? [{ debugName: "errorFallback" }] : /* istanbul ignore next */ []);
461
+ this.errorFallbackByStage = input(null, ...ngDevMode ? [{ debugName: "errorFallbackByStage" }] : /* istanbul ignore next */ []);
462
+ this.errorMessages = input(null, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
463
+ this.loadErrorMessage = input("Failed to load the payment form. Please try again.", ...ngDevMode ? [{ debugName: "loadErrorMessage" }] : /* istanbul ignore next */ []);
464
+ this.a11yMessages = input(null, ...ngDevMode ? [{ debugName: "a11yMessages" }] : /* istanbul ignore next */ []);
465
+ this.stripeReady = output();
466
+ this.ready = output();
467
+ this.paymentMethodTypeChange = output();
468
+ this.elementChange = output();
469
+ this.confirmed = output();
470
+ this.failed = output();
471
+ this.loadError = output();
472
+ this.loading = signal(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
473
+ this.isReady = signal(false, ...ngDevMode ? [{ debugName: "isReady" }] : /* istanbul ignore next */ []);
474
+ this.submitting = signal(false, ...ngDevMode ? [{ debugName: "submitting" }] : /* istanbul ignore next */ []);
475
+ this.complete = signal(false, ...ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []);
476
+ this.selectedType = signal(null, ...ngDevMode ? [{ debugName: "selectedType" }] : /* istanbul ignore next */ []);
477
+ this.errorText = signal("", ...ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []);
478
+ this.loadErrorText = signal("", ...ngDevMode ? [{ debugName: "loadErrorText" }] : /* istanbul ignore next */ []);
479
+ this.announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
480
+ this.errorId = `ui-stripe-error-${nextId++}`;
481
+ this.mountRef = viewChild("mount", ...ngDevMode ? [{ debugName: "mountRef" }] : /* istanbul ignore next */ []);
482
+ this.mountHidden = computed(() => !this.mountOnly() && (this.loading() || this.pending() || !!this.loadErrorText()), ...ngDevMode ? [{ debugName: "mountHidden" }] : /* istanbul ignore next */ []);
483
+ this.achNoticeVisible = computed(() => this.showAchNotice() && this.selectedType() === "us_bank_account", ...ngDevMode ? [{ debugName: "achNoticeVisible" }] : /* istanbul ignore next */ []);
484
+ this.effectiveSubmitLabel = computed(() => this.submitLabel() || (this.mode() === "setup" ? "Save payment method" : "Pay"), ...ngDevMode ? [{ debugName: "effectiveSubmitLabel" }] : /* istanbul ignore next */ []);
485
+ this.submitDisabled = computed(() => this.disabled() || this.loading() || this.pending() || !this.isReady() || !!this.loadErrorText(), ...ngDevMode ? [{ debugName: "submitDisabled" }] : /* istanbul ignore next */ []);
486
+ this.messages = computed(() => {
487
+ const given = Object.fromEntries(Object.entries(this.a11yMessages() ?? {}).filter(([, text]) => typeof text === "string"));
488
+ return {
489
+ ...STRIPE_A11Y_MESSAGES,
490
+ ...given
491
+ };
492
+ }, ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
493
+ this.statusText = computed(() => {
494
+ if (this.loading()) return this.messages().loading;
495
+ if (this.submitting()) return this.mode() === "setup" ? this.messages().savingMethod : this.messages().processingPayment;
496
+ return this.announcement();
497
+ }, ...ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []);
498
+ this.connection = computed(() => {
499
+ return {
500
+ key: this.publishableKey() || this.defaults.publishableKey || "",
501
+ options: buildLoadOptions(this.stripeAccount(), this.locale() ?? this.defaults.locale, this.stripeOptions())
502
+ };
503
+ }, {
504
+ ...ngDevMode ? { debugName: "connection" } : /* istanbul ignore next */ {},
505
+ equal: jsonEqual
506
+ });
507
+ this.elementsConfig = computed(() => {
508
+ const secret = this.clientSecret();
509
+ const deferred = this.deferred();
510
+ let options;
511
+ if (secret) options = { clientSecret: secret };
512
+ else if (deferred) options = {
513
+ mode: deferred.mode ?? this.mode(),
514
+ currency: deferred.currency,
515
+ ...deferred.setupFutureUsage ? { setup_future_usage: deferred.setupFutureUsage } : {},
516
+ ...deferred.captureMethod ? { capture_method: deferred.captureMethod } : {},
517
+ ...deferred.onBehalfOf ? { on_behalf_of: deferred.onBehalfOf } : {},
518
+ ...this.paymentMethodTypes() ? { payment_method_types: this.paymentMethodTypes() } : {}
519
+ };
520
+ else return null;
521
+ const appearance = this.appearance();
522
+ if (appearance) options["appearance"] = appearance;
523
+ return {
524
+ ...options,
525
+ ...this.elementsOptions() ?? {}
526
+ };
527
+ }, {
528
+ ...ngDevMode ? { debugName: "elementsConfig" } : /* istanbul ignore next */ {},
529
+ equal: jsonEqual
530
+ });
531
+ this.elementConfig = computed(() => {
532
+ const options = {};
533
+ const layout = this.layout();
534
+ if (layout) options["layout"] = layout;
535
+ if (this.paymentMethodOrder()) options["paymentMethodOrder"] = this.paymentMethodOrder();
536
+ if (this.wallets()) options["wallets"] = this.wallets();
537
+ if (this.fields()) options["fields"] = this.fields();
538
+ if (this.business()) options["business"] = this.business();
539
+ if (this.terms()) options["terms"] = this.terms();
540
+ return {
541
+ ...options,
542
+ ...this.paymentElementOptions() ?? {}
543
+ };
544
+ }, {
545
+ ...ngDevMode ? { debugName: "elementConfig" } : /* istanbul ignore next */ {},
546
+ equal: jsonEqual
547
+ });
548
+ this.stripe = null;
549
+ this.stripeSignature = "";
550
+ this.elements = null;
551
+ this.element = null;
552
+ this.generation = 0;
553
+ this.lastType = null;
554
+ this.lastFailure = null;
555
+ this.destroyed = false;
556
+ this.appliedDefaultValues = "";
557
+ this.appliedDisabled = false;
558
+ effect(() => {
559
+ const mount = this.mountRef();
560
+ const connection = this.connection();
561
+ const elements = this.elementsConfig();
562
+ const element = this.elementConfig();
563
+ if (!mount) return;
564
+ untracked(() => {
565
+ this.init(mount.nativeElement, connection, elements, element);
566
+ });
567
+ });
568
+ effect(() => {
569
+ const amount = this.deferred()?.amount;
570
+ untracked(() => {
571
+ if (!this.mountOnly() && amount !== void 0 && this.lastAmount !== void 0 && amount !== this.lastAmount && this.elements?.update) this.elements.update({ amount });
572
+ this.lastAmount = amount;
573
+ });
574
+ });
575
+ effect(() => {
576
+ const defaultValues = this.defaultValues();
577
+ untracked(() => this.applyDefaultValues(defaultValues));
578
+ });
579
+ effect(() => {
580
+ const disabled = this.disabled();
581
+ untracked(() => this.applyDisabled(disabled));
582
+ });
583
+ inject(DestroyRef).onDestroy(() => {
584
+ this.destroyed = true;
585
+ this.generation++;
586
+ this.disposeElements();
587
+ this.stripe = null;
588
+ });
589
+ }
590
+ async confirm(options = {}) {
591
+ if (this.submitting() || this.disabled()) return null;
592
+ const stripe = this.stripe;
593
+ const elements = this.elements;
594
+ if (!stripe || !elements) {
595
+ this.fail(failure("not_initialized", MSG_NOT_INITIALIZED, "submit"));
596
+ return null;
597
+ }
598
+ this.submitting.set(true);
599
+ this.errorText.set("");
600
+ this.announcement.set("");
601
+ let stage = "submit";
602
+ try {
603
+ const mode = this.mode();
604
+ const existing = options.useExistingIntent === true;
605
+ const deferred = !existing && !this.clientSecret() && !!this.deferred();
606
+ if (!existing && (this.submitBeforeConfirm() ?? deferred)) {
607
+ const { error } = await elements.submit();
608
+ if (error) {
609
+ this.fail(failureFromError(error, "submit", this.errorOptions("submit")));
610
+ return null;
611
+ }
612
+ }
613
+ let secret = existing ? options.clientSecret : void 0;
614
+ if (deferred) {
615
+ stage = "intent";
616
+ const create = this.createIntent();
617
+ if (!create) {
618
+ this.fail(failure("no_intent_factory", MSG_INTENT_FAILED, "intent"));
619
+ return null;
620
+ }
621
+ try {
622
+ const created = await create({ mode });
623
+ secret = typeof created === "string" ? created : created?.clientSecret;
624
+ } catch (err) {
625
+ this.fail(failure("intent_creation_failed", messageOfThrown(err, STRIPE_DEFAULT_ERROR_MESSAGE), "intent", messageOfThrown(err, "")));
626
+ return null;
627
+ }
628
+ if (!secret) {
629
+ this.fail(failure("intent_creation_failed", MSG_INTENT_FAILED, "intent"));
630
+ return null;
631
+ }
632
+ }
633
+ stage = "confirm";
634
+ const confirmParams = this.buildConfirmParams();
635
+ const params = {
636
+ elements,
637
+ ...secret ? { clientSecret: secret } : {},
638
+ ...confirmParams ? { confirmParams } : {},
639
+ redirect: this.redirect()
640
+ };
641
+ const result = mode === "setup" ? await stripe.confirmSetup(params) : await stripe.confirmPayment(params);
642
+ if (result.error) {
643
+ this.fail(failureFromError(result.error, "confirm", this.errorOptions("confirm")));
644
+ return null;
645
+ }
646
+ const intent = mode === "setup" ? result.setupIntent : result.paymentIntent;
647
+ if (!intent) {
648
+ this.fail(failure("not_completed", mode === "setup" ? "Payment method setup was incomplete. Please try again." : MSG_NOT_COMPLETED, "result"));
649
+ return null;
650
+ }
651
+ let event = normalizeIntent(mode, intent);
652
+ if (mode === "setup" && !event.paymentMethodId) {
653
+ this.fail(failure("no_payment_method", MSG_NO_PAYMENT_METHOD, "result"));
654
+ return null;
655
+ }
656
+ if (mode === "payment" && event.outcome === "requires_action" && this.autoHandleCardAction()) {
657
+ stage = "action";
658
+ const handled = await this.runCardAction(stripe, intent.client_secret);
659
+ if (!handled) return null;
660
+ event = handled;
661
+ }
662
+ return this.finish(event);
663
+ } catch (err) {
664
+ this.fail(this.thrownFailure(err, stage));
665
+ return null;
666
+ } finally {
667
+ this.submitting.set(false);
668
+ }
669
+ }
670
+ async handleNextAction(clientSecret) {
671
+ if (this.submitting()) return null;
672
+ const stripe = this.stripe;
673
+ if (!stripe) {
674
+ this.fail(failure("not_initialized", MSG_NOT_INITIALIZED, "action"));
675
+ return null;
676
+ }
677
+ this.submitting.set(true);
678
+ this.errorText.set("");
679
+ try {
680
+ const handled = await this.runCardAction(stripe, clientSecret);
681
+ return handled ? this.finish(handled) : null;
682
+ } catch (err) {
683
+ this.fail(this.thrownFailure(err, "action"));
684
+ return null;
685
+ } finally {
686
+ this.submitting.set(false);
687
+ }
688
+ }
689
+ async fetchUpdates() {
690
+ const elements = this.elements;
691
+ if (!elements?.fetchUpdates) return failure("not_initialized", MSG_NOT_INITIALIZED, "submit");
692
+ try {
693
+ const { error } = await elements.fetchUpdates();
694
+ return error ? failureFromError(error, "confirm", this.errorOptions("confirm")) : null;
695
+ } catch (err) {
696
+ return this.thrownFailure(err, "confirm");
697
+ }
698
+ }
699
+ updateElements(options) {
700
+ this.elements?.update?.(options);
701
+ }
702
+ updatePaymentElement(options) {
703
+ this.element?.update?.(options);
704
+ }
705
+ destroyElements() {
706
+ this.disposeElements();
707
+ this.isReady.set(false);
708
+ }
709
+ async verifyMicrodepositsForPayment(clientSecret, data) {
710
+ return this.verifyWith("payment", clientSecret, data);
711
+ }
712
+ async verifyMicrodepositsForSetup(clientSecret, data) {
713
+ return this.verifyWith("setup", clientSecret, data);
714
+ }
715
+ async handleReturn(options = {}) {
716
+ const fromUrl = options.clientSecret ? null : readStripeReturnParams(options.search ?? this.doc.defaultView?.location.search ?? "");
717
+ const clientSecret = options.clientSecret ?? fromUrl?.clientSecret;
718
+ if (!clientSecret) return {
719
+ event: null,
720
+ failure: null
721
+ };
722
+ const kind = options.kind ?? fromUrl?.kind ?? this.mode();
723
+ let stripe;
724
+ try {
725
+ stripe = await this.ensureStripe();
726
+ } catch (err) {
727
+ const f = failure("load_error", messageOfThrown(err, MSG_LOAD_FAILED), "load", messageOfThrown(err, ""));
728
+ this.fail(f);
729
+ return {
730
+ event: null,
731
+ failure: f
732
+ };
733
+ }
734
+ const result = await retrieveIntent(stripe, kind, clientSecret);
735
+ if (result.failure) {
736
+ this.fail(result.failure);
737
+ return result;
738
+ }
739
+ if (result.event && !this.finish(result.event, true)) return {
740
+ event: null,
741
+ failure: this.lastFailure
742
+ };
743
+ return result;
744
+ }
745
+ errorOptions(stage) {
746
+ return {
747
+ display: this.errorDisplayByStage()?.[stage] ?? this.errorDisplay(),
748
+ overrides: this.errorMessages(),
749
+ ...this.errorFallbackByStage()?.[stage] || this.errorFallback() ? { fallback: this.errorFallbackByStage()?.[stage] || this.errorFallback() } : {}
750
+ };
751
+ }
752
+ thrownFailure(err, stage) {
753
+ const e = err;
754
+ const error = {
755
+ ...typeof e?.code === "string" ? { code: e.code } : {},
756
+ ...typeof e?.type === "string" ? { type: e.type } : {},
757
+ ...typeof e?.decline_code === "string" ? { decline_code: e.decline_code } : {},
758
+ ...typeof e?.message === "string" && e.message ? { message: e.message } : {}
759
+ };
760
+ const code = stage === "submit" ? "submit_failed" : stage === "action" ? "action_failed" : "confirm_failed";
761
+ const { error: _raw, ...failed } = failureFromError(error, stage, this.errorOptions(stage));
762
+ return {
763
+ ...failed,
764
+ code: error.code ?? code,
765
+ ...stage === "action" ? { actionHandled: true } : {}
766
+ };
767
+ }
768
+ buildConfirmParams() {
769
+ const params = {};
770
+ const returnUrl = this.returnUrl();
771
+ if (returnUrl !== null) params["return_url"] = returnUrl ?? this.doc.defaultView?.location.href ?? "";
772
+ const billing = this.billingDetails();
773
+ if (billing) params["payment_method_data"] = { billing_details: billing };
774
+ Object.assign(params, this.confirmParams() ?? {});
775
+ return Object.keys(params).length ? params : null;
776
+ }
777
+ fail(f) {
778
+ const override = this.errorMessages()?.[f.code];
779
+ if (override) f = {
780
+ ...f,
781
+ message: override.split("{status}").join(f.status ?? "")
782
+ };
783
+ this.lastFailure = f;
784
+ if (this.destroyed) return;
785
+ if (this.showErrors()) this.errorText.set(f.message);
786
+ this.announcement.set("");
787
+ this.failed.emit(f);
788
+ }
789
+ finish(event, fromReturn = false) {
790
+ const acted = {
791
+ ...event.actionHandled ? { actionHandled: true } : {},
792
+ status: event.status
793
+ };
794
+ if (event.outcome === "requires_payment_method") {
795
+ this.fail({
796
+ ...failure("requires_payment_method", MSG_REQUIRES_PAYMENT_METHOD, fromReturn ? "return" : "result"),
797
+ ...acted
798
+ });
799
+ return null;
800
+ }
801
+ if (event.outcome === "canceled" || event.outcome === "unknown") {
802
+ this.fail({
803
+ ...failure("not_completed", MSG_NOT_COMPLETED, fromReturn ? "return" : "result"),
804
+ ...acted
805
+ });
806
+ return null;
807
+ }
808
+ if (this.destroyed) return event;
809
+ this.announcement.set(this.announce(event));
810
+ this.confirmed.emit(event);
811
+ return event;
812
+ }
813
+ announce(event) {
814
+ const m = this.messages();
815
+ switch (event.outcome) {
816
+ case "succeeded": return event.kind === "setup" ? m.methodSaved : m.paymentReceived;
817
+ case "processing": return m.paymentProcessing;
818
+ case "requires_capture": return m.paymentAuthorized;
819
+ case "requires_verification": return m.verificationNeeded;
820
+ default: return m.actionRequired;
821
+ }
822
+ }
823
+ async runCardAction(stripe, clientSecret) {
824
+ const acted = { actionHandled: true };
825
+ if (!stripe.handleCardAction || !clientSecret) {
826
+ this.fail({
827
+ ...failure("action_unavailable", MSG_AUTH_NOT_COMPLETED, "action"),
828
+ ...acted
829
+ });
830
+ return null;
831
+ }
832
+ const { error, paymentIntent } = await stripe.handleCardAction(clientSecret);
833
+ if (error) {
834
+ this.fail({
835
+ ...failureFromError(error, "action", {
836
+ ...this.errorOptions("action"),
837
+ fallback: MSG_AUTH_FAILED
838
+ }),
839
+ ...acted
840
+ });
841
+ return null;
842
+ }
843
+ if (!paymentIntent) {
844
+ this.fail({
845
+ ...failure("action_incomplete", MSG_AUTH_NOT_COMPLETED, "action"),
846
+ ...acted
847
+ });
848
+ return null;
849
+ }
850
+ const event = {
851
+ ...normalizeIntent("payment", paymentIntent),
852
+ ...acted
853
+ };
854
+ if (event.outcome === "requires_payment_method") {
855
+ this.fail({
856
+ ...failure("authentication_failed", "Payment authentication failed. Please try a different payment method.", "action"),
857
+ ...acted,
858
+ status: event.status
859
+ });
860
+ return null;
861
+ }
862
+ return event;
863
+ }
864
+ async ensureStripe() {
865
+ if (this.stripe) return this.stripe;
866
+ const { key, options } = this.connection();
867
+ if (!key) throw new Error(MSG_KEY_MISSING);
868
+ const stripe = await this.loader(key, options);
869
+ if (!stripe) throw new Error(MSG_LOAD_FAILED);
870
+ return stripe;
871
+ }
872
+ async verifyWith(flow, clientSecret, data) {
873
+ let stripe;
874
+ try {
875
+ stripe = await this.ensureStripe();
876
+ } catch (err) {
877
+ return {
878
+ ok: false,
879
+ outcome: null,
880
+ intent: null,
881
+ failure: failure("load_error", messageOfThrown(err, MSG_LOAD_FAILED), "load", messageOfThrown(err, ""))
882
+ };
883
+ }
884
+ return verifyMicrodeposits(stripe, flow, clientSecret, data);
885
+ }
886
+ disposeElements() {
887
+ const element = this.element;
888
+ this.element = null;
889
+ this.elements = null;
890
+ this.lastType = null;
891
+ this.selectedType.set(null);
892
+ this.complete.set(false);
893
+ if (element) {
894
+ try {
895
+ element.destroy();
896
+ } catch {}
897
+ if (!this.destroyed) this.stripeReady.emit(null);
898
+ }
899
+ }
900
+ loadFailed(message, stripeMessage) {
901
+ this.loading.set(false);
902
+ this.isReady.set(false);
903
+ this.loadErrorText.set(this.loadErrorMessage());
904
+ this.loadError.emit(failure("load_error", message, "load", stripeMessage));
905
+ }
906
+ async init(container, connection, elementsConfig, elementConfig) {
907
+ const generation = ++this.generation;
908
+ this.disposeElements();
909
+ this.isReady.set(false);
910
+ this.errorText.set("");
911
+ this.loadErrorText.set("");
912
+ this.announcement.set("");
913
+ if (!this.isBrowser || !elementsConfig) {
914
+ this.loading.set(false);
915
+ return;
916
+ }
917
+ if (!connection.key) {
918
+ this.loadFailed(MSG_KEY_MISSING, "");
919
+ return;
920
+ }
921
+ this.loading.set(true);
922
+ try {
923
+ const signature = JSON.stringify(connection);
924
+ if (!this.stripe || this.stripeSignature !== signature) {
925
+ this.stripe = null;
926
+ const stripe = await this.loader(connection.key, connection.options);
927
+ if (generation !== this.generation) return;
928
+ if (!stripe) {
929
+ this.loadFailed(MSG_LOAD_FAILED, "");
930
+ return;
931
+ }
932
+ this.stripe = stripe;
933
+ this.stripeSignature = signature;
934
+ }
935
+ const options = { ...elementsConfig };
936
+ const deferred = this.deferred();
937
+ if (!options["clientSecret"] && deferred?.amount !== void 0 && options["amount"] === void 0) options["amount"] = deferred.amount;
938
+ this.lastAmount = deferred?.amount;
939
+ if (this.appearanceFromTokens() && !options["appearance"]) options["appearance"] = readStripeAppearance(this.doc, this.host.nativeElement);
940
+ const elements = this.stripe.elements(options);
941
+ const elementOptions = { ...elementConfig };
942
+ const defaultValues = this.defaultValues();
943
+ if (defaultValues) elementOptions["defaultValues"] = defaultValues;
944
+ if (this.disabled() && !this.mountOnly()) elementOptions["readOnly"] = true;
945
+ this.appliedDefaultValues = JSON.stringify(defaultValues ?? null);
946
+ this.appliedDisabled = this.disabled();
947
+ const element = elements.create("payment", elementOptions);
948
+ this.elements = elements;
949
+ this.element = element;
950
+ element.on("change", (event) => {
951
+ if (generation === this.generation) this.onChange(event);
952
+ });
953
+ element.on("ready", () => {
954
+ if (generation !== this.generation) return;
955
+ this.loading.set(false);
956
+ this.isReady.set(true);
957
+ if (!this.mountOnly()) {
958
+ this.applyDefaultValues(this.defaultValues());
959
+ this.applyDisabled(this.disabled());
960
+ }
961
+ this.ready.emit();
962
+ });
963
+ element.on("loaderror", (event) => {
964
+ if (generation !== this.generation) return;
965
+ const message = event?.error?.message || "Failed to load Stripe";
966
+ this.loadFailed(message, event?.error?.message ?? "");
967
+ });
968
+ element.mount(container);
969
+ this.stripeReady.emit({
970
+ stripe: this.stripe,
971
+ elements,
972
+ paymentElement: element
973
+ });
974
+ } catch (err) {
975
+ if (generation !== this.generation) return;
976
+ this.loadFailed(messageOfThrown(err, MSG_LOAD_FAILED), messageOfThrown(err, ""));
977
+ }
978
+ }
979
+ applyDefaultValues(defaultValues) {
980
+ const signature = JSON.stringify(defaultValues ?? null);
981
+ if (this.mountOnly() || !this.element?.update || !this.isReady() || signature === this.appliedDefaultValues) return;
982
+ this.appliedDefaultValues = signature;
983
+ this.element.update({ defaultValues: defaultValues ?? {} });
984
+ }
985
+ applyDisabled(disabled) {
986
+ if (this.mountOnly() || !this.element?.update || !this.isReady() || disabled === this.appliedDisabled) return;
987
+ this.appliedDisabled = disabled;
988
+ this.element.update({ readOnly: disabled });
989
+ }
990
+ onChange(event) {
991
+ const type = event?.value?.type ?? null;
992
+ const complete = !!event?.complete;
993
+ this.complete.set(complete);
994
+ if (type) this.selectedType.set(type);
995
+ this.elementChange.emit({
996
+ complete,
997
+ empty: !!event?.empty,
998
+ type,
999
+ errorMessage: event?.error?.message ?? null
1000
+ });
1001
+ if (type && type !== (this.lastType ?? this.initialPaymentMethodType())) this.paymentMethodTypeChange.emit(type);
1002
+ if (type) this.lastType = type;
1003
+ }
1004
+ static {
1005
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1006
+ minVersion: "12.0.0",
1007
+ version: "22.2.2",
1008
+ ngImport: i0,
1009
+ type: StripePaymentComponent,
1010
+ deps: [],
1011
+ target: i0.ɵɵFactoryTarget.Component
1012
+ });
1013
+ }
1014
+ static {
1015
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1016
+ minVersion: "17.0.0",
1017
+ version: "22.2.2",
1018
+ type: StripePaymentComponent,
1019
+ isStandalone: true,
1020
+ selector: "ui-stripe-payment",
1021
+ inputs: {
1022
+ mountOnly: {
1023
+ classPropertyName: "mountOnly",
1024
+ publicName: "mountOnly",
1025
+ isSignal: true,
1026
+ isRequired: false,
1027
+ transformFunction: null
1028
+ },
1029
+ mode: {
1030
+ classPropertyName: "mode",
1031
+ publicName: "mode",
1032
+ isSignal: true,
1033
+ isRequired: false,
1034
+ transformFunction: null
1035
+ },
1036
+ publishableKey: {
1037
+ classPropertyName: "publishableKey",
1038
+ publicName: "publishableKey",
1039
+ isSignal: true,
1040
+ isRequired: false,
1041
+ transformFunction: null
1042
+ },
1043
+ clientSecret: {
1044
+ classPropertyName: "clientSecret",
1045
+ publicName: "clientSecret",
1046
+ isSignal: true,
1047
+ isRequired: false,
1048
+ transformFunction: null
1049
+ },
1050
+ deferred: {
1051
+ classPropertyName: "deferred",
1052
+ publicName: "deferred",
1053
+ isSignal: true,
1054
+ isRequired: false,
1055
+ transformFunction: null
1056
+ },
1057
+ createIntent: {
1058
+ classPropertyName: "createIntent",
1059
+ publicName: "createIntent",
1060
+ isSignal: true,
1061
+ isRequired: false,
1062
+ transformFunction: null
1063
+ },
1064
+ stripeAccount: {
1065
+ classPropertyName: "stripeAccount",
1066
+ publicName: "stripeAccount",
1067
+ isSignal: true,
1068
+ isRequired: false,
1069
+ transformFunction: null
1070
+ },
1071
+ locale: {
1072
+ classPropertyName: "locale",
1073
+ publicName: "locale",
1074
+ isSignal: true,
1075
+ isRequired: false,
1076
+ transformFunction: null
1077
+ },
1078
+ stripeOptions: {
1079
+ classPropertyName: "stripeOptions",
1080
+ publicName: "stripeOptions",
1081
+ isSignal: true,
1082
+ isRequired: false,
1083
+ transformFunction: null
1084
+ },
1085
+ paymentMethodTypes: {
1086
+ classPropertyName: "paymentMethodTypes",
1087
+ publicName: "paymentMethodTypes",
1088
+ isSignal: true,
1089
+ isRequired: false,
1090
+ transformFunction: null
1091
+ },
1092
+ elementsOptions: {
1093
+ classPropertyName: "elementsOptions",
1094
+ publicName: "elementsOptions",
1095
+ isSignal: true,
1096
+ isRequired: false,
1097
+ transformFunction: null
1098
+ },
1099
+ layout: {
1100
+ classPropertyName: "layout",
1101
+ publicName: "layout",
1102
+ isSignal: true,
1103
+ isRequired: false,
1104
+ transformFunction: null
1105
+ },
1106
+ paymentMethodOrder: {
1107
+ classPropertyName: "paymentMethodOrder",
1108
+ publicName: "paymentMethodOrder",
1109
+ isSignal: true,
1110
+ isRequired: false,
1111
+ transformFunction: null
1112
+ },
1113
+ wallets: {
1114
+ classPropertyName: "wallets",
1115
+ publicName: "wallets",
1116
+ isSignal: true,
1117
+ isRequired: false,
1118
+ transformFunction: null
1119
+ },
1120
+ fields: {
1121
+ classPropertyName: "fields",
1122
+ publicName: "fields",
1123
+ isSignal: true,
1124
+ isRequired: false,
1125
+ transformFunction: null
1126
+ },
1127
+ defaultValues: {
1128
+ classPropertyName: "defaultValues",
1129
+ publicName: "defaultValues",
1130
+ isSignal: true,
1131
+ isRequired: false,
1132
+ transformFunction: null
1133
+ },
1134
+ business: {
1135
+ classPropertyName: "business",
1136
+ publicName: "business",
1137
+ isSignal: true,
1138
+ isRequired: false,
1139
+ transformFunction: null
1140
+ },
1141
+ terms: {
1142
+ classPropertyName: "terms",
1143
+ publicName: "terms",
1144
+ isSignal: true,
1145
+ isRequired: false,
1146
+ transformFunction: null
1147
+ },
1148
+ paymentElementOptions: {
1149
+ classPropertyName: "paymentElementOptions",
1150
+ publicName: "paymentElementOptions",
1151
+ isSignal: true,
1152
+ isRequired: false,
1153
+ transformFunction: null
1154
+ },
1155
+ appearance: {
1156
+ classPropertyName: "appearance",
1157
+ publicName: "appearance",
1158
+ isSignal: true,
1159
+ isRequired: false,
1160
+ transformFunction: null
1161
+ },
1162
+ appearanceFromTokens: {
1163
+ classPropertyName: "appearanceFromTokens",
1164
+ publicName: "appearanceFromTokens",
1165
+ isSignal: true,
1166
+ isRequired: false,
1167
+ transformFunction: null
1168
+ },
1169
+ returnUrl: {
1170
+ classPropertyName: "returnUrl",
1171
+ publicName: "returnUrl",
1172
+ isSignal: true,
1173
+ isRequired: false,
1174
+ transformFunction: null
1175
+ },
1176
+ billingDetails: {
1177
+ classPropertyName: "billingDetails",
1178
+ publicName: "billingDetails",
1179
+ isSignal: true,
1180
+ isRequired: false,
1181
+ transformFunction: null
1182
+ },
1183
+ confirmParams: {
1184
+ classPropertyName: "confirmParams",
1185
+ publicName: "confirmParams",
1186
+ isSignal: true,
1187
+ isRequired: false,
1188
+ transformFunction: null
1189
+ },
1190
+ redirect: {
1191
+ classPropertyName: "redirect",
1192
+ publicName: "redirect",
1193
+ isSignal: true,
1194
+ isRequired: false,
1195
+ transformFunction: null
1196
+ },
1197
+ submitBeforeConfirm: {
1198
+ classPropertyName: "submitBeforeConfirm",
1199
+ publicName: "submitBeforeConfirm",
1200
+ isSignal: true,
1201
+ isRequired: false,
1202
+ transformFunction: null
1203
+ },
1204
+ autoHandleCardAction: {
1205
+ classPropertyName: "autoHandleCardAction",
1206
+ publicName: "autoHandleCardAction",
1207
+ isSignal: true,
1208
+ isRequired: false,
1209
+ transformFunction: null
1210
+ },
1211
+ submitLabel: {
1212
+ classPropertyName: "submitLabel",
1213
+ publicName: "submitLabel",
1214
+ isSignal: true,
1215
+ isRequired: false,
1216
+ transformFunction: null
1217
+ },
1218
+ showSubmit: {
1219
+ classPropertyName: "showSubmit",
1220
+ publicName: "showSubmit",
1221
+ isSignal: true,
1222
+ isRequired: false,
1223
+ transformFunction: null
1224
+ },
1225
+ disabled: {
1226
+ classPropertyName: "disabled",
1227
+ publicName: "disabled",
1228
+ isSignal: true,
1229
+ isRequired: false,
1230
+ transformFunction: null
1231
+ },
1232
+ pending: {
1233
+ classPropertyName: "pending",
1234
+ publicName: "pending",
1235
+ isSignal: true,
1236
+ isRequired: false,
1237
+ transformFunction: null
1238
+ },
1239
+ label: {
1240
+ classPropertyName: "label",
1241
+ publicName: "label",
1242
+ isSignal: true,
1243
+ isRequired: false,
1244
+ transformFunction: null
1245
+ },
1246
+ mountId: {
1247
+ classPropertyName: "mountId",
1248
+ publicName: "mountId",
1249
+ isSignal: true,
1250
+ isRequired: false,
1251
+ transformFunction: null
1252
+ },
1253
+ mountClass: {
1254
+ classPropertyName: "mountClass",
1255
+ publicName: "mountClass",
1256
+ isSignal: true,
1257
+ isRequired: false,
1258
+ transformFunction: null
1259
+ },
1260
+ showAchNotice: {
1261
+ classPropertyName: "showAchNotice",
1262
+ publicName: "showAchNotice",
1263
+ isSignal: true,
1264
+ isRequired: false,
1265
+ transformFunction: null
1266
+ },
1267
+ achNotice: {
1268
+ classPropertyName: "achNotice",
1269
+ publicName: "achNotice",
1270
+ isSignal: true,
1271
+ isRequired: false,
1272
+ transformFunction: null
1273
+ },
1274
+ achNoticeTestId: {
1275
+ classPropertyName: "achNoticeTestId",
1276
+ publicName: "achNoticeTestId",
1277
+ isSignal: true,
1278
+ isRequired: false,
1279
+ transformFunction: null
1280
+ },
1281
+ initialPaymentMethodType: {
1282
+ classPropertyName: "initialPaymentMethodType",
1283
+ publicName: "initialPaymentMethodType",
1284
+ isSignal: true,
1285
+ isRequired: false,
1286
+ transformFunction: null
1287
+ },
1288
+ showErrors: {
1289
+ classPropertyName: "showErrors",
1290
+ publicName: "showErrors",
1291
+ isSignal: true,
1292
+ isRequired: false,
1293
+ transformFunction: null
1294
+ },
1295
+ errorDisplay: {
1296
+ classPropertyName: "errorDisplay",
1297
+ publicName: "errorDisplay",
1298
+ isSignal: true,
1299
+ isRequired: false,
1300
+ transformFunction: null
1301
+ },
1302
+ errorDisplayByStage: {
1303
+ classPropertyName: "errorDisplayByStage",
1304
+ publicName: "errorDisplayByStage",
1305
+ isSignal: true,
1306
+ isRequired: false,
1307
+ transformFunction: null
1308
+ },
1309
+ errorFallback: {
1310
+ classPropertyName: "errorFallback",
1311
+ publicName: "errorFallback",
1312
+ isSignal: true,
1313
+ isRequired: false,
1314
+ transformFunction: null
1315
+ },
1316
+ errorFallbackByStage: {
1317
+ classPropertyName: "errorFallbackByStage",
1318
+ publicName: "errorFallbackByStage",
1319
+ isSignal: true,
1320
+ isRequired: false,
1321
+ transformFunction: null
1322
+ },
1323
+ errorMessages: {
1324
+ classPropertyName: "errorMessages",
1325
+ publicName: "errorMessages",
1326
+ isSignal: true,
1327
+ isRequired: false,
1328
+ transformFunction: null
1329
+ },
1330
+ loadErrorMessage: {
1331
+ classPropertyName: "loadErrorMessage",
1332
+ publicName: "loadErrorMessage",
1333
+ isSignal: true,
1334
+ isRequired: false,
1335
+ transformFunction: null
1336
+ },
1337
+ a11yMessages: {
1338
+ classPropertyName: "a11yMessages",
1339
+ publicName: "a11yMessages",
1340
+ isSignal: true,
1341
+ isRequired: false,
1342
+ transformFunction: null
1343
+ }
1344
+ },
1345
+ outputs: {
1346
+ stripeReady: "stripeReady",
1347
+ ready: "ready",
1348
+ paymentMethodTypeChange: "paymentMethodTypeChange",
1349
+ elementChange: "elementChange",
1350
+ confirmed: "confirmed",
1351
+ failed: "failed",
1352
+ loadError: "loadError"
1353
+ },
1354
+ host: { properties: { "attr.aria-busy": "!mountOnly() && (loading() || submitting()) ? \"true\" : null" } },
1355
+ viewQueries: [{
1356
+ propertyName: "mountRef",
1357
+ first: true,
1358
+ predicate: ["mount"],
1359
+ descendants: true,
1360
+ isSignal: true
1361
+ }],
1362
+ ngImport: i0,
1363
+ template: `
1364
+ <div class="sp">
1365
+ @if (!mountOnly() || a11yMessages()) {
1366
+ <div class="sp-sr" role="status" aria-live="polite" data-testid="stripe-status">{{ statusText() }}</div>
1367
+ }
1368
+ @if (!mountOnly() && (loading() || pending())) {
1369
+ <div class="sp-skeleton" data-testid="stripe-skeleton" aria-hidden="true">
1370
+ <ui-skeleton [height]="44" [mb]="10" />
1371
+ <ui-skeleton [height]="44" [mb]="10" />
1372
+ <ui-skeleton [height]="44" width="60%" />
1373
+ </div>
1374
+ }
1375
+ @if (!mountOnly() && loadErrorText(); as text) {
1376
+ <div class="sp-block" data-testid="stripe-load-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1377
+ }
1378
+ <div #mount class="sp-mount" [attr.id]="mountId() || null" [class]="mountClass()" [class.sp-mount--hidden]="mountHidden()" [attr.aria-hidden]="mountHidden() ? 'true' : null" [attr.inert]="mountHidden() ? '' : null"
1379
+ [attr.role]="mountOnly() ? null : 'group'" [attr.aria-label]="mountOnly() ? null : label()" data-testid="stripe-mount"></div>
1380
+ @if (!mountOnly() && achNoticeVisible()) {
1381
+ <div class="sp-block" [attr.data-testid]="achNoticeTestId()"><ui-alert variant="info">{{ achNotice() }}</ui-alert></div>
1382
+ }
1383
+ @if (!mountOnly() && errorText(); as text) {
1384
+ <div class="sp-block" [id]="errorId" data-testid="stripe-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1385
+ }
1386
+ @if (!mountOnly() && showSubmit()) {
1387
+ <div class="sp-actions">
1388
+ <ui-button variant="primary" type="button" [loading]="submitting()" [disabled]="submitDisabled()" [ariaDescribedBy]="errorText() ? errorId : undefined"
1389
+ data-testid="stripe-submit" (click)="confirm()">{{ effectiveSubmitLabel() }}</ui-button>
1390
+ </div>
1391
+ }
1392
+ </div>
1393
+ `,
1394
+ isInline: true,
1395
+ styles: [":host{display:block;min-width:0}.sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sp-block{margin-top:12px}.sp-actions{margin-top:16px;display:flex;justify-content:flex-end}.sp{position:relative}.sp-mount--hidden{position:absolute;top:0;left:0;right:0;opacity:0;pointer-events:none}@media(max-width:480px){.sp-actions{display:block}.sp-actions ui-button{display:flex}.sp-actions ::ng-deep .btn{width:100%}}\n"],
1396
+ dependencies: [
1397
+ {
1398
+ kind: "component",
1399
+ type: AlertComponent,
1400
+ selector: "ui-alert",
1401
+ inputs: [
1402
+ "variant",
1403
+ "title",
1404
+ "dismissible",
1405
+ "quiet",
1406
+ "compact"
1407
+ ],
1408
+ outputs: ["dismissed"]
1409
+ },
1410
+ {
1411
+ kind: "component",
1412
+ type: ButtonComponent,
1413
+ selector: "ui-button",
1414
+ inputs: [
1415
+ "variant",
1416
+ "routerLink",
1417
+ "queryParams",
1418
+ "fragment",
1419
+ "href",
1420
+ "target",
1421
+ "rel",
1422
+ "color",
1423
+ "active",
1424
+ "size",
1425
+ "type",
1426
+ "disabled",
1427
+ "loading",
1428
+ "fullWidth",
1429
+ "ariaLabel",
1430
+ "ariaExpanded",
1431
+ "ariaPressed",
1432
+ "ariaDescribedBy",
1433
+ "modal-footer-left",
1434
+ "modal-footer-right"
1435
+ ]
1436
+ },
1437
+ {
1438
+ kind: "component",
1439
+ type: SkeletonComponent,
1440
+ selector: "ui-skeleton",
1441
+ inputs: [
1442
+ "height",
1443
+ "width",
1444
+ "radius",
1445
+ "mb",
1446
+ "ariaLabel"
1447
+ ]
1448
+ }
1449
+ ],
1450
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1451
+ });
1452
+ }
1453
+ };
1454
+ i0.ɵɵngDeclareClassMetadata({
1455
+ minVersion: "12.0.0",
1456
+ version: "22.2.2",
1457
+ ngImport: i0,
1458
+ type: StripePaymentComponent,
1459
+ decorators: [{
1460
+ type: Component,
1461
+ args: [{
1462
+ selector: "ui-stripe-payment",
1463
+ standalone: true,
1464
+ changeDetection: ChangeDetectionStrategy.OnPush,
1465
+ imports: [
1466
+ AlertComponent,
1467
+ ButtonComponent,
1468
+ SkeletonComponent
1469
+ ],
1470
+ host: { "[attr.aria-busy]": "!mountOnly() && (loading() || submitting()) ? \"true\" : null" },
1471
+ template: `
1472
+ <div class="sp">
1473
+ @if (!mountOnly() || a11yMessages()) {
1474
+ <div class="sp-sr" role="status" aria-live="polite" data-testid="stripe-status">{{ statusText() }}</div>
1475
+ }
1476
+ @if (!mountOnly() && (loading() || pending())) {
1477
+ <div class="sp-skeleton" data-testid="stripe-skeleton" aria-hidden="true">
1478
+ <ui-skeleton [height]="44" [mb]="10" />
1479
+ <ui-skeleton [height]="44" [mb]="10" />
1480
+ <ui-skeleton [height]="44" width="60%" />
1481
+ </div>
1482
+ }
1483
+ @if (!mountOnly() && loadErrorText(); as text) {
1484
+ <div class="sp-block" data-testid="stripe-load-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1485
+ }
1486
+ <div #mount class="sp-mount" [attr.id]="mountId() || null" [class]="mountClass()" [class.sp-mount--hidden]="mountHidden()" [attr.aria-hidden]="mountHidden() ? 'true' : null" [attr.inert]="mountHidden() ? '' : null"
1487
+ [attr.role]="mountOnly() ? null : 'group'" [attr.aria-label]="mountOnly() ? null : label()" data-testid="stripe-mount"></div>
1488
+ @if (!mountOnly() && achNoticeVisible()) {
1489
+ <div class="sp-block" [attr.data-testid]="achNoticeTestId()"><ui-alert variant="info">{{ achNotice() }}</ui-alert></div>
1490
+ }
1491
+ @if (!mountOnly() && errorText(); as text) {
1492
+ <div class="sp-block" [id]="errorId" data-testid="stripe-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1493
+ }
1494
+ @if (!mountOnly() && showSubmit()) {
1495
+ <div class="sp-actions">
1496
+ <ui-button variant="primary" type="button" [loading]="submitting()" [disabled]="submitDisabled()" [ariaDescribedBy]="errorText() ? errorId : undefined"
1497
+ data-testid="stripe-submit" (click)="confirm()">{{ effectiveSubmitLabel() }}</ui-button>
1498
+ </div>
1499
+ }
1500
+ </div>
1501
+ `,
1502
+ styles: [":host{display:block;min-width:0}.sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sp-block{margin-top:12px}.sp-actions{margin-top:16px;display:flex;justify-content:flex-end}.sp{position:relative}.sp-mount--hidden{position:absolute;top:0;left:0;right:0;opacity:0;pointer-events:none}@media(max-width:480px){.sp-actions{display:block}.sp-actions ui-button{display:flex}.sp-actions ::ng-deep .btn{width:100%}}\n"]
1503
+ }]
1504
+ }],
1505
+ ctorParameters: () => [],
1506
+ propDecorators: {
1507
+ mountOnly: [{
1508
+ type: i0.Input,
1509
+ args: [{
1510
+ isSignal: true,
1511
+ alias: "mountOnly",
1512
+ required: false
1513
+ }]
1514
+ }],
1515
+ mode: [{
1516
+ type: i0.Input,
1517
+ args: [{
1518
+ isSignal: true,
1519
+ alias: "mode",
1520
+ required: false
1521
+ }]
1522
+ }],
1523
+ publishableKey: [{
1524
+ type: i0.Input,
1525
+ args: [{
1526
+ isSignal: true,
1527
+ alias: "publishableKey",
1528
+ required: false
1529
+ }]
1530
+ }],
1531
+ clientSecret: [{
1532
+ type: i0.Input,
1533
+ args: [{
1534
+ isSignal: true,
1535
+ alias: "clientSecret",
1536
+ required: false
1537
+ }]
1538
+ }],
1539
+ deferred: [{
1540
+ type: i0.Input,
1541
+ args: [{
1542
+ isSignal: true,
1543
+ alias: "deferred",
1544
+ required: false
1545
+ }]
1546
+ }],
1547
+ createIntent: [{
1548
+ type: i0.Input,
1549
+ args: [{
1550
+ isSignal: true,
1551
+ alias: "createIntent",
1552
+ required: false
1553
+ }]
1554
+ }],
1555
+ stripeAccount: [{
1556
+ type: i0.Input,
1557
+ args: [{
1558
+ isSignal: true,
1559
+ alias: "stripeAccount",
1560
+ required: false
1561
+ }]
1562
+ }],
1563
+ locale: [{
1564
+ type: i0.Input,
1565
+ args: [{
1566
+ isSignal: true,
1567
+ alias: "locale",
1568
+ required: false
1569
+ }]
1570
+ }],
1571
+ stripeOptions: [{
1572
+ type: i0.Input,
1573
+ args: [{
1574
+ isSignal: true,
1575
+ alias: "stripeOptions",
1576
+ required: false
1577
+ }]
1578
+ }],
1579
+ paymentMethodTypes: [{
1580
+ type: i0.Input,
1581
+ args: [{
1582
+ isSignal: true,
1583
+ alias: "paymentMethodTypes",
1584
+ required: false
1585
+ }]
1586
+ }],
1587
+ elementsOptions: [{
1588
+ type: i0.Input,
1589
+ args: [{
1590
+ isSignal: true,
1591
+ alias: "elementsOptions",
1592
+ required: false
1593
+ }]
1594
+ }],
1595
+ layout: [{
1596
+ type: i0.Input,
1597
+ args: [{
1598
+ isSignal: true,
1599
+ alias: "layout",
1600
+ required: false
1601
+ }]
1602
+ }],
1603
+ paymentMethodOrder: [{
1604
+ type: i0.Input,
1605
+ args: [{
1606
+ isSignal: true,
1607
+ alias: "paymentMethodOrder",
1608
+ required: false
1609
+ }]
1610
+ }],
1611
+ wallets: [{
1612
+ type: i0.Input,
1613
+ args: [{
1614
+ isSignal: true,
1615
+ alias: "wallets",
1616
+ required: false
1617
+ }]
1618
+ }],
1619
+ fields: [{
1620
+ type: i0.Input,
1621
+ args: [{
1622
+ isSignal: true,
1623
+ alias: "fields",
1624
+ required: false
1625
+ }]
1626
+ }],
1627
+ defaultValues: [{
1628
+ type: i0.Input,
1629
+ args: [{
1630
+ isSignal: true,
1631
+ alias: "defaultValues",
1632
+ required: false
1633
+ }]
1634
+ }],
1635
+ business: [{
1636
+ type: i0.Input,
1637
+ args: [{
1638
+ isSignal: true,
1639
+ alias: "business",
1640
+ required: false
1641
+ }]
1642
+ }],
1643
+ terms: [{
1644
+ type: i0.Input,
1645
+ args: [{
1646
+ isSignal: true,
1647
+ alias: "terms",
1648
+ required: false
1649
+ }]
1650
+ }],
1651
+ paymentElementOptions: [{
1652
+ type: i0.Input,
1653
+ args: [{
1654
+ isSignal: true,
1655
+ alias: "paymentElementOptions",
1656
+ required: false
1657
+ }]
1658
+ }],
1659
+ appearance: [{
1660
+ type: i0.Input,
1661
+ args: [{
1662
+ isSignal: true,
1663
+ alias: "appearance",
1664
+ required: false
1665
+ }]
1666
+ }],
1667
+ appearanceFromTokens: [{
1668
+ type: i0.Input,
1669
+ args: [{
1670
+ isSignal: true,
1671
+ alias: "appearanceFromTokens",
1672
+ required: false
1673
+ }]
1674
+ }],
1675
+ returnUrl: [{
1676
+ type: i0.Input,
1677
+ args: [{
1678
+ isSignal: true,
1679
+ alias: "returnUrl",
1680
+ required: false
1681
+ }]
1682
+ }],
1683
+ billingDetails: [{
1684
+ type: i0.Input,
1685
+ args: [{
1686
+ isSignal: true,
1687
+ alias: "billingDetails",
1688
+ required: false
1689
+ }]
1690
+ }],
1691
+ confirmParams: [{
1692
+ type: i0.Input,
1693
+ args: [{
1694
+ isSignal: true,
1695
+ alias: "confirmParams",
1696
+ required: false
1697
+ }]
1698
+ }],
1699
+ redirect: [{
1700
+ type: i0.Input,
1701
+ args: [{
1702
+ isSignal: true,
1703
+ alias: "redirect",
1704
+ required: false
1705
+ }]
1706
+ }],
1707
+ submitBeforeConfirm: [{
1708
+ type: i0.Input,
1709
+ args: [{
1710
+ isSignal: true,
1711
+ alias: "submitBeforeConfirm",
1712
+ required: false
1713
+ }]
1714
+ }],
1715
+ autoHandleCardAction: [{
1716
+ type: i0.Input,
1717
+ args: [{
1718
+ isSignal: true,
1719
+ alias: "autoHandleCardAction",
1720
+ required: false
1721
+ }]
1722
+ }],
1723
+ submitLabel: [{
1724
+ type: i0.Input,
1725
+ args: [{
1726
+ isSignal: true,
1727
+ alias: "submitLabel",
1728
+ required: false
1729
+ }]
1730
+ }],
1731
+ showSubmit: [{
1732
+ type: i0.Input,
1733
+ args: [{
1734
+ isSignal: true,
1735
+ alias: "showSubmit",
1736
+ required: false
1737
+ }]
1738
+ }],
1739
+ disabled: [{
1740
+ type: i0.Input,
1741
+ args: [{
1742
+ isSignal: true,
1743
+ alias: "disabled",
1744
+ required: false
1745
+ }]
1746
+ }],
1747
+ pending: [{
1748
+ type: i0.Input,
1749
+ args: [{
1750
+ isSignal: true,
1751
+ alias: "pending",
1752
+ required: false
1753
+ }]
1754
+ }],
1755
+ label: [{
1756
+ type: i0.Input,
1757
+ args: [{
1758
+ isSignal: true,
1759
+ alias: "label",
1760
+ required: false
1761
+ }]
1762
+ }],
1763
+ mountId: [{
1764
+ type: i0.Input,
1765
+ args: [{
1766
+ isSignal: true,
1767
+ alias: "mountId",
1768
+ required: false
1769
+ }]
1770
+ }],
1771
+ mountClass: [{
1772
+ type: i0.Input,
1773
+ args: [{
1774
+ isSignal: true,
1775
+ alias: "mountClass",
1776
+ required: false
1777
+ }]
1778
+ }],
1779
+ showAchNotice: [{
1780
+ type: i0.Input,
1781
+ args: [{
1782
+ isSignal: true,
1783
+ alias: "showAchNotice",
1784
+ required: false
1785
+ }]
1786
+ }],
1787
+ achNotice: [{
1788
+ type: i0.Input,
1789
+ args: [{
1790
+ isSignal: true,
1791
+ alias: "achNotice",
1792
+ required: false
1793
+ }]
1794
+ }],
1795
+ achNoticeTestId: [{
1796
+ type: i0.Input,
1797
+ args: [{
1798
+ isSignal: true,
1799
+ alias: "achNoticeTestId",
1800
+ required: false
1801
+ }]
1802
+ }],
1803
+ initialPaymentMethodType: [{
1804
+ type: i0.Input,
1805
+ args: [{
1806
+ isSignal: true,
1807
+ alias: "initialPaymentMethodType",
1808
+ required: false
1809
+ }]
1810
+ }],
1811
+ showErrors: [{
1812
+ type: i0.Input,
1813
+ args: [{
1814
+ isSignal: true,
1815
+ alias: "showErrors",
1816
+ required: false
1817
+ }]
1818
+ }],
1819
+ errorDisplay: [{
1820
+ type: i0.Input,
1821
+ args: [{
1822
+ isSignal: true,
1823
+ alias: "errorDisplay",
1824
+ required: false
1825
+ }]
1826
+ }],
1827
+ errorDisplayByStage: [{
1828
+ type: i0.Input,
1829
+ args: [{
1830
+ isSignal: true,
1831
+ alias: "errorDisplayByStage",
1832
+ required: false
1833
+ }]
1834
+ }],
1835
+ errorFallback: [{
1836
+ type: i0.Input,
1837
+ args: [{
1838
+ isSignal: true,
1839
+ alias: "errorFallback",
1840
+ required: false
1841
+ }]
1842
+ }],
1843
+ errorFallbackByStage: [{
1844
+ type: i0.Input,
1845
+ args: [{
1846
+ isSignal: true,
1847
+ alias: "errorFallbackByStage",
1848
+ required: false
1849
+ }]
1850
+ }],
1851
+ errorMessages: [{
1852
+ type: i0.Input,
1853
+ args: [{
1854
+ isSignal: true,
1855
+ alias: "errorMessages",
1856
+ required: false
1857
+ }]
1858
+ }],
1859
+ loadErrorMessage: [{
1860
+ type: i0.Input,
1861
+ args: [{
1862
+ isSignal: true,
1863
+ alias: "loadErrorMessage",
1864
+ required: false
1865
+ }]
1866
+ }],
1867
+ a11yMessages: [{
1868
+ type: i0.Input,
1869
+ args: [{
1870
+ isSignal: true,
1871
+ alias: "a11yMessages",
1872
+ required: false
1873
+ }]
1874
+ }],
1875
+ stripeReady: [{
1876
+ type: i0.Output,
1877
+ args: ["stripeReady"]
1878
+ }],
1879
+ ready: [{
1880
+ type: i0.Output,
1881
+ args: ["ready"]
1882
+ }],
1883
+ paymentMethodTypeChange: [{
1884
+ type: i0.Output,
1885
+ args: ["paymentMethodTypeChange"]
1886
+ }],
1887
+ elementChange: [{
1888
+ type: i0.Output,
1889
+ args: ["elementChange"]
1890
+ }],
1891
+ confirmed: [{
1892
+ type: i0.Output,
1893
+ args: ["confirmed"]
1894
+ }],
1895
+ failed: [{
1896
+ type: i0.Output,
1897
+ args: ["failed"]
1898
+ }],
1899
+ loadError: [{
1900
+ type: i0.Output,
1901
+ args: ["loadError"]
1902
+ }],
1903
+ mountRef: [{
1904
+ type: i0.ViewChild,
1905
+ args: ["mount", { isSignal: true }]
1906
+ }]
1907
+ }
1908
+ });
1909
+ const MICRODEPOSIT_COPY = {
1910
+ title: "Bank account waiting for verification",
1911
+ processingTitle: "Bank account being confirmed",
1912
+ processing: "Your bank is confirming this account; this usually takes up to a few business days. We will email you when it is ready.",
1913
+ cannotPay: "Until then this account can't be used to pay invoices.",
1914
+ readOnly: "An administrator of your organization can finish the verification.",
1915
+ keepsActive: "Your current payment method stays active until the new bank account is verified.",
1916
+ cancelTitle: "Cancel verification",
1917
+ verifyLabel: "Verify bank account",
1918
+ cancelBase: "Cancel the verification of this bank account? It will not be saved as a payment method and you can add it again later.",
1919
+ cancelKeepsActive: " Your current payment method stays active.",
1920
+ cancelNoOther: " You have no other payment method saved.",
1921
+ tooManyAttempts: "Too many failed attempts. Please try again later or contact support.",
1922
+ codeRequired: "Enter the 6-character code."
1923
+ };
1924
+ function microdepositArrivalText(iso) {
1925
+ if (!iso) return "";
1926
+ const date = new Date(iso);
1927
+ return Number.isNaN(date.getTime()) ? "" : date.toLocaleDateString("en-US", {
1928
+ month: "long",
1929
+ day: "numeric",
1930
+ year: "numeric",
1931
+ timeZone: "UTC"
1932
+ });
1933
+ }
1934
+ function depositAmountError(value) {
1935
+ if (value === "" || value === null || value === void 0) return "";
1936
+ const n = Number(value);
1937
+ if (!Number.isInteger(n)) return "Enter whole cents, for example 32.";
1938
+ if (n < 1 || n > 99) return "Enter a number of cents from 1 to 99.";
1939
+ return "";
1940
+ }
1941
+ const normalizeDescriptorCode = (value) => (value ?? "").trim().toUpperCase();
1942
+ function descriptorCodeError(value, requireSmPrefix = false) {
1943
+ const code = normalizeDescriptorCode(value);
1944
+ if (!code) return "";
1945
+ if (!/^[A-Z0-9]{6}$/.test(code)) return "The code has 6 letters or numbers.";
1946
+ if (requireSmPrefix && !/^SM[A-Z0-9]{4}$/.test(code)) return "Descriptor code must start with \"SM\" followed by 4 characters (e.g., SMXXXX)";
1947
+ return "";
1948
+ }
1949
+ function safeHostedUrl(url) {
1950
+ return /^https:\/\//.test(url ?? "") ? url : null;
1951
+ }
1952
+ const arrivalClause = (iso) => {
1953
+ const text = microdepositArrivalText(iso);
1954
+ return text ? ` (by ${text})` : "";
1955
+ };
1956
+ function microdepositStepsText(ctx) {
1957
+ const partner = ctx.partnerName ?? "";
1958
+ const holder = partner ? `${partner}'s account` : "your account";
1959
+ const clause = arrivalClause(ctx.arrivalDate);
1960
+ const deposits = ctx.type === "descriptor_code" ? `Stripe sent one small deposit to ${holder}${clause}, with a description that starts with SM followed by a 6-character code. ` : `Stripe sent two small deposits to ${holder}; they appear in 1-2 business days${clause}, with the description SMXXXX. `;
1961
+ if (ctx.readOnly) return `${deposits}${ctx.readOnlyText ?? (ctx.startedBy === "partner" ? `This bank account was started by ${partner}; it can be finished by them.` : ctx.startedBy === "other" ? "This bank account was started by another crematory; it can be finished by them." : partner ? `${partner} or the crematory that set it up can finish the verification.` : MICRODEPOSIT_COPY.readOnly)} ${MICRODEPOSIT_COPY.cannotPay}`;
1962
+ return `${deposits}${ctx.type === "descriptor_code" ? partner ? `Ask ${partner} for the code and enter it below to finish. ` : "When it arrives, enter that code below to finish. " : partner ? `Ask ${partner} for the two deposit amounts and enter them below to finish. ` : "When they arrive, enter the two amounts below to finish. "}${MICRODEPOSIT_COPY.cannotPay}`;
1963
+ }
1964
+ function microdepositProcessingText(partnerName = "") {
1965
+ return partnerName ? `${partnerName}'s bank is confirming this account; this usually takes up to a few business days. We will email you when it is ready.` : MICRODEPOSIT_COPY.processing;
1966
+ }
1967
+ function microdepositKeepsActiveText(partnerName = "") {
1968
+ return partnerName ? `${partnerName}'s current payment method stays active until the new bank account is verified.` : MICRODEPOSIT_COPY.keepsActive;
1969
+ }
1970
+ function microdepositCancelMessage(options = {}) {
1971
+ const partner = options.partnerName ?? "";
1972
+ if (partner) return `${MICRODEPOSIT_COPY.cancelBase} ${options.hasSavedMethod ? `${partner}'s current payment method stays active.` : `${partner} has no other payment method saved.`}`;
1973
+ return MICRODEPOSIT_COPY.cancelBase + (options.hasSavedMethod ? MICRODEPOSIT_COPY.cancelKeepsActive : MICRODEPOSIT_COPY.cancelNoOther);
1974
+ }
1975
+ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
1976
+ constructor() {
1977
+ this.service = inject(StripePaymentService);
1978
+ this.type = input("amounts", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
1979
+ this.bankName = input("", ...ngDevMode ? [{ debugName: "bankName" }] : /* istanbul ignore next */ []);
1980
+ this.last4 = input("", ...ngDevMode ? [{ debugName: "last4" }] : /* istanbul ignore next */ []);
1981
+ this.arrivalDate = input(null, ...ngDevMode ? [{ debugName: "arrivalDate" }] : /* istanbul ignore next */ []);
1982
+ this.hostedVerificationUrl = input(null, ...ngDevMode ? [{ debugName: "hostedVerificationUrl" }] : /* istanbul ignore next */ []);
1983
+ this.readOnly = input(false, ...ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []);
1984
+ this.statusOnly = input(false, ...ngDevMode ? [{ debugName: "statusOnly" }] : /* istanbul ignore next */ []);
1985
+ this.title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
1986
+ this.stepsText = input("", ...ngDevMode ? [{ debugName: "stepsText" }] : /* istanbul ignore next */ []);
1987
+ this.readOnlyText = input(MICRODEPOSIT_COPY.readOnly, ...ngDevMode ? [{ debugName: "readOnlyText" }] : /* istanbul ignore next */ []);
1988
+ this.hideHostedLink = input(false, ...ngDevMode ? [{ debugName: "hideHostedLink" }] : /* istanbul ignore next */ []);
1989
+ this.cancelLabel = input("", ...ngDevMode ? [{ debugName: "cancelLabel" }] : /* istanbul ignore next */ []);
1990
+ this.verifyLabel = input("", ...ngDevMode ? [{ debugName: "verifyLabel" }] : /* istanbul ignore next */ []);
1991
+ this.keepsActiveText = input("", ...ngDevMode ? [{ debugName: "keepsActiveText" }] : /* istanbul ignore next */ []);
1992
+ this.cancelMessageText = input("", ...ngDevMode ? [{ debugName: "cancelMessageText" }] : /* istanbul ignore next */ []);
1993
+ this.hasSavedMethod = input(false, ...ngDevMode ? [{ debugName: "hasSavedMethod" }] : /* istanbul ignore next */ []);
1994
+ this.verifying = input(false, ...ngDevMode ? [{ debugName: "verifying" }] : /* istanbul ignore next */ []);
1995
+ this.cancelling = input(false, ...ngDevMode ? [{ debugName: "cancelling" }] : /* istanbul ignore next */ []);
1996
+ this.errorText = input("", ...ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []);
1997
+ this.allowCancel = input(true, ...ngDevMode ? [{ debugName: "allowCancel" }] : /* istanbul ignore next */ []);
1998
+ this.requireSmPrefix = input(false, ...ngDevMode ? [{ debugName: "requireSmPrefix" }] : /* istanbul ignore next */ []);
1999
+ this.clientSecret = input(null, ...ngDevMode ? [{ debugName: "clientSecret" }] : /* istanbul ignore next */ []);
2000
+ this.publishableKey = input(null, ...ngDevMode ? [{ debugName: "publishableKey" }] : /* istanbul ignore next */ []);
2001
+ this.stripeAccount = input(null, ...ngDevMode ? [{ debugName: "stripeAccount" }] : /* istanbul ignore next */ []);
2002
+ this.flow = input("payment", ...ngDevMode ? [{ debugName: "flow" }] : /* istanbul ignore next */ []);
2003
+ this.maxAttempts = input(0, ...ngDevMode ? [{ debugName: "maxAttempts" }] : /* istanbul ignore next */ []);
2004
+ this.verify$ = output({ alias: "verify" });
2005
+ this.cancelVerification = output();
2006
+ this.verified = output();
2007
+ this.verifyFailed = output();
2008
+ this.copy = MICRODEPOSIT_COPY;
2009
+ this.first = signal("", ...ngDevMode ? [{ debugName: "first" }] : /* istanbul ignore next */ []);
2010
+ this.second = signal("", ...ngDevMode ? [{ debugName: "second" }] : /* istanbul ignore next */ []);
2011
+ this.code = signal("", ...ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []);
2012
+ this.touched = signal(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
2013
+ this.showCancelConfirm = signal(false, ...ngDevMode ? [{ debugName: "showCancelConfirm" }] : /* istanbul ignore next */ []);
2014
+ this.stripeBusy = signal(false, ...ngDevMode ? [{ debugName: "stripeBusy" }] : /* istanbul ignore next */ []);
2015
+ this.stripeError = signal("", ...ngDevMode ? [{ debugName: "stripeError" }] : /* istanbul ignore next */ []);
2016
+ this.failedAttempts = 0;
2017
+ this.formHidden = computed(() => this.readOnly() || this.statusOnly(), ...ngDevMode ? [{ debugName: "formHidden" }] : /* istanbul ignore next */ []);
2018
+ this.heading = computed(() => this.title() || (this.isProcessing() ? this.copy.processingTitle : this.copy.title), ...ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []);
2019
+ this.bankLine = computed(() => {
2020
+ const bank = this.bankName().trim();
2021
+ const last4 = this.last4().trim();
2022
+ if (!bank && !last4) return "";
2023
+ return `${bank || "Bank account"}${last4 ? ` ····${last4}` : ""}`;
2024
+ }, ...ngDevMode ? [{ debugName: "bankLine" }] : /* istanbul ignore next */ []);
2025
+ this.busy = computed(() => this.verifying() || this.stripeBusy(), ...ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []);
2026
+ this.shownError = computed(() => this.stripeError() || this.errorText(), ...ngDevMode ? [{ debugName: "shownError" }] : /* istanbul ignore next */ []);
2027
+ this.isProcessing = computed(() => this.type() === "processing", ...ngDevMode ? [{ debugName: "isProcessing" }] : /* istanbul ignore next */ []);
2028
+ this.safeUrl = computed(() => safeHostedUrl(this.hostedVerificationUrl()), ...ngDevMode ? [{ debugName: "safeUrl" }] : /* istanbul ignore next */ []);
2029
+ this.defaultSteps = computed(() => microdepositStepsText({
2030
+ type: this.type() === "descriptor_code" ? "descriptor_code" : "amounts",
2031
+ arrivalDate: this.arrivalDate(),
2032
+ readOnly: this.formHidden(),
2033
+ readOnlyText: this.readOnlyText()
2034
+ }), ...ngDevMode ? [{ debugName: "defaultSteps" }] : /* istanbul ignore next */ []);
2035
+ this.amountError = depositAmountError;
2036
+ this.codeError = computed(() => this.code().trim() ? descriptorCodeError(this.code(), this.requireSmPrefix()) : this.copy.codeRequired, ...ngDevMode ? [{ debugName: "codeError" }] : /* istanbul ignore next */ []);
2037
+ this.hasInvalid = computed(() => this.type() === "descriptor_code" ? !!this.codeError() : !!depositAmountError(this.first()) || !!depositAmountError(this.second()) || this.first() === "" || this.second() === "" || this.first() === null || this.second() === null, ...ngDevMode ? [{ debugName: "hasInvalid" }] : /* istanbul ignore next */ []);
2038
+ this.cancelMessage = computed(() => this.cancelMessageText() || this.copy.cancelBase + (this.hasSavedMethod() ? this.copy.cancelKeepsActive : this.copy.cancelNoOther), ...ngDevMode ? [{ debugName: "cancelMessage" }] : /* istanbul ignore next */ []);
2039
+ }
2040
+ async verify() {
2041
+ if (this.busy()) return;
2042
+ this.touched.set(true);
2043
+ if (this.hasInvalid()) return;
2044
+ const secret = this.clientSecret();
2045
+ if (!secret) {
2046
+ this.verify$.emit(this.type() === "descriptor_code" ? { descriptorCode: normalizeDescriptorCode(this.code()) } : { amounts: [Number(this.first()), Number(this.second())] });
2047
+ return;
2048
+ }
2049
+ const max = this.maxAttempts();
2050
+ if (max > 0 && this.failedAttempts >= max) {
2051
+ this.stripeError.set(this.copy.tooManyAttempts);
2052
+ return;
2053
+ }
2054
+ this.stripeBusy.set(true);
2055
+ this.stripeError.set("");
2056
+ const data = this.type() === "descriptor_code" ? { descriptor_code: normalizeDescriptorCode(this.code()) } : { amounts: [Number(this.first()), Number(this.second())] };
2057
+ const connection = {
2058
+ publishableKey: this.publishableKey(),
2059
+ stripeAccount: this.stripeAccount()
2060
+ };
2061
+ const result = this.flow() === "setup" ? await this.service.verifyMicrodepositsForSetup(secret, data, connection) : await this.service.verifyMicrodepositsForPayment(secret, data, connection);
2062
+ this.stripeBusy.set(false);
2063
+ if (result.ok) {
2064
+ this.verified.emit(result);
2065
+ return;
2066
+ }
2067
+ this.failedAttempts++;
2068
+ const message = result.failure?.message ?? "Verification failed";
2069
+ const remaining = max - this.failedAttempts;
2070
+ this.stripeError.set(max > 0 && remaining > 0 ? `${message} (${remaining} attempt${remaining === 1 ? "" : "s"} remaining)` : message);
2071
+ this.verifyFailed.emit(result);
2072
+ }
2073
+ confirmCancel() {
2074
+ if (this.cancelling()) return;
2075
+ this.showCancelConfirm.set(false);
2076
+ this.cancelVerification.emit();
2077
+ }
2078
+ static {
2079
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2080
+ minVersion: "12.0.0",
2081
+ version: "22.2.2",
2082
+ ngImport: i0,
2083
+ type: MicrodepositVerifyComponent,
2084
+ deps: [],
2085
+ target: i0.ɵɵFactoryTarget.Component
2086
+ });
2087
+ }
2088
+ static {
2089
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
2090
+ minVersion: "17.0.0",
2091
+ version: "22.2.2",
2092
+ type: MicrodepositVerifyComponent,
2093
+ isStandalone: true,
2094
+ selector: "ui-microdeposit-verify",
2095
+ inputs: {
2096
+ type: {
2097
+ classPropertyName: "type",
2098
+ publicName: "type",
2099
+ isSignal: true,
2100
+ isRequired: false,
2101
+ transformFunction: null
2102
+ },
2103
+ bankName: {
2104
+ classPropertyName: "bankName",
2105
+ publicName: "bankName",
2106
+ isSignal: true,
2107
+ isRequired: false,
2108
+ transformFunction: null
2109
+ },
2110
+ last4: {
2111
+ classPropertyName: "last4",
2112
+ publicName: "last4",
2113
+ isSignal: true,
2114
+ isRequired: false,
2115
+ transformFunction: null
2116
+ },
2117
+ arrivalDate: {
2118
+ classPropertyName: "arrivalDate",
2119
+ publicName: "arrivalDate",
2120
+ isSignal: true,
2121
+ isRequired: false,
2122
+ transformFunction: null
2123
+ },
2124
+ hostedVerificationUrl: {
2125
+ classPropertyName: "hostedVerificationUrl",
2126
+ publicName: "hostedVerificationUrl",
2127
+ isSignal: true,
2128
+ isRequired: false,
2129
+ transformFunction: null
2130
+ },
2131
+ readOnly: {
2132
+ classPropertyName: "readOnly",
2133
+ publicName: "readOnly",
2134
+ isSignal: true,
2135
+ isRequired: false,
2136
+ transformFunction: null
2137
+ },
2138
+ statusOnly: {
2139
+ classPropertyName: "statusOnly",
2140
+ publicName: "statusOnly",
2141
+ isSignal: true,
2142
+ isRequired: false,
2143
+ transformFunction: null
2144
+ },
2145
+ title: {
2146
+ classPropertyName: "title",
2147
+ publicName: "title",
2148
+ isSignal: true,
2149
+ isRequired: false,
2150
+ transformFunction: null
2151
+ },
2152
+ stepsText: {
2153
+ classPropertyName: "stepsText",
2154
+ publicName: "stepsText",
2155
+ isSignal: true,
2156
+ isRequired: false,
2157
+ transformFunction: null
2158
+ },
2159
+ readOnlyText: {
2160
+ classPropertyName: "readOnlyText",
2161
+ publicName: "readOnlyText",
2162
+ isSignal: true,
2163
+ isRequired: false,
2164
+ transformFunction: null
2165
+ },
2166
+ hideHostedLink: {
2167
+ classPropertyName: "hideHostedLink",
2168
+ publicName: "hideHostedLink",
2169
+ isSignal: true,
2170
+ isRequired: false,
2171
+ transformFunction: null
2172
+ },
2173
+ cancelLabel: {
2174
+ classPropertyName: "cancelLabel",
2175
+ publicName: "cancelLabel",
2176
+ isSignal: true,
2177
+ isRequired: false,
2178
+ transformFunction: null
2179
+ },
2180
+ verifyLabel: {
2181
+ classPropertyName: "verifyLabel",
2182
+ publicName: "verifyLabel",
2183
+ isSignal: true,
2184
+ isRequired: false,
2185
+ transformFunction: null
2186
+ },
2187
+ keepsActiveText: {
2188
+ classPropertyName: "keepsActiveText",
2189
+ publicName: "keepsActiveText",
2190
+ isSignal: true,
2191
+ isRequired: false,
2192
+ transformFunction: null
2193
+ },
2194
+ cancelMessageText: {
2195
+ classPropertyName: "cancelMessageText",
2196
+ publicName: "cancelMessageText",
2197
+ isSignal: true,
2198
+ isRequired: false,
2199
+ transformFunction: null
2200
+ },
2201
+ hasSavedMethod: {
2202
+ classPropertyName: "hasSavedMethod",
2203
+ publicName: "hasSavedMethod",
2204
+ isSignal: true,
2205
+ isRequired: false,
2206
+ transformFunction: null
2207
+ },
2208
+ verifying: {
2209
+ classPropertyName: "verifying",
2210
+ publicName: "verifying",
2211
+ isSignal: true,
2212
+ isRequired: false,
2213
+ transformFunction: null
2214
+ },
2215
+ cancelling: {
2216
+ classPropertyName: "cancelling",
2217
+ publicName: "cancelling",
2218
+ isSignal: true,
2219
+ isRequired: false,
2220
+ transformFunction: null
2221
+ },
2222
+ errorText: {
2223
+ classPropertyName: "errorText",
2224
+ publicName: "errorText",
2225
+ isSignal: true,
2226
+ isRequired: false,
2227
+ transformFunction: null
2228
+ },
2229
+ allowCancel: {
2230
+ classPropertyName: "allowCancel",
2231
+ publicName: "allowCancel",
2232
+ isSignal: true,
2233
+ isRequired: false,
2234
+ transformFunction: null
2235
+ },
2236
+ requireSmPrefix: {
2237
+ classPropertyName: "requireSmPrefix",
2238
+ publicName: "requireSmPrefix",
2239
+ isSignal: true,
2240
+ isRequired: false,
2241
+ transformFunction: null
2242
+ },
2243
+ clientSecret: {
2244
+ classPropertyName: "clientSecret",
2245
+ publicName: "clientSecret",
2246
+ isSignal: true,
2247
+ isRequired: false,
2248
+ transformFunction: null
2249
+ },
2250
+ publishableKey: {
2251
+ classPropertyName: "publishableKey",
2252
+ publicName: "publishableKey",
2253
+ isSignal: true,
2254
+ isRequired: false,
2255
+ transformFunction: null
2256
+ },
2257
+ stripeAccount: {
2258
+ classPropertyName: "stripeAccount",
2259
+ publicName: "stripeAccount",
2260
+ isSignal: true,
2261
+ isRequired: false,
2262
+ transformFunction: null
2263
+ },
2264
+ flow: {
2265
+ classPropertyName: "flow",
2266
+ publicName: "flow",
2267
+ isSignal: true,
2268
+ isRequired: false,
2269
+ transformFunction: null
2270
+ },
2271
+ maxAttempts: {
2272
+ classPropertyName: "maxAttempts",
2273
+ publicName: "maxAttempts",
2274
+ isSignal: true,
2275
+ isRequired: false,
2276
+ transformFunction: null
2277
+ }
2278
+ },
2279
+ outputs: {
2280
+ verify$: "verify",
2281
+ cancelVerification: "cancelVerification",
2282
+ verified: "verified",
2283
+ verifyFailed: "verifyFailed"
2284
+ },
2285
+ ngImport: i0,
2286
+ template: `
2287
+ <div data-testid="bank-pending-card">
2288
+ <ui-form-section [label]="heading()">
2289
+ <ui-alert variant="info" data-testid="bank-pending-alert">
2290
+ <div data-testid="bank-pending-summary">
2291
+ @if (bankLine(); as line) { <strong data-testid="bank-pending-bank">{{ line }}</strong> }
2292
+ <ui-badge label="Pending" variant="yellow" data-testid="bank-pending-badge" />
2293
+ </div>
2294
+ @if (stepsText().trim()) {
2295
+ <ui-text size="sm" [text]="stepsText()" data-testid="bank-pending-steps" />
2296
+ } @else if (isProcessing()) {
2297
+ <ui-text size="sm" [text]="copy.processing" data-testid="bank-pending-steps" />
2298
+ } @else {
2299
+ <ui-text size="sm" data-testid="bank-pending-steps" [text]="defaultSteps()" />
2300
+ }
2301
+ @if (hasSavedMethod()) {
2302
+ <ui-text size="sm" tone="muted" [text]="keepsActiveText() || copy.keepsActive" data-testid="bank-pending-keeps-active" />
2303
+ }
2304
+ <!-- Finishing the verification on Stripe's page saves the payment method (a write): never offered to a read-only user -->
2305
+ @if (!formHidden() && !hideHostedLink() && safeUrl(); as url) {
2306
+ <div><ui-button variant="link" size="sm" [href]="url" target="_blank" data-testid="bank-hosted-link">Open Stripe's verification page</ui-button></div>
2307
+ }
2308
+ </ui-alert>
2309
+
2310
+ @if (!formHidden() && !isProcessing()) {
2311
+ @if (type() === 'descriptor_code') {
2312
+ <ui-text-input label="Verification code" hint="6 letters or numbers from the deposit description" [maxlength]="6" [required]="true" [showErrors]="touched()"
2313
+ [error]="touched() ? codeError() : ''" data-testid="bank-code-input" [ngModel]="code()" (ngModelChange)="code.set($event)" />
2314
+ } @else {
2315
+ <ui-form-row data-testid="bank-amounts-row">
2316
+ <ui-text-input label="First deposit (cents)" type="number" [min]="1" [max]="99" [maxDecimals]="0" [required]="true" [showErrors]="touched()"
2317
+ [error]="touched() ? amountError(first()) : ''" data-testid="bank-amount-first" [ngModel]="first()" (ngModelChange)="first.set($event)" />
2318
+ <ui-text-input label="Second deposit (cents)" type="number" [min]="1" [max]="99" [maxDecimals]="0" [required]="true" [showErrors]="touched()"
2319
+ [error]="touched() ? amountError(second()) : ''" data-testid="bank-amount-second" [ngModel]="second()" (ngModelChange)="second.set($event)" />
2320
+ </ui-form-row>
2321
+ }
2322
+ @if (shownError(); as text) {
2323
+ <ui-alert variant="danger" data-testid="bank-verify-error">{{ text }}</ui-alert>
2324
+ }
2325
+ <ui-button variant="primary" size="sm" data-testid="bank-verify-button" [loading]="busy()" [disabled]="busy() || cancelling()" (click)="verify()">{{ verifyLabel() || copy.verifyLabel }}</ui-button>
2326
+ }
2327
+
2328
+ @if (!formHidden() && allowCancel()) {
2329
+ <ui-button variant="secondary" size="sm" data-testid="bank-cancel-button" [disabled]="busy() || cancelling()" (click)="showCancelConfirm.set(true)">{{ cancelLabel() || copy.cancelTitle }}</ui-button>
2330
+ }
2331
+ </ui-form-section>
2332
+
2333
+ <ui-modal [open]="showCancelConfirm()" [title]="cancelLabel() || copy.cancelTitle" maxWidth="460px" (close)="showCancelConfirm.set(false)">
2334
+ <ui-text size="sm" data-testid="bank-cancel-message" [text]="cancelMessage()" />
2335
+ <ui-button modal-footer-left variant="secondary" size="sm" data-testid="bank-cancel-keep" (click)="showCancelConfirm.set(false)">Keep waiting</ui-button>
2336
+ <ui-button modal-footer-right variant="danger" size="sm" data-testid="bank-cancel-confirm" [loading]="cancelling()" (click)="confirmCancel()">{{ cancelLabel() || copy.cancelTitle }}</ui-button>
2337
+ </ui-modal>
2338
+ </div>
2339
+ `,
2340
+ isInline: true,
2341
+ dependencies: [
2342
+ {
2343
+ kind: "ngmodule",
2344
+ type: FormsModule
2345
+ },
2346
+ {
2347
+ kind: "directive",
2348
+ type: i1.NgControlStatus,
2349
+ selector: "[formControlName],[ngModel],[formControl]"
2350
+ },
2351
+ {
2352
+ kind: "directive",
2353
+ type: i1.RequiredValidator,
2354
+ selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
2355
+ inputs: ["required"]
2356
+ },
2357
+ {
2358
+ kind: "directive",
2359
+ type: i1.MaxLengthValidator,
2360
+ selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
2361
+ inputs: ["maxlength"]
2362
+ },
2363
+ {
2364
+ kind: "directive",
2365
+ type: i1.NgModel,
2366
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
2367
+ inputs: [
2368
+ "name",
2369
+ "disabled",
2370
+ "ngModel",
2371
+ "ngModelOptions"
2372
+ ],
2373
+ outputs: ["ngModelChange"],
2374
+ exportAs: ["ngModel"]
2375
+ },
2376
+ {
2377
+ kind: "component",
2378
+ type: AlertComponent,
2379
+ selector: "ui-alert",
2380
+ inputs: [
2381
+ "variant",
2382
+ "title",
2383
+ "dismissible",
2384
+ "quiet",
2385
+ "compact"
2386
+ ],
2387
+ outputs: ["dismissed"]
2388
+ },
2389
+ {
2390
+ kind: "component",
2391
+ type: BadgeComponent,
2392
+ selector: "ui-badge",
2393
+ inputs: ["label", "variant"]
2394
+ },
2395
+ {
2396
+ kind: "component",
2397
+ type: ButtonComponent,
2398
+ selector: "ui-button",
2399
+ inputs: [
2400
+ "variant",
2401
+ "routerLink",
2402
+ "queryParams",
2403
+ "fragment",
2404
+ "href",
2405
+ "target",
2406
+ "rel",
2407
+ "color",
2408
+ "active",
2409
+ "size",
2410
+ "type",
2411
+ "disabled",
2412
+ "loading",
2413
+ "fullWidth",
2414
+ "ariaLabel",
2415
+ "ariaExpanded",
2416
+ "ariaPressed",
2417
+ "ariaDescribedBy",
2418
+ "modal-footer-left",
2419
+ "modal-footer-right"
2420
+ ]
2421
+ },
2422
+ {
2423
+ kind: "component",
2424
+ type: FormRowComponent,
2425
+ selector: "ui-form-row",
2426
+ inputs: ["cols"]
2427
+ },
2428
+ {
2429
+ kind: "component",
2430
+ type: FormSectionComponent,
2431
+ selector: "ui-form-section",
2432
+ inputs: ["label", "divider"]
2433
+ },
2434
+ {
2435
+ kind: "component",
2436
+ type: ModalComponent,
2437
+ selector: "ui-modal",
2438
+ inputs: [
2439
+ "open",
2440
+ "title",
2441
+ "description",
2442
+ "maxWidth",
2443
+ "bodyOverflow",
2444
+ "dialogTestId",
2445
+ "hideClose",
2446
+ "closable"
2447
+ ],
2448
+ outputs: ["close"]
2449
+ },
2450
+ {
2451
+ kind: "component",
2452
+ type: TextComponent,
2453
+ selector: "ui-text",
2454
+ inputs: [
2455
+ "text",
2456
+ "size",
2457
+ "tone"
2458
+ ]
2459
+ },
2460
+ {
2461
+ kind: "component",
2462
+ type: TextInputComponent,
2463
+ selector: "ui-text-input",
2464
+ inputs: [
2465
+ "label",
2466
+ "ariaLabel",
2467
+ "placeholder",
2468
+ "prefix",
2469
+ "type",
2470
+ "maxlength",
2471
+ "required",
2472
+ "autocomplete",
2473
+ "inputmode",
2474
+ "readonly",
2475
+ "hint",
2476
+ "error",
2477
+ "phoneFormat",
2478
+ "min",
2479
+ "max",
2480
+ "maxDecimals",
2481
+ "step",
2482
+ "valueType",
2483
+ "formatter",
2484
+ "showErrors",
2485
+ "disabled"
2486
+ ],
2487
+ outputs: [
2488
+ "focused",
2489
+ "blurred",
2490
+ "invalidChange"
2491
+ ]
2492
+ }
2493
+ ],
2494
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2495
+ });
2496
+ }
2497
+ };
2498
+ i0.ɵɵngDeclareClassMetadata({
2499
+ minVersion: "12.0.0",
2500
+ version: "22.2.2",
2501
+ ngImport: i0,
2502
+ type: MicrodepositVerifyComponent,
2503
+ decorators: [{
2504
+ type: Component,
2505
+ args: [{
2506
+ selector: "ui-microdeposit-verify",
2507
+ standalone: true,
2508
+ changeDetection: ChangeDetectionStrategy.OnPush,
2509
+ imports: [
2510
+ FormsModule,
2511
+ AlertComponent,
2512
+ BadgeComponent,
2513
+ ButtonComponent,
2514
+ FormRowComponent,
2515
+ FormSectionComponent,
2516
+ ModalComponent,
2517
+ TextComponent,
2518
+ TextInputComponent
2519
+ ],
2520
+ template: `
2521
+ <div data-testid="bank-pending-card">
2522
+ <ui-form-section [label]="heading()">
2523
+ <ui-alert variant="info" data-testid="bank-pending-alert">
2524
+ <div data-testid="bank-pending-summary">
2525
+ @if (bankLine(); as line) { <strong data-testid="bank-pending-bank">{{ line }}</strong> }
2526
+ <ui-badge label="Pending" variant="yellow" data-testid="bank-pending-badge" />
2527
+ </div>
2528
+ @if (stepsText().trim()) {
2529
+ <ui-text size="sm" [text]="stepsText()" data-testid="bank-pending-steps" />
2530
+ } @else if (isProcessing()) {
2531
+ <ui-text size="sm" [text]="copy.processing" data-testid="bank-pending-steps" />
2532
+ } @else {
2533
+ <ui-text size="sm" data-testid="bank-pending-steps" [text]="defaultSteps()" />
2534
+ }
2535
+ @if (hasSavedMethod()) {
2536
+ <ui-text size="sm" tone="muted" [text]="keepsActiveText() || copy.keepsActive" data-testid="bank-pending-keeps-active" />
2537
+ }
2538
+ <!-- Finishing the verification on Stripe's page saves the payment method (a write): never offered to a read-only user -->
2539
+ @if (!formHidden() && !hideHostedLink() && safeUrl(); as url) {
2540
+ <div><ui-button variant="link" size="sm" [href]="url" target="_blank" data-testid="bank-hosted-link">Open Stripe's verification page</ui-button></div>
2541
+ }
2542
+ </ui-alert>
2543
+
2544
+ @if (!formHidden() && !isProcessing()) {
2545
+ @if (type() === 'descriptor_code') {
2546
+ <ui-text-input label="Verification code" hint="6 letters or numbers from the deposit description" [maxlength]="6" [required]="true" [showErrors]="touched()"
2547
+ [error]="touched() ? codeError() : ''" data-testid="bank-code-input" [ngModel]="code()" (ngModelChange)="code.set($event)" />
2548
+ } @else {
2549
+ <ui-form-row data-testid="bank-amounts-row">
2550
+ <ui-text-input label="First deposit (cents)" type="number" [min]="1" [max]="99" [maxDecimals]="0" [required]="true" [showErrors]="touched()"
2551
+ [error]="touched() ? amountError(first()) : ''" data-testid="bank-amount-first" [ngModel]="first()" (ngModelChange)="first.set($event)" />
2552
+ <ui-text-input label="Second deposit (cents)" type="number" [min]="1" [max]="99" [maxDecimals]="0" [required]="true" [showErrors]="touched()"
2553
+ [error]="touched() ? amountError(second()) : ''" data-testid="bank-amount-second" [ngModel]="second()" (ngModelChange)="second.set($event)" />
2554
+ </ui-form-row>
2555
+ }
2556
+ @if (shownError(); as text) {
2557
+ <ui-alert variant="danger" data-testid="bank-verify-error">{{ text }}</ui-alert>
2558
+ }
2559
+ <ui-button variant="primary" size="sm" data-testid="bank-verify-button" [loading]="busy()" [disabled]="busy() || cancelling()" (click)="verify()">{{ verifyLabel() || copy.verifyLabel }}</ui-button>
2560
+ }
2561
+
2562
+ @if (!formHidden() && allowCancel()) {
2563
+ <ui-button variant="secondary" size="sm" data-testid="bank-cancel-button" [disabled]="busy() || cancelling()" (click)="showCancelConfirm.set(true)">{{ cancelLabel() || copy.cancelTitle }}</ui-button>
2564
+ }
2565
+ </ui-form-section>
2566
+
2567
+ <ui-modal [open]="showCancelConfirm()" [title]="cancelLabel() || copy.cancelTitle" maxWidth="460px" (close)="showCancelConfirm.set(false)">
2568
+ <ui-text size="sm" data-testid="bank-cancel-message" [text]="cancelMessage()" />
2569
+ <ui-button modal-footer-left variant="secondary" size="sm" data-testid="bank-cancel-keep" (click)="showCancelConfirm.set(false)">Keep waiting</ui-button>
2570
+ <ui-button modal-footer-right variant="danger" size="sm" data-testid="bank-cancel-confirm" [loading]="cancelling()" (click)="confirmCancel()">{{ cancelLabel() || copy.cancelTitle }}</ui-button>
2571
+ </ui-modal>
2572
+ </div>
2573
+ `
2574
+ }]
2575
+ }],
2576
+ propDecorators: {
2577
+ type: [{
2578
+ type: i0.Input,
2579
+ args: [{
2580
+ isSignal: true,
2581
+ alias: "type",
2582
+ required: false
2583
+ }]
2584
+ }],
2585
+ bankName: [{
2586
+ type: i0.Input,
2587
+ args: [{
2588
+ isSignal: true,
2589
+ alias: "bankName",
2590
+ required: false
2591
+ }]
2592
+ }],
2593
+ last4: [{
2594
+ type: i0.Input,
2595
+ args: [{
2596
+ isSignal: true,
2597
+ alias: "last4",
2598
+ required: false
2599
+ }]
2600
+ }],
2601
+ arrivalDate: [{
2602
+ type: i0.Input,
2603
+ args: [{
2604
+ isSignal: true,
2605
+ alias: "arrivalDate",
2606
+ required: false
2607
+ }]
2608
+ }],
2609
+ hostedVerificationUrl: [{
2610
+ type: i0.Input,
2611
+ args: [{
2612
+ isSignal: true,
2613
+ alias: "hostedVerificationUrl",
2614
+ required: false
2615
+ }]
2616
+ }],
2617
+ readOnly: [{
2618
+ type: i0.Input,
2619
+ args: [{
2620
+ isSignal: true,
2621
+ alias: "readOnly",
2622
+ required: false
2623
+ }]
2624
+ }],
2625
+ statusOnly: [{
2626
+ type: i0.Input,
2627
+ args: [{
2628
+ isSignal: true,
2629
+ alias: "statusOnly",
2630
+ required: false
2631
+ }]
2632
+ }],
2633
+ title: [{
2634
+ type: i0.Input,
2635
+ args: [{
2636
+ isSignal: true,
2637
+ alias: "title",
2638
+ required: false
2639
+ }]
2640
+ }],
2641
+ stepsText: [{
2642
+ type: i0.Input,
2643
+ args: [{
2644
+ isSignal: true,
2645
+ alias: "stepsText",
2646
+ required: false
2647
+ }]
2648
+ }],
2649
+ readOnlyText: [{
2650
+ type: i0.Input,
2651
+ args: [{
2652
+ isSignal: true,
2653
+ alias: "readOnlyText",
2654
+ required: false
2655
+ }]
2656
+ }],
2657
+ hideHostedLink: [{
2658
+ type: i0.Input,
2659
+ args: [{
2660
+ isSignal: true,
2661
+ alias: "hideHostedLink",
2662
+ required: false
2663
+ }]
2664
+ }],
2665
+ cancelLabel: [{
2666
+ type: i0.Input,
2667
+ args: [{
2668
+ isSignal: true,
2669
+ alias: "cancelLabel",
2670
+ required: false
2671
+ }]
2672
+ }],
2673
+ verifyLabel: [{
2674
+ type: i0.Input,
2675
+ args: [{
2676
+ isSignal: true,
2677
+ alias: "verifyLabel",
2678
+ required: false
2679
+ }]
2680
+ }],
2681
+ keepsActiveText: [{
2682
+ type: i0.Input,
2683
+ args: [{
2684
+ isSignal: true,
2685
+ alias: "keepsActiveText",
2686
+ required: false
2687
+ }]
2688
+ }],
2689
+ cancelMessageText: [{
2690
+ type: i0.Input,
2691
+ args: [{
2692
+ isSignal: true,
2693
+ alias: "cancelMessageText",
2694
+ required: false
2695
+ }]
2696
+ }],
2697
+ hasSavedMethod: [{
2698
+ type: i0.Input,
2699
+ args: [{
2700
+ isSignal: true,
2701
+ alias: "hasSavedMethod",
2702
+ required: false
2703
+ }]
2704
+ }],
2705
+ verifying: [{
2706
+ type: i0.Input,
2707
+ args: [{
2708
+ isSignal: true,
2709
+ alias: "verifying",
2710
+ required: false
2711
+ }]
2712
+ }],
2713
+ cancelling: [{
2714
+ type: i0.Input,
2715
+ args: [{
2716
+ isSignal: true,
2717
+ alias: "cancelling",
2718
+ required: false
2719
+ }]
2720
+ }],
2721
+ errorText: [{
2722
+ type: i0.Input,
2723
+ args: [{
2724
+ isSignal: true,
2725
+ alias: "errorText",
2726
+ required: false
2727
+ }]
2728
+ }],
2729
+ allowCancel: [{
2730
+ type: i0.Input,
2731
+ args: [{
2732
+ isSignal: true,
2733
+ alias: "allowCancel",
2734
+ required: false
2735
+ }]
2736
+ }],
2737
+ requireSmPrefix: [{
2738
+ type: i0.Input,
2739
+ args: [{
2740
+ isSignal: true,
2741
+ alias: "requireSmPrefix",
2742
+ required: false
2743
+ }]
2744
+ }],
2745
+ clientSecret: [{
2746
+ type: i0.Input,
2747
+ args: [{
2748
+ isSignal: true,
2749
+ alias: "clientSecret",
2750
+ required: false
2751
+ }]
2752
+ }],
2753
+ publishableKey: [{
2754
+ type: i0.Input,
2755
+ args: [{
2756
+ isSignal: true,
2757
+ alias: "publishableKey",
2758
+ required: false
2759
+ }]
2760
+ }],
2761
+ stripeAccount: [{
2762
+ type: i0.Input,
2763
+ args: [{
2764
+ isSignal: true,
2765
+ alias: "stripeAccount",
2766
+ required: false
2767
+ }]
2768
+ }],
2769
+ flow: [{
2770
+ type: i0.Input,
2771
+ args: [{
2772
+ isSignal: true,
2773
+ alias: "flow",
2774
+ required: false
2775
+ }]
2776
+ }],
2777
+ maxAttempts: [{
2778
+ type: i0.Input,
2779
+ args: [{
2780
+ isSignal: true,
2781
+ alias: "maxAttempts",
2782
+ required: false
2783
+ }]
2784
+ }],
2785
+ verify$: [{
2786
+ type: i0.Output,
2787
+ args: ["verify"]
2788
+ }],
2789
+ cancelVerification: [{
2790
+ type: i0.Output,
2791
+ args: ["cancelVerification"]
2792
+ }],
2793
+ verified: [{
2794
+ type: i0.Output,
2795
+ args: ["verified"]
2796
+ }],
2797
+ verifyFailed: [{
2798
+ type: i0.Output,
2799
+ args: ["verifyFailed"]
2800
+ }]
2801
+ }
2802
+ });
2803
+ export { MICRODEPOSIT_COPY, MicrodepositVerifyComponent, STRIPE_A11Y_MESSAGES, STRIPE_ACH_NOTICE, STRIPE_DEFAULT_ERROR_MESSAGE, STRIPE_ERROR_MESSAGES, STRIPE_LOADER, STRIPE_PAYMENT_DEFAULTS, STRIPE_TECHNICAL_ERROR_MESSAGES, StripePaymentComponent, StripePaymentService, buildLoadOptions, defaultStripeLoader, depositAmountError, descriptorCodeError, getStripeErrorMessage, isDarkPage, microdepositArrivalText, microdepositCancelMessage, microdepositKeepsActiveText, microdepositProcessingText, microdepositStepsText, normalizeDescriptorCode, normalizeIntent, outcomeOf, paymentMethodIdOf, provideStripePayment, readStripeAppearance, readStripeReturnParams, retrieveIntent, verificationOf, verifyMicrodeposits };
2804
+
2805
+ //# sourceMappingURL=forgeroute-ui-stripe.mjs.map