@primer-io/primer-js 0.11.0 → 0.12.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/chunks/{ar.KRXB3WQO.js → ar.44J7SJG6.js} +1 -1
  3. package/dist/chunks/{bg.6SKJRXIR.js → bg.LT2YIFOH.js} +1 -1
  4. package/dist/chunks/{ca.SANDLFEK.js → ca.KUW6ECYF.js} +1 -1
  5. package/dist/chunks/{chunk.QMLIEEKM.js → chunk.TIWM3PQ7.js} +1 -1
  6. package/dist/chunks/{cs.FC4I5M3C.js → cs.XQGMKIF3.js} +1 -1
  7. package/dist/chunks/{da.YI32NZ7B.js → da.HKIIDZRJ.js} +1 -1
  8. package/dist/chunks/{de.7M7UFQB7.js → de.O6IUA6FB.js} +1 -1
  9. package/dist/chunks/{el.XSGTYDZR.js → el.F35KS4NO.js} +1 -1
  10. package/dist/chunks/en-GB.PU23XE2E.js +1 -0
  11. package/dist/chunks/en.HQJMDTVQ.js +1 -0
  12. package/dist/chunks/{es-AR.TBWVUZEF.js → es-AR.OZ6CT5HA.js} +1 -1
  13. package/dist/chunks/{es-MX.6EMWUABR.js → es-MX.E4FWJ3FK.js} +1 -1
  14. package/dist/chunks/{es.XZLDFHYI.js → es.HEWO2JY7.js} +1 -1
  15. package/dist/chunks/{et-EE.JBSFMKZ2.js → et-EE.3GAJR6UB.js} +1 -1
  16. package/dist/chunks/{fi-FI.I75VK2ID.js → fi-FI.4TB5AYVQ.js} +1 -1
  17. package/dist/chunks/{fr.JBNP6RXT.js → fr.5GQNZ4TX.js} +1 -1
  18. package/dist/chunks/{he.PW253QAL.js → he.WGVF57WV.js} +1 -1
  19. package/dist/chunks/{hr.LM4RITYJ.js → hr.YPXJZUYV.js} +1 -1
  20. package/dist/chunks/{hu.JGCKQA6J.js → hu.RX3HFOR5.js} +1 -1
  21. package/dist/chunks/{id.VBXULDDY.js → id.3SO7FJHW.js} +1 -1
  22. package/dist/chunks/{it.7Q6BFLDK.js → it.Y7247AOF.js} +1 -1
  23. package/dist/chunks/{ja.QOC76SSC.js → ja.L6PF6O6A.js} +1 -1
  24. package/dist/chunks/{ko.BANZIFNH.js → ko.X53AFCXY.js} +1 -1
  25. package/dist/chunks/{lt-LT.Q2SRJOKH.js → lt-LT.HMQT67X4.js} +1 -1
  26. package/dist/chunks/{lt.XMNFEN5T.js → lt.YJ3FR7A2.js} +1 -1
  27. package/dist/chunks/{lv-LV.3AJDTMU5.js → lv-LV.HLFWSCCR.js} +1 -1
  28. package/dist/chunks/{lv.TFPDXNEV.js → lv.DEK5WXQB.js} +1 -1
  29. package/dist/chunks/{ms.FPTX4NM4.js → ms.E6PXJ4SR.js} +1 -1
  30. package/dist/chunks/{nb.CAFSKRQ2.js → nb.7357HC5J.js} +1 -1
  31. package/dist/chunks/{nl.7BPSDYTC.js → nl.QBFQWQBY.js} +1 -1
  32. package/dist/chunks/{nl_NL.6ZVCFPVW.js → nl_NL.RS7W3XGO.js} +1 -1
  33. package/dist/chunks/{pl.RF34QM23.js → pl.FSJRWYQ5.js} +1 -1
  34. package/dist/chunks/{pt-BR.AKDHLRUA.js → pt-BR.WVYS3Y2I.js} +1 -1
  35. package/dist/chunks/{pt.VBALOWHZ.js → pt.LUSIBC5X.js} +1 -1
  36. package/dist/chunks/{ro.WN7VCF27.js → ro.TKERTYBG.js} +1 -1
  37. package/dist/chunks/{ru.ICXGVGRR.js → ru.VPEQHZ2S.js} +1 -1
  38. package/dist/chunks/{sk.SIP5JIOX.js → sk.QFMGH6WL.js} +1 -1
  39. package/dist/chunks/{sl.R77UEKCA.js → sl.RUAKKCKD.js} +1 -1
  40. package/dist/chunks/{sr-RS.6M2YSTDX.js → sr-RS.WSZIECEH.js} +1 -1
  41. package/dist/chunks/{sv.33ZY4CDS.js → sv.AHI2S45X.js} +1 -1
  42. package/dist/chunks/{th.M27YUIZC.js → th.ZKRE26WN.js} +1 -1
  43. package/dist/chunks/{tr.Q2SIY6NA.js → tr.6NOOTQVO.js} +1 -1
  44. package/dist/chunks/{uk-UA.EJZOGSJR.js → uk-UA.A6S7PXDN.js} +1 -1
  45. package/dist/chunks/{vi.3RROGLXM.js → vi.4Z5L3EAS.js} +1 -1
  46. package/dist/chunks/{zh-CN.MQHNRMN4.js → zh-CN.SN6TXY6W.js} +1 -1
  47. package/dist/chunks/{zh-HK.WNR7XUSX.js → zh-HK.SQG5YIVQ.js} +1 -1
  48. package/dist/chunks/{zh-TW.GNCY2PNY.js → zh-TW.P2X3B7LC.js} +1 -1
  49. package/dist/custom-elements.json +1234 -967
  50. package/dist/jsx/index.d.ts +2 -2
  51. package/dist/primer-loader.d.ts +150 -19
  52. package/dist/primer-loader.js +15 -10
  53. package/dist/vscode.html-custom-data.json +1 -1
  54. package/dist/web-types.json +2 -2
  55. package/package.json +1 -1
  56. package/dist/chunks/en-GB.VO4GDE3X.js +0 -1
  57. package/dist/chunks/en.MNFLVOE3.js +0 -1
