@primer-io/primer-js 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{ar.5AY75F5J.js → ar.6MRFCKX4.js} +1 -1
- package/dist/chunks/{bg.2EL2HTYI.js → bg.HRSMU7Y5.js} +1 -1
- package/dist/chunks/{ca.WZI7CBFW.js → ca.3FSHJL7U.js} +1 -1
- package/dist/chunks/chunk.I6YWTZRK.js +1 -0
- package/dist/chunks/{cs.GBLLNC3E.js → cs.WAO4WFS3.js} +1 -1
- package/dist/chunks/{da.CDEFQG44.js → da.4OFYGDVA.js} +1 -1
- package/dist/chunks/{de.UHURA2HV.js → de.3FZS52IN.js} +1 -1
- package/dist/chunks/{el.BY5NGYDF.js → el.A4R7VG5T.js} +1 -1
- package/dist/chunks/en-GB.ILZ7SXSW.js +1 -0
- package/dist/chunks/en.7GZJA7MN.js +1 -0
- package/dist/chunks/{es-AR.EYNC6EAZ.js → es-AR.QKHDL4JV.js} +1 -1
- package/dist/chunks/{es-MX.OIO2YURF.js → es-MX.GG7MJMG2.js} +1 -1
- package/dist/chunks/{es.CNNIJYLX.js → es.FEZ6BF3S.js} +1 -1
- package/dist/chunks/{et-EE.4ZF6CLB6.js → et-EE.FJLPTMF3.js} +1 -1
- package/dist/chunks/{fi-FI.4ZXWRRYI.js → fi-FI.DM5R27A5.js} +1 -1
- package/dist/chunks/{fr.TZM5I4K2.js → fr.YZV52NTA.js} +1 -1
- package/dist/chunks/{he.DWEZBG4A.js → he.6SCF3XZZ.js} +1 -1
- package/dist/chunks/{hr.BV4PC324.js → hr.PPDZ7AAS.js} +1 -1
- package/dist/chunks/{hu.MTEKSS3J.js → hu.6WOPSGLW.js} +1 -1
- package/dist/chunks/{id.SJSTOPSC.js → id.NS22WGWL.js} +1 -1
- package/dist/chunks/{it.IISTMHN5.js → it.42TO3R4G.js} +1 -1
- package/dist/chunks/{ja.IBQ3ID5C.js → ja.UEGHEUAP.js} +1 -1
- package/dist/chunks/{ko.KZVQLI4V.js → ko.HTMDY6RY.js} +1 -1
- package/dist/chunks/{lt-LT.RKBB7CZ6.js → lt-LT.4U3GBQTQ.js} +1 -1
- package/dist/chunks/{lt.TLM7OCXP.js → lt.73ME4TDM.js} +1 -1
- package/dist/chunks/{lv-LV.H5TJC2T4.js → lv-LV.JRWO2BF6.js} +1 -1
- package/dist/chunks/{lv.G4SRVBAC.js → lv.KROS45TV.js} +1 -1
- package/dist/chunks/{ms.ATTITA66.js → ms.HE3SWJFQ.js} +1 -1
- package/dist/chunks/{nb.5EE7XOA7.js → nb.TR6TEKBY.js} +1 -1
- package/dist/chunks/{nl.TY2SYTKZ.js → nl.V5QP6OXL.js} +1 -1
- package/dist/chunks/{nl_NL.GB5BQ5PG.js → nl_NL.FCVWIF3Y.js} +1 -1
- package/dist/chunks/{pl.5PRBSG4K.js → pl.DQZDG7LR.js} +1 -1
- package/dist/chunks/{pt-BR.5XRZB5WW.js → pt-BR.CR4ROBVE.js} +1 -1
- package/dist/chunks/{pt.TA5H5JUJ.js → pt.JRWVFJPX.js} +1 -1
- package/dist/chunks/{ro.PSZKGHRP.js → ro.NRMWYY3F.js} +1 -1
- package/dist/chunks/{ru.3QZY7ZIT.js → ru.OWSKHXVO.js} +1 -1
- package/dist/chunks/{sk.FAQFYLGM.js → sk.YGBRNNWT.js} +1 -1
- package/dist/chunks/{sl.QRSCQXJP.js → sl.IRTDTNTP.js} +1 -1
- package/dist/chunks/{sr-RS.TKMMG7FK.js → sr-RS.AWGLHKVE.js} +1 -1
- package/dist/chunks/{sv.HZ3E6V5F.js → sv.O4BXFGNF.js} +1 -1
- package/dist/chunks/{th.AY6M42B4.js → th.GZCEBRT2.js} +1 -1
- package/dist/chunks/{tr.TFKBPYMO.js → tr.ZDILMEEO.js} +1 -1
- package/dist/chunks/{uk-UA.3TU67RSI.js → uk-UA.JUUBOEW3.js} +1 -1
- package/dist/chunks/{vi.NLXELMXV.js → vi.IN7CFTLL.js} +1 -1
- package/dist/chunks/zf.YT47ULXR.js +1 -0
- package/dist/chunks/{zh-CN.VEOQJ3EU.js → zh-CN.RBRAS4RP.js} +1 -1
- package/dist/chunks/{zh-HK.ZEXSW7FF.js → zh-HK.4CK7LBWM.js} +1 -1
- package/dist/chunks/{zh-TW.MMVWEQMZ.js → zh-TW.374TMWNJ.js} +1 -1
- package/dist/custom-elements.json +1477 -1342
- package/dist/primer-loader.d.ts +815 -741
- package/dist/primer-loader.js +923 -922
- package/dist/primer-react-wrappers.js +387 -386
- package/dist/web-types.json +1 -1
- package/package.json +9 -1
- package/dist/chunks/chunk.G45OCYEN.js +0 -1
- package/dist/chunks/en-GB.UBLLAUVW.js +0 -1
- package/dist/chunks/en.BKAVPUID.js +0 -1
- package/dist/chunks/zf.U5XPENNR.js +0 -1
package/dist/primer-loader.d.ts
CHANGED
|
@@ -2252,59 +2252,133 @@ declare global {
|
|
|
2252
2252
|
Primer: typeof Primer;
|
|
2253
2253
|
}
|
|
2254
2254
|
}
|
|
2255
|
+
declare const PaymentMethodType$1: {
|
|
2256
|
+
readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
|
|
2257
|
+
readonly STRIPE_ACH: "STRIPE_ACH";
|
|
2258
|
+
readonly STRIPE_IDEAL: "STRIPE_IDEAL";
|
|
2259
|
+
readonly ADYEN_KLARNA: "ADYEN_KLARNA";
|
|
2260
|
+
readonly ADYEN_BANCONTACT_CARD: "ADYEN_BANCONTACT_CARD";
|
|
2261
|
+
readonly PAY_NL_KAARTDIRECT: "PAY_NL_KAARTDIRECT";
|
|
2262
|
+
readonly ADYEN_EPS: "ADYEN_EPS";
|
|
2263
|
+
readonly ADYEN_BANCONTACT_PAYCONIQ: "ADYEN_BANCONTACT_PAYCONIQ";
|
|
2264
|
+
readonly OMISE_PROMPTPAY: "OMISE_PROMPTPAY";
|
|
2265
|
+
readonly OMISE_TRUEMONEY: "OMISE_TRUEMONEY";
|
|
2266
|
+
readonly ADYEN_MULTIBANCO: "ADYEN_MULTIBANCO";
|
|
2267
|
+
readonly PACYPAY_WECHAT: "PACYPAY_WECHAT";
|
|
2268
|
+
readonly PACYPAY_ALIPAY: "PACYPAY_ALIPAY";
|
|
2269
|
+
readonly ADYEN_MBWAY: "ADYEN_MBWAY";
|
|
2270
|
+
readonly XENDIT_DANA: "XENDIT_DANA";
|
|
2271
|
+
readonly XENDIT_SHOPEEPAY: "XENDIT_SHOPEEPAY";
|
|
2272
|
+
readonly ADYEN_PAYSHOP: "ADYEN_PAYSHOP";
|
|
2273
|
+
readonly ADYEN_PAYTRAIL: "ADYEN_PAYTRAIL";
|
|
2274
|
+
readonly CLEARPAY: "CLEARPAY";
|
|
2275
|
+
readonly RAPYD_FAST: "RAPYD_FAST";
|
|
2276
|
+
readonly RAPYD_PROMPTPAY: "RAPYD_PROMPTPAY";
|
|
2277
|
+
readonly RAPYD_GCASH: "RAPYD_GCASH";
|
|
2278
|
+
readonly RAPYD_POLI: "RAPYD_POLI";
|
|
2279
|
+
readonly RAPYD_GRABPAY: "RAPYD_GRABPAY";
|
|
2280
|
+
readonly PRIMER_PAYPAL: "PRIMER_PAYPAL";
|
|
2281
|
+
readonly TWOC2P: "TWOC2P";
|
|
2282
|
+
readonly NETS: "NETS";
|
|
2283
|
+
readonly STRIPE_GIROPAY: "STRIPE_GIROPAY";
|
|
2284
|
+
readonly MOLLIE_GIROPAY: "MOLLIE_GIROPAY";
|
|
2285
|
+
readonly MOLLIE_EPS: "MOLLIE_EPS";
|
|
2286
|
+
readonly PAY_NL_EPS: "PAY_NL_EPS";
|
|
2287
|
+
readonly PAY_NL_P24: "PAY_NL_P24";
|
|
2288
|
+
readonly MOLLIE_P24: "MOLLIE_P24";
|
|
2289
|
+
readonly MOLLIE_SOFORT: "MOLLIE_SOFORT";
|
|
2290
|
+
readonly COINBASE: "COINBASE";
|
|
2291
|
+
readonly OPENNODE: "OPENNODE";
|
|
2292
|
+
readonly MOLLIE_GIFT_CARD: "MOLLIE_GIFTCARD";
|
|
2293
|
+
readonly XFERS_PAYNOW: "XFERS_PAYNOW";
|
|
2294
|
+
readonly PAYMENT_CARD: "PAYMENT_CARD";
|
|
2295
|
+
readonly APPLE_PAY: "APPLE_PAY";
|
|
2296
|
+
readonly GOOGLE_PAY: "GOOGLE_PAY";
|
|
2297
|
+
readonly PAYPAL: "PAYPAL";
|
|
2298
|
+
readonly GO_CARDLESS: "GOCARDLESS";
|
|
2299
|
+
readonly KLARNA: "KLARNA";
|
|
2300
|
+
readonly PAY_NL_IDEAL: "PAY_NL_IDEAL";
|
|
2301
|
+
readonly PAY_NL_SOFORT_BANKING: "PAY_NL_SOFORT_BANKING";
|
|
2302
|
+
readonly PAY_NL_BANCONTACT: "PAY_NL_BANCONTACT";
|
|
2303
|
+
readonly PAY_NL_PAYPAL: "PAY_NL_PAYPAL";
|
|
2304
|
+
readonly PAY_NL_CREDIT_TRANSFER: "PAY_NL_CREDIT_TRANSFER";
|
|
2305
|
+
readonly PAY_NL_DIRECT_DEBIT: "PAY_NL_DIRECT_DEBIT";
|
|
2306
|
+
readonly PAY_NL_GIROPAY: "PAY_NL_GIROPAY";
|
|
2307
|
+
readonly PAY_NL_PAYCONIQ: "PAY_NL_PAYCONIQ";
|
|
2308
|
+
readonly HOOLAH: "HOOLAH";
|
|
2309
|
+
readonly ADYEN_BLIK: "ADYEN_BLIK";
|
|
2310
|
+
readonly ADYEN_MOBILEPAY: "ADYEN_MOBILEPAY";
|
|
2311
|
+
readonly ADYEN_VIPPS: "ADYEN_VIPPS";
|
|
2312
|
+
readonly ADYEN_GIROPAY: "ADYEN_GIROPAY";
|
|
2313
|
+
readonly ADYEN_SOFORT: "ADYEN_SOFORT";
|
|
2314
|
+
readonly ADYEN_IDEAL: "ADYEN_IDEAL";
|
|
2315
|
+
readonly ADYEN_TRUSTLY: "ADYEN_TRUSTLY";
|
|
2316
|
+
readonly ADYEN_ALIPAY: "ADYEN_ALIPAY";
|
|
2317
|
+
readonly ADYEN_TWINT: "ADYEN_TWINT";
|
|
2318
|
+
readonly ADYEN_BANK_TRANSFER: "ADYEN_BANK_TRANSFER";
|
|
2319
|
+
readonly MOLLIE_BANCONTACT: "MOLLIE_BANCONTACT";
|
|
2320
|
+
readonly MOLLIE_IDEAL: "MOLLIE_IDEAL";
|
|
2321
|
+
readonly BUCKAROO_GIROPAY: "BUCKAROO_GIROPAY";
|
|
2322
|
+
readonly BUCKAROO_EPS: "BUCKAROO_EPS";
|
|
2323
|
+
readonly BUCKAROO_SOFORT: "BUCKAROO_SOFORT";
|
|
2324
|
+
readonly BUCKAROO_BANCONTACT: "BUCKAROO_BANCONTACT";
|
|
2325
|
+
readonly BUCKAROO_IDEAL: "BUCKAROO_IDEAL";
|
|
2326
|
+
readonly ATOME: "ATOME";
|
|
2327
|
+
};
|
|
2328
|
+
type PaymentMethodType$1 = (typeof PaymentMethodType$1)[keyof typeof PaymentMethodType$1];
|
|
2255
2329
|
export type InitializedManager = {
|
|
2256
|
-
type: typeof PaymentMethodType.STRIPE_ACH;
|
|
2330
|
+
type: typeof PaymentMethodType$1.STRIPE_ACH;
|
|
2257
2331
|
manager: IAchPaymentMethodManager;
|
|
2258
2332
|
} | {
|
|
2259
|
-
type: typeof PaymentMethodType.PAYMENT_CARD;
|
|
2333
|
+
type: typeof PaymentMethodType$1.PAYMENT_CARD;
|
|
2260
2334
|
manager: ICardPaymentMethodManager;
|
|
2261
2335
|
} | {
|
|
2262
|
-
type: typeof PaymentMethodType.KLARNA;
|
|
2336
|
+
type: typeof PaymentMethodType$1.KLARNA;
|
|
2263
2337
|
manager: IKlarnaPaymentMethodManager;
|
|
2264
2338
|
} | {
|
|
2265
2339
|
type: RedirectPaymentMethodTypes;
|
|
2266
2340
|
manager: IRedirectPaymentMethodManager;
|
|
2267
2341
|
} | {
|
|
2268
|
-
type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
|
|
2342
|
+
type: typeof PaymentMethodType$1.PAYPAL | typeof PaymentMethodType$1.GOOGLE_PAY | typeof PaymentMethodType$1.APPLE_PAY;
|
|
2269
2343
|
manager: INativePaymentMethodManager;
|
|
2270
2344
|
};
|
|
2271
|
-
export type ManagerByType<T extends PaymentMethodType> = Extract<InitializedManager, {
|
|
2345
|
+
export type ManagerByType<T extends PaymentMethodType$1> = Extract<InitializedManager, {
|
|
2272
2346
|
type: T;
|
|
2273
2347
|
}>;
|
|
2274
|
-
export interface InitializedManagersMap extends Map<PaymentMethodType, InitializedManager> {
|
|
2275
|
-
get<T extends PaymentMethodType>(key: T): ManagerByType<T> | undefined;
|
|
2348
|
+
export interface InitializedManagersMap extends Map<PaymentMethodType$1, InitializedManager> {
|
|
2349
|
+
get<T extends PaymentMethodType$1>(key: T): ManagerByType<T> | undefined;
|
|
2276
2350
|
}
|
|
2277
|
-
export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY>;
|
|
2278
|
-
export type DynamicPaymentMethodTypes = typeof PaymentMethodType.STRIPE_ACH;
|
|
2279
|
-
export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
|
|
2351
|
+
export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType$1, typeof PaymentMethodType$1.STRIPE_ACH | typeof PaymentMethodType$1.PAYMENT_CARD | typeof PaymentMethodType$1.KLARNA | typeof PaymentMethodType$1.PAYPAL | typeof PaymentMethodType$1.GOOGLE_PAY | typeof PaymentMethodType$1.APPLE_PAY>;
|
|
2352
|
+
export type DynamicPaymentMethodTypes = typeof PaymentMethodType$1.STRIPE_ACH;
|
|
2353
|
+
export type NativePaymentMethodTypes = typeof PaymentMethodType$1.PAYPAL | typeof PaymentMethodType$1.GOOGLE_PAY | typeof PaymentMethodType$1.APPLE_PAY;
|
|
2280
2354
|
export type RedirectPaymentMethod = {
|
|
2281
2355
|
type: RedirectPaymentMethodTypes;
|
|
2282
2356
|
managerType: HeadlessManagerType.REDIRECT;
|
|
2283
2357
|
};
|
|
2284
2358
|
export type InitializedPaymentMethod = {
|
|
2285
|
-
type: typeof PaymentMethodType.STRIPE_ACH;
|
|
2359
|
+
type: typeof PaymentMethodType$1.STRIPE_ACH;
|
|
2286
2360
|
managerType: HeadlessManagerType.ACH;
|
|
2287
2361
|
} | {
|
|
2288
|
-
type: typeof PaymentMethodType.PAYMENT_CARD;
|
|
2362
|
+
type: typeof PaymentMethodType$1.PAYMENT_CARD;
|
|
2289
2363
|
managerType: HeadlessManagerType.CARD;
|
|
2290
2364
|
} | {
|
|
2291
|
-
type: typeof PaymentMethodType.KLARNA;
|
|
2365
|
+
type: typeof PaymentMethodType$1.KLARNA;
|
|
2292
2366
|
managerType: HeadlessManagerType.KLARNA;
|
|
2293
2367
|
} | {
|
|
2294
|
-
type: typeof PaymentMethodType.PAYPAL;
|
|
2368
|
+
type: typeof PaymentMethodType$1.PAYPAL;
|
|
2295
2369
|
managerType: HeadlessManagerType.NATIVE;
|
|
2296
2370
|
} | {
|
|
2297
|
-
type: typeof PaymentMethodType.GOOGLE_PAY;
|
|
2371
|
+
type: typeof PaymentMethodType$1.GOOGLE_PAY;
|
|
2298
2372
|
managerType: HeadlessManagerType.NATIVE;
|
|
2299
2373
|
} | {
|
|
2300
|
-
type: typeof PaymentMethodType.APPLE_PAY;
|
|
2374
|
+
type: typeof PaymentMethodType$1.APPLE_PAY;
|
|
2301
2375
|
managerType: HeadlessManagerType.NATIVE;
|
|
2302
2376
|
} | RedirectPaymentMethod;
|
|
2303
|
-
export type PaymentMethodByType<T extends PaymentMethodType> = Extract<InitializedPaymentMethod, {
|
|
2377
|
+
export type PaymentMethodByType<T extends PaymentMethodType$1> = Extract<InitializedPaymentMethod, {
|
|
2304
2378
|
type: T;
|
|
2305
2379
|
}>;
|
|
2306
|
-
export interface InitializedPaymentMethodMap extends Map<PaymentMethodType, InitializedPaymentMethod> {
|
|
2307
|
-
get<T extends PaymentMethodType>(key: T): PaymentMethodByType<T> | undefined;
|
|
2380
|
+
export interface InitializedPaymentMethodMap extends Map<PaymentMethodType$1, InitializedPaymentMethod> {
|
|
2381
|
+
get<T extends PaymentMethodType$1>(key: T): PaymentMethodByType<T> | undefined;
|
|
2308
2382
|
}
|
|
2309
2383
|
export interface AssetsConfig {
|
|
2310
2384
|
backgroundColor: string;
|
|
@@ -2315,7 +2389,7 @@ export declare class InitializedPayments {
|
|
|
2315
2389
|
private readonly _methods;
|
|
2316
2390
|
constructor(map: InitializedPaymentMethodMap);
|
|
2317
2391
|
get<T extends RedirectPaymentMethodTypes>(type: T): RedirectPaymentMethod | undefined;
|
|
2318
|
-
get<T extends (typeof PaymentMethodType)[keyof typeof PaymentMethodType]>(type: T): PaymentMethodByType<T> | undefined;
|
|
2392
|
+
get<T extends (typeof PaymentMethodType$1)[keyof typeof PaymentMethodType$1]>(type: T): PaymentMethodByType<T> | undefined;
|
|
2319
2393
|
toArray(): InitializedPaymentMethod[];
|
|
2320
2394
|
size(): number;
|
|
2321
2395
|
}
|
|
@@ -3290,7 +3364,7 @@ declare global {
|
|
|
3290
3364
|
export type PaymentMethodsContext = InitializedPayments | null;
|
|
3291
3365
|
declare class PaymentMethodComponent extends LitElement {
|
|
3292
3366
|
static styles: CSSResult[];
|
|
3293
|
-
type: PaymentMethodType | undefined;
|
|
3367
|
+
type: PaymentMethodType$1 | undefined;
|
|
3294
3368
|
paymentMethods: PaymentMethodsContext;
|
|
3295
3369
|
render(): typeof nothing | TemplateResult<1>;
|
|
3296
3370
|
}
|
|
@@ -3403,519 +3477,293 @@ declare global {
|
|
|
3403
3477
|
"primer-redirect-payment": RedirectPaymentComponent;
|
|
3404
3478
|
}
|
|
3405
3479
|
}
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3480
|
+
/**
|
|
3481
|
+
* Events emitted by the vault manager components
|
|
3482
|
+
*/
|
|
3483
|
+
export interface VaultManagerEvents {
|
|
3484
|
+
deletePaymentMethod: CustomEvent<string>;
|
|
3485
|
+
cancelDelete: CustomEvent<void>;
|
|
3486
|
+
confirmDelete: CustomEvent<void>;
|
|
3487
|
+
toggleEditMode: CustomEvent<boolean>;
|
|
3488
|
+
closeError: CustomEvent<void>;
|
|
3489
|
+
vaultPaymentError: CustomEvent<{
|
|
3490
|
+
error: Error | unknown;
|
|
3491
|
+
}>;
|
|
3417
3492
|
}
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3493
|
+
/**
|
|
3494
|
+
* Declare the event map for strict typing of events
|
|
3495
|
+
*/
|
|
3496
|
+
export interface VaultManagerEventMap {
|
|
3497
|
+
"delete-payment-method": VaultManagerEvents["deletePaymentMethod"];
|
|
3498
|
+
"cancel-delete": VaultManagerEvents["cancelDelete"];
|
|
3499
|
+
"confirm-delete": VaultManagerEvents["confirmDelete"];
|
|
3500
|
+
"toggle-edit-mode": VaultManagerEvents["toggleEditMode"];
|
|
3501
|
+
"close-error": VaultManagerEvents["closeError"];
|
|
3502
|
+
"primer-vault-payment-error": VaultManagerEvents["vaultPaymentError"];
|
|
3422
3503
|
}
|
|
3423
3504
|
/**
|
|
3424
|
-
*
|
|
3425
|
-
* with proper height calculations based on design system variables.
|
|
3505
|
+
* VaultManagerComponent - displays and manages saved payment methods
|
|
3426
3506
|
*/
|
|
3427
|
-
declare class
|
|
3507
|
+
declare class VaultManagerComponent extends LitElement {
|
|
3428
3508
|
static styles: CSSResult[];
|
|
3429
|
-
paymentMethod: InitializedPaymentMethod | undefined;
|
|
3430
|
-
paymentManagers: InitializedManagersMap;
|
|
3431
|
-
computedStyles: CSSStyleDeclaration | null;
|
|
3432
|
-
private _buttonId;
|
|
3433
|
-
private loadManagerTask;
|
|
3434
3509
|
constructor();
|
|
3510
|
+
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3511
|
+
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3512
|
+
vaultManagerContext: VaultManagerContext;
|
|
3435
3513
|
/**
|
|
3436
|
-
*
|
|
3437
|
-
* Mirrors the calculation used in the host styles
|
|
3514
|
+
* Whether we're in edit mode
|
|
3438
3515
|
*/
|
|
3439
|
-
private
|
|
3516
|
+
private isEditMode;
|
|
3440
3517
|
/**
|
|
3441
|
-
*
|
|
3518
|
+
* Payment method being deleted
|
|
3442
3519
|
*/
|
|
3443
|
-
private
|
|
3444
|
-
protected updated(changedProperties: PropertyValues): void;
|
|
3445
|
-
render(): symbol | TemplateResult<1> | undefined;
|
|
3446
|
-
}
|
|
3447
|
-
declare global {
|
|
3448
|
-
interface HTMLElementTagNameMap {
|
|
3449
|
-
"primer-native-payment": NativePaymentComponent;
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
/**
|
|
3453
|
-
* CardFormComponent serves as a container for card input components.
|
|
3454
|
-
* It handles form submission, validation, and provides context to child components.
|
|
3455
|
-
*/
|
|
3456
|
-
declare class CardFormComponent extends LitElement {
|
|
3457
|
-
static styles: CSSResult[];
|
|
3458
|
-
hideLabels: boolean;
|
|
3459
|
-
updated(changedProperties: Map<string, unknown>): void;
|
|
3520
|
+
private deletePaymentMethodId;
|
|
3460
3521
|
/**
|
|
3461
|
-
*
|
|
3522
|
+
* Whether a delete operation is in progress
|
|
3462
3523
|
*/
|
|
3463
|
-
private
|
|
3464
|
-
private selectedCardNetwork;
|
|
3524
|
+
private isDeleting;
|
|
3465
3525
|
/**
|
|
3466
|
-
*
|
|
3526
|
+
* Error message if something goes wrong
|
|
3467
3527
|
*/
|
|
3468
|
-
|
|
3528
|
+
private errorMessage;
|
|
3469
3529
|
/**
|
|
3470
|
-
*
|
|
3530
|
+
* Animation duration override
|
|
3471
3531
|
*/
|
|
3472
|
-
|
|
3532
|
+
animationDuration: number;
|
|
3473
3533
|
/**
|
|
3474
|
-
*
|
|
3534
|
+
* Get base animation configuration with current settings
|
|
3475
3535
|
*/
|
|
3476
|
-
private
|
|
3536
|
+
private getAnimationConfig;
|
|
3477
3537
|
/**
|
|
3478
|
-
*
|
|
3538
|
+
* Toggle edit mode handler
|
|
3479
3539
|
*/
|
|
3480
|
-
private
|
|
3481
|
-
connectedCallback(): void;
|
|
3482
|
-
disconnectedCallback(): void;
|
|
3540
|
+
private handleToggleEditMode;
|
|
3483
3541
|
/**
|
|
3484
|
-
*
|
|
3485
|
-
* Supports both native <button> and custom <primer-button> elements.
|
|
3542
|
+
* Handle delete click from payment method item
|
|
3486
3543
|
*/
|
|
3487
|
-
private
|
|
3544
|
+
private handleDeletePaymentMethod;
|
|
3488
3545
|
/**
|
|
3489
|
-
*
|
|
3490
|
-
* This is a backup method to catch all possible submission events
|
|
3546
|
+
* Cancel delete operation
|
|
3491
3547
|
*/
|
|
3492
|
-
private
|
|
3548
|
+
private handleCancelDelete;
|
|
3493
3549
|
/**
|
|
3494
|
-
*
|
|
3550
|
+
* Confirm and process payment method deletion
|
|
3495
3551
|
*/
|
|
3496
|
-
private
|
|
3552
|
+
private handleConfirmDelete;
|
|
3497
3553
|
/**
|
|
3498
|
-
*
|
|
3554
|
+
* Handle payment error events
|
|
3499
3555
|
*/
|
|
3500
|
-
private
|
|
3556
|
+
private handlePaymentError;
|
|
3501
3557
|
/**
|
|
3502
|
-
*
|
|
3503
|
-
* Validates the form and dispatches either a submit success or errors event.
|
|
3558
|
+
* Handle closing error message
|
|
3504
3559
|
*/
|
|
3505
|
-
private
|
|
3560
|
+
private handleCloseError;
|
|
3506
3561
|
/**
|
|
3507
|
-
*
|
|
3508
|
-
|
|
3562
|
+
* Get payment method display name for the given ID
|
|
3563
|
+
*/
|
|
3564
|
+
private getPaymentMethodName;
|
|
3565
|
+
/**
|
|
3566
|
+
* Render loading overlay with spinner when isUpdating is true
|
|
3567
|
+
*/
|
|
3568
|
+
private renderLoadingOverlay;
|
|
3569
|
+
/**
|
|
3570
|
+
* Render delete confirmation content
|
|
3571
|
+
*/
|
|
3572
|
+
private renderDeleteConfirmation;
|
|
3573
|
+
/**
|
|
3574
|
+
* Render a payment method item with appropriate animations
|
|
3575
|
+
*/
|
|
3576
|
+
private renderPaymentMethodItem;
|
|
3577
|
+
/**
|
|
3578
|
+
* Render the payment method list with submit button
|
|
3579
|
+
*/
|
|
3580
|
+
private renderPaymentMethodList;
|
|
3581
|
+
/**
|
|
3582
|
+
* Main render method
|
|
3509
3583
|
*/
|
|
3510
|
-
private handleFormSubmit;
|
|
3511
3584
|
render(): typeof nothing | TemplateResult<1>;
|
|
3512
3585
|
}
|
|
3513
|
-
export interface CardFormContext {
|
|
3514
|
-
cardNumberInput: IHeadlessHostedInput;
|
|
3515
|
-
expiryInput: IHeadlessHostedInput;
|
|
3516
|
-
cvvInput: IHeadlessHostedInput;
|
|
3517
|
-
setCardholderName: (val: string) => void;
|
|
3518
|
-
setCardNetwork: (val: string) => void;
|
|
3519
|
-
validate: () => Promise<Validation>;
|
|
3520
|
-
submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
|
|
3521
|
-
errors?: Validation["validationErrors"];
|
|
3522
|
-
hideLabels?: boolean;
|
|
3523
|
-
}
|
|
3524
3586
|
/**
|
|
3525
|
-
*
|
|
3526
|
-
* the
|
|
3587
|
+
* VaultPaymentMethodItemComponent - displays a single payment method
|
|
3588
|
+
* Uses the VaultManagerController for display formatting
|
|
3589
|
+
* Now supports selection via the simplified button checked state
|
|
3590
|
+
* Enhanced with smooth transitions between edit and payment modes
|
|
3591
|
+
* Always renders the primer-button for consistent UI and improved accessibility
|
|
3527
3592
|
*/
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
computedStyles: CSSStyleDeclaration | null;
|
|
3531
|
-
/** A string for the input placeholder. */
|
|
3532
|
-
placeholder: string;
|
|
3533
|
-
/** An accessible label for the input. */
|
|
3534
|
-
ariaLabel: string;
|
|
3535
|
-
/** The label for the input. */
|
|
3536
|
-
label: string;
|
|
3537
|
-
requestUpdate: ReactiveControllerHost["requestUpdate"];
|
|
3538
|
-
}
|
|
3539
|
-
export interface TaskFunctionOptions {
|
|
3540
|
-
signal: AbortSignal;
|
|
3541
|
-
}
|
|
3542
|
-
export type TaskFunction<D extends ReadonlyArray<unknown>, R = unknown> = (args: D, options: TaskFunctionOptions) => R | typeof initialState | Promise<R | typeof initialState>;
|
|
3543
|
-
export type ArgsFunction<D extends ReadonlyArray<unknown>> = () => D;
|
|
3544
|
-
declare const TaskStatus: {
|
|
3545
|
-
readonly INITIAL: 0;
|
|
3546
|
-
readonly PENDING: 1;
|
|
3547
|
-
readonly COMPLETE: 2;
|
|
3548
|
-
readonly ERROR: 3;
|
|
3549
|
-
};
|
|
3550
|
-
declare const initialState: unique symbol;
|
|
3551
|
-
export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
|
|
3552
|
-
export type StatusRenderer<R> = {
|
|
3553
|
-
initial?: () => unknown;
|
|
3554
|
-
pending?: () => unknown;
|
|
3555
|
-
complete?: (value: R) => unknown;
|
|
3556
|
-
error?: (error: unknown) => unknown;
|
|
3557
|
-
};
|
|
3558
|
-
export interface TaskConfig<T extends ReadonlyArray<unknown>, R> {
|
|
3559
|
-
task: TaskFunction<T, R>;
|
|
3560
|
-
args?: ArgsFunction<T>;
|
|
3561
|
-
/**
|
|
3562
|
-
* Determines if the task is run automatically when arguments change after a
|
|
3563
|
-
* host update. Default to `true`.
|
|
3564
|
-
*
|
|
3565
|
-
* If `true`, the task checks arguments during the host update (after
|
|
3566
|
-
* `willUpdate()` and before `update()` in Lit) and runs if they change. For
|
|
3567
|
-
* a task to see argument changes they must be done in `willUpdate()` or
|
|
3568
|
-
* earlier. The host element can see task status changes caused by its own
|
|
3569
|
-
* current update.
|
|
3570
|
-
*
|
|
3571
|
-
* If `'afterUpdate'`, the task checks arguments and runs _after_ the host
|
|
3572
|
-
* update. This means that the task can see host changes done in update, such
|
|
3573
|
-
* as rendered DOM. The host element can not see task status changes caused
|
|
3574
|
-
* by its own update, so the task must trigger a second host update to make
|
|
3575
|
-
* those changes renderable.
|
|
3576
|
-
*
|
|
3577
|
-
* Note: `'afterUpdate'` is unlikely to be SSR compatible in the future.
|
|
3578
|
-
*
|
|
3579
|
-
* If `false`, the task is not run automatically, and must be run with the
|
|
3580
|
-
* {@linkcode run} method.
|
|
3581
|
-
*/
|
|
3582
|
-
autoRun?: boolean | "afterUpdate";
|
|
3593
|
+
declare class VaultPaymentMethodItemComponent extends LitElement {
|
|
3594
|
+
static styles: CSSResult[];
|
|
3583
3595
|
/**
|
|
3584
|
-
*
|
|
3585
|
-
* equal. If the argsEqual function returns true, the task will not auto-run.
|
|
3586
|
-
*
|
|
3587
|
-
* The default is {@linkcode shallowArrayEquals}. {@linkcode deepArrayEquals}
|
|
3588
|
-
* is also available.
|
|
3596
|
+
* Strongly typed event declarations
|
|
3589
3597
|
*/
|
|
3590
|
-
|
|
3598
|
+
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3599
|
+
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3591
3600
|
/**
|
|
3592
|
-
*
|
|
3593
|
-
* status and the value is set to initialData.
|
|
3594
|
-
*
|
|
3595
|
-
* Initial args should be coherent with the initialValue, since they are
|
|
3596
|
-
* assumed to be the args that would produce that value. When autoRun is
|
|
3597
|
-
* `true` the task will not auto-run again until the args change.
|
|
3601
|
+
* Consume the vault manager context
|
|
3598
3602
|
*/
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
}
|
|
3603
|
-
declare class Task<const T extends ReadonlyArray<unknown> = ReadonlyArray<unknown>, const R = unknown> {
|
|
3604
|
-
private _previousArgs?;
|
|
3605
|
-
private _task;
|
|
3606
|
-
private _argsFn?;
|
|
3607
|
-
private _argsEqual;
|
|
3608
|
-
private _callId;
|
|
3609
|
-
private _host;
|
|
3610
|
-
private _value?;
|
|
3611
|
-
private _error?;
|
|
3612
|
-
private _abortController?;
|
|
3613
|
-
private _onComplete?;
|
|
3614
|
-
private _onError?;
|
|
3615
|
-
private _status;
|
|
3603
|
+
vaultManagerContext: VaultManagerContext;
|
|
3604
|
+
vaultItemContext: VaultItemContext;
|
|
3605
|
+
headlessUtils: HeadlessUnitilsContext;
|
|
3616
3606
|
/**
|
|
3617
|
-
*
|
|
3618
|
-
* host update. Default to `true`.
|
|
3619
|
-
*
|
|
3620
|
-
* @see {@link TaskConfig.autoRun} for more information.
|
|
3607
|
+
* The payment method to display
|
|
3621
3608
|
*/
|
|
3622
|
-
|
|
3609
|
+
paymentMethod: VaultedPaymentMethod | null;
|
|
3623
3610
|
/**
|
|
3624
|
-
*
|
|
3625
|
-
*
|
|
3626
|
-
* If a new task run is started while a previous run is pending, the Promise
|
|
3627
|
-
* is kept and only resolved when the new run is completed.
|
|
3611
|
+
* Whether the component is in edit mode
|
|
3628
3612
|
*/
|
|
3629
|
-
|
|
3630
|
-
private
|
|
3631
|
-
private _rejectTaskComplete?;
|
|
3632
|
-
private _taskComplete?;
|
|
3633
|
-
constructor(host: ReactiveControllerHost, task: TaskConfig<T, R>);
|
|
3634
|
-
constructor(host: ReactiveControllerHost, task: TaskFunction<T, R>, args?: ArgsFunction<T>);
|
|
3635
|
-
hostUpdate(): void;
|
|
3636
|
-
hostUpdated(): void;
|
|
3637
|
-
private _getArgs;
|
|
3613
|
+
isEditMode: boolean;
|
|
3614
|
+
private _getAssetsTask;
|
|
3638
3615
|
/**
|
|
3639
|
-
*
|
|
3640
|
-
* host update, and runs the task if it should.
|
|
3641
|
-
*
|
|
3642
|
-
* A task should run when its arguments change from the previous run, based on
|
|
3643
|
-
* the args equality function.
|
|
3644
|
-
*
|
|
3645
|
-
* This method is side-effectful: it stores the new args as the previous args.
|
|
3616
|
+
* Check if this payment method is currently selected in the context
|
|
3646
3617
|
*/
|
|
3647
|
-
private
|
|
3618
|
+
private isSelected;
|
|
3648
3619
|
/**
|
|
3649
|
-
*
|
|
3650
|
-
*
|
|
3651
|
-
* This can be useful for running tasks in response to events as opposed to
|
|
3652
|
-
* automatically running when host element state changes.
|
|
3653
|
-
*
|
|
3654
|
-
* @param args an optional set of arguments to use for this task run. If args
|
|
3655
|
-
* is not given, the args function is called to get the arguments for
|
|
3656
|
-
* this run.
|
|
3620
|
+
* Handle when the button is clicked
|
|
3621
|
+
* This is used to select the payment method and deselect others
|
|
3657
3622
|
*/
|
|
3658
|
-
|
|
3623
|
+
private handleClick;
|
|
3659
3624
|
/**
|
|
3660
|
-
*
|
|
3661
|
-
* passed to the task function.
|
|
3662
|
-
*
|
|
3663
|
-
* Aborting a task does nothing if the task is not running: ie, in the
|
|
3664
|
-
* complete, error, or initial states.
|
|
3665
|
-
*
|
|
3666
|
-
* Aborting a task does not automatically cancel the task function. The task
|
|
3667
|
-
* function must be written to accept the AbortSignal and either forward it
|
|
3668
|
-
* to other APIs like `fetch()`, or handle cancellation manually by using
|
|
3669
|
-
* [`signal.throwIfAborted()`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted}
|
|
3670
|
-
* or the
|
|
3671
|
-
* [`abort`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event}
|
|
3672
|
-
* event.
|
|
3673
|
-
*
|
|
3674
|
-
* @param reason The reason for aborting. Passed to
|
|
3675
|
-
* `AbortController.abort()`.
|
|
3625
|
+
* Dispatch delete event
|
|
3676
3626
|
*/
|
|
3677
|
-
|
|
3627
|
+
private handleDeleteClick;
|
|
3678
3628
|
/**
|
|
3679
|
-
*
|
|
3680
|
-
*
|
|
3681
|
-
* Is `undefined` if the task has not run yet, or if the previous run errored.
|
|
3629
|
+
* Builds the common content template shared between modes
|
|
3682
3630
|
*/
|
|
3683
|
-
|
|
3631
|
+
private renderPaymentMethodContent;
|
|
3684
3632
|
/**
|
|
3685
|
-
*
|
|
3686
|
-
*
|
|
3687
|
-
* Is `undefined` if the task has not run yet, or if the previous run
|
|
3688
|
-
* completed successfully.
|
|
3633
|
+
* Render method
|
|
3689
3634
|
*/
|
|
3690
|
-
|
|
3691
|
-
get status(): TaskStatus;
|
|
3692
|
-
render<T extends StatusRenderer<R>>(renderer: T): MaybeReturnType<T["initial"]> | MaybeReturnType<T["pending"]> | MaybeReturnType<T["complete"]> | MaybeReturnType<T["error"]>;
|
|
3635
|
+
render(): symbol | TemplateResult<1> | undefined;
|
|
3693
3636
|
}
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
export type HostedInputType = "cardNumber" | "cvv" | "expire" | "cardholderName";
|
|
3699
|
-
/**
|
|
3700
|
-
* Configuration for the hosted input controller.
|
|
3701
|
-
*/
|
|
3702
|
-
export interface HostedInputConfig {
|
|
3703
|
-
/** Differentiates the input type. */
|
|
3704
|
-
type: HostedInputType;
|
|
3705
|
-
/** Selector for the container element where the input should be rendered. */
|
|
3706
|
-
containerSelector: string;
|
|
3707
|
-
/**
|
|
3708
|
-
* Optional callback for handling input events (e.g. for CardFormName).
|
|
3709
|
-
*/
|
|
3710
|
-
onInput?: (value: string) => void;
|
|
3637
|
+
declare global {
|
|
3638
|
+
interface HTMLElementTagNameMap {
|
|
3639
|
+
"primer-vault-payment-method-item": VaultPaymentMethodItemComponent;
|
|
3640
|
+
}
|
|
3711
3641
|
}
|
|
3712
3642
|
/**
|
|
3713
|
-
*
|
|
3643
|
+
* VaultManagerHeaderComponent - displays the header for the vault manager
|
|
3714
3644
|
*/
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
private _isFocused;
|
|
3718
|
-
private _meta;
|
|
3719
|
-
private _hostedInput;
|
|
3720
|
-
private _standardInput;
|
|
3721
|
-
private readonly host;
|
|
3722
|
-
private readonly config;
|
|
3723
|
-
/**
|
|
3724
|
-
* Task to set up the hosted input.
|
|
3725
|
-
*/
|
|
3726
|
-
readonly setupTask: Task<[
|
|
3727
|
-
InputSource
|
|
3728
|
-
], boolean | typeof initialState>;
|
|
3729
|
-
constructor(host: T, config: HostedInputConfig);
|
|
3730
|
-
/**
|
|
3731
|
-
* Focuses the input, whether it's a hosted input or standard input
|
|
3732
|
-
*/
|
|
3733
|
-
focusInput(): void;
|
|
3734
|
-
/**
|
|
3735
|
-
* Returns the hosted input from the card form context based on the type.
|
|
3736
|
-
* For 'cardholderName', no hosted input is provided so we return a fallback indicator.
|
|
3737
|
-
*/
|
|
3738
|
-
private getHostedInput;
|
|
3645
|
+
declare class VaultManagerHeaderComponent extends LitElement {
|
|
3646
|
+
static styles: CSSResult[];
|
|
3739
3647
|
/**
|
|
3740
|
-
*
|
|
3741
|
-
* If a hosted input is provided, it renders it into the target container.
|
|
3742
|
-
* Otherwise (e.g. for cardholderName), it creates a standard input element.
|
|
3648
|
+
* Strongly typed event declarations
|
|
3743
3649
|
*/
|
|
3744
|
-
|
|
3650
|
+
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3651
|
+
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3745
3652
|
/**
|
|
3746
|
-
*
|
|
3653
|
+
* Whether we're in edit mode
|
|
3747
3654
|
*/
|
|
3748
|
-
|
|
3655
|
+
isEditMode: boolean;
|
|
3749
3656
|
/**
|
|
3750
|
-
*
|
|
3657
|
+
* Whether we have payment methods to edit
|
|
3751
3658
|
*/
|
|
3752
|
-
|
|
3659
|
+
hasPaymentMethods: boolean;
|
|
3753
3660
|
/**
|
|
3754
|
-
*
|
|
3661
|
+
* Toggle edit mode
|
|
3755
3662
|
*/
|
|
3756
|
-
private
|
|
3663
|
+
private toggleEditMode;
|
|
3757
3664
|
/**
|
|
3758
|
-
*
|
|
3665
|
+
* Render method
|
|
3759
3666
|
*/
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
hostDisconnected(): void;
|
|
3667
|
+
protected render(): TemplateResult<1>;
|
|
3668
|
+
}
|
|
3669
|
+
declare global {
|
|
3670
|
+
interface HTMLElementTagNameMap {
|
|
3671
|
+
"primer-vault-manager-header": VaultManagerHeaderComponent;
|
|
3672
|
+
}
|
|
3767
3673
|
}
|
|
3768
3674
|
/**
|
|
3769
|
-
*
|
|
3770
|
-
*/
|
|
3771
|
-
export type TranslationConfig = {
|
|
3772
|
-
id: string;
|
|
3773
|
-
defaultMessage: string;
|
|
3774
|
-
};
|
|
3775
|
-
/**
|
|
3776
|
-
* Configuration for abstract input component
|
|
3675
|
+
* VaultDeleteConfirmationComponent - displays confirmation UI for deleting a payment method
|
|
3777
3676
|
*/
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
inputType: HostedInputType;
|
|
3781
|
-
/** ID selector for the container where the input will be rendered */
|
|
3782
|
-
containerSelector: string;
|
|
3783
|
-
/** Error name to match in the card form context */
|
|
3784
|
-
errorName: string;
|
|
3785
|
-
/** Translation keys for default values */
|
|
3786
|
-
translations: {
|
|
3787
|
-
label: TranslationConfig | string;
|
|
3788
|
-
placeholder?: TranslationConfig | string;
|
|
3789
|
-
ariaLabel?: TranslationConfig | string;
|
|
3790
|
-
};
|
|
3791
|
-
/** Optional input handler for non-hosted inputs */
|
|
3792
|
-
onInput?: (value: string) => void;
|
|
3793
|
-
}
|
|
3794
|
-
declare abstract class AbstractCardInputComponent extends LitElement implements HostedInputHost {
|
|
3795
|
-
cardFormContext: CardFormContext | null;
|
|
3796
|
-
computedStyles: CSSStyleDeclaration | null;
|
|
3797
|
-
/** Tracks which properties were explicitly set by the user */
|
|
3798
|
-
protected readonly _userAssignedProps: Set<string>;
|
|
3799
|
-
/** Internal storage for property values */
|
|
3800
|
-
protected _internalLabel: string;
|
|
3801
|
-
protected _internalPlaceholder: string;
|
|
3802
|
-
protected _internalAriaLabel: string;
|
|
3803
|
-
/** Configuration for this input component */
|
|
3804
|
-
protected abstract readonly config: InputComponentConfig;
|
|
3805
|
-
/** Hosted input controller */
|
|
3806
|
-
protected readonly hostedInputController: HostedInputController<HostedInputHost>;
|
|
3807
|
-
/**
|
|
3808
|
-
* Gets a translated or static string value from the translation config
|
|
3809
|
-
*/
|
|
3810
|
-
private getTranslatedValue;
|
|
3811
|
-
/**
|
|
3812
|
-
* The input label text.
|
|
3813
|
-
* Falls back to localized default if not explicitly set.
|
|
3814
|
-
*/
|
|
3815
|
-
get label(): string;
|
|
3816
|
-
set label(value: string);
|
|
3817
|
-
/**
|
|
3818
|
-
* The input placeholder text.
|
|
3819
|
-
* Falls back to localized default if not explicitly set.
|
|
3820
|
-
* When explicitly set to empty string, no placeholder will be displayed.
|
|
3821
|
-
*/
|
|
3822
|
-
get placeholder(): string;
|
|
3823
|
-
set placeholder(value: string);
|
|
3677
|
+
declare class VaultDeleteConfirmationComponent extends LitElement {
|
|
3678
|
+
static styles: CSSResult[];
|
|
3824
3679
|
/**
|
|
3825
|
-
*
|
|
3826
|
-
* Falls back to localized default if not explicitly set.
|
|
3680
|
+
* Strongly typed event declarations
|
|
3827
3681
|
*/
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
constructor();
|
|
3682
|
+
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3683
|
+
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3831
3684
|
/**
|
|
3832
|
-
*
|
|
3833
|
-
* and the config is available
|
|
3685
|
+
* Whether a delete operation is in progress
|
|
3834
3686
|
*/
|
|
3835
|
-
|
|
3687
|
+
isDeleting: boolean;
|
|
3836
3688
|
/**
|
|
3837
|
-
*
|
|
3838
|
-
* This is still needed for hosted iframe inputs
|
|
3689
|
+
* The ID of the payment method being deleted
|
|
3839
3690
|
*/
|
|
3840
|
-
|
|
3691
|
+
paymentMethodId: string;
|
|
3841
3692
|
/**
|
|
3842
|
-
*
|
|
3843
|
-
*
|
|
3844
|
-
* Can be used instead of the error returned by the `validate()` method since internally `primer-sdk-web`
|
|
3845
|
-
* uses the same logic to compute the error code
|
|
3846
|
-
*
|
|
3847
|
-
* @returns {string|null}
|
|
3693
|
+
* Payment method name to display in confirmation
|
|
3848
3694
|
*/
|
|
3849
|
-
|
|
3695
|
+
paymentMethodName: string;
|
|
3850
3696
|
/**
|
|
3851
|
-
*
|
|
3697
|
+
* Consume the vault manager context to access payment method info
|
|
3852
3698
|
*/
|
|
3853
|
-
|
|
3854
|
-
}
|
|
3855
|
-
/**
|
|
3856
|
-
* Card number input component with dynamic card network detection and selection
|
|
3857
|
-
*/
|
|
3858
|
-
declare class InputCardNumberComponent extends AbstractCardInputComponent {
|
|
3859
|
-
static styles: CSSResult[];
|
|
3699
|
+
vaultManager: VaultManagerContext;
|
|
3860
3700
|
/**
|
|
3861
|
-
*
|
|
3701
|
+
* Handle confirm click
|
|
3862
3702
|
*/
|
|
3863
|
-
|
|
3864
|
-
constructor();
|
|
3703
|
+
private handleConfirmClick;
|
|
3865
3704
|
/**
|
|
3866
|
-
* Handle
|
|
3705
|
+
* Handle cancel click
|
|
3867
3706
|
*/
|
|
3868
|
-
private
|
|
3707
|
+
private handleCancelClick;
|
|
3869
3708
|
/**
|
|
3870
|
-
*
|
|
3709
|
+
* Render method
|
|
3871
3710
|
*/
|
|
3872
|
-
protected
|
|
3873
|
-
render(): typeof nothing | TemplateResult<1>;
|
|
3874
|
-
}
|
|
3875
|
-
declare global {
|
|
3876
|
-
interface HTMLElementTagNameMap {
|
|
3877
|
-
"primer-input-card-number": InputCardNumberComponent;
|
|
3878
|
-
}
|
|
3879
|
-
}
|
|
3880
|
-
declare class InputCvvComponent extends AbstractCardInputComponent {
|
|
3881
|
-
static styles: CSSResult[];
|
|
3882
|
-
protected readonly config: InputComponentConfig;
|
|
3883
|
-
constructor();
|
|
3884
|
-
render(): typeof nothing | TemplateResult<1>;
|
|
3711
|
+
protected render(): TemplateResult<1>;
|
|
3885
3712
|
}
|
|
3886
3713
|
declare global {
|
|
3887
3714
|
interface HTMLElementTagNameMap {
|
|
3888
|
-
"primer-
|
|
3715
|
+
"primer-vault-delete-confirmation": VaultDeleteConfirmationComponent;
|
|
3889
3716
|
}
|
|
3890
3717
|
}
|
|
3891
|
-
|
|
3718
|
+
/**
|
|
3719
|
+
* VaultEmptyStateComponent - displays when no payment methods are available
|
|
3720
|
+
*/
|
|
3721
|
+
declare class VaultEmptyStateComponent extends LitElement {
|
|
3892
3722
|
static styles: CSSResult[];
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3723
|
+
/**
|
|
3724
|
+
* Render method
|
|
3725
|
+
*/
|
|
3726
|
+
protected render(): TemplateResult<1>;
|
|
3896
3727
|
}
|
|
3897
3728
|
declare global {
|
|
3898
3729
|
interface HTMLElementTagNameMap {
|
|
3899
|
-
"primer-
|
|
3730
|
+
"primer-vault-empty-state": VaultEmptyStateComponent;
|
|
3900
3731
|
}
|
|
3901
3732
|
}
|
|
3902
|
-
|
|
3733
|
+
/**
|
|
3734
|
+
* VaultErrorMessageComponent - displays error messages with improved visuals
|
|
3735
|
+
*/
|
|
3736
|
+
declare class VaultErrorMessageComponent extends LitElement {
|
|
3903
3737
|
static styles: CSSResult[];
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3738
|
+
/**
|
|
3739
|
+
* Strongly typed event declarations
|
|
3740
|
+
*/
|
|
3741
|
+
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3742
|
+
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3743
|
+
/**
|
|
3744
|
+
* The error message to display
|
|
3745
|
+
*/
|
|
3746
|
+
errorMessage: string;
|
|
3747
|
+
/**
|
|
3748
|
+
* Handle dismiss click
|
|
3749
|
+
*/
|
|
3750
|
+
private handleDismiss;
|
|
3751
|
+
/**
|
|
3752
|
+
* Render method
|
|
3753
|
+
*/
|
|
3754
|
+
protected render(): TemplateResult<1>;
|
|
3908
3755
|
}
|
|
3909
3756
|
declare global {
|
|
3910
3757
|
interface HTMLElementTagNameMap {
|
|
3911
|
-
"primer-
|
|
3758
|
+
"primer-vault-error-message": VaultErrorMessageComponent;
|
|
3912
3759
|
}
|
|
3913
3760
|
}
|
|
3914
3761
|
/**
|
|
3915
|
-
* A
|
|
3762
|
+
* A submit button component for vault payment flows.
|
|
3916
3763
|
* Provides a consistent submit button with translation support.
|
|
3764
|
+
* Integrates with the vault manager context to handle payment submission.
|
|
3917
3765
|
*/
|
|
3918
|
-
declare class
|
|
3766
|
+
declare class VaultPaymentSubmitComponent extends LitElement {
|
|
3919
3767
|
static styles: CSSResult[];
|
|
3920
3768
|
private readonly _userAssignedProps;
|
|
3921
3769
|
private _internalButtonText;
|
|
@@ -3926,8 +3774,10 @@ declare class CardFormSubmitComponent extends LitElement {
|
|
|
3926
3774
|
get buttonText(): string;
|
|
3927
3775
|
set buttonText(value: string);
|
|
3928
3776
|
headlessInstance: HeadlessUnitilsContext;
|
|
3929
|
-
clientOptions: ClientOptionsContext;
|
|
3930
3777
|
sdkState: SdkStateContext;
|
|
3778
|
+
vaultItemContext: VaultItemContext;
|
|
3779
|
+
vaultManager: VaultManagerContext;
|
|
3780
|
+
clientOptions: PrimerCheckoutOptions | null;
|
|
3931
3781
|
/**
|
|
3932
3782
|
* The button variant to use.
|
|
3933
3783
|
* @default "primary"
|
|
@@ -3935,409 +3785,543 @@ declare class CardFormSubmitComponent extends LitElement {
|
|
|
3935
3785
|
variant: string;
|
|
3936
3786
|
/**
|
|
3937
3787
|
* Whether the button is disabled.
|
|
3788
|
+
* This property allows external disabling of the button
|
|
3789
|
+
* regardless of the context state.
|
|
3938
3790
|
* @default false
|
|
3939
3791
|
*/
|
|
3940
3792
|
disabled: boolean;
|
|
3941
|
-
private handleClick;
|
|
3942
|
-
render(): TemplateResult<1>;
|
|
3943
|
-
}
|
|
3944
|
-
declare global {
|
|
3945
|
-
interface HTMLElementTagNameMap {
|
|
3946
|
-
"primer-card-form-submit": CardFormSubmitComponent;
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
/**
|
|
3950
|
-
* Component for displaying and selecting card networks
|
|
3951
|
-
* Uses context directly rather than properties
|
|
3952
|
-
*
|
|
3953
|
-
* @fires network-selected - Dispatched when a network is selected with the network name as detail
|
|
3954
|
-
*/
|
|
3955
|
-
declare class CardNetworkSelectorComponent extends LitElement {
|
|
3956
|
-
static styles: CSSResult[];
|
|
3957
|
-
/**
|
|
3958
|
-
* Card networks context from provider
|
|
3959
|
-
*/
|
|
3960
|
-
cardNetworks: CardNetworksContext;
|
|
3961
|
-
headlessUtils: HeadlessUnitilsContext;
|
|
3962
|
-
private selectedCardNetwork;
|
|
3963
|
-
/**
|
|
3964
|
-
* Internal state to track if dropdown is open
|
|
3965
|
-
*/
|
|
3966
|
-
private isDropdownOpen;
|
|
3967
|
-
/**
|
|
3968
|
-
* Index of the currently focused network in the dropdown
|
|
3969
|
-
*/
|
|
3970
|
-
private focusedNetworkIndex;
|
|
3971
|
-
/**
|
|
3972
|
-
* Tracks if keyboard navigation is being used
|
|
3973
|
-
*/
|
|
3974
|
-
private isKeyboardNavigation;
|
|
3975
3793
|
/**
|
|
3976
|
-
*
|
|
3977
|
-
|
|
3978
|
-
private buttonRef;
|
|
3979
|
-
/**
|
|
3980
|
-
* Reference to the dropdown container
|
|
3981
|
-
*/
|
|
3982
|
-
private dropdownRef;
|
|
3983
|
-
/**
|
|
3984
|
-
* Reference to network option elements
|
|
3985
|
-
*/
|
|
3986
|
-
private networkOptionRefs;
|
|
3987
|
-
/**
|
|
3988
|
-
* Toggle the dropdown state
|
|
3989
|
-
*/
|
|
3990
|
-
private toggleDropdown;
|
|
3991
|
-
private getNetworkIconUrl;
|
|
3992
|
-
/**
|
|
3993
|
-
* Get selectable networks from context
|
|
3994
|
-
*/
|
|
3995
|
-
private getSelectableNetworks;
|
|
3996
|
-
/**
|
|
3997
|
-
* Get detected network from context
|
|
3998
|
-
*/
|
|
3999
|
-
private getDetectedNetwork;
|
|
4000
|
-
/**
|
|
4001
|
-
* Get the index of the currently selected network
|
|
4002
|
-
*/
|
|
4003
|
-
private getSelectedNetworkIndex;
|
|
4004
|
-
/**
|
|
4005
|
-
* Handle network selection
|
|
4006
|
-
*/
|
|
4007
|
-
private selectNetwork;
|
|
4008
|
-
/**
|
|
4009
|
-
* Handle click outside to close dropdown
|
|
4010
|
-
*/
|
|
4011
|
-
private handleClickOutside;
|
|
4012
|
-
/**
|
|
4013
|
-
* Handle mouse movement to disable keyboard navigation mode
|
|
3794
|
+
* Handle button click event.
|
|
3795
|
+
* Prevents default form submission and triggers the vault payment flow.
|
|
4014
3796
|
*/
|
|
4015
|
-
private
|
|
3797
|
+
private handleClick;
|
|
4016
3798
|
/**
|
|
4017
|
-
*
|
|
3799
|
+
* Computed property to determine if the button should be disabled
|
|
4018
3800
|
*/
|
|
4019
|
-
private
|
|
3801
|
+
private get isButtonDisabled();
|
|
3802
|
+
render(): TemplateResult<1>;
|
|
3803
|
+
}
|
|
3804
|
+
declare global {
|
|
3805
|
+
interface HTMLElementTagNameMap {
|
|
3806
|
+
"primer-vault-payment-submit": VaultPaymentSubmitComponent;
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
/**
|
|
3810
|
+
* CVV Input component for vault payment methods
|
|
3811
|
+
* Renders a secure iframe for CVV input when required by the selected payment method
|
|
3812
|
+
* Uses dedicated CVV context to minimize re-renders
|
|
3813
|
+
*/
|
|
3814
|
+
declare class VaultCvvInputComponent extends LitElement {
|
|
3815
|
+
static styles: CSSResult[];
|
|
4020
3816
|
/**
|
|
4021
|
-
*
|
|
3817
|
+
* Form context for checking form dirty state
|
|
4022
3818
|
*/
|
|
4023
|
-
|
|
3819
|
+
vaultManagerFormContext: VaultManagerContext;
|
|
4024
3820
|
/**
|
|
4025
|
-
*
|
|
3821
|
+
* CVV-specific context for dedicated CVV handling
|
|
3822
|
+
* Separated to minimize re-renders on frequent CVV input changes
|
|
4026
3823
|
*/
|
|
4027
|
-
|
|
3824
|
+
vaultManagerCvvContext: VaultItemContext;
|
|
3825
|
+
computedStyles: CSSStyleDeclaration | null;
|
|
3826
|
+
paymentMethod: PaymentCardVaultedMethod | null;
|
|
3827
|
+
private cvvError;
|
|
3828
|
+
private cvvInputIsDirty;
|
|
3829
|
+
private cvvInputIsBlurred;
|
|
3830
|
+
private cvvInput;
|
|
4028
3831
|
/**
|
|
4029
|
-
*
|
|
4030
|
-
* and to document for click outside and mousemove
|
|
3832
|
+
* Unique ID for the CVV input container
|
|
4031
3833
|
*/
|
|
4032
|
-
|
|
3834
|
+
private readonly cvvContainerId;
|
|
3835
|
+
private _setupCVVIframe;
|
|
3836
|
+
constructor();
|
|
3837
|
+
disconnectedCallback(): void;
|
|
4033
3838
|
/**
|
|
4034
|
-
*
|
|
4035
|
-
* This allows keyboard navigation to continue working
|
|
3839
|
+
* Update CVV metadata in the context when input changes
|
|
4036
3840
|
*/
|
|
4037
|
-
|
|
3841
|
+
onCvvInputChange(): void;
|
|
3842
|
+
onBlur(): void;
|
|
4038
3843
|
/**
|
|
4039
|
-
*
|
|
3844
|
+
* Main render method
|
|
4040
3845
|
*/
|
|
4041
|
-
|
|
4042
|
-
render(): TemplateResult<1>;
|
|
3846
|
+
protected render(): symbol | TemplateResult<1> | undefined;
|
|
4043
3847
|
}
|
|
4044
3848
|
declare global {
|
|
4045
3849
|
interface HTMLElementTagNameMap {
|
|
4046
|
-
"primer-
|
|
3850
|
+
"primer-vault-cvv-input": VaultCvvInputComponent;
|
|
4047
3851
|
}
|
|
4048
3852
|
}
|
|
4049
3853
|
declare global {
|
|
4050
3854
|
interface HTMLElementTagNameMap {
|
|
4051
|
-
"primer-
|
|
3855
|
+
"primer-vault-manager": VaultManagerComponent;
|
|
4052
3856
|
}
|
|
4053
3857
|
}
|
|
4054
3858
|
/**
|
|
4055
|
-
*
|
|
4056
|
-
|
|
4057
|
-
export interface VaultManagerEvents {
|
|
4058
|
-
deletePaymentMethod: CustomEvent<string>;
|
|
4059
|
-
cancelDelete: CustomEvent<void>;
|
|
4060
|
-
confirmDelete: CustomEvent<void>;
|
|
4061
|
-
toggleEditMode: CustomEvent<boolean>;
|
|
4062
|
-
closeError: CustomEvent<void>;
|
|
4063
|
-
vaultPaymentError: CustomEvent<{
|
|
4064
|
-
error: Error | unknown;
|
|
4065
|
-
}>;
|
|
4066
|
-
}
|
|
4067
|
-
/**
|
|
4068
|
-
* Declare the event map for strict typing of events
|
|
4069
|
-
*/
|
|
4070
|
-
export interface VaultManagerEventMap {
|
|
4071
|
-
"delete-payment-method": VaultManagerEvents["deletePaymentMethod"];
|
|
4072
|
-
"cancel-delete": VaultManagerEvents["cancelDelete"];
|
|
4073
|
-
"confirm-delete": VaultManagerEvents["confirmDelete"];
|
|
4074
|
-
"toggle-edit-mode": VaultManagerEvents["toggleEditMode"];
|
|
4075
|
-
"close-error": VaultManagerEvents["closeError"];
|
|
4076
|
-
"primer-vault-payment-error": VaultManagerEvents["vaultPaymentError"];
|
|
4077
|
-
}
|
|
4078
|
-
/**
|
|
4079
|
-
* VaultManagerComponent - displays and manages saved payment methods
|
|
3859
|
+
* CardFormComponent serves as a container for card input components.
|
|
3860
|
+
* It handles form submission, validation, and provides context to child components.
|
|
4080
3861
|
*/
|
|
4081
|
-
declare class
|
|
3862
|
+
declare class CardFormComponent extends LitElement {
|
|
4082
3863
|
static styles: CSSResult[];
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
4086
|
-
vaultManagerContext: VaultManagerContext;
|
|
3864
|
+
hideLabels: boolean;
|
|
3865
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
4087
3866
|
/**
|
|
4088
|
-
*
|
|
3867
|
+
* Tracks whether custom content has been provided via slot
|
|
4089
3868
|
*/
|
|
4090
|
-
private
|
|
3869
|
+
private hasAssignedContent;
|
|
3870
|
+
private selectedCardNetwork;
|
|
4091
3871
|
/**
|
|
4092
|
-
* Payment
|
|
3872
|
+
* Payment managers injected from context
|
|
4093
3873
|
*/
|
|
4094
|
-
|
|
3874
|
+
paymentManagers: InitializedManagersMap;
|
|
4095
3875
|
/**
|
|
4096
|
-
*
|
|
3876
|
+
* Context provider for card form data
|
|
4097
3877
|
*/
|
|
4098
|
-
private
|
|
3878
|
+
private readonly cardFormProvider;
|
|
4099
3879
|
/**
|
|
4100
|
-
*
|
|
3880
|
+
* Events controller for dispatching form events
|
|
4101
3881
|
*/
|
|
4102
|
-
private
|
|
3882
|
+
private readonly eventsController;
|
|
4103
3883
|
/**
|
|
4104
|
-
*
|
|
3884
|
+
* Task to set up the card form with hosted inputs
|
|
4105
3885
|
*/
|
|
4106
|
-
|
|
3886
|
+
private readonly setupCardFormTask;
|
|
3887
|
+
connectedCallback(): void;
|
|
3888
|
+
disconnectedCallback(): void;
|
|
4107
3889
|
/**
|
|
4108
|
-
*
|
|
3890
|
+
* Handles click events from slotted content.
|
|
3891
|
+
* Supports both native <button> and custom <primer-button> elements.
|
|
4109
3892
|
*/
|
|
4110
|
-
private
|
|
3893
|
+
private handleSlotButtonClick;
|
|
4111
3894
|
/**
|
|
4112
|
-
*
|
|
3895
|
+
* Handles direct submit events from child components
|
|
3896
|
+
* This is a backup method to catch all possible submission events
|
|
4113
3897
|
*/
|
|
4114
|
-
private
|
|
3898
|
+
private handleDirectSubmit;
|
|
4115
3899
|
/**
|
|
4116
|
-
*
|
|
3900
|
+
* Determines if a button is a submit button based on its attributes
|
|
4117
3901
|
*/
|
|
4118
|
-
private
|
|
3902
|
+
private isSubmitButton;
|
|
4119
3903
|
/**
|
|
4120
|
-
*
|
|
3904
|
+
* Handles slot change events to detect custom content
|
|
4121
3905
|
*/
|
|
4122
|
-
private
|
|
3906
|
+
private onSlotChange;
|
|
4123
3907
|
/**
|
|
4124
|
-
*
|
|
3908
|
+
* Handles the card form submission.
|
|
3909
|
+
* Validates the form and dispatches either a submit success or errors event.
|
|
4125
3910
|
*/
|
|
4126
|
-
private
|
|
3911
|
+
private submitCardPayment;
|
|
4127
3912
|
/**
|
|
4128
|
-
*
|
|
3913
|
+
* Event handler for form submission
|
|
3914
|
+
* Handles both native form submissions and custom events
|
|
4129
3915
|
*/
|
|
4130
|
-
private
|
|
3916
|
+
private handleFormSubmit;
|
|
3917
|
+
render(): typeof nothing | TemplateResult<1>;
|
|
3918
|
+
}
|
|
3919
|
+
export interface CardFormContext {
|
|
3920
|
+
cardNumberInput: IHeadlessHostedInput;
|
|
3921
|
+
expiryInput: IHeadlessHostedInput;
|
|
3922
|
+
cvvInput: IHeadlessHostedInput;
|
|
3923
|
+
setCardholderName: (val: string) => void;
|
|
3924
|
+
setCardNetwork: (val: string) => void;
|
|
3925
|
+
validate: () => Promise<Validation>;
|
|
3926
|
+
submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
|
|
3927
|
+
errors?: Validation["validationErrors"];
|
|
3928
|
+
hideLabels?: boolean;
|
|
3929
|
+
}
|
|
3930
|
+
/**
|
|
3931
|
+
* A shared type that ensures the host of a HostedInputController contains
|
|
3932
|
+
* the required properties for proper hosted input handling.
|
|
3933
|
+
*/
|
|
3934
|
+
export interface HostedInputHost extends ReactiveControllerHost, LitElement {
|
|
3935
|
+
cardFormContext: CardFormContext | null;
|
|
3936
|
+
computedStyles: CSSStyleDeclaration | null;
|
|
3937
|
+
/** A string for the input placeholder. */
|
|
3938
|
+
placeholder: string;
|
|
3939
|
+
/** An accessible label for the input. */
|
|
3940
|
+
ariaLabel: string;
|
|
3941
|
+
/** The label for the input. */
|
|
3942
|
+
label: string;
|
|
3943
|
+
requestUpdate: ReactiveControllerHost["requestUpdate"];
|
|
3944
|
+
}
|
|
3945
|
+
export interface TaskFunctionOptions {
|
|
3946
|
+
signal: AbortSignal;
|
|
3947
|
+
}
|
|
3948
|
+
export type TaskFunction<D extends ReadonlyArray<unknown>, R = unknown> = (args: D, options: TaskFunctionOptions) => R | typeof initialState | Promise<R | typeof initialState>;
|
|
3949
|
+
export type ArgsFunction<D extends ReadonlyArray<unknown>> = () => D;
|
|
3950
|
+
declare const TaskStatus: {
|
|
3951
|
+
readonly INITIAL: 0;
|
|
3952
|
+
readonly PENDING: 1;
|
|
3953
|
+
readonly COMPLETE: 2;
|
|
3954
|
+
readonly ERROR: 3;
|
|
3955
|
+
};
|
|
3956
|
+
declare const initialState: unique symbol;
|
|
3957
|
+
export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
|
|
3958
|
+
export type StatusRenderer<R> = {
|
|
3959
|
+
initial?: () => unknown;
|
|
3960
|
+
pending?: () => unknown;
|
|
3961
|
+
complete?: (value: R) => unknown;
|
|
3962
|
+
error?: (error: unknown) => unknown;
|
|
3963
|
+
};
|
|
3964
|
+
export interface TaskConfig<T extends ReadonlyArray<unknown>, R> {
|
|
3965
|
+
task: TaskFunction<T, R>;
|
|
3966
|
+
args?: ArgsFunction<T>;
|
|
4131
3967
|
/**
|
|
4132
|
-
*
|
|
3968
|
+
* Determines if the task is run automatically when arguments change after a
|
|
3969
|
+
* host update. Default to `true`.
|
|
3970
|
+
*
|
|
3971
|
+
* If `true`, the task checks arguments during the host update (after
|
|
3972
|
+
* `willUpdate()` and before `update()` in Lit) and runs if they change. For
|
|
3973
|
+
* a task to see argument changes they must be done in `willUpdate()` or
|
|
3974
|
+
* earlier. The host element can see task status changes caused by its own
|
|
3975
|
+
* current update.
|
|
3976
|
+
*
|
|
3977
|
+
* If `'afterUpdate'`, the task checks arguments and runs _after_ the host
|
|
3978
|
+
* update. This means that the task can see host changes done in update, such
|
|
3979
|
+
* as rendered DOM. The host element can not see task status changes caused
|
|
3980
|
+
* by its own update, so the task must trigger a second host update to make
|
|
3981
|
+
* those changes renderable.
|
|
3982
|
+
*
|
|
3983
|
+
* Note: `'afterUpdate'` is unlikely to be SSR compatible in the future.
|
|
3984
|
+
*
|
|
3985
|
+
* If `false`, the task is not run automatically, and must be run with the
|
|
3986
|
+
* {@linkcode run} method.
|
|
4133
3987
|
*/
|
|
4134
|
-
|
|
3988
|
+
autoRun?: boolean | "afterUpdate";
|
|
4135
3989
|
/**
|
|
4136
|
-
*
|
|
3990
|
+
* A function that determines if the current arg and previous args arrays are
|
|
3991
|
+
* equal. If the argsEqual function returns true, the task will not auto-run.
|
|
3992
|
+
*
|
|
3993
|
+
* The default is {@linkcode shallowArrayEquals}. {@linkcode deepArrayEquals}
|
|
3994
|
+
* is also available.
|
|
4137
3995
|
*/
|
|
4138
|
-
|
|
3996
|
+
argsEqual?: (oldArgs: T, newArgs: T) => boolean;
|
|
3997
|
+
/**
|
|
3998
|
+
* If initialValue is provided, the task is initialized to the COMPLETE
|
|
3999
|
+
* status and the value is set to initialData.
|
|
4000
|
+
*
|
|
4001
|
+
* Initial args should be coherent with the initialValue, since they are
|
|
4002
|
+
* assumed to be the args that would produce that value. When autoRun is
|
|
4003
|
+
* `true` the task will not auto-run again until the args change.
|
|
4004
|
+
*/
|
|
4005
|
+
initialValue?: R;
|
|
4006
|
+
onComplete?: (value: R) => unknown;
|
|
4007
|
+
onError?: (error: unknown) => unknown;
|
|
4008
|
+
}
|
|
4009
|
+
declare class Task<const T extends ReadonlyArray<unknown> = ReadonlyArray<unknown>, const R = unknown> {
|
|
4010
|
+
private _previousArgs?;
|
|
4011
|
+
private _task;
|
|
4012
|
+
private _argsFn?;
|
|
4013
|
+
private _argsEqual;
|
|
4014
|
+
private _callId;
|
|
4015
|
+
private _host;
|
|
4016
|
+
private _value?;
|
|
4017
|
+
private _error?;
|
|
4018
|
+
private _abortController?;
|
|
4019
|
+
private _onComplete?;
|
|
4020
|
+
private _onError?;
|
|
4021
|
+
private _status;
|
|
4022
|
+
/**
|
|
4023
|
+
* Determines if the task is run automatically when arguments change after a
|
|
4024
|
+
* host update. Default to `true`.
|
|
4025
|
+
*
|
|
4026
|
+
* @see {@link TaskConfig.autoRun} for more information.
|
|
4027
|
+
*/
|
|
4028
|
+
autoRun: boolean | "afterUpdate";
|
|
4029
|
+
/**
|
|
4030
|
+
* A Promise that resolve when the current task run is complete.
|
|
4031
|
+
*
|
|
4032
|
+
* If a new task run is started while a previous run is pending, the Promise
|
|
4033
|
+
* is kept and only resolved when the new run is completed.
|
|
4034
|
+
*/
|
|
4035
|
+
get taskComplete(): Promise<R>;
|
|
4036
|
+
private _resolveTaskComplete?;
|
|
4037
|
+
private _rejectTaskComplete?;
|
|
4038
|
+
private _taskComplete?;
|
|
4039
|
+
constructor(host: ReactiveControllerHost, task: TaskConfig<T, R>);
|
|
4040
|
+
constructor(host: ReactiveControllerHost, task: TaskFunction<T, R>, args?: ArgsFunction<T>);
|
|
4041
|
+
hostUpdate(): void;
|
|
4042
|
+
hostUpdated(): void;
|
|
4043
|
+
private _getArgs;
|
|
4139
4044
|
/**
|
|
4140
|
-
*
|
|
4045
|
+
* Determines if the task should run when it's triggered because of a
|
|
4046
|
+
* host update, and runs the task if it should.
|
|
4047
|
+
*
|
|
4048
|
+
* A task should run when its arguments change from the previous run, based on
|
|
4049
|
+
* the args equality function.
|
|
4050
|
+
*
|
|
4051
|
+
* This method is side-effectful: it stores the new args as the previous args.
|
|
4141
4052
|
*/
|
|
4142
|
-
private
|
|
4053
|
+
private _performTask;
|
|
4143
4054
|
/**
|
|
4144
|
-
*
|
|
4055
|
+
* Runs a task manually.
|
|
4056
|
+
*
|
|
4057
|
+
* This can be useful for running tasks in response to events as opposed to
|
|
4058
|
+
* automatically running when host element state changes.
|
|
4059
|
+
*
|
|
4060
|
+
* @param args an optional set of arguments to use for this task run. If args
|
|
4061
|
+
* is not given, the args function is called to get the arguments for
|
|
4062
|
+
* this run.
|
|
4145
4063
|
*/
|
|
4146
|
-
|
|
4064
|
+
run(args?: T): Promise<void>;
|
|
4147
4065
|
/**
|
|
4148
|
-
*
|
|
4066
|
+
* Aborts the currently pending task run by aborting the AbortSignal
|
|
4067
|
+
* passed to the task function.
|
|
4068
|
+
*
|
|
4069
|
+
* Aborting a task does nothing if the task is not running: ie, in the
|
|
4070
|
+
* complete, error, or initial states.
|
|
4071
|
+
*
|
|
4072
|
+
* Aborting a task does not automatically cancel the task function. The task
|
|
4073
|
+
* function must be written to accept the AbortSignal and either forward it
|
|
4074
|
+
* to other APIs like `fetch()`, or handle cancellation manually by using
|
|
4075
|
+
* [`signal.throwIfAborted()`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted}
|
|
4076
|
+
* or the
|
|
4077
|
+
* [`abort`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event}
|
|
4078
|
+
* event.
|
|
4079
|
+
*
|
|
4080
|
+
* @param reason The reason for aborting. Passed to
|
|
4081
|
+
* `AbortController.abort()`.
|
|
4149
4082
|
*/
|
|
4150
|
-
|
|
4083
|
+
abort(reason?: unknown): void;
|
|
4151
4084
|
/**
|
|
4152
|
-
*
|
|
4085
|
+
* The result of the previous task run, if it resolved.
|
|
4086
|
+
*
|
|
4087
|
+
* Is `undefined` if the task has not run yet, or if the previous run errored.
|
|
4153
4088
|
*/
|
|
4154
|
-
|
|
4089
|
+
get value(): R | undefined;
|
|
4155
4090
|
/**
|
|
4156
|
-
*
|
|
4091
|
+
* The error from the previous task run, if it rejected.
|
|
4092
|
+
*
|
|
4093
|
+
* Is `undefined` if the task has not run yet, or if the previous run
|
|
4094
|
+
* completed successfully.
|
|
4157
4095
|
*/
|
|
4158
|
-
|
|
4096
|
+
get error(): unknown;
|
|
4097
|
+
get status(): TaskStatus;
|
|
4098
|
+
render<T extends StatusRenderer<R>>(renderer: T): MaybeReturnType<T["initial"]> | MaybeReturnType<T["pending"]> | MaybeReturnType<T["complete"]> | MaybeReturnType<T["error"]>;
|
|
4159
4099
|
}
|
|
4100
|
+
export type MaybeReturnType<F> = F extends (...args: never[]) => infer R ? R : undefined;
|
|
4160
4101
|
/**
|
|
4161
|
-
*
|
|
4162
|
-
* Uses the VaultManagerController for display formatting
|
|
4163
|
-
* Now supports selection via the simplified button checked state
|
|
4164
|
-
* Enhanced with smooth transitions between edit and payment modes
|
|
4165
|
-
* Always renders the primer-button for consistent UI and improved accessibility
|
|
4102
|
+
* Available input types for hosted inputs.
|
|
4166
4103
|
*/
|
|
4167
|
-
|
|
4168
|
-
|
|
4104
|
+
export type HostedInputType = "cardNumber" | "cvv" | "expire" | "cardholderName";
|
|
4105
|
+
/**
|
|
4106
|
+
* Configuration for the hosted input controller.
|
|
4107
|
+
*/
|
|
4108
|
+
export interface HostedInputConfig {
|
|
4109
|
+
/** Differentiates the input type. */
|
|
4110
|
+
type: HostedInputType;
|
|
4111
|
+
/** Selector for the container element where the input should be rendered. */
|
|
4112
|
+
containerSelector: string;
|
|
4169
4113
|
/**
|
|
4170
|
-
*
|
|
4114
|
+
* Optional callback for handling input events (e.g. for CardFormName).
|
|
4171
4115
|
*/
|
|
4172
|
-
|
|
4173
|
-
|
|
4116
|
+
onInput?: (value: string) => void;
|
|
4117
|
+
}
|
|
4118
|
+
/**
|
|
4119
|
+
* Possible input source types that can be returned by getHostedInput
|
|
4120
|
+
*/
|
|
4121
|
+
export type InputSource = IHeadlessHostedInput | "cardholderName" | undefined;
|
|
4122
|
+
declare class HostedInputController<T extends HostedInputHost> implements ReactiveController {
|
|
4123
|
+
private _isFocused;
|
|
4124
|
+
private _meta;
|
|
4125
|
+
private _hostedInput;
|
|
4126
|
+
private _standardInput;
|
|
4127
|
+
private readonly host;
|
|
4128
|
+
private readonly config;
|
|
4174
4129
|
/**
|
|
4175
|
-
*
|
|
4130
|
+
* Task to set up the hosted input.
|
|
4176
4131
|
*/
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4132
|
+
readonly setupTask: Task<[
|
|
4133
|
+
InputSource
|
|
4134
|
+
], boolean | typeof initialState>;
|
|
4135
|
+
constructor(host: T, config: HostedInputConfig);
|
|
4180
4136
|
/**
|
|
4181
|
-
*
|
|
4137
|
+
* Focuses the input, whether it's a hosted input or standard input
|
|
4182
4138
|
*/
|
|
4183
|
-
|
|
4139
|
+
focusInput(): void;
|
|
4184
4140
|
/**
|
|
4185
|
-
*
|
|
4141
|
+
* Returns the hosted input from the card form context based on the type.
|
|
4142
|
+
* For 'cardholderName', no hosted input is provided so we return a fallback indicator.
|
|
4186
4143
|
*/
|
|
4187
|
-
|
|
4188
|
-
private _getAssetsTask;
|
|
4144
|
+
private getHostedInput;
|
|
4189
4145
|
/**
|
|
4190
|
-
*
|
|
4146
|
+
* Sets up the hosted input.
|
|
4147
|
+
* If a hosted input is provided, it renders it into the target container.
|
|
4148
|
+
* Otherwise (e.g. for cardholderName), it creates a standard input element.
|
|
4191
4149
|
*/
|
|
4192
|
-
private
|
|
4150
|
+
private setupHostedInput;
|
|
4193
4151
|
/**
|
|
4194
|
-
*
|
|
4195
|
-
* This is used to select the payment method and deselect others
|
|
4152
|
+
* Gets the target container element from the host's render root
|
|
4196
4153
|
*/
|
|
4197
|
-
private
|
|
4154
|
+
private getTargetContainer;
|
|
4198
4155
|
/**
|
|
4199
|
-
*
|
|
4156
|
+
* Sets up a standard input element for non-hosted input types
|
|
4200
4157
|
*/
|
|
4201
|
-
private
|
|
4158
|
+
private setupStandardInput;
|
|
4202
4159
|
/**
|
|
4203
|
-
*
|
|
4160
|
+
* Sets up event listeners for standard input elements
|
|
4204
4161
|
*/
|
|
4205
|
-
private
|
|
4162
|
+
private setupInputEventListeners;
|
|
4206
4163
|
/**
|
|
4207
|
-
*
|
|
4164
|
+
* Sets up a hosted iframe input for iframe-based input types
|
|
4208
4165
|
*/
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4166
|
+
private setupHostedIframeInput;
|
|
4167
|
+
/** Exposes the current focus state. */
|
|
4168
|
+
get isFocused(): boolean;
|
|
4169
|
+
/** Exposes the current metadata state. */
|
|
4170
|
+
get meta(): InputMetadata;
|
|
4171
|
+
hostConnected(): void;
|
|
4172
|
+
hostDisconnected(): void;
|
|
4215
4173
|
}
|
|
4216
4174
|
/**
|
|
4217
|
-
*
|
|
4175
|
+
* Translation configuration object
|
|
4218
4176
|
*/
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4177
|
+
export type TranslationConfig = {
|
|
4178
|
+
id: string;
|
|
4179
|
+
defaultMessage: string;
|
|
4180
|
+
};
|
|
4181
|
+
/**
|
|
4182
|
+
* Configuration for abstract input component
|
|
4183
|
+
*/
|
|
4184
|
+
export interface InputComponentConfig {
|
|
4185
|
+
/** The component's hosted input type */
|
|
4186
|
+
inputType: HostedInputType;
|
|
4187
|
+
/** ID selector for the container where the input will be rendered */
|
|
4188
|
+
containerSelector: string;
|
|
4189
|
+
/** Error name to match in the card form context */
|
|
4190
|
+
errorName: string;
|
|
4191
|
+
/** Translation keys for default values */
|
|
4192
|
+
translations: {
|
|
4193
|
+
label: TranslationConfig | string;
|
|
4194
|
+
placeholder?: TranslationConfig | string;
|
|
4195
|
+
ariaLabel?: TranslationConfig | string;
|
|
4196
|
+
};
|
|
4197
|
+
/** Optional input handler for non-hosted inputs */
|
|
4198
|
+
onInput?: (value: string) => void;
|
|
4199
|
+
}
|
|
4200
|
+
declare abstract class AbstractCardInputComponent extends LitElement implements HostedInputHost {
|
|
4201
|
+
cardFormContext: CardFormContext | null;
|
|
4202
|
+
computedStyles: CSSStyleDeclaration | null;
|
|
4203
|
+
/** Tracks which properties were explicitly set by the user */
|
|
4204
|
+
protected readonly _userAssignedProps: Set<string>;
|
|
4205
|
+
/** Internal storage for property values */
|
|
4206
|
+
protected _internalLabel: string;
|
|
4207
|
+
protected _internalPlaceholder: string;
|
|
4208
|
+
protected _internalAriaLabel: string;
|
|
4209
|
+
/** Configuration for this input component */
|
|
4210
|
+
protected abstract readonly config: InputComponentConfig;
|
|
4211
|
+
/** Hosted input controller */
|
|
4212
|
+
protected readonly hostedInputController: HostedInputController<HostedInputHost>;
|
|
4230
4213
|
/**
|
|
4231
|
-
*
|
|
4214
|
+
* Gets a translated or static string value from the translation config
|
|
4232
4215
|
*/
|
|
4233
|
-
|
|
4216
|
+
private getTranslatedValue;
|
|
4234
4217
|
/**
|
|
4235
|
-
*
|
|
4218
|
+
* The input label text.
|
|
4219
|
+
* Falls back to localized default if not explicitly set.
|
|
4236
4220
|
*/
|
|
4237
|
-
|
|
4221
|
+
get label(): string;
|
|
4222
|
+
set label(value: string);
|
|
4238
4223
|
/**
|
|
4239
|
-
*
|
|
4224
|
+
* The input placeholder text.
|
|
4225
|
+
* Falls back to localized default if not explicitly set.
|
|
4226
|
+
* When explicitly set to empty string, no placeholder will be displayed.
|
|
4240
4227
|
*/
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
declare global {
|
|
4244
|
-
interface HTMLElementTagNameMap {
|
|
4245
|
-
"primer-vault-manager-header": VaultManagerHeaderComponent;
|
|
4246
|
-
}
|
|
4247
|
-
}
|
|
4248
|
-
/**
|
|
4249
|
-
* VaultDeleteConfirmationComponent - displays confirmation UI for deleting a payment method
|
|
4250
|
-
*/
|
|
4251
|
-
declare class VaultDeleteConfirmationComponent extends LitElement {
|
|
4252
|
-
static styles: CSSResult[];
|
|
4228
|
+
get placeholder(): string;
|
|
4229
|
+
set placeholder(value: string);
|
|
4253
4230
|
/**
|
|
4254
|
-
*
|
|
4231
|
+
* The input aria-label attribute.
|
|
4232
|
+
* Falls back to localized default if not explicitly set.
|
|
4255
4233
|
*/
|
|
4256
|
-
|
|
4257
|
-
|
|
4234
|
+
get ariaLabel(): string;
|
|
4235
|
+
set ariaLabel(value: string);
|
|
4236
|
+
constructor();
|
|
4258
4237
|
/**
|
|
4259
|
-
*
|
|
4238
|
+
* Initialize the controller after the component has been constructed
|
|
4239
|
+
* and the config is available
|
|
4260
4240
|
*/
|
|
4261
|
-
|
|
4241
|
+
protected childUpdated(): void;
|
|
4262
4242
|
/**
|
|
4263
|
-
*
|
|
4243
|
+
* Handler for wrapper-click event from InputWrapper component
|
|
4244
|
+
* This is still needed for hosted iframe inputs
|
|
4264
4245
|
*/
|
|
4265
|
-
|
|
4246
|
+
private handleWrapperClick;
|
|
4266
4247
|
/**
|
|
4267
|
-
*
|
|
4248
|
+
* Get the error code from the hosted input controller when the input is submitted or touched
|
|
4249
|
+
*
|
|
4250
|
+
* Can be used instead of the error returned by the `validate()` method since internally `primer-sdk-web`
|
|
4251
|
+
* uses the same logic to compute the error code
|
|
4252
|
+
*
|
|
4253
|
+
* @returns {string|null}
|
|
4268
4254
|
*/
|
|
4269
|
-
|
|
4255
|
+
getError(): string | null;
|
|
4270
4256
|
/**
|
|
4271
|
-
*
|
|
4257
|
+
* Common rendering logic for all card input components
|
|
4272
4258
|
*/
|
|
4273
|
-
|
|
4259
|
+
protected renderInput(): typeof nothing | TemplateResult<1>;
|
|
4260
|
+
}
|
|
4261
|
+
/**
|
|
4262
|
+
* Card number input component with dynamic card network detection and selection
|
|
4263
|
+
*/
|
|
4264
|
+
declare class InputCardNumberComponent extends AbstractCardInputComponent {
|
|
4265
|
+
static styles: CSSResult[];
|
|
4274
4266
|
/**
|
|
4275
|
-
*
|
|
4267
|
+
* Configuration for this input component
|
|
4276
4268
|
*/
|
|
4277
|
-
|
|
4269
|
+
protected readonly config: InputComponentConfig;
|
|
4270
|
+
constructor();
|
|
4278
4271
|
/**
|
|
4279
|
-
* Handle
|
|
4272
|
+
* Handle network selection from the network selector component
|
|
4280
4273
|
*/
|
|
4281
|
-
private
|
|
4274
|
+
private handleNetworkSelected;
|
|
4282
4275
|
/**
|
|
4283
|
-
*
|
|
4276
|
+
* Override the renderInput method to include the network selector
|
|
4284
4277
|
*/
|
|
4285
|
-
protected
|
|
4278
|
+
protected renderInput(): typeof nothing | TemplateResult<1>;
|
|
4279
|
+
render(): typeof nothing | TemplateResult<1>;
|
|
4286
4280
|
}
|
|
4287
4281
|
declare global {
|
|
4288
4282
|
interface HTMLElementTagNameMap {
|
|
4289
|
-
"primer-
|
|
4283
|
+
"primer-input-card-number": InputCardNumberComponent;
|
|
4290
4284
|
}
|
|
4291
4285
|
}
|
|
4292
|
-
|
|
4293
|
-
* VaultEmptyStateComponent - displays when no payment methods are available
|
|
4294
|
-
*/
|
|
4295
|
-
declare class VaultEmptyStateComponent extends LitElement {
|
|
4286
|
+
declare class InputCvvComponent extends AbstractCardInputComponent {
|
|
4296
4287
|
static styles: CSSResult[];
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
protected render(): TemplateResult<1>;
|
|
4288
|
+
protected readonly config: InputComponentConfig;
|
|
4289
|
+
constructor();
|
|
4290
|
+
render(): typeof nothing | TemplateResult<1>;
|
|
4301
4291
|
}
|
|
4302
4292
|
declare global {
|
|
4303
4293
|
interface HTMLElementTagNameMap {
|
|
4304
|
-
"primer-
|
|
4294
|
+
"primer-input-cvv": InputCvvComponent;
|
|
4305
4295
|
}
|
|
4306
4296
|
}
|
|
4307
|
-
|
|
4308
|
-
* VaultErrorMessageComponent - displays error messages with improved visuals
|
|
4309
|
-
*/
|
|
4310
|
-
declare class VaultErrorMessageComponent extends LitElement {
|
|
4297
|
+
declare class InputCardExpiryComponent extends AbstractCardInputComponent {
|
|
4311
4298
|
static styles: CSSResult[];
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
4316
|
-
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
4317
|
-
/**
|
|
4318
|
-
* The error message to display
|
|
4319
|
-
*/
|
|
4320
|
-
errorMessage: string;
|
|
4321
|
-
/**
|
|
4322
|
-
* Handle dismiss click
|
|
4323
|
-
*/
|
|
4324
|
-
private handleDismiss;
|
|
4325
|
-
/**
|
|
4326
|
-
* Render method
|
|
4327
|
-
*/
|
|
4328
|
-
protected render(): TemplateResult<1>;
|
|
4299
|
+
protected readonly config: InputComponentConfig;
|
|
4300
|
+
constructor();
|
|
4301
|
+
render(): typeof nothing | TemplateResult<1>;
|
|
4329
4302
|
}
|
|
4330
4303
|
declare global {
|
|
4331
4304
|
interface HTMLElementTagNameMap {
|
|
4332
|
-
"primer-
|
|
4305
|
+
"primer-input-card-expiry": InputCardExpiryComponent;
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
declare class InputCardHolderNameComponent extends AbstractCardInputComponent {
|
|
4309
|
+
static styles: CSSResult[];
|
|
4310
|
+
protected readonly config: InputComponentConfig;
|
|
4311
|
+
constructor();
|
|
4312
|
+
private handleInput;
|
|
4313
|
+
render(): typeof nothing | TemplateResult<1>;
|
|
4314
|
+
}
|
|
4315
|
+
declare global {
|
|
4316
|
+
interface HTMLElementTagNameMap {
|
|
4317
|
+
"primer-input-card-holder-name": InputCardHolderNameComponent;
|
|
4333
4318
|
}
|
|
4334
4319
|
}
|
|
4335
4320
|
/**
|
|
4336
|
-
* A submit button component for
|
|
4321
|
+
* A form submit button component for card forms.
|
|
4337
4322
|
* Provides a consistent submit button with translation support.
|
|
4338
|
-
* Integrates with the vault manager context to handle payment submission.
|
|
4339
4323
|
*/
|
|
4340
|
-
declare class
|
|
4324
|
+
declare class CardFormSubmitComponent extends LitElement {
|
|
4341
4325
|
static styles: CSSResult[];
|
|
4342
4326
|
private readonly _userAssignedProps;
|
|
4343
4327
|
private _internalButtonText;
|
|
@@ -4348,10 +4332,8 @@ declare class VaultPaymentSubmitComponent extends LitElement {
|
|
|
4348
4332
|
get buttonText(): string;
|
|
4349
4333
|
set buttonText(value: string);
|
|
4350
4334
|
headlessInstance: HeadlessUnitilsContext;
|
|
4335
|
+
clientOptions: ClientOptionsContext;
|
|
4351
4336
|
sdkState: SdkStateContext;
|
|
4352
|
-
vaultItemContext: VaultItemContext;
|
|
4353
|
-
vaultManager: VaultManagerContext;
|
|
4354
|
-
clientOptions: PrimerCheckoutOptions | null;
|
|
4355
4337
|
/**
|
|
4356
4338
|
* The button variant to use.
|
|
4357
4339
|
* @default "primary"
|
|
@@ -4359,74 +4341,120 @@ declare class VaultPaymentSubmitComponent extends LitElement {
|
|
|
4359
4341
|
variant: string;
|
|
4360
4342
|
/**
|
|
4361
4343
|
* Whether the button is disabled.
|
|
4362
|
-
* This property allows external disabling of the button
|
|
4363
|
-
* regardless of the context state.
|
|
4364
4344
|
* @default false
|
|
4365
4345
|
*/
|
|
4366
4346
|
disabled: boolean;
|
|
4367
|
-
/**
|
|
4368
|
-
* Handle button click event.
|
|
4369
|
-
* Prevents default form submission and triggers the vault payment flow.
|
|
4370
|
-
*/
|
|
4371
4347
|
private handleClick;
|
|
4372
|
-
/**
|
|
4373
|
-
* Computed property to determine if the button should be disabled
|
|
4374
|
-
*/
|
|
4375
|
-
private get isButtonDisabled();
|
|
4376
4348
|
render(): TemplateResult<1>;
|
|
4377
4349
|
}
|
|
4378
4350
|
declare global {
|
|
4379
4351
|
interface HTMLElementTagNameMap {
|
|
4380
|
-
"primer-
|
|
4352
|
+
"primer-card-form-submit": CardFormSubmitComponent;
|
|
4381
4353
|
}
|
|
4382
4354
|
}
|
|
4383
4355
|
/**
|
|
4384
|
-
*
|
|
4385
|
-
*
|
|
4386
|
-
*
|
|
4356
|
+
* Component for displaying and selecting card networks
|
|
4357
|
+
* Uses context directly rather than properties
|
|
4358
|
+
*
|
|
4359
|
+
* @fires network-selected - Dispatched when a network is selected with the network name as detail
|
|
4387
4360
|
*/
|
|
4388
|
-
declare class
|
|
4361
|
+
declare class CardNetworkSelectorComponent extends LitElement {
|
|
4389
4362
|
static styles: CSSResult[];
|
|
4390
4363
|
/**
|
|
4391
|
-
*
|
|
4364
|
+
* Card networks context from provider
|
|
4392
4365
|
*/
|
|
4393
|
-
|
|
4366
|
+
cardNetworks: CardNetworksContext;
|
|
4367
|
+
headlessUtils: HeadlessUnitilsContext;
|
|
4368
|
+
private selectedCardNetwork;
|
|
4394
4369
|
/**
|
|
4395
|
-
*
|
|
4396
|
-
* Separated to minimize re-renders on frequent CVV input changes
|
|
4370
|
+
* Internal state to track if dropdown is open
|
|
4397
4371
|
*/
|
|
4398
|
-
|
|
4399
|
-
computedStyles: CSSStyleDeclaration | null;
|
|
4400
|
-
paymentMethod: PaymentCardVaultedMethod | null;
|
|
4401
|
-
private cvvError;
|
|
4402
|
-
private cvvInputIsDirty;
|
|
4403
|
-
private cvvInputIsBlurred;
|
|
4404
|
-
private cvvInput;
|
|
4372
|
+
private isDropdownOpen;
|
|
4405
4373
|
/**
|
|
4406
|
-
*
|
|
4374
|
+
* Index of the currently focused network in the dropdown
|
|
4407
4375
|
*/
|
|
4408
|
-
private
|
|
4409
|
-
private _setupCVVIframe;
|
|
4410
|
-
constructor();
|
|
4411
|
-
disconnectedCallback(): void;
|
|
4376
|
+
private focusedNetworkIndex;
|
|
4412
4377
|
/**
|
|
4413
|
-
*
|
|
4378
|
+
* Tracks if keyboard navigation is being used
|
|
4414
4379
|
*/
|
|
4415
|
-
|
|
4416
|
-
onBlur(): void;
|
|
4380
|
+
private isKeyboardNavigation;
|
|
4417
4381
|
/**
|
|
4418
|
-
*
|
|
4382
|
+
* Reference to the dropdown button
|
|
4419
4383
|
*/
|
|
4420
|
-
|
|
4384
|
+
private buttonRef;
|
|
4385
|
+
/**
|
|
4386
|
+
* Reference to the dropdown container
|
|
4387
|
+
*/
|
|
4388
|
+
private dropdownRef;
|
|
4389
|
+
/**
|
|
4390
|
+
* Reference to network option elements
|
|
4391
|
+
*/
|
|
4392
|
+
private networkOptionRefs;
|
|
4393
|
+
/**
|
|
4394
|
+
* Toggle the dropdown state
|
|
4395
|
+
*/
|
|
4396
|
+
private toggleDropdown;
|
|
4397
|
+
private getNetworkIconUrl;
|
|
4398
|
+
/**
|
|
4399
|
+
* Get selectable networks from context
|
|
4400
|
+
*/
|
|
4401
|
+
private getSelectableNetworks;
|
|
4402
|
+
/**
|
|
4403
|
+
* Get detected network from context
|
|
4404
|
+
*/
|
|
4405
|
+
private getDetectedNetwork;
|
|
4406
|
+
/**
|
|
4407
|
+
* Get the index of the currently selected network
|
|
4408
|
+
*/
|
|
4409
|
+
private getSelectedNetworkIndex;
|
|
4410
|
+
/**
|
|
4411
|
+
* Handle network selection
|
|
4412
|
+
*/
|
|
4413
|
+
private selectNetwork;
|
|
4414
|
+
/**
|
|
4415
|
+
* Handle click outside to close dropdown
|
|
4416
|
+
*/
|
|
4417
|
+
private handleClickOutside;
|
|
4418
|
+
/**
|
|
4419
|
+
* Handle mouse movement to disable keyboard navigation mode
|
|
4420
|
+
*/
|
|
4421
|
+
private handleMouseMove;
|
|
4422
|
+
/**
|
|
4423
|
+
* Handle keydown events for keyboard navigation
|
|
4424
|
+
*/
|
|
4425
|
+
private handleKeyDown;
|
|
4426
|
+
/**
|
|
4427
|
+
* Focus the current network option
|
|
4428
|
+
*/
|
|
4429
|
+
private focusNetworkOption;
|
|
4430
|
+
/**
|
|
4431
|
+
* Save reference to network option element
|
|
4432
|
+
*/
|
|
4433
|
+
private setNetworkOptionRef;
|
|
4434
|
+
/**
|
|
4435
|
+
* Attach event listener to the component for keydown events
|
|
4436
|
+
* and to document for click outside and mousemove
|
|
4437
|
+
*/
|
|
4438
|
+
connectedCallback(): void;
|
|
4439
|
+
/**
|
|
4440
|
+
* Handle document-level keydown events, but only when dropdown is open
|
|
4441
|
+
* This allows keyboard navigation to continue working
|
|
4442
|
+
*/
|
|
4443
|
+
private handleDocumentKeyDown;
|
|
4444
|
+
/**
|
|
4445
|
+
* Lifecycle: Remove all event listeners when disconnected
|
|
4446
|
+
*/
|
|
4447
|
+
disconnectedCallback(): void;
|
|
4448
|
+
render(): TemplateResult<1>;
|
|
4421
4449
|
}
|
|
4422
4450
|
declare global {
|
|
4423
4451
|
interface HTMLElementTagNameMap {
|
|
4424
|
-
"primer-
|
|
4452
|
+
"primer-card-network-selector": CardNetworkSelectorComponent;
|
|
4425
4453
|
}
|
|
4426
4454
|
}
|
|
4427
4455
|
declare global {
|
|
4428
4456
|
interface HTMLElementTagNameMap {
|
|
4429
|
-
"primer-
|
|
4457
|
+
"primer-card-form": CardFormComponent;
|
|
4430
4458
|
}
|
|
4431
4459
|
}
|
|
4432
4460
|
/**
|
|
@@ -4446,6 +4474,35 @@ declare global {
|
|
|
4446
4474
|
"primer-show-other-payments": ShowOtherPaymentsComponent;
|
|
4447
4475
|
}
|
|
4448
4476
|
}
|
|
4477
|
+
/**
|
|
4478
|
+
* Component for rendering native payment buttons (Apple Pay, Google Pay, PayPal)
|
|
4479
|
+
* with proper height calculations based on design system variables.
|
|
4480
|
+
*/
|
|
4481
|
+
declare class NativePaymentComponent extends LitElement {
|
|
4482
|
+
static styles: CSSResult[];
|
|
4483
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
4484
|
+
paymentManagers: InitializedManagersMap;
|
|
4485
|
+
computedStyles: CSSStyleDeclaration | null;
|
|
4486
|
+
private _buttonId;
|
|
4487
|
+
private loadManagerTask;
|
|
4488
|
+
constructor();
|
|
4489
|
+
/**
|
|
4490
|
+
* Calculates the button height based on CSS variables
|
|
4491
|
+
* Mirrors the calculation used in the host styles
|
|
4492
|
+
*/
|
|
4493
|
+
private calculateButtonHeight;
|
|
4494
|
+
/**
|
|
4495
|
+
* Creates render options with appropriate styles based on payment method type
|
|
4496
|
+
*/
|
|
4497
|
+
private createRenderOptions;
|
|
4498
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
4499
|
+
render(): symbol | TemplateResult<1> | undefined;
|
|
4500
|
+
}
|
|
4501
|
+
declare global {
|
|
4502
|
+
interface HTMLElementTagNameMap {
|
|
4503
|
+
"primer-native-payment": NativePaymentComponent;
|
|
4504
|
+
}
|
|
4505
|
+
}
|
|
4449
4506
|
declare class PrimerCheckoutCompleteComponent extends LitElement {
|
|
4450
4507
|
render(): TemplateResult<1>;
|
|
4451
4508
|
}
|
|
@@ -4493,6 +4550,23 @@ declare global {
|
|
|
4493
4550
|
"primer-error-message-container": ErrorMessageContainerComponent;
|
|
4494
4551
|
}
|
|
4495
4552
|
}
|
|
4553
|
+
declare class PrimerMainComponent extends LitElement {
|
|
4554
|
+
static styles: CSSResult[];
|
|
4555
|
+
private hasAssignedContent;
|
|
4556
|
+
/**
|
|
4557
|
+
* Inline slotchange event listener.
|
|
4558
|
+
* Uses assignedNodes with flatten to detect if the slot has any nodes.
|
|
4559
|
+
*/
|
|
4560
|
+
private onSlotChange;
|
|
4561
|
+
paymentMethods: PaymentMethodsContext;
|
|
4562
|
+
sdkState: SdkStateContext;
|
|
4563
|
+
render(): TemplateResult<1>;
|
|
4564
|
+
}
|
|
4565
|
+
declare global {
|
|
4566
|
+
interface HTMLElementTagNameMap {
|
|
4567
|
+
"primer-main": PrimerMainComponent;
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4496
4570
|
/**
|
|
4497
4571
|
* Main function to load the Primer SDK with all required dependencies and styles
|
|
4498
4572
|
* @returns {Promise<void>} A promise that resolves when loading is complete
|