@primer-io/primer-js 0.3.12 → 0.5.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.
@@ -244,6 +244,31 @@ export type PortalComponentProps = {
244
244
  oneventName?: (e: CustomEvent<CustomEvent>) => void;
245
245
  };
246
246
 
247
+ export type SelectComponentProps = {
248
+ /** The name attribute for the select element */
249
+ name?: string;
250
+ /** The id attribute for the select element */
251
+ id?: string;
252
+ /** The current value of the select */
253
+ value?: string;
254
+ /** Whether the select is disabled */
255
+ disabled?: boolean;
256
+ /** Whether the select is in an error state */
257
+ "has-error"?: boolean;
258
+ /** Placeholder text for the select */
259
+ placeholder?: string;
260
+ /** Array of options for the select */
261
+ options?: SelectOption[];
262
+ /** Fired when selection changes */
263
+ onchange?: (e: CustomEvent<CustomEvent>) => void;
264
+ /** Fired when input value changes */
265
+ oninput?: (e: CustomEvent<CustomEvent>) => void;
266
+ /** Fired when select receives focus */
267
+ onfocus?: (e: CustomEvent<CustomEvent>) => void;
268
+ /** Fired when select loses focus */
269
+ onblur?: (e: CustomEvent<CustomEvent>) => void;
270
+ };
271
+
247
272
  export type SpinnerComponentProps = {
248
273
  /** Color of the spinner
249
274
  Defaults to the design system loader color */
@@ -277,6 +302,30 @@ export type AchPaymentComponentProps = {
277
302
  "onprimer-ach-mandate-declined"?: (e: CustomEvent<CustomEvent>) => void;
278
303
  };
279
304
 
305
+ export type BillingAddressComponentProps = {
306
+ /** Configuration from SDK Core containing checkoutModules configuration */
307
+ configuration?: ConfigurationContextType;
308
+ /** Headless SDK utilities for API methods like setBillingAddress */
309
+ headlessUtils?: HeadlessUtilsContextType;
310
+ /** Fired when form data changes */
311
+ "onprimer-billing-address-change"?: (e: CustomEvent<CustomEvent>) => void;
312
+ /** Fired when form is submitted */
313
+ "onprimer-billing-address-submit"?: (e: CustomEvent<CustomEvent>) => void;
314
+ };
315
+
316
+ export type BlikComponentProps = {
317
+ /** Payment method configuration */
318
+ paymentMethod?: InitializedPaymentMethod;
319
+ /** Disables component interaction when true */
320
+ disabled?: boolean;
321
+ /** */
322
+ paymentManagers?: InitializedManagersMap;
323
+ /** Dispatched on successful payment */
324
+ "onprimer-payment-success"?: (e: CustomEvent<never>) => void;
325
+ /** Dispatched on payment error */
326
+ "onprimer-payment-error"?: (e: CustomEvent<never>) => void;
327
+ };
328
+
280
329
  export type CardFormComponentProps = {
281
330
  /** */
282
331
  "hide-labels"?: boolean;
@@ -434,7 +483,7 @@ export type CardFormSubmitComponentProps = {
434
483
  Falls back to localized default if not explicitly set. */
435
484
  buttonText?: string;
436
485
  /** */
437
- headlessInstance?: HeadlessUtilsContextType;
486
+ headlessUtils?: HeadlessUtilsContextType;
438
487
  /** */
439
488
  clientOptions?: ClientOptionsContextType;
440
489
  /** */
@@ -831,6 +880,19 @@ export type CustomElements = {
831
880
  */
832
881
  "primer-portal": Partial<PortalComponentProps & BaseProps & BaseEvents>;
833
882
 
883
+ /**
884
+ * A native select dropdown component
885
+ * ---
886
+ *
887
+ *
888
+ * ### **Events:**
889
+ * - **change** - Fired when selection changes
890
+ * - **input** - Fired when input value changes
891
+ * - **focus** - Fired when select receives focus
892
+ * - **blur** - Fired when select loses focus
893
+ */
894
+ "primer-select": Partial<SelectComponentProps & BaseProps & BaseEvents>;
895
+
834
896
  /**
835
897
  * Spinner component with configurable size and color
836
898
  * Adapted to work both standalone and within input components
@@ -852,6 +914,45 @@ export type CustomElements = {
852
914
  */
853
915
  "primer-ach-payment": Partial<AchPaymentComponentProps & BaseProps & BaseEvents>;
854
916
 
917
+ /**
918
+ * BillingAddressComponent provides a form for collecting billing address information.
919
+ *
920
+ * Configuration is exclusively server-side via SDK Core's checkoutModules. Field visibility
921
+ * is determined by the BILLING_ADDRESS module in the client session configuration.
922
+ * ---
923
+ *
924
+ *
925
+ * ### **Events:**
926
+ * - **primer-billing-address-change** - Fired when form data changes
927
+ * - **primer-billing-address-submit** - Fired when form is submitted
928
+ *
929
+ * ### **Methods:**
930
+ * - **validateForSubmission(): _Promise<boolean>_** - Public method to validate billing address fields
931
+ * Called by the parent form (card-form) when submitting
932
+ * Returns true if billing address is valid
933
+ * Note: Does NOT call setBillingAddress API - that happens after card validation
934
+ * - **submitToSDK(): _Promise<boolean>_** - Public method to submit billing address to SDK Core
935
+ * Called by parent form ONLY after both card and billing address validation pass
936
+ *
937
+ * Note: headlessUtils is guaranteed to be available when this method is called,
938
+ * as the component only renders (and becomes interactive) after initialization task completes.
939
+ */
940
+ "primer-billing-address": Partial<BillingAddressComponentProps & BaseProps & BaseEvents>;
941
+
942
+ /**
943
+ * BLIK Payment Component
944
+ *
945
+ * Consolidated component handling BLIK payment flow from button click through
946
+ * payment completion. Uses a 4-state machine for managing the user experience.
947
+ * ---
948
+ *
949
+ *
950
+ * ### **Events:**
951
+ * - **primer-payment-success** - Dispatched on successful payment
952
+ * - **primer-payment-error** - Dispatched on payment error
953
+ */
954
+ "primer-blik": Partial<BlikComponentProps & BaseProps & BaseEvents>;
955
+
855
956
  /**
856
957
  * CardFormComponent serves as a container for card input components.
857
958
  * It handles form submission, validation, and provides context to child components.