@primer-io/primer-js 0.11.1 → 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.
- package/CHANGELOG.md +13 -0
- package/dist/chunks/{ar.KRXB3WQO.js → ar.44J7SJG6.js} +1 -1
- package/dist/chunks/{bg.6SKJRXIR.js → bg.LT2YIFOH.js} +1 -1
- package/dist/chunks/{ca.SANDLFEK.js → ca.KUW6ECYF.js} +1 -1
- package/dist/chunks/{chunk.QMLIEEKM.js → chunk.TIWM3PQ7.js} +1 -1
- package/dist/chunks/{cs.FC4I5M3C.js → cs.XQGMKIF3.js} +1 -1
- package/dist/chunks/{da.YI32NZ7B.js → da.HKIIDZRJ.js} +1 -1
- package/dist/chunks/{de.7M7UFQB7.js → de.O6IUA6FB.js} +1 -1
- package/dist/chunks/{el.XSGTYDZR.js → el.F35KS4NO.js} +1 -1
- package/dist/chunks/en-GB.PU23XE2E.js +1 -0
- package/dist/chunks/en.HQJMDTVQ.js +1 -0
- package/dist/chunks/{es-AR.TBWVUZEF.js → es-AR.OZ6CT5HA.js} +1 -1
- package/dist/chunks/{es-MX.6EMWUABR.js → es-MX.E4FWJ3FK.js} +1 -1
- package/dist/chunks/{es.XZLDFHYI.js → es.HEWO2JY7.js} +1 -1
- package/dist/chunks/{et-EE.JBSFMKZ2.js → et-EE.3GAJR6UB.js} +1 -1
- package/dist/chunks/{fi-FI.I75VK2ID.js → fi-FI.4TB5AYVQ.js} +1 -1
- package/dist/chunks/{fr.JBNP6RXT.js → fr.5GQNZ4TX.js} +1 -1
- package/dist/chunks/{he.PW253QAL.js → he.WGVF57WV.js} +1 -1
- package/dist/chunks/{hr.LM4RITYJ.js → hr.YPXJZUYV.js} +1 -1
- package/dist/chunks/{hu.JGCKQA6J.js → hu.RX3HFOR5.js} +1 -1
- package/dist/chunks/{id.VBXULDDY.js → id.3SO7FJHW.js} +1 -1
- package/dist/chunks/{it.7Q6BFLDK.js → it.Y7247AOF.js} +1 -1
- package/dist/chunks/{ja.QOC76SSC.js → ja.L6PF6O6A.js} +1 -1
- package/dist/chunks/{ko.BANZIFNH.js → ko.X53AFCXY.js} +1 -1
- package/dist/chunks/{lt-LT.Q2SRJOKH.js → lt-LT.HMQT67X4.js} +1 -1
- package/dist/chunks/{lt.XMNFEN5T.js → lt.YJ3FR7A2.js} +1 -1
- package/dist/chunks/{lv-LV.3AJDTMU5.js → lv-LV.HLFWSCCR.js} +1 -1
- package/dist/chunks/{lv.TFPDXNEV.js → lv.DEK5WXQB.js} +1 -1
- package/dist/chunks/{ms.FPTX4NM4.js → ms.E6PXJ4SR.js} +1 -1
- package/dist/chunks/{nb.CAFSKRQ2.js → nb.7357HC5J.js} +1 -1
- package/dist/chunks/{nl.7BPSDYTC.js → nl.QBFQWQBY.js} +1 -1
- package/dist/chunks/{nl_NL.6ZVCFPVW.js → nl_NL.RS7W3XGO.js} +1 -1
- package/dist/chunks/{pl.RF34QM23.js → pl.FSJRWYQ5.js} +1 -1
- package/dist/chunks/{pt-BR.AKDHLRUA.js → pt-BR.WVYS3Y2I.js} +1 -1
- package/dist/chunks/{pt.VBALOWHZ.js → pt.LUSIBC5X.js} +1 -1
- package/dist/chunks/{ro.WN7VCF27.js → ro.TKERTYBG.js} +1 -1
- package/dist/chunks/{ru.ICXGVGRR.js → ru.VPEQHZ2S.js} +1 -1
- package/dist/chunks/{sk.SIP5JIOX.js → sk.QFMGH6WL.js} +1 -1
- package/dist/chunks/{sl.R77UEKCA.js → sl.RUAKKCKD.js} +1 -1
- package/dist/chunks/{sr-RS.6M2YSTDX.js → sr-RS.WSZIECEH.js} +1 -1
- package/dist/chunks/{sv.33ZY4CDS.js → sv.AHI2S45X.js} +1 -1
- package/dist/chunks/{th.M27YUIZC.js → th.ZKRE26WN.js} +1 -1
- package/dist/chunks/{tr.Q2SIY6NA.js → tr.6NOOTQVO.js} +1 -1
- package/dist/chunks/{uk-UA.EJZOGSJR.js → uk-UA.A6S7PXDN.js} +1 -1
- package/dist/chunks/{vi.3RROGLXM.js → vi.4Z5L3EAS.js} +1 -1
- package/dist/chunks/{zh-CN.MQHNRMN4.js → zh-CN.SN6TXY6W.js} +1 -1
- package/dist/chunks/{zh-HK.WNR7XUSX.js → zh-HK.SQG5YIVQ.js} +1 -1
- package/dist/chunks/{zh-TW.GNCY2PNY.js → zh-TW.P2X3B7LC.js} +1 -1
- package/dist/custom-elements.json +1268 -1001
- package/dist/jsx/index.d.ts +2 -2
- package/dist/primer-loader.d.ts +150 -19
- package/dist/primer-loader.js +15 -10
- package/dist/vscode.html-custom-data.json +1 -1
- package/dist/web-types.json +2 -2
- package/package.json +1 -1
- package/dist/chunks/en-GB.VO4GDE3X.js +0 -1
- package/dist/chunks/en.MNFLVOE3.js +0 -1
package/dist/jsx/index.d.ts
CHANGED
|
@@ -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
|
|
1202
|
+
* - Passes buttonHeight in render options (sdk-core constrains to 25-55px)
|
|
1203
1203
|
* - Uses updateOverlayForContainer for disabled state
|
|
1204
|
-
* -
|
|
1204
|
+
* - Height is calculated from CSS (PAYMENT_METHOD_LINE_HEIGHT + padding)
|
|
1205
1205
|
* ---
|
|
1206
1206
|
*
|
|
1207
1207
|
*/
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
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.,
|
|
2000
|
-
paymentMethodType
|
|
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
|
|
2019
|
-
paymentMethodType
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
3653
|
+
* - Passes buttonHeight in render options (sdk-core constrains to 25-55px)
|
|
3523
3654
|
* - Uses updateOverlayForContainer for disabled state
|
|
3524
|
-
* -
|
|
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[];
|