@primer-io/primer-js 1.2.0 → 1.3.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.
@@ -238,6 +238,33 @@ export type InputWrapperComponentProps = {
238
238
  "has-error"?: boolean;
239
239
  };
240
240
 
241
+ export type PtPhoneNumberInputComponentProps = {
242
+ /** Fixed PT dial code. Exposed as a property only so tests can override. */
243
+ prefix?: string;
244
+ /** Externally-provided full phone number including the prefix. The component
245
+ displays only the local portion (everything after the prefix). */
246
+ value?: string;
247
+ /** */
248
+ placeholder?: string;
249
+ /** */
250
+ "input-id"?: string;
251
+ /** Maximum total length of the full phone number (including prefix). */
252
+ "max-length"?: number;
253
+ /** Minimum total length of the full phone number (including prefix). */
254
+ "min-length"?: number;
255
+ /** */
256
+ disabled?: boolean;
257
+ /** */
258
+ "has-errors"?: boolean;
259
+
260
+ /** */
261
+ oneventName?: (e: CustomEvent<CustomEvent>) => void;
262
+ /** CustomEvent<string> with full phone number on each keystroke */
263
+ oninput?: (e: CustomEvent<never>) => void;
264
+ /** CustomEvent<string> with full phone number on commit */
265
+ onchange?: (e: CustomEvent<never>) => void;
266
+ };
267
+
241
268
  export type SelectComponentProps = {
242
269
  /** The name attribute for the select element */
243
270
  name?: string;
@@ -284,6 +311,13 @@ export type AdyenKlarnaComponentProps = {
284
311
  primerContext?: ContextType | undefined;
285
312
  };
286
313
 
314
+ export type AdyenMbwayComponentProps = {
315
+ /** */
316
+ paymentMethod?: MbwayPaymentMethod | undefined;
317
+ /** */
318
+ disabled?: boolean;
319
+ };
320
+
287
321
  export type BillingAddressComponentProps = {
288
322
  /** */
289
323
  primerContext?: ContextType | undefined;
@@ -825,6 +859,28 @@ export type CustomElements = {
825
859
  */
826
860
  "primer-input-wrapper": Partial<InputWrapperComponentProps & BaseProps & BaseEvents>;
827
861
 
862
+ /**
863
+ * Portuguese Phone Number Input
864
+ *
865
+ * Inline phone input dedicated to Portuguese (+351) numbers. Renders a PT
866
+ * flag, a fixed `+351` prefix, and a digit-only field; the user types only
867
+ * the local digits. Emits `input` / `change` events whose detail is the full
868
+ * E.164 number (`+351` + digits) or an empty string when no digits are
869
+ * entered.
870
+ *
871
+ * This is intentionally PT-only — MB WAY is the only consumer and only
872
+ * operates in Portugal. If we ever need other locales, fork into a
873
+ * country-aware component rather than generalising this one.
874
+ * ---
875
+ *
876
+ *
877
+ * ### **Events:**
878
+ * - **eventName**
879
+ * - **input** - CustomEvent<string> with full phone number on each keystroke
880
+ * - **change** - CustomEvent<string> with full phone number on commit
881
+ */
882
+ "primer-pt-phone-number-input": Partial<PtPhoneNumberInputComponentProps & BaseProps & BaseEvents>;
883
+
828
884
  /**
829
885
  * A native select dropdown component
830
886
  * ---
@@ -853,6 +909,15 @@ export type CustomElements = {
853
909
  */
854
910
  "primer-adyen-klarna": Partial<AdyenKlarnaComponentProps & BaseProps & BaseEvents>;
855
911
 
912
+ /**
913
+ * Adyen MB WAY Payment Component
914
+ *
915
+ * Inline phone-number entry → tokenize → poll MB WAY app → resume.
916
+ * ---
917
+ *
918
+ */
919
+ "primer-adyen-mbway": Partial<AdyenMbwayComponentProps & BaseProps & BaseEvents>;
920
+
856
921
  /**
857
922
  * BillingAddressComponent provides a form for collecting billing address information.
858
923
  *
@@ -572,7 +572,8 @@ declare enum HeadlessManagerType {
572
572
  KLARNA = "KLARNA",
573
573
  ADYEN_KLARNA = "ADYEN_KLARNA",
574
574
  ACH = "ACH",
575
- BLIK = "BLIK"
575
+ BLIK = "BLIK",
576
+ MBWAY = "MBWAY"
576
577
  }
577
578
  declare enum EventTypes {
578
579
  CHANGE = "change",
@@ -1049,6 +1050,18 @@ export interface IBlikPaymentMethodManager {
1049
1050
  blikCode: string;
1050
1051
  }): Promise<void>;
1051
1052
  }
1053
+ /**
1054
+ * Adyen MB WAY Payment Method Manager
1055
+ *
1056
+ * Collects the user's phone number (with country prefix) inline, tokenizes
1057
+ * it, and polls the returned status URL until the user confirms the payment
1058
+ * in the MB WAY mobile app.
1059
+ */
1060
+ export interface IMbwayPaymentMethodManager {
1061
+ start(params: {
1062
+ phoneNumber: string;
1063
+ }): Promise<void>;
1064
+ }
1052
1065
  /**
1053
1066
  * Adyen Klarna payment option
1054
1067
  */
@@ -1910,10 +1923,11 @@ export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof
1910
1923
  * - ADYEN_KLARNA: Uses ADYEN_KLARNA manager
1911
1924
  * - PAYPAL, GOOGLE_PAY, APPLE_PAY: Use NATIVE manager
1912
1925
  * - ADYEN_BLIK: Uses BLIK manager
1926
+ * - ADYEN_MBWAY: Uses MBWAY manager
1913
1927
  *
1914
1928
  * All other payment methods use the REDIRECT manager by default.
1915
1929
  */
1916
- export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK>;
1930
+ export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK | typeof PaymentMethodType.ADYEN_MBWAY>;
1917
1931
  /**
1918
1932
  * Represents a payment method that uses the REDIRECT manager.
1919
1933
  *
@@ -1937,6 +1951,11 @@ export interface BlikPaymentMethod {
1937
1951
  managerType: HeadlessManagerType.BLIK;
1938
1952
  manager: IBlikPaymentMethodManager;
1939
1953
  }
1954
+ export interface MbwayPaymentMethod {
1955
+ type: typeof PaymentMethodType.ADYEN_MBWAY;
1956
+ managerType: HeadlessManagerType.MBWAY;
1957
+ manager: IMbwayPaymentMethodManager;
1958
+ }
1940
1959
  export type InitializedPaymentMethod = {
1941
1960
  type: typeof PaymentMethodType.STRIPE_ACH;
1942
1961
  managerType: HeadlessManagerType.ACH;
@@ -1953,7 +1972,7 @@ export type InitializedPaymentMethod = {
1953
1972
  type: typeof PaymentMethodType.ADYEN_KLARNA;
1954
1973
  managerType: HeadlessManagerType.ADYEN_KLARNA;
1955
1974
  manager: IAdyenKlarnaPaymentMethodManager;
1956
- } | BlikPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
1975
+ } | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
1957
1976
  export interface AssetsConfig {
1958
1977
  backgroundColor: string;
1959
1978
  name: string;
@@ -3204,6 +3223,59 @@ declare global {
3204
3223
  "primer-input": InputComponent;
3205
3224
  }
3206
3225
  }
3226
+ /**
3227
+ * Portuguese Phone Number Input
3228
+ *
3229
+ * Inline phone input dedicated to Portuguese (+351) numbers. Renders a PT
3230
+ * flag, a fixed `+351` prefix, and a digit-only field; the user types only
3231
+ * the local digits. Emits `input` / `change` events whose detail is the full
3232
+ * E.164 number (`+351` + digits) or an empty string when no digits are
3233
+ * entered.
3234
+ *
3235
+ * This is intentionally PT-only — MB WAY is the only consumer and only
3236
+ * operates in Portugal. If we ever need other locales, fork into a
3237
+ * country-aware component rather than generalising this one.
3238
+ *
3239
+ * @element primer-pt-phone-number-input
3240
+ *
3241
+ * @fires input - CustomEvent<string> with full phone number on each keystroke
3242
+ * @fires change - CustomEvent<string> with full phone number on commit
3243
+ */
3244
+ declare class PtPhoneNumberInputComponent extends LitElement {
3245
+ static styles: import("lit").CSSResult[];
3246
+ /** Fixed PT dial code. Exposed as a property only so tests can override. */
3247
+ prefix: string;
3248
+ /**
3249
+ * Externally-provided full phone number including the prefix. The component
3250
+ * displays only the local portion (everything after the prefix).
3251
+ */
3252
+ value: string;
3253
+ placeholder: string;
3254
+ inputId: string;
3255
+ /** Maximum total length of the full phone number (including prefix). */
3256
+ maxLength: number;
3257
+ /** Minimum total length of the full phone number (including prefix). */
3258
+ minLength: number;
3259
+ disabled: boolean;
3260
+ hasErrors: boolean;
3261
+ private inputEl?;
3262
+ /** Strip the prefix to get the local digit portion. */
3263
+ private get localDigits();
3264
+ /** Allowed local digit count, derived from total length minus prefix. */
3265
+ private get maxLocalDigits();
3266
+ updated(changed: Map<string, unknown>): void;
3267
+ private dispatchValueEvent;
3268
+ private handleInput;
3269
+ private handleChange;
3270
+ private handleHostClick;
3271
+ focus(): void;
3272
+ render(): TemplateResult;
3273
+ }
3274
+ declare global {
3275
+ interface HTMLElementTagNameMap {
3276
+ "primer-pt-phone-number-input": PtPhoneNumberInputComponent;
3277
+ }
3278
+ }
3207
3279
  export interface SelectOption {
3208
3280
  value: string;
3209
3281
  label: string;
@@ -3638,6 +3710,38 @@ declare global {
3638
3710
  "primer-adyen-klarna": AdyenKlarnaComponent;
3639
3711
  }
3640
3712
  }
3713
+ /**
3714
+ * Adyen MB WAY Payment Component
3715
+ *
3716
+ * Inline phone-number entry → tokenize → poll MB WAY app → resume.
3717
+ *
3718
+ * @element primer-adyen-mbway
3719
+ */
3720
+ declare class AdyenMbwayComponent extends LitElement {
3721
+ static styles: import("lit").CSSResult[];
3722
+ paymentMethod: MbwayPaymentMethod | undefined;
3723
+ disabled: boolean;
3724
+ private currentState;
3725
+ private phoneNumber;
3726
+ private errorMessage;
3727
+ private get isExpanded();
3728
+ private get isPhoneValid();
3729
+ private handleExpandedChange;
3730
+ private handleCollapse;
3731
+ private handleInput;
3732
+ private handleRetry;
3733
+ private submit;
3734
+ private renderExpandedInput;
3735
+ private renderLoading;
3736
+ private renderError;
3737
+ private renderExpandedState;
3738
+ render(): TemplateResult;
3739
+ }
3740
+ declare global {
3741
+ interface HTMLElementTagNameMap {
3742
+ "primer-adyen-mbway": AdyenMbwayComponent;
3743
+ }
3744
+ }
3641
3745
  declare class PaymentMethodComponent extends LitElement {
3642
3746
  static styles: import("lit").CSSResult[];
3643
3747
  type: PaymentMethodType | undefined;
@@ -3684,6 +3788,11 @@ declare class PaymentMethodButtonComponent extends LitElement {
3684
3788
  * Should be replaced once we align on a better solution across all platforms.
3685
3789
  */
3686
3790
  private _legacyGetButtonLabel;
3791
+ private _getBackgroundColor;
3792
+ private _getIconUrl;
3793
+ private _getIconPosition;
3794
+ private _getTextColor;
3795
+ private _getDisplayName;
3687
3796
  private _setupTask;
3688
3797
  private _handleClick;
3689
3798
  render(): symbol | import("lit-html").TemplateResult<1> | undefined;
@@ -5147,6 +5256,7 @@ declare global {
5147
5256
  export declare function loadPrimer(): void;
5148
5257
 
5149
5258
  export {
5259
+ AdyenMbwayComponent as AdyenMbway,
5150
5260
  ApplePayComponent as ApplePay,
5151
5261
  BillingAddressComponent as BillingAddress,
5152
5262
  BlikComponent as Blik,
@@ -5180,6 +5290,7 @@ export {
5180
5290
  PrimerIconComponent as PrimerIcon,
5181
5291
  PrimerKlarnaComponent as PrimerKlarna,
5182
5292
  PrimerMainComponent as PrimerMain,
5293
+ PtPhoneNumberInputComponent as PtPhoneNumberInput,
5183
5294
  RedirectPaymentComponent as RedirectPayment,
5184
5295
  SelectComponent as Select,
5185
5296
  ShowOtherPaymentsComponent as ShowOtherPayments,