@primer-io/primer-js 0.15.0 → 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 +11 -0
- package/dist/custom-elements.json +1123 -1292
- package/dist/jsx/index.d.ts +45 -45
- package/dist/primer-loader.d.ts +75 -154
- package/dist/primer-loader.js +10 -10
- package/dist/vscode.html-custom-data.json +19 -19
- package/dist/web-types.json +51 -51
- package/package.json +1 -1
package/dist/jsx/index.d.ts
CHANGED
|
@@ -125,18 +125,6 @@ export type PrimerCheckoutStateComponentProps = {
|
|
|
125
125
|
description?: string | undefined;
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
export type DialogComponentProps = {
|
|
129
|
-
/** */
|
|
130
|
-
size?: "flex" | "large";
|
|
131
|
-
/** */
|
|
132
|
-
showCloseButton?: boolean;
|
|
133
|
-
|
|
134
|
-
/** */
|
|
135
|
-
"onprimer:dialog-open"?: (e: CustomEvent<CustomEvent>) => void;
|
|
136
|
-
/** */
|
|
137
|
-
"onprimer:dialog-close"?: (e: CustomEvent<CustomEvent>) => void;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
128
|
export type CollapsableComponentProps = {
|
|
141
129
|
/** The header text for the collapsable */
|
|
142
130
|
header?: string;
|
|
@@ -156,6 +144,18 @@ export type CollapsableComponentProps = {
|
|
|
156
144
|
"onexpanded-changed"?: (e: CustomEvent<CustomEvent>) => void;
|
|
157
145
|
};
|
|
158
146
|
|
|
147
|
+
export type DialogComponentProps = {
|
|
148
|
+
/** */
|
|
149
|
+
size?: "flex" | "large";
|
|
150
|
+
/** */
|
|
151
|
+
showCloseButton?: boolean;
|
|
152
|
+
|
|
153
|
+
/** */
|
|
154
|
+
"onprimer:dialog-open"?: (e: CustomEvent<CustomEvent>) => void;
|
|
155
|
+
/** */
|
|
156
|
+
"onprimer:dialog-close"?: (e: CustomEvent<CustomEvent>) => void;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
159
|
export type ErrorMessageComponentProps = {
|
|
160
160
|
/** The error message text to display */
|
|
161
161
|
message?: string;
|
|
@@ -564,7 +564,7 @@ Falls back to localized default if not explicitly set. */
|
|
|
564
564
|
cardFormContext?: CardFormContext | null;
|
|
565
565
|
};
|
|
566
566
|
|
|
567
|
-
export type
|
|
567
|
+
export type InputCardNumberComponentProps = {
|
|
568
568
|
/** */
|
|
569
569
|
computedStyles?: CSSStyleDeclaration | null;
|
|
570
570
|
/** The input label text.
|
|
@@ -581,7 +581,7 @@ Falls back to localized default if not explicitly set. */
|
|
|
581
581
|
cardFormContext?: CardFormContext | null;
|
|
582
582
|
};
|
|
583
583
|
|
|
584
|
-
export type
|
|
584
|
+
export type InputCvvComponentProps = {
|
|
585
585
|
/** */
|
|
586
586
|
computedStyles?: CSSStyleDeclaration | null;
|
|
587
587
|
/** The input label text.
|
|
@@ -625,6 +625,11 @@ export type PayPalComponentProps = {
|
|
|
625
625
|
disabled?: boolean;
|
|
626
626
|
};
|
|
627
627
|
|
|
628
|
+
export type PaymentMethodContentComponentProps = {
|
|
629
|
+
/** The asset configuration containing icon and display data */
|
|
630
|
+
assetConfig?: AssetConfig | null;
|
|
631
|
+
};
|
|
632
|
+
|
|
628
633
|
export type VaultCvvInputComponentProps = {
|
|
629
634
|
/** */
|
|
630
635
|
computedStyles?: CSSStyleDeclaration | null;
|
|
@@ -637,11 +642,6 @@ Separated to minimize re-renders on frequent CVV input changes */
|
|
|
637
642
|
vaultManagerCvvContext?: VaultItemContextType;
|
|
638
643
|
};
|
|
639
644
|
|
|
640
|
-
export type PaymentMethodContentComponentProps = {
|
|
641
|
-
/** The asset configuration containing icon and display data */
|
|
642
|
-
assetConfig?: AssetConfig | null;
|
|
643
|
-
};
|
|
644
|
-
|
|
645
645
|
export type VaultDeleteConfirmationComponentProps = {
|
|
646
646
|
/** Whether a delete operation is in progress */
|
|
647
647
|
isDeleting?: boolean;
|
|
@@ -779,33 +779,33 @@ export type CustomElements = {
|
|
|
779
779
|
"primer-checkout-state": Partial<PrimerCheckoutStateComponentProps & BaseProps & BaseEvents>;
|
|
780
780
|
|
|
781
781
|
/**
|
|
782
|
-
*
|
|
782
|
+
* A collapsable component that smoothly expands and collapses content.
|
|
783
|
+
* Uses CSS Grid for smooth animation and incorporates the primary button.
|
|
783
784
|
* ---
|
|
784
785
|
*
|
|
785
786
|
*
|
|
786
787
|
* ### **Events:**
|
|
787
|
-
* - **
|
|
788
|
-
* - **primer:dialog-close**
|
|
788
|
+
* - **expanded-changed**
|
|
789
789
|
*
|
|
790
790
|
* ### **Methods:**
|
|
791
|
-
* - **
|
|
791
|
+
* - **expand(): _void_** - Expand the collapsable programmatically
|
|
792
|
+
* - **collapse(): _void_** - Collapse the collapsable programmatically
|
|
792
793
|
*/
|
|
793
|
-
"primer-
|
|
794
|
+
"primer-collapsable": Partial<CollapsableComponentProps & BaseProps & BaseEvents>;
|
|
794
795
|
|
|
795
796
|
/**
|
|
796
|
-
*
|
|
797
|
-
* Uses CSS Grid for smooth animation and incorporates the primary button.
|
|
797
|
+
*
|
|
798
798
|
* ---
|
|
799
799
|
*
|
|
800
800
|
*
|
|
801
801
|
* ### **Events:**
|
|
802
|
-
* - **
|
|
802
|
+
* - **primer:dialog-open**
|
|
803
|
+
* - **primer:dialog-close**
|
|
803
804
|
*
|
|
804
805
|
* ### **Methods:**
|
|
805
|
-
* - **
|
|
806
|
-
* - **collapse(): _void_** - Collapse the collapsable programmatically
|
|
806
|
+
* - **startExitAnimation(): _void_** - Public method to trigger exit animation programmatically
|
|
807
807
|
*/
|
|
808
|
-
"primer-
|
|
808
|
+
"primer-dialog": Partial<DialogComponentProps & BaseProps & BaseEvents>;
|
|
809
809
|
|
|
810
810
|
/**
|
|
811
811
|
* A reusable atomic error message component that displays error information
|
|
@@ -1148,34 +1148,34 @@ export type CustomElements = {
|
|
|
1148
1148
|
"primer-input-card-holder-name": Partial<InputCardHolderNameComponentProps & BaseProps & BaseEvents>;
|
|
1149
1149
|
|
|
1150
1150
|
/**
|
|
1151
|
-
*
|
|
1151
|
+
* Card number input component with dynamic card network detection and selection
|
|
1152
1152
|
* ---
|
|
1153
1153
|
*
|
|
1154
1154
|
*
|
|
1155
1155
|
* ### **Methods:**
|
|
1156
1156
|
*
|
|
1157
|
+
*
|
|
1157
1158
|
* - **getError(): _string|null_** - Get the error code from the hosted input controller when the input is submitted or touched
|
|
1158
1159
|
*
|
|
1159
1160
|
* Can be used instead of the error returned by the `validate()` method since internally `primer-sdk-web`
|
|
1160
1161
|
* uses the same logic to compute the error code
|
|
1161
|
-
*
|
|
1162
1162
|
*/
|
|
1163
|
-
"primer-input-
|
|
1163
|
+
"primer-input-card-number": Partial<InputCardNumberComponentProps & BaseProps & BaseEvents>;
|
|
1164
1164
|
|
|
1165
1165
|
/**
|
|
1166
|
-
*
|
|
1166
|
+
*
|
|
1167
1167
|
* ---
|
|
1168
1168
|
*
|
|
1169
1169
|
*
|
|
1170
1170
|
* ### **Methods:**
|
|
1171
1171
|
*
|
|
1172
|
-
*
|
|
1173
1172
|
* - **getError(): _string|null_** - Get the error code from the hosted input controller when the input is submitted or touched
|
|
1174
1173
|
*
|
|
1175
1174
|
* Can be used instead of the error returned by the `validate()` method since internally `primer-sdk-web`
|
|
1176
1175
|
* uses the same logic to compute the error code
|
|
1176
|
+
*
|
|
1177
1177
|
*/
|
|
1178
|
-
"primer-input-
|
|
1178
|
+
"primer-input-cvv": Partial<InputCvvComponentProps & BaseProps & BaseEvents>;
|
|
1179
1179
|
|
|
1180
1180
|
/**
|
|
1181
1181
|
* Apple Pay component with standard button container rendering.
|
|
@@ -1216,6 +1216,15 @@ export type CustomElements = {
|
|
|
1216
1216
|
*/
|
|
1217
1217
|
"primer-paypal": Partial<PayPalComponentProps & BaseProps & BaseEvents>;
|
|
1218
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* PaymentMethodContentComponent - renders payment method information with icon and details
|
|
1221
|
+
* This component encapsulates the display logic and styles for payment method content
|
|
1222
|
+
* so it can be reused across different containers without style conflicts
|
|
1223
|
+
* ---
|
|
1224
|
+
*
|
|
1225
|
+
*/
|
|
1226
|
+
"primer-payment-method-content": Partial<PaymentMethodContentComponentProps & BaseProps & BaseEvents>;
|
|
1227
|
+
|
|
1219
1228
|
/**
|
|
1220
1229
|
* CVV Input component for vault payment methods
|
|
1221
1230
|
* Renders a secure iframe for CVV input when required by the selected payment method
|
|
@@ -1228,15 +1237,6 @@ export type CustomElements = {
|
|
|
1228
1237
|
*/
|
|
1229
1238
|
"primer-vault-cvv-input": Partial<VaultCvvInputComponentProps & BaseProps & BaseEvents>;
|
|
1230
1239
|
|
|
1231
|
-
/**
|
|
1232
|
-
* PaymentMethodContentComponent - renders payment method information with icon and details
|
|
1233
|
-
* This component encapsulates the display logic and styles for payment method content
|
|
1234
|
-
* so it can be reused across different containers without style conflicts
|
|
1235
|
-
* ---
|
|
1236
|
-
*
|
|
1237
|
-
*/
|
|
1238
|
-
"primer-payment-method-content": Partial<PaymentMethodContentComponentProps & BaseProps & BaseEvents>;
|
|
1239
|
-
|
|
1240
1240
|
/**
|
|
1241
1241
|
* VaultDeleteConfirmationComponent - displays confirmation UI for deleting a payment method
|
|
1242
1242
|
* ---
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -1927,72 +1927,6 @@ export interface AssetsConfig {
|
|
|
1927
1927
|
name: string;
|
|
1928
1928
|
iconUrl: string;
|
|
1929
1929
|
}
|
|
1930
|
-
export declare class InitializedPayments {
|
|
1931
|
-
private readonly _methods;
|
|
1932
|
-
constructor(map: InitializedPaymentMethodMap);
|
|
1933
|
-
get<T extends RedirectPaymentMethodTypes>(type: T): RedirectPaymentMethod | undefined;
|
|
1934
|
-
get<T extends (typeof PaymentMethodType)[keyof typeof PaymentMethodType]>(type: T): PaymentMethodByType<T> | undefined;
|
|
1935
|
-
toArray(): InitializedPaymentMethod[];
|
|
1936
|
-
size(): number;
|
|
1937
|
-
}
|
|
1938
|
-
/**
|
|
1939
|
-
* Map of vaulted payment method ID to vaulted payment method summary
|
|
1940
|
-
*/
|
|
1941
|
-
export type VaultedPaymentMethodsMap = Map<string, VaultedPaymentMethodSummary>;
|
|
1942
|
-
/**
|
|
1943
|
-
* Wrapper class for vaulted payment methods that provides type-safe access
|
|
1944
|
-
* to filtered vaulted payment method data.
|
|
1945
|
-
*
|
|
1946
|
-
* This class mirrors the structure of InitializedPayments but for vault data,
|
|
1947
|
-
* providing a consistent API for merchants to access vaulted payment methods
|
|
1948
|
-
* through events and callbacks.
|
|
1949
|
-
*
|
|
1950
|
-
* @example
|
|
1951
|
-
* ```typescript
|
|
1952
|
-
* // Access via callback
|
|
1953
|
-
* primerJS.onVaultedMethodsUpdate = (data) => {
|
|
1954
|
-
* console.log('Vault size:', data.size());
|
|
1955
|
-
*
|
|
1956
|
-
* // Get specific method by ID
|
|
1957
|
-
* const method = data.get('pm_abc123');
|
|
1958
|
-
* if (method) {
|
|
1959
|
-
* console.log('Last 4:', method.paymentInstrumentData?.last4Digits);
|
|
1960
|
-
* }
|
|
1961
|
-
*
|
|
1962
|
-
* // Get all methods
|
|
1963
|
-
* const allMethods = data.toArray();
|
|
1964
|
-
* allMethods.forEach(method => {
|
|
1965
|
-
* console.log(method.paymentMethodType);
|
|
1966
|
-
* });
|
|
1967
|
-
* };
|
|
1968
|
-
* ```
|
|
1969
|
-
*/
|
|
1970
|
-
export declare class InitializedVaultedPayments {
|
|
1971
|
-
private readonly _methods;
|
|
1972
|
-
/**
|
|
1973
|
-
* @param map - Map of vaulted payment method IDs to summaries
|
|
1974
|
-
*/
|
|
1975
|
-
constructor(map: VaultedPaymentMethodsMap);
|
|
1976
|
-
/**
|
|
1977
|
-
* Get a vaulted payment method by its ID
|
|
1978
|
-
*
|
|
1979
|
-
* @param id - Payment method ID
|
|
1980
|
-
* @returns Vaulted payment method summary if found, undefined otherwise
|
|
1981
|
-
*/
|
|
1982
|
-
get(id: string): VaultedPaymentMethodSummary | undefined;
|
|
1983
|
-
/**
|
|
1984
|
-
* Get all vaulted payment methods as an array
|
|
1985
|
-
*
|
|
1986
|
-
* @returns Array of all vaulted payment method summaries
|
|
1987
|
-
*/
|
|
1988
|
-
toArray(): VaultedPaymentMethodSummary[];
|
|
1989
|
-
/**
|
|
1990
|
-
* Get the count of vaulted payment methods
|
|
1991
|
-
*
|
|
1992
|
-
* @returns Number of vaulted payment methods
|
|
1993
|
-
*/
|
|
1994
|
-
size(): number;
|
|
1995
|
-
}
|
|
1996
1930
|
export type ReducerCallbacks<State, _Action extends {
|
|
1997
1931
|
type: string;
|
|
1998
1932
|
}> = {
|
|
@@ -2090,9 +2024,9 @@ declare class VaultManagerController extends CompositeStateController<PrimerChec
|
|
|
2090
2024
|
* Applies PII filtering to all vaulted payment methods.
|
|
2091
2025
|
*
|
|
2092
2026
|
* @param vaultedPaymentMethods - Raw vaulted payment methods from API
|
|
2093
|
-
* @returns
|
|
2027
|
+
* @returns Array of filtered vaulted payment method summaries
|
|
2094
2028
|
*/
|
|
2095
|
-
private
|
|
2029
|
+
private createVaultedPaymentsArray;
|
|
2096
2030
|
/**
|
|
2097
2031
|
* Update vaulted payment methods and dispatch events/callbacks.
|
|
2098
2032
|
* This method:
|
|
@@ -2186,8 +2120,8 @@ export interface PaymentFailureData {
|
|
|
2186
2120
|
* Includes filtered vaulted payment methods with minimal PII exposure.
|
|
2187
2121
|
*/
|
|
2188
2122
|
export interface VaultedMethodsUpdateData {
|
|
2189
|
-
/**
|
|
2190
|
-
vaultedPayments:
|
|
2123
|
+
/** Array of filtered vaulted payment method summaries */
|
|
2124
|
+
vaultedPayments: VaultedPaymentMethodSummary[];
|
|
2191
2125
|
/** Indicates if CVV recapture is required for vaulted payments */
|
|
2192
2126
|
cvvRecapture: boolean;
|
|
2193
2127
|
/** Unix timestamp in seconds */
|
|
@@ -2249,51 +2183,42 @@ export declare class PrimerJS {
|
|
|
2249
2183
|
*/
|
|
2250
2184
|
readonly vault: VaultAPI;
|
|
2251
2185
|
/**
|
|
2252
|
-
*
|
|
2253
|
-
* Use for analytics tracking or UI updates (e.g., disable form).
|
|
2186
|
+
* @deprecated Use the `primer:payment-start` event instead.
|
|
2254
2187
|
*
|
|
2255
|
-
*
|
|
2188
|
+
* Listen to the event on the checkout element:
|
|
2256
2189
|
* ```typescript
|
|
2257
|
-
*
|
|
2190
|
+
* checkout.addEventListener('primer:payment-start', (e) => {
|
|
2258
2191
|
* analytics.track('payment_started');
|
|
2259
2192
|
* disablePaymentForm();
|
|
2260
|
-
* };
|
|
2193
|
+
* });
|
|
2261
2194
|
* ```
|
|
2262
2195
|
*/
|
|
2263
2196
|
onPaymentStart?: () => void;
|
|
2264
2197
|
/**
|
|
2265
|
-
*
|
|
2266
|
-
* Use for last-chance validation or conditional payment creation.
|
|
2267
|
-
*
|
|
2268
|
-
* @param data - Payment method information
|
|
2269
|
-
* @param handler - Control flow handler (continue or abort)
|
|
2198
|
+
* @deprecated Use the `primer:payment-start` event instead.
|
|
2270
2199
|
*
|
|
2271
|
-
*
|
|
2200
|
+
* Listen to the event on the checkout element:
|
|
2272
2201
|
* ```typescript
|
|
2273
|
-
*
|
|
2274
|
-
*
|
|
2275
|
-
*
|
|
2202
|
+
* checkout.addEventListener('primer:payment-start', (e) => {
|
|
2203
|
+
* const { paymentMethodType, abortPaymentCreation, continuePaymentCreation } = e.detail;
|
|
2204
|
+
*
|
|
2205
|
+
* if (!validateBusinessRules(paymentMethodType)) {
|
|
2206
|
+
* abortPaymentCreation();
|
|
2276
2207
|
* return;
|
|
2277
2208
|
* }
|
|
2278
|
-
*
|
|
2279
|
-
* };
|
|
2209
|
+
* continuePaymentCreation({ idempotencyKey: 'optional-key' });
|
|
2210
|
+
* });
|
|
2280
2211
|
* ```
|
|
2281
2212
|
*/
|
|
2282
2213
|
onPaymentPrepare?: (data: PaymentData, handler: PrepareHandler) => void;
|
|
2283
2214
|
/**
|
|
2284
|
-
*
|
|
2285
|
-
* Receives minimal payment summary with reduced PII exposure.
|
|
2215
|
+
* @deprecated Use the `primer:payment-success` event instead.
|
|
2286
2216
|
*
|
|
2287
|
-
*
|
|
2288
|
-
* - Order confirmation and backend sync
|
|
2289
|
-
* - Receipt generation
|
|
2290
|
-
* - Payment processing with minimal PII exposure
|
|
2291
|
-
*
|
|
2292
|
-
* @param data - Payment success data with PaymentSummary (ID, orderId, last4, brand)
|
|
2293
|
-
*
|
|
2294
|
-
* @example
|
|
2217
|
+
* Listen to the event on the checkout element:
|
|
2295
2218
|
* ```typescript
|
|
2296
|
-
*
|
|
2219
|
+
* checkout.addEventListener('primer:payment-success', (e) => {
|
|
2220
|
+
* const { payment, paymentMethodType } = e.detail;
|
|
2221
|
+
*
|
|
2297
2222
|
* // Update backend
|
|
2298
2223
|
* await fetch(`/api/orders/${payment.orderId}/complete`, {
|
|
2299
2224
|
* method: 'POST',
|
|
@@ -2302,24 +2227,17 @@ export declare class PrimerJS {
|
|
|
2302
2227
|
*
|
|
2303
2228
|
* // Redirect to success page
|
|
2304
2229
|
* window.location.href = `/order-success?id=${payment.orderId}`;
|
|
2305
|
-
* };
|
|
2230
|
+
* });
|
|
2306
2231
|
* ```
|
|
2307
2232
|
*/
|
|
2308
2233
|
onPaymentSuccess?: (data: PaymentSuccessData) => void;
|
|
2309
2234
|
/**
|
|
2310
|
-
*
|
|
2311
|
-
* Receives error details and optional payment summary if created before failure.
|
|
2312
|
-
*
|
|
2313
|
-
* Use for:
|
|
2314
|
-
* - Error handling and user messaging
|
|
2315
|
-
* - Support ticket creation with diagnosticsId
|
|
2316
|
-
* - Retry logic for specific error types
|
|
2235
|
+
* @deprecated Use the `primer:payment-failure` event instead.
|
|
2317
2236
|
*
|
|
2318
|
-
*
|
|
2319
|
-
*
|
|
2320
|
-
* @example
|
|
2237
|
+
* Listen to the event on the checkout element:
|
|
2321
2238
|
* ```typescript
|
|
2322
|
-
*
|
|
2239
|
+
* checkout.addEventListener('primer:payment-failure', (e) => {
|
|
2240
|
+
* const { error, payment } = e.detail;
|
|
2323
2241
|
* console.error('Payment failed:', error.code, error.message);
|
|
2324
2242
|
*
|
|
2325
2243
|
* // Log to error tracking
|
|
@@ -2332,30 +2250,21 @@ export declare class PrimerJS {
|
|
|
2332
2250
|
*
|
|
2333
2251
|
* // Show user-friendly message
|
|
2334
2252
|
* showErrorMessage(error.message);
|
|
2335
|
-
* };
|
|
2253
|
+
* });
|
|
2336
2254
|
* ```
|
|
2337
2255
|
*/
|
|
2338
2256
|
onPaymentFailure?: (data: PaymentFailureData) => void;
|
|
2339
2257
|
/**
|
|
2340
|
-
*
|
|
2341
|
-
* Receives filtered vaulted payment method data with minimal PII exposure.
|
|
2342
|
-
*
|
|
2343
|
-
* Use for:
|
|
2344
|
-
* - Building custom vault UI
|
|
2345
|
-
* - Determining if CVV recapture is required (check cvvRecapture flag)
|
|
2346
|
-
* - Analytics tracking for vault usage
|
|
2347
|
-
* - Syncing vault state with backend
|
|
2348
|
-
*
|
|
2349
|
-
* @param data - Vault methods update data with filtered payment methods and cvvRecapture flag
|
|
2258
|
+
* @deprecated Use the `primer:vault-methods-update` event instead.
|
|
2350
2259
|
*
|
|
2351
|
-
*
|
|
2260
|
+
* Listen to the event on the checkout element:
|
|
2352
2261
|
* ```typescript
|
|
2353
|
-
*
|
|
2354
|
-
*
|
|
2262
|
+
* checkout.addEventListener('primer:vault-methods-update', (e) => {
|
|
2263
|
+
* const { vaultedPayments } = e.detail;
|
|
2264
|
+
* console.log(`Vault contains ${vaultedPayments.length} methods`);
|
|
2355
2265
|
*
|
|
2356
2266
|
* // Display in custom UI
|
|
2357
|
-
*
|
|
2358
|
-
* methods.forEach(method => {
|
|
2267
|
+
* vaultedPayments.forEach(method => {
|
|
2359
2268
|
* displayVaultedMethod({
|
|
2360
2269
|
* id: method.id,
|
|
2361
2270
|
* type: method.paymentMethodType,
|
|
@@ -2363,7 +2272,7 @@ export declare class PrimerJS {
|
|
|
2363
2272
|
* network: method.paymentInstrumentData?.network,
|
|
2364
2273
|
* });
|
|
2365
2274
|
* });
|
|
2366
|
-
* };
|
|
2275
|
+
* });
|
|
2367
2276
|
* ```
|
|
2368
2277
|
*/
|
|
2369
2278
|
onVaultedMethodsUpdate?: (data: VaultedMethodsUpdateData) => void;
|
|
@@ -2372,7 +2281,7 @@ export declare class PrimerJS {
|
|
|
2372
2281
|
* Set the initialized payment methods
|
|
2373
2282
|
* @internal - This is only used internally by the SDK
|
|
2374
2283
|
*/
|
|
2375
|
-
setPaymentMethods(methods:
|
|
2284
|
+
setPaymentMethods(methods: InitializedPaymentMethod[]): void;
|
|
2376
2285
|
/**
|
|
2377
2286
|
* Set the initialized payment managers
|
|
2378
2287
|
* @internal - This is only used internally by the SDK
|
|
@@ -2436,23 +2345,11 @@ export declare class PrimerJS {
|
|
|
2436
2345
|
* @internal - This is only used internally by the SDK
|
|
2437
2346
|
*/
|
|
2438
2347
|
handlePaymentStart(): void;
|
|
2439
|
-
/**
|
|
2440
|
-
* Internal method to handle the onBeforePaymentCreate callback and transform it to onPaymentPrepare
|
|
2441
|
-
* @internal - This is only used internally by the SDK
|
|
2442
|
-
*/
|
|
2443
|
-
handleBeforePaymentCreate(data: {
|
|
2444
|
-
paymentMethodType: PaymentMethodType;
|
|
2445
|
-
}, originalHandler: {
|
|
2446
|
-
continuePaymentCreation: (data?: {
|
|
2447
|
-
idempotencyKey?: string;
|
|
2448
|
-
}) => void;
|
|
2449
|
-
abortPaymentCreation: () => void;
|
|
2450
|
-
}): void;
|
|
2451
2348
|
/**
|
|
2452
2349
|
* Internal method to handle the onVaultedMethodsUpdate callback
|
|
2453
2350
|
* @internal - This is only used internally by the SDK
|
|
2454
2351
|
*/
|
|
2455
|
-
handleVaultedMethodsUpdate(vaultedPayments:
|
|
2352
|
+
handleVaultedMethodsUpdate(vaultedPayments: VaultedPaymentMethodSummary[], cvvRecapture: boolean): void;
|
|
2456
2353
|
/**
|
|
2457
2354
|
* Sets the cardholder name value in the card payment form.
|
|
2458
2355
|
*
|
|
@@ -2503,7 +2400,7 @@ export interface ShowOtherPaymentsToggledPayload {
|
|
|
2503
2400
|
}
|
|
2504
2401
|
export interface PrimerEvents {
|
|
2505
2402
|
"primer:state-change": CustomEvent<SdkStateContextType>;
|
|
2506
|
-
"primer:methods-update": CustomEvent<
|
|
2403
|
+
"primer:methods-update": CustomEvent<InitializedPaymentMethod[]>;
|
|
2507
2404
|
"primer:ready": CustomEvent<PrimerJS>;
|
|
2508
2405
|
"primer:card-network-change": CustomEvent<CardNetworksContextType>;
|
|
2509
2406
|
"primer:bin-data-loading-change": CustomEvent<{
|
|
@@ -2513,13 +2410,22 @@ export interface PrimerEvents {
|
|
|
2513
2410
|
"primer:card-submit": CustomEvent<CardSubmitPayload>;
|
|
2514
2411
|
"primer:card-success": CustomEvent<CardSubmitSuccessPayload>;
|
|
2515
2412
|
"primer:card-error": CustomEvent<CardSubmitErrorsPayload>;
|
|
2413
|
+
"primer:dialog-open": CustomEvent;
|
|
2414
|
+
"primer:dialog-close": CustomEvent;
|
|
2516
2415
|
"primer-ach-error": CustomEvent<PrimeAchErrorPayload>;
|
|
2517
2416
|
"primer-ach-bank-details-collected": CustomEvent;
|
|
2518
2417
|
"primer-ach-mandate-confirmed": CustomEvent;
|
|
2519
2418
|
"primer-ach-mandate-declined": CustomEvent;
|
|
2520
|
-
"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
|
+
}>;
|
|
2521
2427
|
"primer:payment-success": CustomEvent<{
|
|
2522
|
-
|
|
2428
|
+
payment: PaymentSummary;
|
|
2523
2429
|
paymentMethodType?: PaymentMethodType;
|
|
2524
2430
|
timestamp: number;
|
|
2525
2431
|
}>;
|
|
@@ -2530,15 +2436,20 @@ export interface PrimerEvents {
|
|
|
2530
2436
|
diagnosticsId?: string;
|
|
2531
2437
|
data?: Record<string, unknown>;
|
|
2532
2438
|
};
|
|
2533
|
-
|
|
2439
|
+
payment?: PaymentSummary;
|
|
2534
2440
|
paymentMethodType?: PaymentMethodType;
|
|
2535
2441
|
timestamp: number;
|
|
2536
2442
|
}>;
|
|
2537
|
-
"primer:
|
|
2538
|
-
|
|
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;
|
|
2539
2450
|
timestamp: number;
|
|
2540
2451
|
}>;
|
|
2541
|
-
"primer:vault
|
|
2452
|
+
"primer:vault-selection-change": CustomEvent<{
|
|
2542
2453
|
paymentMethodId: string | null;
|
|
2543
2454
|
timestamp: number;
|
|
2544
2455
|
}>;
|
|
@@ -2559,7 +2470,7 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2559
2470
|
*/
|
|
2560
2471
|
dispatchEvent<K extends keyof PrimerEvents>(type: K, detail: PrimerEvents[K]["detail"]): void;
|
|
2561
2472
|
dispatchSdkState(sdkState: SdkStateContextType): void;
|
|
2562
|
-
dispatchPaymentMethods(paymentMethods:
|
|
2473
|
+
dispatchPaymentMethods(paymentMethods: InitializedPaymentMethod[]): void;
|
|
2563
2474
|
dispatchCheckoutInitialized(checkoutInstance: PrimerJS): void;
|
|
2564
2475
|
dispatchCardNetworkChange(network: CardNetworksContextType): void;
|
|
2565
2476
|
dispatchBinDataAvailable(data: BinDataAvailableEvent): void;
|
|
@@ -2567,6 +2478,9 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2567
2478
|
dispatchCardSubmit(source?: string): void;
|
|
2568
2479
|
dispatchFormSubmitSuccess(result: CardSubmitResult): void;
|
|
2569
2480
|
dispatchFormSubmitErrors(errors: InputValidationError[]): void;
|
|
2481
|
+
dispatchPaymentCancel(data: {
|
|
2482
|
+
paymentMethodType: PaymentMethodType | null;
|
|
2483
|
+
}): void;
|
|
2570
2484
|
/**
|
|
2571
2485
|
* Handle external card submit events and forward them through the event system.
|
|
2572
2486
|
* This method provides a centralized way to process external card submission events
|
|
@@ -2577,9 +2491,15 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2577
2491
|
handleExternalCardSubmit(eventDetails: CardSubmitPayload): void;
|
|
2578
2492
|
/**
|
|
2579
2493
|
* Dispatch payment start event.
|
|
2580
|
-
* 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
|
|
2581
2501
|
*/
|
|
2582
|
-
dispatchPaymentStart():
|
|
2502
|
+
dispatchPaymentStart(paymentMethodType: PaymentMethodType, handler: PrepareHandler): boolean;
|
|
2583
2503
|
/**
|
|
2584
2504
|
* Dispatch payment success event with minimal payment summary.
|
|
2585
2505
|
* Called when payment completes successfully.
|
|
@@ -2599,9 +2519,10 @@ declare class PrimerEventsController implements ReactiveController {
|
|
|
2599
2519
|
* Dispatch vault methods update event.
|
|
2600
2520
|
* Called when vaulted payment methods are loaded or updated.
|
|
2601
2521
|
*
|
|
2602
|
-
* @param vaultedPayments -
|
|
2522
|
+
* @param vaultedPayments - Array of filtered vaulted payment method summaries
|
|
2523
|
+
* @param cvvRecapture - Whether CVV recapture is required for vaulted payments
|
|
2603
2524
|
*/
|
|
2604
|
-
dispatchVaultMethodsUpdate(vaultedPayments:
|
|
2525
|
+
dispatchVaultMethodsUpdate(vaultedPayments: VaultedPaymentMethodSummary[], cvvRecapture: boolean): void;
|
|
2605
2526
|
/**
|
|
2606
2527
|
* Dispatch vault selection change event.
|
|
2607
2528
|
* Called when a vaulted payment method is selected or deselected.
|
|
@@ -2688,7 +2609,7 @@ declare class SDKContextController implements ReactiveController {
|
|
|
2688
2609
|
* Updates the payment methods context.
|
|
2689
2610
|
* @param value The new payment methods data.
|
|
2690
2611
|
*/
|
|
2691
|
-
setPaymentMethods(value:
|
|
2612
|
+
setPaymentMethods(value: InitializedPaymentMethod[]): void;
|
|
2692
2613
|
/**
|
|
2693
2614
|
* Updates the payment manager context.
|
|
2694
2615
|
* @param value The new payment manager mapping.
|
|
@@ -3630,7 +3551,7 @@ declare global {
|
|
|
3630
3551
|
"primer-klarna": PrimerKlarnaComponent;
|
|
3631
3552
|
}
|
|
3632
3553
|
}
|
|
3633
|
-
export type PaymentMethodsContextType =
|
|
3554
|
+
export type PaymentMethodsContextType = InitializedPaymentMethod[] | null;
|
|
3634
3555
|
/**
|
|
3635
3556
|
* Google Pay component with shadow root rendering for full-width button support.
|
|
3636
3557
|
*
|