@@ -1199,9 +1199,9 @@ export type CustomElements = {
1199
1199
  *
1200
1200
  * PayPal uses the standard button container approach:
1201
1201
  * - Renders to a button container div (not shadow root)
1202
- * - Passes buttonHeight in render options with PayPal SDK constraints (25-55px)
1202
+ * - Passes buttonHeight in render options (sdk-core constrains to 25-55px)
1203
1203
  * - Uses updateOverlayForContainer for disabled state
1204
- * - Warns if height exceeds maximum allowed by PayPal SDK
1204
+ * - Height is calculated from CSS (PAYMENT_METHOD_LINE_HEIGHT + padding)
1205
1205
  * ---
1206
1206
  *
1207
1207
  */
@@ -352,6 +352,122 @@ declare const PaymentInstrumentType$1 = {
352
352
  ADYEN_AFFIRM: "ADYEN_AFFIRM",
353
353
  } as const;
354
354
  type PaymentInstrumentType$1 = (typeof PaymentInstrumentType$1)[keyof typeof PaymentInstrumentType$1];
355
+ /**
356
+ * Google Pay shipping address parameters.
357
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters
358
+ */
359
+ export interface GooglePayShippingAddressParameters {
360
+ /**
361
+ * ISO 3166-1 alpha-2 country codes where shipping is allowed.
362
+ * If not specified, all shipping address countries are allowed.
363
+ */
364
+ allowedCountryCodes?: string[];
365
+ /**
366
+ * Set to true if a phone number is required for the shipping address.
367
+ */
368
+ phoneNumberRequired?: boolean;
369
+ }
370
+ /**
371
+ * Google Pay button type options.
372
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
373
+ */
374
+ export type GooglePayButtonType = google.payments.api.ButtonType;
375
+ /**
376
+ * Google Pay button color options.
377
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
378
+ */
379
+ export type GooglePayButtonColor = google.payments.api.ButtonColor;
380
+ /**
381
+ * Google Pay button size mode options.
382
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
383
+ */
384
+ export type GooglePayButtonSizeMode = google.payments.api.ButtonSizeMode;
385
+ /**
386
+ * Google Pay button border type options.
387
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
388
+ */
389
+ export type GooglePayButtonBorderType = google.payments.api.ButtonBorderType;
390
+ /**
391
+ * Google Pay client-side options provided by the merchant.
392
+ */
393
+ export interface GooglePayClientOptions {
394
+ /**
395
+ * When true, requests billing address from Google Pay and updates client session.
396
+ */
397
+ captureBillingAddress?: boolean;
398
+ /**
399
+ * When true, requests shipping address from Google Pay and updates client session.
400
+ */
401
+ captureShippingAddress?: boolean;
402
+ /**
403
+ * Shipping address parameters. Only used when captureShippingAddress is true.
404
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters
405
+ */
406
+ shippingAddressParameters?: GooglePayShippingAddressParameters;
407
+ /**
408
+ * When true, requests email address from Google Pay and updates client session.
409
+ */
410
+ emailRequired?: boolean;
411
+ /**
412
+ * When true, enables shipping method selection in the Google Pay payment sheet.
413
+ * Shipping methods are read from the SHIPPING checkout module in the client configuration.
414
+ * When the user selects a shipping option, the SDK will call selectShippingMethod()
415
+ * on the client session API to update the order on the backend.
416
+ */
417
+ requireShippingMethod?: boolean;
418
+ /**
419
+ * When true (and environment is PRODUCTION), the Google Pay button will only be
420
+ * displayed if the user already has an existing payment method that can be used.
421
+ * This enables a one-tap checkout experience for returning users.
422
+ *
423
+ * @default false
424
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#IsReadyToPayRequest
425
+ */
426
+ existingPaymentMethodRequired?: boolean;
427
+ /**
428
+ * The type of button displayed. Each button type has a localized label.
429
+ * @default 'buy'
430
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
431
+ */
432
+ buttonType?: GooglePayButtonType;
433
+ /**
434
+ * The color of the button.
435
+ * - 'default' or 'black': Suitable for light colored backgrounds
436
+ * - 'white': Suitable for dark colored backgrounds
437
+ * @default 'black'
438
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
439
+ */
440
+ buttonColor?: GooglePayButtonColor;
441
+ /**
442
+ * The size mode of the button.
443
+ * - 'static': Button is sized according to the translated buttonType
444
+ * - 'fill': Button fills the container width (use CSS to control size)
445
+ * @default 'fill'
446
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
447
+ */
448
+ buttonSizeMode?: GooglePayButtonSizeMode;
449
+ /**
450
+ * The corner radius of the button in pixels.
451
+ * Minimum is 0, maximum depends on button height (e.g., max 20 for 40px height).
452
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
453
+ */
454
+ buttonRadius?: number;
455
+ /**
456
+ * The locale for the button text.
457
+ * ISO 639-1 code (e.g., 'en', 'de', 'fr', 'ja').
458
+ * If not specified, defaults to browser/OS locale.
459
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
460
+ */
461
+ buttonLocale?: string;
462
+ /**
463
+ * The border type of the button.
464
+ * - 'default_border': A thin border is displayed around the button (default)
465
+ * - 'no_border': No border is displayed around the button
466
+ * @default 'default_border'
467
+ * @see https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions
468
+ */
469
+ buttonBorderType?: GooglePayButtonBorderType;
470
+ }
355
471
  /**
356
472
  * Minimal payment summary with reduced PII exposure.
357
473
  * Used in events for public data delivery.
@@ -1080,6 +1196,8 @@ export interface AnalyticsUtils {
1080
1196
  clientSessionId?: string;
1081
1197
  clientSessionToken?: string;
1082
1198
  sdkVersion?: string;
1199
+ /** Timestamp (ms) when the first backend call (/configuration) started */
1200
+ configurationFetchStartTime?: number;
1083
1201
  }
