@gr4vy/secure-fields-react 2.7.1 → 2.9.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # v2.9.0 (Tue Jun 23 2026)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - feat: add click to pay method to update checkout options [#1236](https://github.com/gr4vy/secure-fields/pull/1236) ([@luca-gr4vy](https://github.com/luca-gr4vy) [@cbetta](https://github.com/cbetta))
6
+
7
+ #### Authors: 2
8
+
9
+ - Cristiano Betta ([@cbetta](https://github.com/cbetta))
10
+ - Luca Allievi ([@luca-gr4vy](https://github.com/luca-gr4vy))
11
+
12
+ ---
13
+
1
14
  # v2.7.1 (Wed May 20 2026)
2
15
 
3
16
  #### 🐛 Bug Fix
package/README.md CHANGED
@@ -268,3 +268,23 @@ The following props can be used on the `SecureFields` component to listen to spe
268
268
  | `onClickToPayCheckoutWithNewCard` | An event handler that listens for users checking out with a new card. It listens for the [`CLICK_TO_PAY_CHECKOUT_WITH_NEW_CARD`](https://docs.gr4vy.com/guides/payments/secure-fields/events#global-events) event and accepts a callback function. |
269
269
  | `onClickToPayUnableToLoadDpa` | An event handler that listens for Click to Pay not being able to load the provided DPA. It listens for the [`CLICK_TO_PAY_UNABLE_TO_LOAD_DPA`](https://docs.gr4vy.com/guides/payments/secure-fields/events#global-events) event and accepts a callback function. |
270
270
  | `onMethodChange` | An event handler that listens for users selecting a different method (either `card` or `click-to-pay`). It listens for the [`METHOD_CHANGE`](https://docs.gr4vy.com/guides/payments/secure-fields/events#global-events) event and accepts a callback function with the selected method. |
271
+
272
+ ### Updating Checkout Options
273
+
274
+ Update the Click to Pay checkout options after initialization. This is useful when the transaction amount changes (e.g. cart updates) before the user submits.
275
+
276
+ ```js
277
+ const { secureFields } = useSecureFields()
278
+
279
+ secureFields.clickToPay.updateCheckoutOptions({
280
+ transactionAmount: 9.99,
281
+ transactionCurrencyCode: 'AUD',
282
+ })
283
+ ```
284
+
285
+ Options are merged with previously set values, so you can update individual fields without losing the rest.
286
+
287
+ | Option | Type | Description |
288
+ | ------------------------- | -------- | ------------------------------ |
289
+ | `transactionAmount` | `number` | The transaction amount. |
290
+ | `transactionCurrencyCode` | `string` | The transaction currency code. |
@@ -1,3 +1,3 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ClickToPayComponentProps } from "../../types";
3
- export declare const CardForm: ({ children, id: _, style, onVisibilityChange, ...rest }: PropsWithChildren<ClickToPayComponentProps>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const CardForm: ({ children, id: _, style, onVisibilityChange, ...rest }: PropsWithChildren<ClickToPayComponentProps>) => import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { ClickToPayOptions } from "../../types";
2
- export declare const ClickToPay: (options: ClickToPayOptions) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ClickToPay: (options: ClickToPayOptions) => import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ClickToPayComponentProps } from "../../types";
3
- export declare const ClickToPaySignIn: ({ children, id: _, style, onVisibilityChange, ...rest }: PropsWithChildren<ClickToPayComponentProps>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const ClickToPaySignIn: ({ children, id: _, style, onVisibilityChange, ...rest }: PropsWithChildren<ClickToPayComponentProps>) => import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  export declare const FieldGroup: ({ children, ...rest }: {
2
2
  [x: string]: any;
3
3
  children: any;
4
- }) => import("react/jsx-runtime").JSX.Element;
4
+ }) => import("react").JSX.Element;
@@ -3,4 +3,4 @@ import { Config } from "../../types";
3
3
  export type Props = {
4
4
  children?: ReactNode;
5
5
  } & Config;
6
- export declare const SecureFields: ({ children, ...config }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const SecureFields: ({ children, ...config }: Props) => import("react").JSX.Element;
@@ -7,7 +7,7 @@ export declare const SecureFieldsContext: import("react").Context<{
7
7
  clickToPay?: ClickToPayInstance;
8
8
  setClickToPay?: Dispatch<ClickToPayInstance>;
9
9
  }>;
10
- export declare const SecureFieldsProvider: ({ children, ...config }: PropsWithChildren<Config>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const SecureFieldsProvider: ({ children, ...config }: PropsWithChildren<Config>) => import("react").JSX.Element;
11
11
  export declare const useSecureFields: () => {
12
12
  secureFields: SecureFields;
13
13
  debug: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gr4vy/secure-fields-react",
3
- "version": "2.7.1",
3
+ "version": "2.9.0",
4
4
  "description": "Gr4vy-hosted secure fields offering advanced theming, PCI compliance, event handling, and more.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index",
@@ -42,7 +42,7 @@
42
42
  "react-dom": ">=17.0.0"
43
43
  },
44
44
  "dependencies": {
45
- "@gr4vy/secure-fields": "^2.7.1"
45
+ "@gr4vy/secure-fields": "^2.9.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@testing-library/react": "^12.1.5",
@@ -56,5 +56,5 @@
56
56
  "access": "public",
57
57
  "registry": "https://registry.npmjs.org"
58
58
  },
59
- "gitHead": "83a98fd6f3322aaa7229e49ae89671b4453cfde4"
59
+ "gitHead": "5420fcc4a7977fafc84ca551e5acad083cd70d4d"
60
60
  }