@primer-io/primer-js 0.14.1 → 1.0.0
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/CHANGELOG.md +21 -0
- package/dist/custom-elements.json +517 -635
- package/dist/jsx/index.d.ts +21 -21
- package/dist/primer-loader.d.ts +102 -154
- package/dist/primer-loader.js +11 -11
- package/dist/vscode.html-custom-data.json +14 -14
- package/dist/web-types.json +53 -53
- package/package.json +1 -1
package/dist/jsx/index.d.ts
CHANGED
|
@@ -320,6 +320,19 @@ export type BillingAddressComponentProps = {
|
|
|
320
320
|
"onprimer-billing-address-submit"?: (e: CustomEvent<CustomEvent>) => void;
|
|
321
321
|
};
|
|
322
322
|
|
|
323
|
+
export type BlikComponentProps = {
|
|
324
|
+
/** Payment method configuration */
|
|
325
|
+
paymentMethod?: InitializedPaymentMethod;
|
|
326
|
+
/** Disables component interaction when true */
|
|
327
|
+
disabled?: boolean;
|
|
328
|
+
/** */
|
|
329
|
+
paymentManagers?: InitializedManagersMap;
|
|
330
|
+
/** Dispatched on successful payment */
|
|
331
|
+
"onprimer-payment-success"?: (e: CustomEvent<never>) => void;
|
|
332
|
+
/** Dispatched on payment error */
|
|
333
|
+
"onprimer-payment-error"?: (e: CustomEvent<never>) => void;
|
|
334
|
+
};
|
|
335
|
+
|
|
323
336
|
export type CardFormComponentProps = {
|
|
324
337
|
/** */
|
|
325
338
|
"hide-labels"?: boolean;
|
|
@@ -343,19 +356,6 @@ Uses client configuration with fallback to default (false) */
|
|
|
343
356
|
shouldRequireCardholderName?: boolean;
|
|
344
357
|
};
|
|
345
358
|
|
|
346
|
-
export type BlikComponentProps = {
|
|
347
|
-
/** Payment method configuration */
|
|
348
|
-
paymentMethod?: InitializedPaymentMethod;
|
|
349
|
-
/** Disables component interaction when true */
|
|
350
|
-
disabled?: boolean;
|
|
351
|
-
/** */
|
|
352
|
-
paymentManagers?: InitializedManagersMap;
|
|
353
|
-
/** Dispatched on successful payment */
|
|
354
|
-
"onprimer-payment-success"?: (e: CustomEvent<never>) => void;
|
|
355
|
-
/** Dispatched on payment error */
|
|
356
|
-
"onprimer-payment-error"?: (e: CustomEvent<never>) => void;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
359
|
export type DynamicPaymentComponentProps = {
|
|
360
360
|
/** */
|
|
361
361
|
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
@@ -961,14 +961,6 @@ export type CustomElements = {
|
|
|
961
961
|
*/
|
|
962
962
|
"primer-billing-address": Partial<BillingAddressComponentProps & BaseProps & BaseEvents>;
|
|
963
963
|
|
|
964
|
-
/**
|
|
965
|
-
* CardFormComponent serves as a container for card input components.
|
|
966
|
-
* It handles form submission, validation, and provides context to child components.
|
|
967
|
-
* ---
|
|
968
|
-
*
|
|
969
|
-
*/
|
|
970
|
-
"primer-card-form": Partial<CardFormComponentProps & BaseProps & BaseEvents>;
|
|
971
|
-
|
|
972
964
|
/**
|
|
973
965
|
* BLIK Payment Component
|
|
974
966
|
*
|
|
@@ -983,6 +975,14 @@ export type CustomElements = {
|
|
|
983
975
|
*/
|
|
984
976
|
"primer-blik": Partial<BlikComponentProps & BaseProps & BaseEvents>;
|
|
985
977
|
|
|
978
|
+
/**
|
|
979
|
+
* CardFormComponent serves as a container for card input components.
|
|
980
|
+
* It handles form submission, validation, and provides context to child components.
|
|
981
|
+
* ---
|
|
982
|
+
*
|
|
983
|
+
*/
|
|
984
|
+
"primer-card-form": Partial<CardFormComponentProps & BaseProps & BaseEvents>;
|
|
985
|
+
|
|
986
986
|
/**
|
|
987
987
|
*
|
|
988
988
|
* ---
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -810,6 +810,24 @@ export interface CardNetworkChangeEvent {
|
|
|
810
810
|
};
|
|
811
811
|
source: "REMOTE" | "LOCAL" | "LOCAL_FALLBACK";
|
|
812
812
|
}
|
|
813
|
+
export interface BinDataDetails extends CardNetworkDetails {
|
|
814
|
+
issuerCountryCode?: string;
|
|
815
|
+
issuerName?: string;
|
|
816
|
+
accountFundingType?: string;
|
|
817
|
+
prepaidReloadableIndicator?: string;
|
|
818
|
+
productUsageType?: string;
|
|
819
|
+
productCode?: string;
|
|
820
|
+
productName?: string;
|
|
821
|
+
issuerCurrencyCode?: string;
|
|
822
|
+
regionalRestriction?: string;
|
|
823
|
+
accountNumberType?: string;
|
|
824
|
+
}
|
|
825
|
+
export interface BinDataAvailableEvent {
|
|
826
|
+
preferred?: BinDataDetails;
|
|
827
|
+
alternatives: BinDataDetails[];
|
|
828
|
+
status: "complete" | "partial";
|
|
829
|
+
firstDigits?: string;
|
|
830
|
+
}
|
|
813
831
|
export interface CardPaymentMethodSubmitValues {
|
|
814
832
|
cardNetwork?: string;
|
|
815
833
|
}
|
|
@@ -1124,6 +1142,8 @@ export interface HeadlessSDKUtilities {
|
|
|
1124
1142
|
setBillingAddress(address: NullableAddress): Promise<void>;
|
|
1125
1143
|
}
|
|
1126
1144
|
export interface CardPaymentMethodManagerOptions {
|
|
1145
|
+
onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
|
|
1146
|
+
onBinDataLoadingChange?: (loading: boolean) => void;
|
|
1127
1147
|
onCardMetadataChange?: (metadata: {
|
|
1128
1148
|
type: CardNetworkType | null;
|
|
1129
1149
|
possibleTypes: string[];
|
|
@@ -1907,72 +1927,6 @@ export interface AssetsConfig {
|
|
|
1907
1927
|
name: string;
|
|
1908
1928
|
iconUrl: string;
|
|
1909
1929
|
}
|
|
1910
|
-
export declare class InitializedPayments {
|
|
1911
|
-
private readonly _methods;
|
|
1912
|
-
constructor(map: InitializedPaymentMethodMap);
|
|
1913
|
-
get<T extends RedirectPaymentMethodTypes>(type: T): RedirectPaymentMethod | undefined;
|
|
1914
|
-
get<T extends (typeof PaymentMethodType)[keyof typeof PaymentMethodType]>(type: T): PaymentMethodByType<T> | undefined;
|
|
1915
|
-
toArray(): InitializedPaymentMethod[];
|
|
1916
|
-
size(): number;
|
|
1917
|
-
}
|
|
1918
|
-
/**
|
|
1919
|
-
* Map of vaulted payment method ID to vaulted payment method summary
|
|
1920
|
-
*/
|
|
1921
|
-
export type VaultedPaymentMethodsMap = Map<string, VaultedPaymentMethodSummary>;
|
|
1922
|
-
/**
|
|
1923
|
-
* Wrapper class for vaulted payment methods that provides type-safe access
|
|
1924
|
-
* to filtered vaulted payment method data.
|
|
1925
|
-
*
|
|
1926
|
-
* This class mirrors the structure of InitializedPayments but for vault data,
|
|
1927
|
-
* providing a consistent API for merchants to access vaulted payment methods
|
|
1928
|
-
* through events and callbacks.
|
|
1929
|
-
*
|
|
1930
|
-
* @example
|
|
1931
|
-
* ```typescript
|
|
1932
|
-
* // Access via callback
|
|
1933
|
-
* primerJS.onVaultedMethodsUpdate = (data) => {
|
|
1934
|
-
* console.log('Vault size:', data.size());
|
|
1935
|
-
*
|
|
1936
|
-
* // Get specific method by ID
|
|
1937
|
-
* const method = data.get('pm_abc123');
|
|
1938
|
-
* if (method) {
|
|
1939
|
-
* console.log('Last 4:', method.paymentInstrumentData?.last4Digits);
|
|
1940
|
-
* }
|
|
1941
|
-
*
|
|
1942
|
-
* // Get all methods
|
|
1943
|
-
* const allMethods = data.toArray();
|
|
1944
|
-
* allMethods.forEach(method => {
|
|
1945
|
-
* console.log(method.paymentMethodType);
|
|
1946
|
-
* });
|
|
1947
|
-
* };
|
|
1948
|
-
* ```
|
|
1949
|
-
*/
|
|
1950
|
-
export declare class InitializedVaultedPayments {
|
|
1951
|
-
private readonly _methods;
|
|
1952
|
-
/**
|
|
1953
|
-
* @param map - Map of vaulted payment method IDs to summaries
|
|
1954
|
-
*/
|
|
1955
|
-
constructor(map: VaultedPaymentMethodsMap);
|
|
1956
|
-
/**
|
|
1957
|
-
* Get a vaulted payment method by its ID
|
|
1958
|
-
*
|
|
1959
|
-
* @param id - Payment method ID
|
|
1960
|
-
* @returns Vaulted payment method summary if found, undefined otherwise
|
|
1961
|
-
*/
|
|
1962
|
-
get(id: string): VaultedPaymentMethodSummary | undefined;
|
|
1963
|
-
/**
|
|
1964
|
-
* Get all vaulted payment methods as an array
|
|
1965
|
-
*
|
|
1966
|
-
* @returns Array of all vaulted payment method summaries
|
|
1967
|
-
*/
|
|
1968
|
-
toArray(): VaultedPaymentMethodSummary[];
|
|
1969
|
-
/**
|
|
1970
|
-
* Get the count of vaulted payment methods
|
|
1971
|
-
*
|
|
1972
|
-
* @returns Number of vaulted payment methods
|
|
1973
|
-
*/
|
|
1974
|
-
size(): number;
|
|
1975
|
-
}
|
|
1976
1930
|
export type ReducerCallbacks<State, _Action extends {
|
|
1977
1931
|
type: string;
|
|
1978
1932
|
}> = {
|
|
@@ -2070,9 +2024,9 @@ declare class VaultManagerController extends CompositeStateController<PrimerChec
|
|
|
2070
2024
|
* Applies PII filtering to all vaulted payment methods.
|
|
2071
2025
|
*
|
|
2072
2026
|
* @param vaultedPaymentMethods - Raw vaulted payment methods from API
|
|
2073
|
-
* @returns
|
|
2027
|
+
* @returns Array of filtered vaulted payment method summaries
|
|
2074
2028
|
*/
|
|
2075
|
-
private
|
|
2029
|
+
private createVaultedPaymentsArray;
|
|
2076
2030
|
/**
|
|
2077
2031
|
* Update vaulted payment methods and dispatch events/callbacks.
|
|
2078
2032
|
* This method:
|
|
@@ -2166,8 +2120,8 @@ export interface PaymentFailureData {
|
|
|
2166
2120
|
* Includes filtered vaulted payment methods with minimal PII exposure.
|
|
2167
2121
|
*/
|
|
2168
2122
|
export interface VaultedMethodsUpdateData {
|
|
2169
|
-
/**
|
|
2170
|
-
vaultedPayments:
|
|
2123
|
+
/** Array of filtered vaulted payment method summaries */
|
|
2124
|
+
vaultedPayments: VaultedPaymentMethodSummary[];
|
|
2171
2125
|
/** Indicates if CVV recapture is required for vaulted payments */
|
|
2172
2126
|
cvvRecapture: boolean;
|
|
2173
2127
|
/** Unix timestamp in seconds */
|
|
@@ -2229,51 +2183,42 @@ export declare class PrimerJS {
|
|
|
2229
2183
|
*/
|
|
2230
2184
|
readonly vault: VaultAPI;
|
|
2231
2185
|
/**
|
|
2232
|
-
*
|
|
2233
|
-
* Use for analytics tracking or UI updates (e.g., disable form).
|
|
2186
|
+
* @deprecated Use the `primer:payment-start` event instead.
|
|
2234
2187
|
*
|
|
2235
|
-
*
|
|
2188
|
+
* Listen to the event on the checkout element:
|
|
2236
2189
|
* ```typescript
|
|
2237
|
-
*
|
|
2190
|
+
* checkout.addEventListener('primer:payment-start', (e) => {
|
|
2238
2191
|
* analytics.track('payment_started');
|
|
2239
2192
|
* disablePaymentForm();
|
|
2240
|
-
* };
|
|
2193
|
+
* });
|
|
2241
2194
|
* ```
|
|
2242
2195
|
*/
|
|
2243
2196
|
onPaymentStart?: () => void;
|
|
2244
2197
|
/**
|
|
2245
|
-
*
|
|
2246
|
-
* Use for last-chance validation or conditional payment creation.
|
|
2198
|
+
* @deprecated Use the `primer:payment-start` event instead.
|
|
2247
2199
|
*
|
|
2248
|
-
*
|
|
2249
|
-
* @param handler - Control flow handler (continue or abort)
|
|
2250
|
-
*
|
|
2251
|
-
* @example
|
|
2200
|
+
* Listen to the event on the checkout element:
|
|
2252
2201
|
* ```typescript
|
|
2253
|
-
*
|
|
2254
|
-
*
|
|
2255
|
-
*
|
|
2202
|
+
* checkout.addEventListener('primer:payment-start', (e) => {
|
|
2203
|
+
* const { paymentMethodType, abortPaymentCreation, continuePaymentCreation } = e.detail;
|
|
2204
|
+
*
|
|
2205
|
+
* if (!validateBusinessRules(paymentMethodType)) {
|
|
2206
|
+
* abortPaymentCreation();
|
|
2256
2207
|
* return;
|
|
2257
2208
|
* }
|
|
2258
|
-
*
|
|
2259
|
-
* };
|
|
2209
|
+
* continuePaymentCreation({ idempotencyKey: 'optional-key' });
|
|
2210
|
+
* });
|
|
2260
2211
|
* ```
|
|
2261
2212
|
*/
|
|
2262
2213
|
onPaymentPrepare?: (data: PaymentData, handler: PrepareHandler) => void;
|
|
2263
2214
|
/**
|
|
2264
|
-
*
|
|
2265
|
-
* Receives minimal payment summary with reduced PII exposure.
|
|
2215
|
+
* @deprecated Use the `primer:payment-success` event instead.
|
|
2266
2216
|
*
|
|
2267
|
-
*
|
|
2268
|
-
* - Order confirmation and backend sync
|
|
2269
|
-
* - Receipt generation
|
|
2270
|
-
* - Payment processing with minimal PII exposure
|
|
2271
|
-
*
|
|
2272
|
-
* @param data - Payment success data with PaymentSummary (ID, orderId, last4, brand)
|
|
2273
|
-
*
|
|
2274
|
-
* @example
|
|
2217
|
+
* Listen to the event on the checkout element:
|
|
2275
2218
|
* ```typescript
|
|
2276
|
-
*
|
|
2219
|
+
* checkout.addEventListener('primer:payment-success', (e) => {
|
|
2220
|
+
* const { payment, paymentMethodType } = e.detail;
|
|
2221
|
+
*
|
|
2277
2222
|
* // Update backend
|
|
2278
2223
|
* await fetch(`/api/orders/${payment.orderId}/complete`, {
|
|
2279
2224
|
* method: 'POST',
|
|
@@ -2282,24 +2227,17 @@ export declare class PrimerJS {
|
|
|
2282
2227
|
*
|
|
2283
2228
|
* // Redirect to success page
|
|
2284
2229
|
* window.location.href = `/order-success?id=${payment.orderId}`;
|
|
2285
|
-
* };
|
|
2230
|
+
* });
|
|
2286
2231
|
* ```
|
|
2287
2232
|
*/
|
|
2288
2233
|
onPaymentSuccess?: (data: PaymentSuccessData) => void;
|
|
2289
2234
|
/**
|
|
2290
|
-
*
|
|
2291
|
-
* Receives error details and optional payment summary if created before failure.
|
|
2292
|
-
*
|
|
2293
|
-
* Use for:
|
|
2294
|
-
* - Error handling and user messaging
|
|
2295
|
-
* - Support ticket creation with diagnosticsId
|
|
2296
|
-
* - Retry logic for specific error types
|
|
2235
|
+
* @deprecated Use the `primer:payment-failure` event instead.
|
|
2297
2236
|
*
|
|
2298
|
-
*
|
|
2299
|
-
*
|
|
2300
|
-
* @example
|
|
2237
|
+
* Listen to the event on the checkout element:
|
|
2301
2238
|
* ```typescript
|
|
2302
|
-
*
|
|
2239
|
+
* checkout.addEventListener('primer:payment-failure', (e) => {
|
|
2240
|
+
* const { error, payment } = e.detail;
|
|
2303
2241
|
* console.error('Payment failed:', error.code, error.message);
|
|
2304
2242
|
*
|
|
2305
2243
|
* // Log to error tracking
|
|
@@ -2312,30 +2250,21 @@ export declare class PrimerJS {
|
|
|
2312
2250
|
*
|
|
2313
2251
|
* // Show user-friendly message
|
|
2314
2252
|
* showErrorMessage(error.message);
|
|
2315
|
-
* };
|
|
2253
|
+
* });
|
|
2316
2254
|
* ```
|
|
2317
2255
|
*/
|
|
2318
2256
|
onPaymentFailure?: (data: PaymentFailureData) => void;
|
|
2319
2257
|
/**
|
|
2320
|
-
*
|
|
2321
|
-
* Receives filtered vaulted payment method data with minimal PII exposure.
|
|
2322
|
-
*
|
|
2323
|
-
* Use for:
|
|
2324
|
-
* - Building custom vault UI
|
|
2325
|
-
* - Determining if CVV recapture is required (check cvvRecapture flag)
|
|
2326
|
-
* - Analytics tracking for vault usage
|
|
2327
|
-
* - Syncing vault state with backend
|
|
2328
|
-
*
|
|
2329
|
-
* @param data - Vault methods update data with filtered payment methods and cvvRecapture flag
|
|
2258
|
+
* @deprecated Use the `primer:vault-methods-update` event instead.
|
|
2330
2259
|
*
|
|
2331
|
-
*
|
|
2260
|
+
* Listen to the event on the checkout element:
|
|
2332
2261
|
* ```typescript
|
|
2333
|
-
*
|
|
2334
|
-
*
|
|
2262
|
+
* checkout.addEventListener('primer:vault-methods-update', (e) => {
|
|
2263
|
+
* const { vaultedPayments } = e.detail;
|
|
2264
|
+
* console.log(`Vault contains ${vaultedPayments.length} methods`);
|
|
2335
2265
|
*
|
|
2336
2266
|
* // Display in custom UI
|
|
2337
|
-
*
|
|
2338
|
-
* methods.forEach(method => {
|
|
2267
|
+
* vaultedPayments.forEach(method => {
|
|
2339
2268
|
* displayVaultedMethod({
|
|
2340
2269
|
* id: method.id,
|
|
2341
2270
|
* type: method.paymentMethodType,
|
|
@@ -2343,7 +2272,7 @@ export declare class PrimerJS {
|
|
|
2343
2272
|
* network: method.paymentInstrumentData?.network,
|
|
2344
2273
|
* });
|
|
2345
2274
|
* });
|
|
2346
|
-
* };
|
|
2275
|
+
* });
|
|
2347
2276
|
* ```
|
|
2348
2277
|
*/
|
|
2349
2278
|
onVaultedMethodsUpdate?: (data: VaultedMethodsUpdateData) => void;
|
|
@@ -2352,7 +2281,7 @@ export declare class PrimerJS {
|
|
|
2352
2281
|
* Set the initialized payment methods
|
|
2353
2282
|
* @internal - This is only used internally by the SDK
|
|
2354
2283
|
*/
|
|
2355
|
-
setPaymentMethods(methods:
|
|
2284
|
+
setPaymentMethods(methods: InitializedPaymentMethod[]): void;
|
|
2356
2285
|
/**
|
|
2357
2286
|
* Set the initialized payment managers
|
|
2358
2287
|
* @internal - This is only used internally by the SDK
|
|
@@ -2416,23 +2345,11 @@ export declare class PrimerJS {
|
|
|
2416
2345
|
* @internal - This is only used internally by the SDK
|
|
2417
2346
|
*/
|
|
2418
2347
|
handlePaymentStart(): void;
|
|
2419
|
-
/**
|
|
2420
|
-
* Internal method to handle the onBeforePaymentCreate callback and transform it to onPaymentPrepare
|
|
2421
|
-
* @internal - This is only used internally by the SDK
|
|
2422
|
-
*/
|
|
2423
|
-
handleBeforePaymentCreate(data: {
|
|
2424
|
-
paymentMethodType: PaymentMethodType;
|
|
2425
|
-
}, originalHandler: {
|
|
2426
|
-
continuePaymentCreation: (data?: {
|
|
2427
|
-
idempotencyKey?: string;
|
|
2428
|
-
}) => void;
|
|
2429
|
-
abortPaymentCreation: () => void;
|
|
2430
|
-
}): void;
|
|
2431
2348
|
/**
|
|
2432
2349
|
* Internal method to handle the onVaultedMethodsUpdate callback
|
|
2433
2350
|
* @internal - This is only used internally by the SDK
|
|
2434
2351
|
*/
|
|
2435
|
-
handleVaultedMethodsUpdate(vaultedPayments:
|
|
2352
|
+
handleVaultedMethodsUpdate(vaultedPayments: VaultedPaymentMethodSummary[], cvvRecapture: boolean): void;
|
|
2436
2353
|
/**
|
|
2437
2354
|
* Sets the cardholder name value in the card payment form.
|
|
2438
2355
|
*
|
|
@@ -2483,19 +2400,32 @@ export interface ShowOtherPaymentsToggledPayload {
|
|
|
2483
2400
|
}
|
|
2484
2401
|
export interface PrimerEvents {
|
|
2485
2402
|
"primer:state-change": CustomEvent<SdkStateContextType>;
|
|
2486
|
-
"primer:methods-update": CustomEvent<
|
|
2403
|
+
"primer:methods-update": CustomEvent<InitializedPaymentMethod[]>;
|
|
2487
2404
|
"primer:ready": CustomEvent<PrimerJS>;
|
|
2488
2405
|
"primer:card-network-change": CustomEvent<CardNetworksContextType>;
|
|
2406
|
+
"primer:bin-data-loading-change": CustomEvent<{
|
|
2407
|
+
loading: boolean;
|
|
2408
|
+
}>;
|
|
2409
|
+
"primer:bin-data-available": CustomEvent<BinDataAvailableEvent>;
|
|
2489
2410
|
"primer:card-submit": CustomEvent<CardSubmitPayload>;
|
|
2490
2411
|
"primer:card-success": CustomEvent<CardSubmitSuccessPayload>;
|
|
2491
2412
|
"primer:card-error": CustomEvent<CardSubmitErrorsPayload>;
|
|
2413
|
+
"primer:dialog-open": CustomEvent;
|
|
2414
|
+
"primer:dialog-close": CustomEvent;
|
|
2492
2415
|
"primer-ach-error": CustomEvent<PrimeAchErrorPayload>;
|
|
2493
2416
|
"primer-ach-bank-details-collected": CustomEvent;
|
|
2494
2417
|
"primer-ach-mandate-confirmed": CustomEvent;
|
|
2495
2418
|
"primer-ach-mandate-declined": CustomEvent;
|
|
2496
|
-
"primer:payment-start": CustomEvent<
|
|
2419
|
+
"primer:payment-start": CustomEvent<{
|
|
2420
|
+
paymentMethodType: PaymentMethodType;
|
|
2421
|
+
abortPaymentCreation: () => void;
|
|
2422
|
+
continuePaymentCreation: (data?: {
|
|
2423
|
+
idempotencyKey?: string;
|
|
2424
|
+
}) => void;
|
|
2425
|
+
timestamp: number;
|
|
2426
|
+
}>;
|
|
2497
2427
|
"primer:payment-success": CustomEvent<{
|
|
2498
|
-
|
|
2428
|
+
payment: PaymentSummary;
|
|
2499
2429
|
paymentMethodType?: PaymentMethodType;
|
|
2500
2430
|
timestamp: number;
|
|
2501
2431
|
}>;
|
|
@@ -2506,15 +2436,20 @@ export interface PrimerEvents {
|
|
|
2506
2436
|
diagnosticsId?: string;
|
|
2507
2437
|
data?: Record<string, unknown>;
|
|
2508
2438
|
};
|
|
2509
|
-
|
|
2439
|
+
payment?: PaymentSummary;
|
|
2510
2440
|
paymentMethodType?: PaymentMethodType;
|
|
2511
2441
|
timestamp: number;
|
|
2512
2442
|
}>;
|
|
2513
|
-
"primer:
|
|
2514
|
-
|
|
2443
|
+
"primer:payment-cancel": CustomEvent<{
|
|
2444
|
+
paymentMethodType: PaymentMethodType | null;
|
|
2445
|
+
timestamp: number;
|
|
2446
|
+
}>;
|
|
2447
|
+
"primer:vault-methods-update": CustomEvent<{
|
|
2448
|
+
vaultedPayments: VaultedPaymentMethodSummary[];
|
|
2449
|
+
cvvRecapture: boolean;
|
|
2515
2450
|
timestamp: number;
|
|
2516
2451
|
}>;
|
|
2517
|
-
"primer:vault
|
|
2452
|
+
"primer:vault-selection-change": CustomEvent<{
|
|
2518
2453
|
paymentMethodId: string | null;
|
|
2519
2454
|
timestamp: number;
|
|
2520
2455
|
}>;
|
|
@@ -2535,12 +2470,17 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2535
2470
|
*/
|
|
2536
2471
|
dispatchEvent<K extends keyof PrimerEvents>(type: K, detail: PrimerEvents[K]["detail"]): void;
|
|
2537
2472
|
dispatchSdkState(sdkState: SdkStateContextType): void;
|
|
2538
|
-
dispatchPaymentMethods(paymentMethods:
|
|
2473
|
+
dispatchPaymentMethods(paymentMethods: InitializedPaymentMethod[]): void;
|
|
2539
2474
|
dispatchCheckoutInitialized(checkoutInstance: PrimerJS): void;
|
|
2540
2475
|
dispatchCardNetworkChange(network: CardNetworksContextType): void;
|
|
2476
|
+
dispatchBinDataAvailable(data: BinDataAvailableEvent): void;
|
|
2477
|
+
dispatchBinDataLoadingChange(loading: boolean): void;
|
|
2541
2478
|
dispatchCardSubmit(source?: string): void;
|
|
2542
2479
|
dispatchFormSubmitSuccess(result: CardSubmitResult): void;
|
|
2543
2480
|
dispatchFormSubmitErrors(errors: InputValidationError[]): void;
|
|
2481
|
+
dispatchPaymentCancel(data: {
|
|
2482
|
+
paymentMethodType: PaymentMethodType | null;
|
|
2483
|
+
}): void;
|
|
2544
2484
|
/**
|
|
2545
2485
|
* Handle external card submit events and forward them through the event system.
|
|
2546
2486
|
* This method provides a centralized way to process external card submission events
|
|
@@ -2551,9 +2491,15 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2551
2491
|
handleExternalCardSubmit(eventDetails: CardSubmitPayload): void;
|
|
2552
2492
|
/**
|
|
2553
2493
|
* Dispatch payment start event.
|
|
2554
|
-
* Called when payment flow begins.
|
|
2494
|
+
* Called when payment flow begins, before payment creation.
|
|
2495
|
+
*
|
|
2496
|
+
* Event detail includes handlers to control the payment flow:
|
|
2497
|
+
* - abortPaymentCreation: Call to abort the payment
|
|
2498
|
+
* - continuePaymentCreation: Call to continue (optionally with idempotencyKey)
|
|
2499
|
+
*
|
|
2500
|
+
* @returns true if an event listener called a handler, false otherwise
|
|
2555
2501
|
*/
|
|
2556
|
-
dispatchPaymentStart():
|
|
2502
|
+
dispatchPaymentStart(paymentMethodType: PaymentMethodType, handler: PrepareHandler): boolean;
|
|
2557
2503
|
/**
|
|
2558
2504
|
* Dispatch payment success event with minimal payment summary.
|
|
2559
2505
|
* Called when payment completes successfully.
|
|
@@ -2573,9 +2519,10 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2573
2519
|
* Dispatch vault methods update event.
|
|
2574
2520
|
* Called when vaulted payment methods are loaded or updated.
|
|
2575
2521
|
*
|
|
2576
|
-
* @param vaultedPayments -
|
|
2522
|
+
* @param vaultedPayments - Array of filtered vaulted payment method summaries
|
|
2523
|
+
* @param cvvRecapture - Whether CVV recapture is required for vaulted payments
|
|
2577
2524
|
*/
|
|
2578
|
-
dispatchVaultMethodsUpdate(vaultedPayments:
|
|
2525
|
+
dispatchVaultMethodsUpdate(vaultedPayments: VaultedPaymentMethodSummary[], cvvRecapture: boolean): void;
|
|
2579
2526
|
/**
|
|
2580
2527
|
* Dispatch vault selection change event.
|
|
2581
2528
|
* Called when a vaulted payment method is selected or deselected.
|
|
@@ -2662,7 +2609,7 @@ declare class SDKContextController implements ReactiveController {
|
|
|
2662
2609
|
* Updates the payment methods context.
|
|
2663
2610
|
* @param value The new payment methods data.
|
|
2664
2611
|
*/
|
|
2665
|
-
setPaymentMethods(value:
|
|
2612
|
+
setPaymentMethods(value: InitializedPaymentMethod[]): void;
|
|
2666
2613
|
/**
|
|
2667
2614
|
* Updates the payment manager context.
|
|
2668
2615
|
* @param value The new payment manager mapping.
|
|
@@ -2766,6 +2713,7 @@ declare class CardNetworkController implements ReactiveController {
|
|
|
2766
2713
|
* @param event - The card network change event
|
|
2767
2714
|
*/
|
|
2768
2715
|
processCardNetworkChangeEvent(event: CardNetworkChangeEvent): void;
|
|
2716
|
+
processBinDataAvailableEvent(event: BinDataAvailableEvent): void;
|
|
2769
2717
|
}
|
|
2770
2718
|
declare class StyleProcessingController implements ReactiveController {
|
|
2771
2719
|
host: ReactiveControllerHost & LitElement;
|
|
@@ -3603,7 +3551,7 @@ declare global {
|
|
|
3603
3551
|
"primer-klarna": PrimerKlarnaComponent;
|
|
3604
3552
|
}
|
|
3605
3553
|
}
|
|
3606
|
-
export type PaymentMethodsContextType =
|
|
3554
|
+
export type PaymentMethodsContextType = InitializedPaymentMethod[] | null;
|
|
3607
3555
|
/**
|
|
3608
3556
|
* Google Pay component with shadow root rendering for full-width button support.
|
|
3609
3557
|
*
|