@bloque/payments-core 0.0.8 → 0.0.10

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.cjs CHANGED
@@ -53,6 +53,10 @@ class BloqueCheckout {
53
53
  mode,
54
54
  checkoutUrl,
55
55
  appearance: options.appearance,
56
+ showInstallments: options.showInstallments,
57
+ paymentMethods: options.paymentMethods || [
58
+ 'card'
59
+ ],
56
60
  onReady: options.onReady,
57
61
  onSuccess: options.onSuccess,
58
62
  onError: options.onError,
@@ -64,14 +68,16 @@ class BloqueCheckout {
64
68
  if (this.iframe) return this.iframe;
65
69
  this.iframe = document.createElement('iframe');
66
70
  let iframeUrl = this.options.checkoutUrl;
71
+ const params = new URLSearchParams();
67
72
  if (this.options.appearance) {
68
- const params = new URLSearchParams();
69
73
  if (this.options.appearance.primaryColor) params.set('primaryColor', this.options.appearance.primaryColor);
70
74
  if (this.options.appearance.borderRadius) params.set('borderRadius', this.options.appearance.borderRadius);
71
75
  if (this.options.appearance.fontFamily) params.set('fontFamily', this.options.appearance.fontFamily);
72
- const queryString = params.toString();
73
- if (queryString) iframeUrl = `${iframeUrl}?${queryString}`;
74
76
  }
77
+ if (this.options.showInstallments) params.set('showInstallments', 'true');
78
+ if (this.options.paymentMethods && this.options.paymentMethods.length > 0) params.set('paymentMethods', this.options.paymentMethods.join(','));
79
+ const queryString = params.toString();
80
+ if (queryString) iframeUrl = `${iframeUrl}?${queryString}`;
75
81
  this.iframe.src = iframeUrl;
76
82
  this.iframe.setAttribute('frameborder', '0');
77
83
  this.iframe.setAttribute('allowtransparency', 'true');
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { BloqueCheckout, createCheckout, init } from './checkout';
2
- export type { AppearanceConfig, BloqueCheckoutOptions, BloqueInitOptions, CheckoutMessage, CheckoutMessageType, PaymentResult, } from './types';
2
+ export type { AppearanceConfig, BloqueCheckoutOptions, BloqueInitOptions, CheckoutMessage, CheckoutMessageType, PaymentMethod, PaymentResult, } from './types';
package/dist/index.js CHANGED
@@ -23,6 +23,10 @@ class BloqueCheckout {
23
23
  mode,
24
24
  checkoutUrl,
25
25
  appearance: options.appearance,
26
+ showInstallments: options.showInstallments,
27
+ paymentMethods: options.paymentMethods || [
28
+ 'card'
29
+ ],
26
30
  onReady: options.onReady,
27
31
  onSuccess: options.onSuccess,
28
32
  onError: options.onError,
@@ -34,14 +38,16 @@ class BloqueCheckout {
34
38
  if (this.iframe) return this.iframe;
35
39
  this.iframe = document.createElement('iframe');
36
40
  let iframeUrl = this.options.checkoutUrl;
41
+ const params = new URLSearchParams();
37
42
  if (this.options.appearance) {
38
- const params = new URLSearchParams();
39
43
  if (this.options.appearance.primaryColor) params.set('primaryColor', this.options.appearance.primaryColor);
40
44
  if (this.options.appearance.borderRadius) params.set('borderRadius', this.options.appearance.borderRadius);
41
45
  if (this.options.appearance.fontFamily) params.set('fontFamily', this.options.appearance.fontFamily);
42
- const queryString = params.toString();
43
- if (queryString) iframeUrl = `${iframeUrl}?${queryString}`;
44
46
  }
47
+ if (this.options.showInstallments) params.set('showInstallments', 'true');
48
+ if (this.options.paymentMethods && this.options.paymentMethods.length > 0) params.set('paymentMethods', this.options.paymentMethods.join(','));
49
+ const queryString = params.toString();
50
+ if (queryString) iframeUrl = `${iframeUrl}?${queryString}`;
45
51
  this.iframe.src = iframeUrl;
46
52
  this.iframe.setAttribute('frameborder', '0');
47
53
  this.iframe.setAttribute('allowtransparency', 'true');
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type PaymentMethod = 'card' | 'pse';
1
2
  export interface AppearanceConfig {
2
3
  /**
3
4
  * Primary color for buttons and accents
@@ -54,6 +55,19 @@ export interface BloqueCheckoutOptions {
54
55
  * Appearance configuration for the checkout
55
56
  */
56
57
  appearance?: AppearanceConfig;
58
+ /**
59
+ * Whether to show installment options in the checkout
60
+ * @default false
61
+ */
62
+ showInstallments?: boolean;
63
+ /**
64
+ * Payment methods to display in the checkout
65
+ * @example ['card', 'pse'] - Both card and PSE
66
+ * @example ['pse'] - Only PSE
67
+ * @example ['card'] - Only card (default)
68
+ * @default ['card']
69
+ */
70
+ paymentMethods?: PaymentMethod[];
57
71
  /**
58
72
  * Callback fired when the checkout iframe is ready to receive the checkout ID
59
73
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/payments-core",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Core utilities and types for Bloque Payments.",
5
5
  "type": "module",
6
6
  "keywords": [