@reevit/react 0.4.4 → 0.4.5

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/dist/index.d.mts CHANGED
@@ -668,7 +668,7 @@ declare class ReevitAPIClient {
668
668
  /**
669
669
  * Creates a payment intent
670
670
  */
671
- createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string, options?: {
671
+ createPaymentIntent(config: ReevitCheckoutConfig, method?: PaymentMethod, country?: string, options?: {
672
672
  preferredProviders?: string[];
673
673
  allowedProviders?: string[];
674
674
  }): Promise<{
package/dist/index.d.ts CHANGED
@@ -668,7 +668,7 @@ declare class ReevitAPIClient {
668
668
  /**
669
669
  * Creates a payment intent
670
670
  */
671
- createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string, options?: {
671
+ createPaymentIntent(config: ReevitCheckoutConfig, method?: PaymentMethod, country?: string, options?: {
672
672
  preferredProviders?: string[];
673
673
  allowedProviders?: string[];
674
674
  }): Promise<{
package/dist/index.js CHANGED
@@ -216,12 +216,14 @@ var ReevitAPIClient = class {
216
216
  const request = {
217
217
  amount: config.amount,
218
218
  currency: config.currency,
219
- method: this.mapPaymentMethod(method),
220
219
  country,
221
220
  customer_id: config.email || config.metadata?.customerId,
222
221
  phone: config.phone,
223
222
  metadata
224
223
  };
224
+ if (method) {
225
+ request.method = this.mapPaymentMethod(method);
226
+ }
225
227
  if (options?.preferredProviders?.length || options?.allowedProviders?.length) {
226
228
  request.policy = {
227
229
  prefer: options?.preferredProviders,
@@ -428,7 +430,8 @@ function useReevit(options) {
428
430
  }
429
431
  const reference = config.reference || generateReference();
430
432
  const country = detectCountryFromCurrency(config.currency);
431
- const paymentMethod = method || config.paymentMethods?.[0] || "card";
433
+ const defaultMethod = config.paymentMethods && config.paymentMethods.length === 1 ? config.paymentMethods[0] : void 0;
434
+ const paymentMethod = method ?? defaultMethod;
432
435
  let data;
433
436
  let error;
434
437
  if (config.paymentLinkCode) {