1084
1202
  export interface PrimerHeadlessCheckout {
1085
1203
  createPaymentMethodManager(type: "PAYMENT_CARD", options?: PaymentMethodManagerOptions): Promise<ICardPaymentMethodManager | null>;
@@ -1402,25 +1520,38 @@ export interface PrimerCheckoutOptions {
1402
1520
  /**
1403
1521
  * Configuration options for Google Pay button and payment flow.
1404
1522
  *
1405
- * Controls button appearance, billing/shipping address collection,
1406
- * and email requirements. The SDK manages button rendering automatically,
1407
- * so the `container` property is omitted from this configuration.
1523
+ * When `sdkCore: true` (default), uses `GooglePayClientOptions` from SDK Core with
1524
+ * full express checkout support including:
1525
+ * - Button customization (`buttonType`, `buttonColor`, `buttonSizeMode`, `buttonRadius`, `buttonLocale`)
1526
+ * - Billing/shipping address capture
1527
+ * - Email collection
1528
+ * - Shipping method selection
1529
+ *
1530
+ * When `sdkCore: false`, uses legacy `GooglePayOptions` with basic button styling.
1408
1531
  *
1409
- * @see GooglePayOptions - Full type definition in compatibility-types.ts
1410
1532
  * @example
1411
1533
  * ```typescript
1534
+ * // SDK Core mode (recommended)
1535
+ * googlePay: {
1536
+ * buttonType: 'checkout',
1537
+ * buttonColor: 'white',
1538
+ * buttonSizeMode: 'fill',
1539
+ * buttonRadius: 8,
1540
+ * captureBillingAddress: true,
1541
+ * captureShippingAddress: true,
1542
+ * emailRequired: true,
1543
+ * requireShippingMethod: true,
1544
+ * }
1545
+ *
1546
+ * // Legacy mode (sdkCore: false)
1412
1547
  * googlePay: {
1413
1548
  * buttonType: 'buy',
1414
1549
  * buttonColor: 'black',
1415
1550
  * captureBillingAddress: true,
1416
- * emailRequired: true,
1417
- * shippingAddressParameters: {
1418
- * phoneNumberRequired: true
1419
- * }
1420
1551
  * }
1421
1552
  * ```
1422
1553
  */
1423
- googlePay?: Omit<GooglePayOptions, "container">;
1554
+ googlePay?: GooglePayClientOptions | Omit<GooglePayOptions, "container">;
1424
1555
  /**
1425
1556
  * Configuration options for PayPal button and payment flow.
1426
1557
  *
@@ -1996,8 +2127,8 @@ export interface PrepareHandler {
1996
2127
  export interface PaymentSuccessData {
1997
2128
  /** Minimal payment summary (ID, orderId, last4, brand) - reduced PII exposure */
1998
2129
  payment: PaymentSummary;
1999
- /** Payment method type (e.g., "PAYMENT_CARD", "PAYPAL") */
2000
- paymentMethodType: string;
2130
+ /** Payment method type. May be undefined when paymentMethodData is not included in response (e.g., legacy SDK mode). */
2131
+ paymentMethodType?: PaymentMethodType;
2001
2132
  /** Unix timestamp in seconds */
2002
2133
  timestamp: number;
2003
2134
  }
@@ -2015,8 +2146,8 @@ export interface PaymentFailureData {
2015
2146
  };
2016
2147
  /** Optional minimal payment summary if payment was created before failure */
2017
2148
  payment?: PaymentSummary;
2018
- /** Payment method type (e.g., "PAYMENT_CARD", "PAYPAL") */
2019
- paymentMethodType: string;
2149
+ /** Payment method type. May be undefined when payment object is not returned in the callback. */
2150
+ paymentMethodType?: PaymentMethodType;
2020
2151
  /** Unix timestamp in seconds */
2021
2152
  timestamp: number;
2022
2153
  }
