@primer-io/primer-js 0.3.11 → 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.
@@ -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,33 @@ 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
+
542
558
  export type PaymentMethodContentComponentProps = {
543
559
  /** The asset configuration containing icon and display data */
544
560
  assetConfig?: AssetConfig | null;
@@ -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
  * ---
@@ -1035,6 +1043,45 @@ export type CustomElements = {
1035
1043
  */
1036
1044
  "primer-input-cvv": Partial<InputCvvComponentProps & BaseProps & BaseEvents>;
1037
1045
 
1046
+ /**
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
1054
+ * ---
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
+ * ---
1068
+ *
1069
+ */
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>;
1084
+
1038
1085
  /**
1039
1086
  * PaymentMethodContentComponent - renders payment method information with icon and details
1040
1087
  * This component encapsulates the display logic and styles for payment method content
@@ -2191,6 +2191,86 @@ declare global {
2191
2191
  }
2192
2192
  }
2193
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
+ }
2194
2274
  declare class PaymentMethodComponent extends LitElement {
2195
2275
  static styles: import("lit").CSSResult[];
2196
2276
  type: PaymentMethodType | undefined;
@@ -3435,45 +3515,6 @@ declare global {
3435
3515
  "primer-show-other-payments": ShowOtherPaymentsComponent;
3436
3516
  }
3437
3517
  }
3438
- /**
3439
- * Component for rendering native payment buttons (Apple Pay, Google Pay, PayPal)
3440
- * with proper height calculations based on design system variables.
3441
- */
3442
- declare class NativePaymentComponent extends LitElement {
3443
- static styles: import("lit").CSSResult[];
3444
- paymentMethod: InitializedPaymentMethod | undefined;
3445
- paymentManagers: InitializedManagersMap;
3446
- computedStyles: CSSStyleDeclaration | null;
3447
- disabled: boolean;
3448
- private _buttonId;
3449
- private loadManagerTask;
3450
- private nativeButtonTask;
3451
- constructor();
3452
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
3453
- /**
3454
- * Calculates the button height by reading the computed height from the element.
3455
- * The CSS already calculates the correct height using CSS variables,
3456
- * so we just read the browser's computed value (which handles rem/em/% conversions).
3457
- */
3458
- private calculateButtonHeight;
3459
- /**
3460
- * Creates render options with appropriate styles based on payment method type
3461
- */
3462
- private createRenderOptions;
3463
- protected updated(changedProperties: PropertyValues): void;
3464
- /**
3465
- * Updates the disabled overlay based on the current disabled state
3466
- */
3467
- private updateDisabledOverlay;
3468
- private updateGooglePayOverlay;
3469
- private updateRegularOverlay;
3470
- render(): symbol | import("lit-html").TemplateResult<1> | undefined;
3471
- }
3472
- declare global {
3473
- interface HTMLElementTagNameMap {
3474
- "primer-native-payment": NativePaymentComponent;
3475
- }
3476
- }
3477
3518
  declare class PrimerCheckoutCompleteComponent extends LitElement {
3478
3519
  render(): import("lit-html").TemplateResult<1>;
3479
3520
  }
@@ -3546,6 +3587,7 @@ export declare function loadPrimer(): void;
3546
3587
 
3547
3588
  export {
3548
3589
  AchPaymentComponent as AchPayment,
3590
+ ApplePayComponent as ApplePay,
3549
3591
  ButtonComponent as Button,
3550
3592
  CardFormComponent as CardForm,
3551
3593
  CardFormSubmitComponent as CardFormSubmit,
@@ -3555,6 +3597,7 @@ export {
3555
3597
  DynamicPaymentComponent as DynamicPayment,
3556
3598
  ErrorMessageComponent as ErrorMessage,
3557
3599
  ErrorMessageContainerComponent as ErrorMessageContainer,
3600
+ GooglePayComponent as GooglePay,
3558
3601
  InputCardExpiryComponent as CardFormExpiry,
3559
3602
  InputCardHolderNameComponent as CardFormName,
3560
3603
  InputCardNumberComponent as CardFormCardNumber,
@@ -3563,7 +3606,7 @@ export {
3563
3606
  InputErrorComponent as CardFormError,
3564
3607
  InputLabelComponent as InputLabel,
3565
3608
  InputWrapperComponent as InputWrapper,
3566
- NativePaymentComponent as NativePayment,
3609
+ PayPalComponent as PayPal,
3567
3610
  PaymentMethodComponent as PaymentMethod,
3568
3611
  PaymentMethodContainerComponent as PaymentMethodContainer,
3569
3612
  PortalComponent as Portal,