@primer-io/primer-js 0.1.3 → 0.1.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.
- package/dist/custom-elements.json +2798 -1268
- package/dist/jsx/index.d.ts +96 -6
- package/dist/primer-loader.d.ts +243 -39
- package/dist/primer-loader.js +754 -265
- package/dist/vscode.html-custom-data.json +45 -5
- package/dist/web-types.json +111 -10
- package/package.json +1 -1
package/dist/jsx/index.d.ts
CHANGED
|
@@ -62,14 +62,14 @@ type BaseEvents = {};
|
|
|
62
62
|
|
|
63
63
|
export type PrimerCheckoutComponentProps = {
|
|
64
64
|
/** */
|
|
65
|
-
|
|
65
|
+
customStyles?: string;
|
|
66
66
|
/** */
|
|
67
|
-
|
|
67
|
+
clientToken?: string;
|
|
68
68
|
/** */
|
|
69
69
|
options?: PrimerCheckoutOptions;
|
|
70
70
|
/** Whether the component has completed initialization and loading
|
|
71
71
|
This is used to control the CSS-only loader visibility */
|
|
72
|
-
|
|
72
|
+
_jsInitialized?: boolean;
|
|
73
73
|
/** */
|
|
74
74
|
jsInitialized?: boolean;
|
|
75
75
|
/** */
|
|
@@ -88,6 +88,8 @@ This is used to control the CSS-only loader visibility */
|
|
|
88
88
|
vaultManagerController?: VaultManagerController;
|
|
89
89
|
/** */
|
|
90
90
|
cardNetworkController?: CardNetworkController;
|
|
91
|
+
/** */
|
|
92
|
+
achPaymentEventsController?: AchPaymentEventsController;
|
|
91
93
|
};
|
|
92
94
|
|
|
93
95
|
export type ButtonComponentProps = {
|
|
@@ -136,6 +138,11 @@ export type CollapsableComponentProps = {
|
|
|
136
138
|
"onexpanded-changed"?: (e: CustomEvent<CustomEvent>) => void;
|
|
137
139
|
};
|
|
138
140
|
|
|
141
|
+
export type DialogComponentProps = {
|
|
142
|
+
/** */
|
|
143
|
+
"onprimer-dialog-close"?: (e: CustomEvent<CustomEvent>) => void;
|
|
144
|
+
};
|
|
145
|
+
|
|
139
146
|
export type ErrorMessageComponentProps = {
|
|
140
147
|
/** The error message text to display */
|
|
141
148
|
message?: string;
|
|
@@ -226,6 +233,13 @@ export type InputWrapperComponentProps = {
|
|
|
226
233
|
"onwrapper-click"?: (e: CustomEvent<CustomEvent>) => void;
|
|
227
234
|
};
|
|
228
235
|
|
|
236
|
+
export type PortalComponentProps = {
|
|
237
|
+
/** */
|
|
238
|
+
id?: string;
|
|
239
|
+
/** */
|
|
240
|
+
oneventName?: (e: CustomEvent<CustomEvent>) => void;
|
|
241
|
+
};
|
|
242
|
+
|
|
229
243
|
export type SpinnerComponentProps = {
|
|
230
244
|
/** Color of the spinner
|
|
231
245
|
Defaults to the design system loader color */
|
|
@@ -238,11 +252,45 @@ Useful when embedding in inputs */
|
|
|
238
252
|
compact?: boolean;
|
|
239
253
|
};
|
|
240
254
|
|
|
255
|
+
export type AchPaymentComponentProps = {
|
|
256
|
+
/** */
|
|
257
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
258
|
+
/** */
|
|
259
|
+
paymentManagers?: InitializedManagersMap;
|
|
260
|
+
/** */
|
|
261
|
+
sdkState?: SdkStateContext | undefined;
|
|
262
|
+
/** */
|
|
263
|
+
clientOptions?: ClientOptionsContext | undefined;
|
|
264
|
+
/** */
|
|
265
|
+
screen?: "form" | "mandate";
|
|
266
|
+
/** */
|
|
267
|
+
"onprimer-ach-error"?: (e: CustomEvent<CustomEvent>) => void;
|
|
268
|
+
/** */
|
|
269
|
+
"onprimer-ach-bank-details-collected"?: (e: CustomEvent<CustomEvent>) => void;
|
|
270
|
+
/** */
|
|
271
|
+
"onprimer-ach-mandate-confirmed"?: (e: CustomEvent<CustomEvent>) => void;
|
|
272
|
+
/** */
|
|
273
|
+
"onprimer-ach-mandate-declined"?: (e: CustomEvent<CustomEvent>) => void;
|
|
274
|
+
};
|
|
275
|
+
|
|
241
276
|
export type CardFormComponentProps = {
|
|
242
277
|
/** Payment managers injected from context */
|
|
243
278
|
paymentManagers?: InitializedManagersMap;
|
|
244
279
|
};
|
|
245
280
|
|
|
281
|
+
export type DynamicPaymentComponentProps = {
|
|
282
|
+
/** */
|
|
283
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
284
|
+
/** */
|
|
285
|
+
paymentManagers?: InitializedManagersMap;
|
|
286
|
+
/** */
|
|
287
|
+
sdkState?: SdkStateContext;
|
|
288
|
+
/** */
|
|
289
|
+
headlessUtils?: HeadlessUnitilsContext;
|
|
290
|
+
/** */
|
|
291
|
+
open?: boolean;
|
|
292
|
+
};
|
|
293
|
+
|
|
246
294
|
export type ErrorMessageContainerComponentProps = {
|
|
247
295
|
/** */
|
|
248
296
|
"show-processing-errors"?: boolean;
|
|
@@ -306,7 +354,9 @@ export type ShowOtherPaymentsComponentProps = {
|
|
|
306
354
|
};
|
|
307
355
|
|
|
308
356
|
export type VaultManagerComponentProps = {
|
|
309
|
-
/**
|
|
357
|
+
/** Animation duration override */
|
|
358
|
+
animationDuration?: number;
|
|
359
|
+
/** */
|
|
310
360
|
addEventListener?: <K extends keyof VaultManagerEventMap>(
|
|
311
361
|
type: K,
|
|
312
362
|
listener: (ev: VaultManagerEventMap[K]) => void,
|
|
@@ -318,8 +368,7 @@ export type VaultManagerComponentProps = {
|
|
|
318
368
|
listener: (ev: VaultManagerEventMap[K]) => void,
|
|
319
369
|
options?: boolean | AddEventListenerOptions,
|
|
320
370
|
) => void;
|
|
321
|
-
/**
|
|
322
|
-
Contains vault-related functionality and state */
|
|
371
|
+
/** */
|
|
323
372
|
vaultManagerContext?: VaultManagerContext;
|
|
324
373
|
};
|
|
325
374
|
|
|
@@ -592,6 +641,16 @@ export type CustomElements = {
|
|
|
592
641
|
*/
|
|
593
642
|
"primer-collapsable": Partial<CollapsableComponentProps & BaseProps & BaseEvents>;
|
|
594
643
|
|
|
644
|
+
/**
|
|
645
|
+
*
|
|
646
|
+
* ---
|
|
647
|
+
*
|
|
648
|
+
*
|
|
649
|
+
* ### **Events:**
|
|
650
|
+
* - **primer-dialog-close**
|
|
651
|
+
*/
|
|
652
|
+
"primer-dialog": Partial<DialogComponentProps & BaseProps & BaseEvents>;
|
|
653
|
+
|
|
595
654
|
/**
|
|
596
655
|
* A reusable atomic error message component that displays error information
|
|
597
656
|
* with appropriate styling and accessibility attributes.
|
|
@@ -680,6 +739,16 @@ export type CustomElements = {
|
|
|
680
739
|
*/
|
|
681
740
|
"primer-input-wrapper": Partial<InputWrapperComponentProps & BaseProps & BaseEvents>;
|
|
682
741
|
|
|
742
|
+
/**
|
|
743
|
+
*
|
|
744
|
+
* ---
|
|
745
|
+
*
|
|
746
|
+
*
|
|
747
|
+
* ### **Events:**
|
|
748
|
+
* - **eventName**
|
|
749
|
+
*/
|
|
750
|
+
"primer-portal": Partial<PortalComponentProps & BaseProps & BaseEvents>;
|
|
751
|
+
|
|
683
752
|
/**
|
|
684
753
|
* Spinner component with configurable size and color
|
|
685
754
|
* Adapted to work both standalone and within input components
|
|
@@ -688,6 +757,19 @@ export type CustomElements = {
|
|
|
688
757
|
*/
|
|
689
758
|
"primer-spinner": Partial<SpinnerComponentProps & BaseProps & BaseEvents>;
|
|
690
759
|
|
|
760
|
+
/**
|
|
761
|
+
*
|
|
762
|
+
* ---
|
|
763
|
+
*
|
|
764
|
+
*
|
|
765
|
+
* ### **Events:**
|
|
766
|
+
* - **primer-ach-error**
|
|
767
|
+
* - **primer-ach-bank-details-collected**
|
|
768
|
+
* - **primer-ach-mandate-confirmed**
|
|
769
|
+
* - **primer-ach-mandate-declined**
|
|
770
|
+
*/
|
|
771
|
+
"primer-ach-payment": Partial<AchPaymentComponentProps & BaseProps & BaseEvents>;
|
|
772
|
+
|
|
691
773
|
/**
|
|
692
774
|
* CardFormComponent serves as a container for card input components.
|
|
693
775
|
* It handles form submission, validation, and provides context to child components.
|
|
@@ -696,6 +778,13 @@ export type CustomElements = {
|
|
|
696
778
|
*/
|
|
697
779
|
"primer-card-form": Partial<CardFormComponentProps & BaseProps & BaseEvents>;
|
|
698
780
|
|
|
781
|
+
/**
|
|
782
|
+
*
|
|
783
|
+
* ---
|
|
784
|
+
*
|
|
785
|
+
*/
|
|
786
|
+
"primer-dynamic-payment": Partial<DynamicPaymentComponentProps & BaseProps & BaseEvents>;
|
|
787
|
+
|
|
699
788
|
/**
|
|
700
789
|
* A container component that connects to the SDK state context
|
|
701
790
|
* and displays appropriate error messages based on error state.
|
|
@@ -913,6 +1002,7 @@ export type CustomElements = {
|
|
|
913
1002
|
* Uses the VaultManagerController for display formatting
|
|
914
1003
|
* Now supports selection via the simplified button checked state
|
|
915
1004
|
* Enhanced with smooth transitions between edit and payment modes
|
|
1005
|
+
* Always renders the primer-button for consistent UI and improved accessibility
|
|
916
1006
|
* ---
|
|
917
1007
|
*
|
|
918
1008
|
*
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -1727,6 +1727,7 @@ export type ResumeToken = {
|
|
|
1727
1727
|
paymentId?: string;
|
|
1728
1728
|
};
|
|
1729
1729
|
export interface InputValidationError {
|
|
1730
|
+
field?: string;
|
|
1730
1731
|
name: string;
|
|
1731
1732
|
error: string;
|
|
1732
1733
|
message: string;
|
|
@@ -2096,6 +2097,7 @@ export interface IKlarnaPaymentMethodManager {
|
|
|
2096
2097
|
}
|
|
2097
2098
|
export interface IAchPaymentMethodManager {
|
|
2098
2099
|
start(paymentDetails: StripeAchCustomerDetails): Promise<Validation | void>;
|
|
2100
|
+
setAndValidate(paymentDetails: StripeAchCustomerDetails): Promise<Validation>;
|
|
2099
2101
|
collectBankAccountDetails(): Promise<void>;
|
|
2100
2102
|
confirmMandate(): Promise<void>;
|
|
2101
2103
|
declineMandate(): Promise<void>;
|
|
@@ -2243,6 +2245,7 @@ export type PrimerCheckoutOptions = JSONSafe<HeadlessUniversalCheckoutOptions> &
|
|
|
2243
2245
|
submitButton?: {
|
|
2244
2246
|
amountVisible?: boolean;
|
|
2245
2247
|
};
|
|
2248
|
+
stripe?: UniversalCheckoutOptions["stripe"];
|
|
2246
2249
|
};
|
|
2247
2250
|
declare global {
|
|
2248
2251
|
interface Window {
|
|
@@ -2272,6 +2275,7 @@ export interface InitializedManagersMap extends Map<PaymentMethodType, Initializ
|
|
|
2272
2275
|
get<T extends PaymentMethodType>(key: T): ManagerByType<T> | undefined;
|
|
2273
2276
|
}
|
|
2274
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;
|
|
2275
2279
|
export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
|
|
2276
2280
|
export type RedirectPaymentMethod = {
|
|
2277
2281
|
type: RedirectPaymentMethodTypes;
|
|
@@ -2302,6 +2306,11 @@ export type PaymentMethodByType<T extends PaymentMethodType> = Extract<Initializ
|
|
|
2302
2306
|
export interface InitializedPaymentMethodMap extends Map<PaymentMethodType, InitializedPaymentMethod> {
|
|
2303
2307
|
get<T extends PaymentMethodType>(key: T): PaymentMethodByType<T> | undefined;
|
|
2304
2308
|
}
|
|
2309
|
+
export interface AssetsConfig {
|
|
2310
|
+
backgroundColor: string;
|
|
2311
|
+
name: string;
|
|
2312
|
+
iconUrl: string;
|
|
2313
|
+
}
|
|
2305
2314
|
export declare class InitializedPayments {
|
|
2306
2315
|
private readonly _methods;
|
|
2307
2316
|
constructor(map: InitializedPaymentMethodMap);
|
|
@@ -2316,6 +2325,9 @@ export interface CardSubmitSuccessPayload {
|
|
|
2316
2325
|
export interface CardSubmitErrorsPayload {
|
|
2317
2326
|
errors: unknown | InputValidationError[];
|
|
2318
2327
|
}
|
|
2328
|
+
export interface PrimeAchErrorPayload {
|
|
2329
|
+
error: Error;
|
|
2330
|
+
}
|
|
2319
2331
|
export interface PrimerEvents {
|
|
2320
2332
|
"primer-state-changed": CustomEvent<SdkStateContext>;
|
|
2321
2333
|
"primer-payment-methods-updated": CustomEvent<InitializedPayments>;
|
|
@@ -2323,6 +2335,10 @@ export interface PrimerEvents {
|
|
|
2323
2335
|
"primer-card-network-change": CustomEvent<CardNetworksContext>;
|
|
2324
2336
|
"primer-card-submit-success": CustomEvent<CardSubmitSuccessPayload>;
|
|
2325
2337
|
"primer-card-submit-errors": CustomEvent<CardSubmitErrorsPayload>;
|
|
2338
|
+
"primer-ach-error": CustomEvent<PrimeAchErrorPayload>;
|
|
2339
|
+
"primer-ach-bank-details-collected": CustomEvent;
|
|
2340
|
+
"primer-ach-mandate-confirmed": CustomEvent;
|
|
2341
|
+
"primer-ach-mandate-declined": CustomEvent;
|
|
2326
2342
|
}
|
|
2327
2343
|
declare class PrimerEventsController implements ReactiveController {
|
|
2328
2344
|
host: ReactiveControllerHost & LitElement;
|
|
@@ -2348,6 +2364,37 @@ export type KlarnaCategoriesContext = {
|
|
|
2348
2364
|
categories: KlarnaPaymentMethodCategory[];
|
|
2349
2365
|
isLoading: boolean;
|
|
2350
2366
|
};
|
|
2367
|
+
export type ReducerCallbacks<State, _Action extends {
|
|
2368
|
+
type: string;
|
|
2369
|
+
}> = {
|
|
2370
|
+
[K in keyof State]?: State[K] extends (...args: unknown[]) => unknown ? State[K] : never;
|
|
2371
|
+
};
|
|
2372
|
+
export type TypedReducer<State, Action extends {
|
|
2373
|
+
type: string;
|
|
2374
|
+
}, Callbacks> = (state: State, action: Action, callbacks: Callbacks) => State;
|
|
2375
|
+
declare abstract class ReactiveStateController<Host extends ReactiveControllerHost, State, Action extends {
|
|
2376
|
+
type: string;
|
|
2377
|
+
}, Callbacks = ReducerCallbacks<State, Action> | null> implements ReactiveController {
|
|
2378
|
+
protected host: Host;
|
|
2379
|
+
protected stateHandler: (state: State) => void;
|
|
2380
|
+
private _dispatcher;
|
|
2381
|
+
constructor(host: Host, initialState: State, reducer: TypedReducer<State, Action, Callbacks>, initialCallbacks: Callbacks, stateHandler?: (state: State) => void);
|
|
2382
|
+
get currentState(): Readonly<State>;
|
|
2383
|
+
protected dispatch(action: Action): void;
|
|
2384
|
+
protected setCallbacks(callbacks: Partial<Callbacks>): void;
|
|
2385
|
+
hostConnected(): void;
|
|
2386
|
+
hostDisconnected(): void;
|
|
2387
|
+
}
|
|
2388
|
+
declare class CompositeStateController<Host extends ReactiveControllerHost> implements ReactiveController {
|
|
2389
|
+
protected host: Host;
|
|
2390
|
+
private _controllers;
|
|
2391
|
+
constructor(host: Host);
|
|
2392
|
+
addController<State, Action extends {
|
|
2393
|
+
type: string;
|
|
2394
|
+
}, Callbacks = ReducerCallbacks<State, Action> | null>(controller: ReactiveStateController<Host, State, Action, Callbacks>): void;
|
|
2395
|
+
hostConnected(): void;
|
|
2396
|
+
hostDisconnected(): void;
|
|
2397
|
+
}
|
|
2351
2398
|
/**
|
|
2352
2399
|
* Options for initializing the Vault Manager
|
|
2353
2400
|
*/
|
|
@@ -2362,9 +2409,10 @@ export interface VaultManagerInitOptions {
|
|
|
2362
2409
|
export interface VaultManagerState {
|
|
2363
2410
|
enabled: boolean;
|
|
2364
2411
|
isLoading: boolean;
|
|
2412
|
+
isUpdating: boolean;
|
|
2365
2413
|
vaultedPaymentMethods: VaultedPaymentMethod[];
|
|
2366
2414
|
cvvRecapture: boolean;
|
|
2367
|
-
createCvvInput
|
|
2415
|
+
createCvvInput: ((options: CardSecurityCodeInputOptions) => Promise<CvvInput | null>) | null;
|
|
2368
2416
|
deleteVaultedPaymentMethod: (paymentMethodId: string) => Promise<void>;
|
|
2369
2417
|
startVaultedPaymentFlow: (options?: {
|
|
2370
2418
|
cvv?: string;
|
|
@@ -2381,10 +2429,9 @@ export interface VaultManagerItemState {
|
|
|
2381
2429
|
selectedVaultedPaymentMethod: VaultedPaymentMethod | null;
|
|
2382
2430
|
setSelectedVaultedPaymentMethod: (paymentMethod: VaultedPaymentMethod | null) => void;
|
|
2383
2431
|
}
|
|
2384
|
-
declare class VaultManagerController
|
|
2385
|
-
|
|
2386
|
-
private
|
|
2387
|
-
private _vaultItemState;
|
|
2432
|
+
declare class VaultManagerController extends CompositeStateController<PrimerCheckoutType> {
|
|
2433
|
+
private coreController;
|
|
2434
|
+
private itemController;
|
|
2388
2435
|
private _vaultManager;
|
|
2389
2436
|
private _options;
|
|
2390
2437
|
constructor(host: PrimerCheckoutType);
|
|
@@ -2398,23 +2445,17 @@ declare class VaultManagerController implements ReactiveController {
|
|
|
2398
2445
|
set vaultManager(vaultManager: HeadlessVaultManager | null);
|
|
2399
2446
|
get options(): VaultManagerInitOptions | null;
|
|
2400
2447
|
set options(options: VaultManagerInitOptions | null);
|
|
2448
|
+
get vaultManagerState(): Readonly<VaultManagerState>;
|
|
2449
|
+
get vaultItemState(): Readonly<VaultManagerItemState>;
|
|
2401
2450
|
/**
|
|
2402
2451
|
* Lifecycle method called when the host disconnects
|
|
2403
2452
|
*/
|
|
2404
2453
|
hostDisconnected(): void;
|
|
2405
|
-
/**
|
|
2406
|
-
* Dispatches an action to update the core vault state
|
|
2407
|
-
*/
|
|
2408
|
-
private dispatchVaultManager;
|
|
2409
|
-
/**
|
|
2410
|
-
* Dispatches an action to update the CVV state
|
|
2411
|
-
* Separate dispatch method to handle CVV state independently
|
|
2412
|
-
*/
|
|
2413
|
-
private dispatchVaultItem;
|
|
2414
2454
|
/**
|
|
2415
2455
|
* Fetch vaulted payment methods from the server
|
|
2416
2456
|
*/
|
|
2417
|
-
fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
|
|
2457
|
+
fetchVaultedPaymentMethods(initialLoad?: boolean): Promise<VaultedPaymentMethod[]>;
|
|
2458
|
+
createCvvInput(options: CardSecurityCodeInputOptions): Promise<CvvInput | null>;
|
|
2418
2459
|
/**
|
|
2419
2460
|
* Delete a vaulted payment method by ID
|
|
2420
2461
|
*/
|
|
@@ -2482,13 +2523,33 @@ declare class SDKContextController implements ReactiveController {
|
|
|
2482
2523
|
setComputedStyles(value: CSSStyleDeclaration): void;
|
|
2483
2524
|
setVaultManagerCvv(value: VaultItemContext): void;
|
|
2484
2525
|
}
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2526
|
+
export type SdkStateAction = {
|
|
2527
|
+
type: "START_PROCESSING";
|
|
2528
|
+
} | {
|
|
2529
|
+
type: "START_LOADING";
|
|
2530
|
+
} | {
|
|
2531
|
+
type: "COMPLETE_PROCESSING";
|
|
2532
|
+
} | {
|
|
2533
|
+
type: "STOP_PROCESSING";
|
|
2534
|
+
} | {
|
|
2535
|
+
type: "SET_ERROR";
|
|
2536
|
+
payload: Error;
|
|
2537
|
+
} | {
|
|
2538
|
+
type: "SET_FAILURE";
|
|
2539
|
+
payload: {
|
|
2540
|
+
code: string;
|
|
2541
|
+
message: string;
|
|
2542
|
+
details?: Record<string, unknown>;
|
|
2543
|
+
};
|
|
2544
|
+
} | {
|
|
2545
|
+
type: "COMPLETE_LOADING";
|
|
2546
|
+
} | {
|
|
2547
|
+
type: "RESET";
|
|
2548
|
+
} | {
|
|
2549
|
+
type: "RESET_ERROR";
|
|
2550
|
+
};
|
|
2551
|
+
declare class SdkStateController extends ReactiveStateController<PrimerCheckoutType, SdkState, SdkStateAction, null> {
|
|
2488
2552
|
constructor(host: PrimerCheckoutType);
|
|
2489
|
-
hostConnected(): void;
|
|
2490
|
-
private reducer;
|
|
2491
|
-
private dispatch;
|
|
2492
2553
|
startLoading(): void;
|
|
2493
2554
|
startProcessing(): void;
|
|
2494
2555
|
stopProcessing(): void;
|
|
@@ -2497,8 +2558,8 @@ declare class SdkStateController implements ReactiveController {
|
|
|
2497
2558
|
setError(error: Error): void;
|
|
2498
2559
|
setFailure(code: string, message: string, details?: Record<string, unknown>): void;
|
|
2499
2560
|
reset(): void;
|
|
2561
|
+
resetError(): void;
|
|
2500
2562
|
forceCompleteLoading(): void;
|
|
2501
|
-
get state(): SdkState;
|
|
2502
2563
|
}
|
|
2503
2564
|
export interface PrimerCheckoutType extends ReactiveControllerHost, LitElement {
|
|
2504
2565
|
requestUpdate: ReactiveControllerHost["requestUpdate"];
|
|
@@ -2637,6 +2698,15 @@ declare const targetLocales = [
|
|
|
2637
2698
|
`zh-TW`,
|
|
2638
2699
|
] as const;
|
|
2639
2700
|
export type LocaleCode = typeof sourceLocale | (typeof targetLocales)[number];
|
|
2701
|
+
declare class AchPaymentEventsController implements ReactiveController {
|
|
2702
|
+
host: PrimerCheckoutComponent;
|
|
2703
|
+
constructor(host: PrimerCheckoutComponent);
|
|
2704
|
+
private _error;
|
|
2705
|
+
private _mandateConfirmed;
|
|
2706
|
+
private _mandateDeclined;
|
|
2707
|
+
hostConnected(): void;
|
|
2708
|
+
hostDisconnected(): void;
|
|
2709
|
+
}
|
|
2640
2710
|
/**
|
|
2641
2711
|
* PrimerCheckoutComponent implements the main checkout experience.
|
|
2642
2712
|
* This component includes a CSS-only loader that displays before the JavaScript
|
|
@@ -2671,6 +2741,7 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
|
|
|
2671
2741
|
styleProcessingController: StyleProcessingController;
|
|
2672
2742
|
vaultManagerController: VaultManagerController;
|
|
2673
2743
|
cardNetworkController: CardNetworkController;
|
|
2744
|
+
achPaymentEventsController: AchPaymentEventsController;
|
|
2674
2745
|
constructor();
|
|
2675
2746
|
attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void;
|
|
2676
2747
|
disconnectedCallback(): void;
|
|
@@ -2686,6 +2757,10 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
|
|
|
2686
2757
|
addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: ShadowRootEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
2687
2758
|
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
2688
2759
|
addEventListener<K extends keyof PrimerEvents>(type: K, listener: (this: PrimerCheckoutComponent, ev: PrimerEvents[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
2760
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
2761
|
+
removeEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: ShadowRootEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
2762
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: DocumentEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
2763
|
+
removeEventListener<K extends keyof PrimerEvents>(type: K, listener: (this: PrimerCheckoutComponent, ev: PrimerEvents[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
2689
2764
|
}
|
|
2690
2765
|
/**
|
|
2691
2766
|
* Injects the CSS loader styles into the page
|
|
@@ -3136,6 +3211,37 @@ declare global {
|
|
|
3136
3211
|
"primer-error-message": ErrorMessageComponent;
|
|
3137
3212
|
}
|
|
3138
3213
|
}
|
|
3214
|
+
declare class PortalComponent extends LitElement {
|
|
3215
|
+
static styles: CSSResult[];
|
|
3216
|
+
id: string;
|
|
3217
|
+
getContainer(): HTMLDivElement;
|
|
3218
|
+
/**
|
|
3219
|
+
* Proxies the events sent from the portalled content and
|
|
3220
|
+
* re-dispatches them.
|
|
3221
|
+
*
|
|
3222
|
+
* TODO: find a better way to scale to new events instead
|
|
3223
|
+
* of hardcoding them one by one here.
|
|
3224
|
+
*/
|
|
3225
|
+
private _setupEventListeners;
|
|
3226
|
+
disconnectedCallback(): void;
|
|
3227
|
+
private _handleSlotChange;
|
|
3228
|
+
render(): TemplateResult<1>;
|
|
3229
|
+
}
|
|
3230
|
+
declare global {
|
|
3231
|
+
interface HTMLElementTagNameMap {
|
|
3232
|
+
"primer-portal": PortalComponent;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
declare class DialogComponent extends LitElement {
|
|
3236
|
+
static styles: CSSResult[];
|
|
3237
|
+
private _handleCloseClick;
|
|
3238
|
+
render(): TemplateResult<1>;
|
|
3239
|
+
}
|
|
3240
|
+
declare global {
|
|
3241
|
+
interface HTMLElementTagNameMap {
|
|
3242
|
+
"primer-dialog": DialogComponent;
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3139
3245
|
/**
|
|
3140
3246
|
* This component renders Klarna payment method in a card-like (accordion) container with
|
|
3141
3247
|
* payment categories options to choose from.
|
|
@@ -3161,7 +3267,7 @@ declare class PrimerKlarnaComponent extends LitElement {
|
|
|
3161
3267
|
renderSelectedCategory(): Promise<void>;
|
|
3162
3268
|
selectCategory(category: string): void;
|
|
3163
3269
|
updated(changedProperties: Map<string, unknown>): void;
|
|
3164
|
-
renderCategorySelection():
|
|
3270
|
+
renderCategorySelection(): TemplateResult<1>;
|
|
3165
3271
|
renderExpandedContent(): TemplateResult<1>;
|
|
3166
3272
|
render(): typeof nothing | TemplateResult<1> | undefined;
|
|
3167
3273
|
}
|
|
@@ -3182,6 +3288,88 @@ declare global {
|
|
|
3182
3288
|
"primer-payment-method": PaymentMethodComponent;
|
|
3183
3289
|
}
|
|
3184
3290
|
}
|
|
3291
|
+
export type ClientOptionsContext = PrimerCheckoutOptions | null;
|
|
3292
|
+
export type AchField = "firstName" | "lastName" | "emailAddress";
|
|
3293
|
+
export interface AchFormState {
|
|
3294
|
+
value: string;
|
|
3295
|
+
error: string;
|
|
3296
|
+
pristine: boolean;
|
|
3297
|
+
touched: boolean;
|
|
3298
|
+
dirty: boolean;
|
|
3299
|
+
valid: boolean;
|
|
3300
|
+
}
|
|
3301
|
+
export type AchFormStateMap = Record<AchField, AchFormState>;
|
|
3302
|
+
export type ValidationFunction = (data: StripeAchCustomerDetails) => Promise<Validation>;
|
|
3303
|
+
declare class AchPaymentFormControler implements ReactiveController {
|
|
3304
|
+
host: AchPaymentComponent;
|
|
3305
|
+
validate: ValidationFunction;
|
|
3306
|
+
formState: AchFormStateMap;
|
|
3307
|
+
get hasError(): {
|
|
3308
|
+
firstName: boolean;
|
|
3309
|
+
lastName: boolean;
|
|
3310
|
+
emailAddress: boolean;
|
|
3311
|
+
};
|
|
3312
|
+
get formData(): StripeAchCustomerDetails;
|
|
3313
|
+
constructor(host: AchPaymentComponent, validate: ValidationFunction);
|
|
3314
|
+
setFieldValue(field: AchField, value: string): Promise<void>;
|
|
3315
|
+
setValidation(validation: Validation, submit?: boolean): void;
|
|
3316
|
+
setFieldTouched(field: AchField): void;
|
|
3317
|
+
resetForm(): void;
|
|
3318
|
+
private isValidFieldName;
|
|
3319
|
+
hostConnected(): void;
|
|
3320
|
+
hostDisconnected(): void;
|
|
3321
|
+
}
|
|
3322
|
+
declare class AchPaymentComponent extends LitElement {
|
|
3323
|
+
static styles: CSSResult[];
|
|
3324
|
+
protected readonly formController: AchPaymentFormControler;
|
|
3325
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
3326
|
+
paymentManagers: InitializedManagersMap;
|
|
3327
|
+
sdkState: SdkStateContext | undefined;
|
|
3328
|
+
clientOptions: ClientOptionsContext | undefined;
|
|
3329
|
+
screen: "form" | "mandate";
|
|
3330
|
+
private isSubmitting;
|
|
3331
|
+
private _paymentMethodManagerTask;
|
|
3332
|
+
private _handleInput;
|
|
3333
|
+
private _handleBlur;
|
|
3334
|
+
private _handleError;
|
|
3335
|
+
private _handleSubmitButtonClick;
|
|
3336
|
+
private _handleCollectBankAccountDetails;
|
|
3337
|
+
private _handleConfirmMandate;
|
|
3338
|
+
private _handleDeclineMandate;
|
|
3339
|
+
private renderForm;
|
|
3340
|
+
private renderMandate;
|
|
3341
|
+
render(): TemplateResult | typeof nothing | undefined;
|
|
3342
|
+
}
|
|
3343
|
+
declare global {
|
|
3344
|
+
interface HTMLElementTagNameMap {
|
|
3345
|
+
"primer-ach-payment": AchPaymentComponent;
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
declare class DynamicPaymentComponent extends LitElement {
|
|
3349
|
+
static styles: CSSResult[];
|
|
3350
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
3351
|
+
paymentManagers: InitializedManagersMap;
|
|
3352
|
+
sdkState: SdkStateContext;
|
|
3353
|
+
headlessUtils: HeadlessUnitilsContext;
|
|
3354
|
+
open: boolean;
|
|
3355
|
+
private _paymentMethodManagerTask;
|
|
3356
|
+
private _getAssetsTask;
|
|
3357
|
+
/**
|
|
3358
|
+
* Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
|
|
3359
|
+
* Should be replaced once we align on a better solution across all platforms.
|
|
3360
|
+
* TODO: get label from payment config
|
|
3361
|
+
*/
|
|
3362
|
+
private _legacyGetButtonLabel;
|
|
3363
|
+
private _setupTasks;
|
|
3364
|
+
start(): void;
|
|
3365
|
+
renderDialog(): typeof nothing | TemplateResult<1>;
|
|
3366
|
+
render(): symbol | TemplateResult<1> | undefined;
|
|
3367
|
+
}
|
|
3368
|
+
declare global {
|
|
3369
|
+
interface HTMLElementTagNameMap {
|
|
3370
|
+
"primer-dynamic-payment": DynamicPaymentComponent;
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3185
3373
|
declare class RedirectPaymentComponent extends LitElement {
|
|
3186
3374
|
static styles: CSSResult[];
|
|
3187
3375
|
paymentMethod: InitializedPaymentMethod | undefined;
|
|
@@ -3189,6 +3377,11 @@ declare class RedirectPaymentComponent extends LitElement {
|
|
|
3189
3377
|
sdkState: SdkStateContext;
|
|
3190
3378
|
headlessUtils: HeadlessUnitilsContext;
|
|
3191
3379
|
private _paymentMethodManagerTask;
|
|
3380
|
+
/**
|
|
3381
|
+
* Based on packages/primer-sdk-web/src/payment-methods/Button.tsx
|
|
3382
|
+
* Should be replaced once we align on a better solution across all platforms.
|
|
3383
|
+
*/
|
|
3384
|
+
private _legacyGetButtonLabel;
|
|
3192
3385
|
private _getAssetsTask;
|
|
3193
3386
|
private _setupTasks;
|
|
3194
3387
|
startRedirectPayment(): void;
|
|
@@ -3704,7 +3897,6 @@ declare global {
|
|
|
3704
3897
|
"primer-input-card-holder-name": InputCardHolderNameComponent;
|
|
3705
3898
|
}
|
|
3706
3899
|
}
|
|
3707
|
-
export type ClientOptionsContext = PrimerCheckoutOptions | null;
|
|
3708
3900
|
/**
|
|
3709
3901
|
* A form submit button component for card forms.
|
|
3710
3902
|
* Provides a consistent submit button with translation support.
|
|
@@ -3874,15 +4066,9 @@ export interface VaultManagerEventMap {
|
|
|
3874
4066
|
*/
|
|
3875
4067
|
declare class VaultManagerComponent extends LitElement {
|
|
3876
4068
|
static styles: CSSResult[];
|
|
3877
|
-
|
|
3878
|
-
* Strongly typed event declarations
|
|
3879
|
-
*/
|
|
4069
|
+
constructor();
|
|
3880
4070
|
addEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3881
4071
|
removeEventListener: <K extends keyof VaultManagerEventMap>(type: K, listener: (ev: VaultManagerEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void;
|
|
3882
|
-
/**
|
|
3883
|
-
* The vault manager core context from the SDK
|
|
3884
|
-
* Contains vault-related functionality and state
|
|
3885
|
-
*/
|
|
3886
4072
|
vaultManagerContext: VaultManagerContext;
|
|
3887
4073
|
/**
|
|
3888
4074
|
* Whether we're in edit mode
|
|
@@ -3900,6 +4086,14 @@ declare class VaultManagerComponent extends LitElement {
|
|
|
3900
4086
|
* Error message if something goes wrong
|
|
3901
4087
|
*/
|
|
3902
4088
|
private errorMessage;
|
|
4089
|
+
/**
|
|
4090
|
+
* Animation duration override
|
|
4091
|
+
*/
|
|
4092
|
+
animationDuration: number;
|
|
4093
|
+
/**
|
|
4094
|
+
* Get base animation configuration with current settings
|
|
4095
|
+
*/
|
|
4096
|
+
private getAnimationConfig;
|
|
3903
4097
|
/**
|
|
3904
4098
|
* Toggle edit mode handler
|
|
3905
4099
|
*/
|
|
@@ -3929,13 +4123,24 @@ declare class VaultManagerComponent extends LitElement {
|
|
|
3929
4123
|
*/
|
|
3930
4124
|
private getPaymentMethodName;
|
|
3931
4125
|
/**
|
|
3932
|
-
* Render
|
|
4126
|
+
* Render loading overlay with spinner when isUpdating is true
|
|
4127
|
+
*/
|
|
4128
|
+
private renderLoadingOverlay;
|
|
4129
|
+
/**
|
|
4130
|
+
* Render delete confirmation content
|
|
3933
4131
|
*/
|
|
3934
4132
|
private renderDeleteConfirmation;
|
|
3935
4133
|
/**
|
|
3936
|
-
* Render a payment method item
|
|
4134
|
+
* Render a payment method item with appropriate animations
|
|
3937
4135
|
*/
|
|
3938
4136
|
private renderPaymentMethodItem;
|
|
4137
|
+
/**
|
|
4138
|
+
* Render the payment method list with submit button
|
|
4139
|
+
*/
|
|
4140
|
+
private renderPaymentMethodList;
|
|
4141
|
+
/**
|
|
4142
|
+
* Main render method
|
|
4143
|
+
*/
|
|
3939
4144
|
render(): typeof nothing | TemplateResult<1>;
|
|
3940
4145
|
}
|
|
3941
4146
|
/**
|
|
@@ -3943,6 +4148,7 @@ declare class VaultManagerComponent extends LitElement {
|
|
|
3943
4148
|
* Uses the VaultManagerController for display formatting
|
|
3944
4149
|
* Now supports selection via the simplified button checked state
|
|
3945
4150
|
* Enhanced with smooth transitions between edit and payment modes
|
|
4151
|
+
* Always renders the primer-button for consistent UI and improved accessibility
|
|
3946
4152
|
*/
|
|
3947
4153
|
declare class VaultPaymentMethodItemComponent extends LitElement {
|
|
3948
4154
|
static styles: CSSResult[];
|
|
@@ -4215,16 +4421,10 @@ declare global {
|
|
|
4215
4421
|
*/
|
|
4216
4422
|
declare class ShowOtherPaymentsComponent extends LitElement {
|
|
4217
4423
|
static styles: CSSResult[];
|
|
4218
|
-
private isShowingOtherPayments;
|
|
4219
4424
|
/**
|
|
4220
4425
|
* Consume the vault manager context to interact with vault state
|
|
4221
4426
|
*/
|
|
4222
4427
|
vaultManager: VaultManagerContext;
|
|
4223
|
-
/**
|
|
4224
|
-
* Handle expanded state change events from the collapsable component
|
|
4225
|
-
* Syncs the collapsable UI state with the vault manager state
|
|
4226
|
-
*/
|
|
4227
|
-
private handleExpandedChanged;
|
|
4228
4428
|
render(): typeof nothing | TemplateResult<1>;
|
|
4229
4429
|
}
|
|
4230
4430
|
declare global {
|
|
@@ -4291,11 +4491,14 @@ declare global {
|
|
|
4291
4491
|
}
|
|
4292
4492
|
|
|
4293
4493
|
export {
|
|
4494
|
+
AchPaymentComponent as AchPayment,
|
|
4294
4495
|
ButtonComponent as Button,
|
|
4295
4496
|
CardFormComponent as CardForm,
|
|
4296
4497
|
CardFormSubmitComponent as CardFormSubmit,
|
|
4297
4498
|
CardNetworkSelectorComponent as CardFormCardNetworkSelector,
|
|
4298
4499
|
CollapsableComponent as Collapsable,
|
|
4500
|
+
DialogComponent as Dialog,
|
|
4501
|
+
DynamicPaymentComponent as DynamicPayment,
|
|
4299
4502
|
ErrorMessageComponent as ErrorMessage,
|
|
4300
4503
|
ErrorMessageContainerComponent as ErrorMessageContainer,
|
|
4301
4504
|
InputCardExpiryComponent as CardFormExpiry,
|
|
@@ -4308,6 +4511,7 @@ export {
|
|
|
4308
4511
|
InputWrapperComponent as InputWrapper,
|
|
4309
4512
|
NativePaymentComponent as NativePayment,
|
|
4310
4513
|
PaymentMethodComponent as PaymentMethod,
|
|
4514
|
+
PortalComponent as Portal,
|
|
4311
4515
|
PrimerCheckoutCompleteComponent as PrimerCheckoutComplete,
|
|
4312
4516
|
PrimerCheckoutErrorComponent as PrimerCheckoutFailure,
|
|
4313
4517
|
PrimerCheckoutStateComponent as PrimerCheckoutState,
|