@@ -2353,7 +2484,7 @@ export interface PrimerEvents {
2353
2484
  "primer:payment-start": CustomEvent<undefined>;
2354
2485
  "primer:payment-success": CustomEvent<{
2355
2486
  paymentSummary: PaymentSummary;
2356
- paymentMethodType: string;
2487
+ paymentMethodType?: PaymentMethodType;
2357
2488
  timestamp: number;
2358
2489
  }>;
2359
2490
  "primer:payment-failure": CustomEvent<{
@@ -2364,7 +2495,7 @@ export interface PrimerEvents {
2364
2495
  data?: Record<string, unknown>;
2365
2496
  };
2366
2497
  paymentSummary?: PaymentSummary;
2367
- paymentMethodType: string;
2498
+ paymentMethodType?: PaymentMethodType;
2368
2499
  timestamp: number;
2369
2500
  }>;
2370
2501
  "primer:vault:methods-update": CustomEvent<{
@@ -2415,7 +2546,7 @@ declare class PrimerEventsController implements ReactiveController {
2415
2546
  * Dispatch payment success event with minimal payment summary.
2416
2547
  * Called when payment completes successfully.
2417
2548
  */
2418
- dispatchPaymentSuccess(payment: Payment, paymentMethodType: string): void;
2549
+ dispatchPaymentSuccess(payment: Payment, paymentMethodType: PaymentMethodType | undefined): void;
2419
2550
  /**
2420
2551
  * Dispatch payment failure event.
2421
2552
  * Called when payment fails or is declined.
@@ -2425,7 +2556,7 @@ declare class PrimerEventsController implements ReactiveController {
2425
2556
  message: string;
2426
2557
  diagnosticsId?: string;
2427
2558
  data?: Record<string, unknown>;
2428
- }, paymentMethodType: string, payment?: Payment): void;
2559
+ }, paymentMethodType: PaymentMethodType | undefined, payment?: Payment): void;
2429
2560
  /**
2430
2561
  * Dispatch vault methods update event.
2431
2562
  * Called when vaulted payment methods are loaded or updated.
@@ -3519,9 +3650,9 @@ declare global {
3519
3650
  *
3520
3651
  * PayPal uses the standard button container approach:
3521
3652
  * - Renders to a button container div (not shadow root)
3522
- * - Passes buttonHeight in render options with PayPal SDK constraints (25-55px)
3653
+ * - Passes buttonHeight in render options (sdk-core constrains to 25-55px)
3523
3654
  * - Uses updateOverlayForContainer for disabled state
3524
- * - Warns if height exceeds maximum allowed by PayPal SDK
3655
+ * - Height is calculated from CSS (PAYMENT_METHOD_LINE_HEIGHT + padding)
3525
3656
  */
3526
3657
  declare class PayPalComponent extends LitElement {
3527
3658
  static styles: import("lit").CSSResult[];