@primer-io/primer-js 1.3.0 → 1.4.1

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.
@@ -268,8 +268,6 @@ displays only the local portion (everything after the prefix). */
268
268
  export type SelectComponentProps = {
269
269
  /** The name attribute for the select element */
270
270
  name?: string;
271
- /** The id attribute for the select element */
272
- id?: string;
273
271
  /** The current value of the select */
274
272
  value?: string;
275
273
  /** Whether the select is disabled */
@@ -281,13 +279,13 @@ export type SelectComponentProps = {
281
279
  /** Array of options for the select */
282
280
  options?: SelectOption[];
283
281
  /** Fired when selection changes */
284
- onchange?: (e: CustomEvent<CustomEvent>) => void;
282
+ onchange?: (e: CustomEvent<never>) => void;
285
283
  /** Fired when input value changes */
286
- oninput?: (e: CustomEvent<CustomEvent>) => void;
284
+ oninput?: (e: CustomEvent<never>) => void;
287
285
  /** Fired when select receives focus */
288
- onfocus?: (e: CustomEvent<CustomEvent>) => void;
286
+ onfocus?: (e: CustomEvent<never>) => void;
289
287
  /** Fired when select loses focus */
290
- onblur?: (e: CustomEvent<CustomEvent>) => void;
288
+ onblur?: (e: CustomEvent<never>) => void;
291
289
  };
292
290
 
293
291
  export type SpinnerComponentProps = {
@@ -471,13 +469,13 @@ export type VaultManagerComponentProps = {
471
469
  addEventListener?: <K extends keyof VaultManagerEventMap>(
472
470
  type: K,
473
471
  listener: (ev: VaultManagerEventMap[K]) => void,
474
- options?: boolean | AddEventListenerOptions,
472
+ options?: boolean | AddEventListenerOptions
475
473
  ) => void;
476
474
  /** */
477
475
  removeEventListener?: <K extends keyof VaultManagerEventMap>(
478
476
  type: K,
479
477
  listener: (ev: VaultManagerEventMap[K]) => void,
480
- options?: boolean | AddEventListenerOptions,
478
+ options?: boolean | AddEventListenerOptions
481
479
  ) => void;
482
480
  /** */
483
481
  primerContext?: ContextType | undefined;
@@ -634,13 +632,13 @@ export type VaultDeleteConfirmationComponentProps = {
634
632
  addEventListener?: <K extends keyof VaultManagerEventMap>(
635
633
  type: K,
636
634
  listener: (ev: VaultManagerEventMap[K]) => void,
637
- options?: boolean | AddEventListenerOptions,
635
+ options?: boolean | AddEventListenerOptions
638
636
  ) => void;
639
637
  /** */
640
638
  removeEventListener?: <K extends keyof VaultManagerEventMap>(
641
639
  type: K,
642
640
  listener: (ev: VaultManagerEventMap[K]) => void,
643
- options?: boolean | AddEventListenerOptions,
641
+ options?: boolean | AddEventListenerOptions
644
642
  ) => void;
645
643
  };
646
644
 
@@ -653,13 +651,13 @@ export type VaultErrorMessageComponentProps = {
653
651
  addEventListener?: <K extends keyof VaultManagerEventMap>(
654
652
  type: K,
655
653
  listener: (ev: VaultManagerEventMap[K]) => void,
656
- options?: boolean | AddEventListenerOptions,
654
+ options?: boolean | AddEventListenerOptions
657
655
  ) => void;
658
656
  /** */
659
657
  removeEventListener?: <K extends keyof VaultManagerEventMap>(
660
658
  type: K,
661
659
  listener: (ev: VaultManagerEventMap[K]) => void,
662
- options?: boolean | AddEventListenerOptions,
660
+ options?: boolean | AddEventListenerOptions
663
661
  ) => void;
664
662
  };
665
663
 
@@ -672,13 +670,13 @@ export type VaultManagerHeaderComponentProps = {
672
670
  addEventListener?: <K extends keyof VaultManagerEventMap>(
673
671
  type: K,
674
672
  listener: (ev: VaultManagerEventMap[K]) => void,
675
- options?: boolean | AddEventListenerOptions,
673
+ options?: boolean | AddEventListenerOptions
676
674
  ) => void;
677
675
  /** */
678
676
  removeEventListener?: <K extends keyof VaultManagerEventMap>(
679
677
  type: K,
680
678
  listener: (ev: VaultManagerEventMap[K]) => void,
681
- options?: boolean | AddEventListenerOptions,
679
+ options?: boolean | AddEventListenerOptions
682
680
  ) => void;
683
681
  };
684
682
 
@@ -689,13 +687,13 @@ export type VaultPaymentMethodItemComponentProps = {
689
687
  addEventListener?: <K extends keyof VaultManagerEventMap>(
690
688
  type: K,
691
689
  listener: (ev: VaultManagerEventMap[K]) => void,
692
- options?: boolean | AddEventListenerOptions,
690
+ options?: boolean | AddEventListenerOptions
693
691
  ) => void;
694
692
  /** */
695
693
  removeEventListener?: <K extends keyof VaultManagerEventMap>(
696
694
  type: K,
697
695
  listener: (ev: VaultManagerEventMap[K]) => void,
698
- options?: boolean | AddEventListenerOptions,
696
+ options?: boolean | AddEventListenerOptions
699
697
  ) => void;
700
698
  /** */
701
699
  primerContext?: ContextType | undefined;
@@ -712,7 +712,7 @@ export interface PaymentMethodConfig<T = Record<string, unknown>> {
712
712
  id: string;
713
713
  type: PaymentMethodType;
714
714
  name: string;
715
- implementationType: "WEB_REDIRECT" | "NATIVE_SDK";
715
+ implementationType: "WEB_REDIRECT" | "NATIVE_SDK" | "BACKEND_DRIVEN";
716
716
  displayMetadata: {
717
717
  button: {
718
718
  backgroundColor: BackgroundColor;
@@ -1480,12 +1480,39 @@ export interface PrimerCheckoutOptions {
1480
1480
  */
1481
1481
  redirect?: {
1482
1482
  /**
1483
- * URL the payment method redirects back to after the customer completes
1484
- * (or cancels) the flow on the external page.
1483
+ * URL the customer is redirected back to after completing (or
1484
+ * cancelling) the payment on the external page.
1485
+ *
1486
+ * Required when the configured payment methods include any that may
1487
+ * redirect the customer to an external page. The SDK throws at initialization
1488
+ * if a redirect-capable payment method is enabled and this is
1489
+ * missing.
1490
+ *
1491
+ * **Setting up the return page**
1492
+ *
1493
+ * The URL you provide must host a page that mounts the
1494
+ * `<primer-checkout>` component again so the payment can be
1495
+ * resumed. Primer redirects the customer back with a new client
1496
+ * token appended as a `clientToken` query parameter — read it
1497
+ * from the URL and pass it to the component:
1498
+ *
1499
+ * ```html
1500
+ * <primer-checkout client-token=""></primer-checkout>
1501
+ * <script>
1502
+ * const clientToken = new URLSearchParams(window.location.search)
1503
+ * .get('clientToken');
1504
+ * document
1505
+ * .querySelector('primer-checkout')
1506
+ * .setAttribute('client-token', clientToken);
1507
+ * </script>
1508
+ * ```
1509
+ *
1510
+ * The SDK reads the intent embedded in the token, detects that
1511
+ * this is a return-from-redirect, and resumes the payment
1512
+ * automatically — no separate method call is required.
1485
1513
  *
1486
- * If omitted, the SDK uses the current page URL.
1487
1514
  */
1488
- returnUrl?: string;
1515
+ returnUrl: string;
1489
1516
  /**
1490
1517
  * Whether to force a full-page redirect for payment methods that would
1491
1518
  * otherwise open in a popup.
@@ -3296,10 +3323,6 @@ declare class SelectComponent extends LitElement {
3296
3323
  * The name attribute for the select element
3297
3324
  */
3298
3325
  name: string;
3299
- /**
3300
- * The id attribute for the select element
3301
- */
3302
- id: string;
3303
3326
  /**
3304
3327
  * The current value of the select
3305
3328
  */