@primer-io/primer-js 0.3.10 → 0.3.12
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 +13 -0
- package/dist/custom-elements.json +1115 -508
- package/dist/jsx/index.d.ts +77 -30
- package/dist/primer-loader.d.ts +84 -40
- package/dist/primer-loader.js +21 -33
- package/dist/vscode.html-custom-data.json +54 -26
- package/dist/web-types.json +120 -63
- package/package.json +3 -2
package/dist/jsx/index.d.ts
CHANGED
|
@@ -333,17 +333,6 @@ export type PrimerKlarnaComponentProps = {
|
|
|
333
333
|
toggleExpand?: string;
|
|
334
334
|
};
|
|
335
335
|
|
|
336
|
-
export type NativePaymentComponentProps = {
|
|
337
|
-
/** */
|
|
338
|
-
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
339
|
-
/** */
|
|
340
|
-
paymentManagers?: InitializedManagersMap;
|
|
341
|
-
/** */
|
|
342
|
-
computedStyles?: CSSStyleDeclaration | null;
|
|
343
|
-
/** */
|
|
344
|
-
disabled?: boolean;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
336
|
export type PaymentMethodComponentProps = {
|
|
348
337
|
/** */
|
|
349
338
|
type?: PaymentMethodType | undefined;
|
|
@@ -539,6 +528,38 @@ Falls back to localized default if not explicitly set. */
|
|
|
539
528
|
cardFormContext?: CardFormContext | null;
|
|
540
529
|
};
|
|
541
530
|
|
|
531
|
+
export type ApplePayComponentProps = {
|
|
532
|
+
/** */
|
|
533
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
534
|
+
/** */
|
|
535
|
+
paymentManagers?: InitializedManagersMap;
|
|
536
|
+
/** */
|
|
537
|
+
disabled?: boolean;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
export type GooglePayComponentProps = {
|
|
541
|
+
/** */
|
|
542
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
543
|
+
/** */
|
|
544
|
+
paymentManagers?: InitializedManagersMap;
|
|
545
|
+
/** */
|
|
546
|
+
disabled?: boolean;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
export type PayPalComponentProps = {
|
|
550
|
+
/** */
|
|
551
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
552
|
+
/** */
|
|
553
|
+
paymentManagers?: InitializedManagersMap;
|
|
554
|
+
/** */
|
|
555
|
+
disabled?: boolean;
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
export type PaymentMethodContentComponentProps = {
|
|
559
|
+
/** The asset configuration containing icon and display data */
|
|
560
|
+
assetConfig?: AssetConfig | null;
|
|
561
|
+
};
|
|
562
|
+
|
|
542
563
|
export type VaultCvvInputComponentProps = {
|
|
543
564
|
/** */
|
|
544
565
|
computedStyles?: CSSStyleDeclaration | null;
|
|
@@ -551,11 +572,6 @@ Separated to minimize re-renders on frequent CVV input changes */
|
|
|
551
572
|
vaultManagerCvvContext?: VaultItemContextType;
|
|
552
573
|
};
|
|
553
574
|
|
|
554
|
-
export type PaymentMethodContentComponentProps = {
|
|
555
|
-
/** The asset configuration containing icon and display data */
|
|
556
|
-
assetConfig?: AssetConfig | null;
|
|
557
|
-
};
|
|
558
|
-
|
|
559
575
|
export type VaultDeleteConfirmationComponentProps = {
|
|
560
576
|
/** Whether a delete operation is in progress */
|
|
561
577
|
isDeleting?: boolean;
|
|
@@ -876,14 +892,6 @@ export type CustomElements = {
|
|
|
876
892
|
*/
|
|
877
893
|
"primer-klarna": Partial<PrimerKlarnaComponentProps & BaseProps & BaseEvents>;
|
|
878
894
|
|
|
879
|
-
/**
|
|
880
|
-
* Component for rendering native payment buttons (Apple Pay, Google Pay, PayPal)
|
|
881
|
-
* with proper height calculations based on design system variables.
|
|
882
|
-
* ---
|
|
883
|
-
*
|
|
884
|
-
*/
|
|
885
|
-
"primer-native-payment": Partial<NativePaymentComponentProps & BaseProps & BaseEvents>;
|
|
886
|
-
|
|
887
895
|
/**
|
|
888
896
|
*
|
|
889
897
|
* ---
|
|
@@ -1036,16 +1044,43 @@ export type CustomElements = {
|
|
|
1036
1044
|
"primer-input-cvv": Partial<InputCvvComponentProps & BaseProps & BaseEvents>;
|
|
1037
1045
|
|
|
1038
1046
|
/**
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1047
|
+
* Apple Pay component with standard button container rendering.
|
|
1048
|
+
*
|
|
1049
|
+
* Apple Pay uses the standard button container approach:
|
|
1050
|
+
* - Renders to a button container div (not shadow root)
|
|
1051
|
+
* - Passes buttonHeight in render options
|
|
1052
|
+
* - Uses updateOverlayForContainer for disabled state
|
|
1053
|
+
* - Simpler than Google Pay's shadow root approach
|
|
1042
1054
|
* ---
|
|
1043
1055
|
*
|
|
1056
|
+
*/
|
|
1057
|
+
"primer-apple-pay": Partial<ApplePayComponentProps & BaseProps & BaseEvents>;
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* Google Pay component with shadow root rendering for full-width button support.
|
|
1061
|
+
*
|
|
1062
|
+
* Google Pay requires special rendering logic:
|
|
1063
|
+
* - Renders directly to shadow root (not button container)
|
|
1064
|
+
* - Does NOT render .native-button-container div
|
|
1065
|
+
* - Passes shadowRoot: true in render options
|
|
1066
|
+
* - Requires retry logic for async button rendering
|
|
1067
|
+
* ---
|
|
1044
1068
|
*
|
|
1045
|
-
* ### **Methods:**
|
|
1046
|
-
* - **onCvvInputChange()** - Update CVV metadata in the context when input changes
|
|
1047
1069
|
*/
|
|
1048
|
-
"primer-
|
|
1070
|
+
"primer-google-pay": Partial<GooglePayComponentProps & BaseProps & BaseEvents>;
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* PayPal component with standard button container rendering.
|
|
1074
|
+
*
|
|
1075
|
+
* PayPal uses the standard button container approach:
|
|
1076
|
+
* - Renders to a button container div (not shadow root)
|
|
1077
|
+
* - Passes buttonHeight in render options with PayPal SDK constraints (25-55px)
|
|
1078
|
+
* - Uses updateOverlayForContainer for disabled state
|
|
1079
|
+
* - Warns if height exceeds maximum allowed by PayPal SDK
|
|
1080
|
+
* ---
|
|
1081
|
+
*
|
|
1082
|
+
*/
|
|
1083
|
+
"primer-paypal": Partial<PayPalComponentProps & BaseProps & BaseEvents>;
|
|
1049
1084
|
|
|
1050
1085
|
/**
|
|
1051
1086
|
* PaymentMethodContentComponent - renders payment method information with icon and details
|
|
@@ -1056,6 +1091,18 @@ export type CustomElements = {
|
|
|
1056
1091
|
*/
|
|
1057
1092
|
"primer-payment-method-content": Partial<PaymentMethodContentComponentProps & BaseProps & BaseEvents>;
|
|
1058
1093
|
|
|
1094
|
+
/**
|
|
1095
|
+
* CVV Input component for vault payment methods
|
|
1096
|
+
* Renders a secure iframe for CVV input when required by the selected payment method
|
|
1097
|
+
* Uses dedicated CVV context to minimize re-renders
|
|
1098
|
+
* ---
|
|
1099
|
+
*
|
|
1100
|
+
*
|
|
1101
|
+
* ### **Methods:**
|
|
1102
|
+
* - **onCvvInputChange()** - Update CVV metadata in the context when input changes
|
|
1103
|
+
*/
|
|
1104
|
+
"primer-vault-cvv-input": Partial<VaultCvvInputComponentProps & BaseProps & BaseEvents>;
|
|
1105
|
+
|
|
1059
1106
|
/**
|
|
1060
1107
|
* VaultDeleteConfirmationComponent - displays confirmation UI for deleting a payment method
|
|
1061
1108
|
* ---
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -768,6 +768,7 @@ export interface PrimerHeadlessCheckout {
|
|
|
768
768
|
getAssetsManager(): IAssetsManager;
|
|
769
769
|
start: () => Promise<void>;
|
|
770
770
|
refreshClientSession(): Promise<boolean>;
|
|
771
|
+
teardown?: () => void;
|
|
771
772
|
}
|
|
772
773
|
export interface HeadlessUniversalCheckoutOptions {
|
|
773
774
|
style?: CheckoutStyle;
|
|
@@ -2190,6 +2191,86 @@ declare global {
|
|
|
2190
2191
|
}
|
|
2191
2192
|
}
|
|
2192
2193
|
export type PaymentMethodsContextType = InitializedPayments | null;
|
|
2194
|
+
/**
|
|
2195
|
+
* Google Pay component with shadow root rendering for full-width button support.
|
|
2196
|
+
*
|
|
2197
|
+
* Google Pay requires special rendering logic:
|
|
2198
|
+
* - Renders directly to shadow root (not button container)
|
|
2199
|
+
* - Does NOT render .native-button-container div
|
|
2200
|
+
* - Passes shadowRoot: true in render options
|
|
2201
|
+
* - Requires retry logic for async button rendering
|
|
2202
|
+
*/
|
|
2203
|
+
declare class GooglePayComponent extends LitElement {
|
|
2204
|
+
static styles: import("lit").CSSResult[];
|
|
2205
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
2206
|
+
paymentManagers: InitializedManagersMap;
|
|
2207
|
+
disabled: boolean;
|
|
2208
|
+
private loadManagerTask;
|
|
2209
|
+
private renderButtonTask;
|
|
2210
|
+
constructor();
|
|
2211
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2212
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
2213
|
+
render(): symbol;
|
|
2214
|
+
}
|
|
2215
|
+
declare global {
|
|
2216
|
+
interface HTMLElementTagNameMap {
|
|
2217
|
+
"primer-google-pay": GooglePayComponent;
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Apple Pay component with standard button container rendering.
|
|
2222
|
+
*
|
|
2223
|
+
* Apple Pay uses the standard button container approach:
|
|
2224
|
+
* - Renders to a button container div (not shadow root)
|
|
2225
|
+
* - Passes buttonHeight in render options
|
|
2226
|
+
* - Uses updateOverlayForContainer for disabled state
|
|
2227
|
+
* - Simpler than Google Pay's shadow root approach
|
|
2228
|
+
*/
|
|
2229
|
+
declare class ApplePayComponent extends LitElement {
|
|
2230
|
+
static styles: import("lit").CSSResult[];
|
|
2231
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
2232
|
+
paymentManagers: InitializedManagersMap;
|
|
2233
|
+
disabled: boolean;
|
|
2234
|
+
private buttonContainerRef;
|
|
2235
|
+
private loadManagerTask;
|
|
2236
|
+
private renderButtonTask;
|
|
2237
|
+
constructor();
|
|
2238
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2239
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
2240
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
2241
|
+
}
|
|
2242
|
+
declare global {
|
|
2243
|
+
interface HTMLElementTagNameMap {
|
|
2244
|
+
"primer-apple-pay": ApplePayComponent;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* PayPal component with standard button container rendering.
|
|
2249
|
+
*
|
|
2250
|
+
* PayPal uses the standard button container approach:
|
|
2251
|
+
* - Renders to a button container div (not shadow root)
|
|
2252
|
+
* - Passes buttonHeight in render options with PayPal SDK constraints (25-55px)
|
|
2253
|
+
* - Uses updateOverlayForContainer for disabled state
|
|
2254
|
+
* - Warns if height exceeds maximum allowed by PayPal SDK
|
|
2255
|
+
*/
|
|
2256
|
+
declare class PayPalComponent extends LitElement {
|
|
2257
|
+
static styles: import("lit").CSSResult[];
|
|
2258
|
+
paymentMethod: InitializedPaymentMethod | undefined;
|
|
2259
|
+
paymentManagers: InitializedManagersMap;
|
|
2260
|
+
disabled: boolean;
|
|
2261
|
+
private buttonContainerRef;
|
|
2262
|
+
private loadManagerTask;
|
|
2263
|
+
private renderButtonTask;
|
|
2264
|
+
constructor();
|
|
2265
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2266
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
2267
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
2268
|
+
}
|
|
2269
|
+
declare global {
|
|
2270
|
+
interface HTMLElementTagNameMap {
|
|
2271
|
+
"primer-paypal": PayPalComponent;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2193
2274
|
declare class PaymentMethodComponent extends LitElement {
|
|
2194
2275
|
static styles: import("lit").CSSResult[];
|
|
2195
2276
|
type: PaymentMethodType | undefined;
|
|
@@ -3434,45 +3515,6 @@ declare global {
|
|
|
3434
3515
|
"primer-show-other-payments": ShowOtherPaymentsComponent;
|
|
3435
3516
|
}
|
|
3436
3517
|
}
|
|
3437
|
-
/**
|
|
3438
|
-
* Component for rendering native payment buttons (Apple Pay, Google Pay, PayPal)
|
|
3439
|
-
* with proper height calculations based on design system variables.
|
|
3440
|
-
*/
|
|
3441
|
-
declare class NativePaymentComponent extends LitElement {
|
|
3442
|
-
static styles: import("lit").CSSResult[];
|
|
3443
|
-
paymentMethod: InitializedPaymentMethod | undefined;
|
|
3444
|
-
paymentManagers: InitializedManagersMap;
|
|
3445
|
-
computedStyles: CSSStyleDeclaration | null;
|
|
3446
|
-
disabled: boolean;
|
|
3447
|
-
private _buttonId;
|
|
3448
|
-
private loadManagerTask;
|
|
3449
|
-
private nativeButtonTask;
|
|
3450
|
-
constructor();
|
|
3451
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
3452
|
-
/**
|
|
3453
|
-
* Calculates the button height by reading the computed height from the element.
|
|
3454
|
-
* The CSS already calculates the correct height using CSS variables,
|
|
3455
|
-
* so we just read the browser's computed value (which handles rem/em/% conversions).
|
|
3456
|
-
*/
|
|
3457
|
-
private calculateButtonHeight;
|
|
3458
|
-
/**
|
|
3459
|
-
* Creates render options with appropriate styles based on payment method type
|
|
3460
|
-
*/
|
|
3461
|
-
private createRenderOptions;
|
|
3462
|
-
protected updated(changedProperties: PropertyValues): void;
|
|
3463
|
-
/**
|
|
3464
|
-
* Updates the disabled overlay based on the current disabled state
|
|
3465
|
-
*/
|
|
3466
|
-
private updateDisabledOverlay;
|
|
3467
|
-
private updateGooglePayOverlay;
|
|
3468
|
-
private updateRegularOverlay;
|
|
3469
|
-
render(): symbol | import("lit-html").TemplateResult<1> | undefined;
|
|
3470
|
-
}
|
|
3471
|
-
declare global {
|
|
3472
|
-
interface HTMLElementTagNameMap {
|
|
3473
|
-
"primer-native-payment": NativePaymentComponent;
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
3518
|
declare class PrimerCheckoutCompleteComponent extends LitElement {
|
|
3477
3519
|
render(): import("lit-html").TemplateResult<1>;
|
|
3478
3520
|
}
|
|
@@ -3545,6 +3587,7 @@ export declare function loadPrimer(): void;
|
|
|
3545
3587
|
|
|
3546
3588
|
export {
|
|
3547
3589
|
AchPaymentComponent as AchPayment,
|
|
3590
|
+
ApplePayComponent as ApplePay,
|
|
3548
3591
|
ButtonComponent as Button,
|
|
3549
3592
|
CardFormComponent as CardForm,
|
|
3550
3593
|
CardFormSubmitComponent as CardFormSubmit,
|
|
@@ -3554,6 +3597,7 @@ export {
|
|
|
3554
3597
|
DynamicPaymentComponent as DynamicPayment,
|
|
3555
3598
|
ErrorMessageComponent as ErrorMessage,
|
|
3556
3599
|
ErrorMessageContainerComponent as ErrorMessageContainer,
|
|
3600
|
+
GooglePayComponent as GooglePay,
|
|
3557
3601
|
InputCardExpiryComponent as CardFormExpiry,
|
|
3558
3602
|
InputCardHolderNameComponent as CardFormName,
|
|
3559
3603
|
InputCardNumberComponent as CardFormCardNumber,
|
|
@@ -3562,7 +3606,7 @@ export {
|
|
|
3562
3606
|
InputErrorComponent as CardFormError,
|
|
3563
3607
|
InputLabelComponent as InputLabel,
|
|
3564
3608
|
InputWrapperComponent as InputWrapper,
|
|
3565
|
-
|
|
3609
|
+
PayPalComponent as PayPal,
|
|
3566
3610
|
PaymentMethodComponent as PaymentMethod,
|
|
3567
3611
|
PaymentMethodContainerComponent as PaymentMethodContainer,
|
|
3568
3612
|
PortalComponent as Portal,
|