@gr4vy/secure-fields-react 1.7.0 → 1.8.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 +12 -0
- package/README.md +1 -0
- package/lib/hooks/use-secure-fields.js +5 -1
- package/lib/hooks/use-secure-fields.js.map +1 -1
- package/lib/types.d.ts +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v1.8.0 (Mon Jun 12 2023)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- feat: add form status event [#343](https://github.com/gr4vy/secure-fields/pull/343) ([@theturboboy](https://github.com/theturboboy))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Andrei Haidukevich ([@theturboboy](https://github.com/theturboboy))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v1.4.0 (Wed Apr 12 2023)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ const { SecureFields } = require(`@gr4vy/secure-fields-react`)
|
|
|
49
49
|
| `debug` | Enables / disables the debug mode. |
|
|
50
50
|
| `font` | Loads a custom font from [Google Fonts](https://fonts.google.com/) to be used inside inputs. You can define the font family as well as styles or weights as a string (e.g. "Lato:400,600"). To use the loaded font, add the correct `fontFamily` property to the styles object when rendering fields. |
|
|
51
51
|
| `onReady` | An event handler that listens for Secure Fields to be securely loaded. It listens for the [`READY`](../secure-fields/README.md#events) event and accepts a callback function. |
|
|
52
|
+
| `onFormChange` | An event handler that listens for Secure Fields change. It listens for the [`FORM_CHANGE`](../secure-fields/README.md#events) event and accepts a callback function. |
|
|
52
53
|
| `onCardVaultSuccess` | An event handler that listens for card data to be securely vaulted. It listens for the [`CARD_VAULT_SUCCESS`](../secure-fields/README.md#events) event and accepts a callback function. |
|
|
53
54
|
| `onCardVaultFailure` | An event handler that listens for any failures when storing any card data. It listens for the [`CARD_VAULT_FAILURE`](../secure-fields/README.md#events) event and accepts a callback function. |
|
|
54
55
|
|
|
@@ -29,7 +29,7 @@ var react_1 = require("react");
|
|
|
29
29
|
exports.SecureFieldsContext = (0, react_1.createContext)(null);
|
|
30
30
|
var SecureFieldsProvider = function (_a) {
|
|
31
31
|
var children = _a.children, config = __rest(_a, ["children"]);
|
|
32
|
-
var sessionId = config.sessionId, debug = config.debug, font = config.font, onReady = config.onReady, onCardVaultSuccess = config.onCardVaultSuccess, onCardVaultFailure = config.onCardVaultFailure;
|
|
32
|
+
var sessionId = config.sessionId, debug = config.debug, font = config.font, onReady = config.onReady, onFormChange = config.onFormChange, onCardVaultSuccess = config.onCardVaultSuccess, onCardVaultFailure = config.onCardVaultFailure;
|
|
33
33
|
var _b = (0, react_1.useState)(), secureFields = _b[0], setSecureFields = _b[1];
|
|
34
34
|
(0, react_1.useEffect)(function () {
|
|
35
35
|
setSecureFields(new secure_fields_1.SecureFields(config));
|
|
@@ -40,6 +40,8 @@ var SecureFieldsProvider = function (_a) {
|
|
|
40
40
|
font && (secureFields === null || secureFields === void 0 ? void 0 : secureFields.addFont(font));
|
|
41
41
|
onReady &&
|
|
42
42
|
(secureFields === null || secureFields === void 0 ? void 0 : secureFields.addEventListener(secure_fields_1.SecureFields.Events.READY, onReady));
|
|
43
|
+
onFormChange &&
|
|
44
|
+
(secureFields === null || secureFields === void 0 ? void 0 : secureFields.addEventListener(secure_fields_1.SecureFields.Events.FORM_CHANGE, onFormChange));
|
|
43
45
|
onCardVaultSuccess &&
|
|
44
46
|
(secureFields === null || secureFields === void 0 ? void 0 : secureFields.addEventListener(secure_fields_1.SecureFields.Events.CARD_VAULT_SUCCESS, onCardVaultSuccess));
|
|
45
47
|
onCardVaultFailure &&
|
|
@@ -47,6 +49,8 @@ var SecureFieldsProvider = function (_a) {
|
|
|
47
49
|
return function () {
|
|
48
50
|
onReady &&
|
|
49
51
|
(secureFields === null || secureFields === void 0 ? void 0 : secureFields.removeEventListener(secure_fields_1.SecureFields.Events.READY, onReady));
|
|
52
|
+
onFormChange &&
|
|
53
|
+
(secureFields === null || secureFields === void 0 ? void 0 : secureFields.removeEventListener(secure_fields_1.SecureFields.Events.FORM_CHANGE, onFormChange));
|
|
50
54
|
onCardVaultSuccess &&
|
|
51
55
|
(secureFields === null || secureFields === void 0 ? void 0 : secureFields.removeEventListener(secure_fields_1.SecureFields.Events.CARD_VAULT_SUCCESS, onCardVaultSuccess));
|
|
52
56
|
onCardVaultFailure &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-secure-fields.js","sourceRoot":"","sources":["../../src/hooks/use-secure-fields.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAmD;AACnD,+BAOc;AAGD,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAG7C,IAAI,CAAC,CAAA;AAED,IAAM,oBAAoB,GAAG,UAAC,EAGT;IAF1B,IAAA,QAAQ,cAAA,EACL,MAAM,cAF0B,YAGpC,CADU;IAGP,IAAA,SAAS,
|
|
1
|
+
{"version":3,"file":"use-secure-fields.js","sourceRoot":"","sources":["../../src/hooks/use-secure-fields.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAmD;AACnD,+BAOc;AAGD,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAG7C,IAAI,CAAC,CAAA;AAED,IAAM,oBAAoB,GAAG,UAAC,EAGT;IAF1B,IAAA,QAAQ,cAAA,EACL,MAAM,cAF0B,YAGpC,CADU;IAGP,IAAA,SAAS,GAOP,MAAM,UAPC,EACT,KAAK,GAMH,MAAM,MANH,EACL,IAAI,GAKF,MAAM,KALJ,EACJ,OAAO,GAIL,MAAM,QAJD,EACP,YAAY,GAGV,MAAM,aAHI,EACZ,kBAAkB,GAEhB,MAAM,mBAFU,EAClB,kBAAkB,GAChB,M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CAAC,WAAW,EAC/B,YAAY,CACb,CAAA,CAAA;YACH,kBAAkB;iBAChB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,mBAAmB,CAC/B,4BAAY,CAAC,MAAM,CAAC,kBAAkB,EACtC,kBAAkB,CACnB,CAAA,CAAA;YACH,kBAAkB;iBAChB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,mBAAmB,CAC/B,4BAAY,CAAC,MAAM,CAAC,kBAAkB,EACtC,kBAAkB,CACnB,CAAA,CAAA;QACL,CAAC,CAAA;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAElB,OAAO,CACL,uBAAC,2BAAmB,CAAC,QAAQ,aAAC,KAAK,EAAE,EAAE,YAAY,cAAA,EAAE,KAAK,OAAA,EAAE,gBACzD,QAAQ,IACoB,CAChC,CAAA;AACH,CAAC,CAAA;AAtEY,QAAA,oBAAoB,wBAsEhC;AAEM,IAAM,eAAe,GAAG;IAC7B,OAAO,IAAA,kBAAU,EAAC,2BAAmB,CAAC,CAAA;AACxC,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config as BaseConfig, Field as BaseField } from '@gr4vy/secure-fields';
|
|
1
|
+
import { Config as BaseConfig, Field as BaseField, FormChangeEventData } from '@gr4vy/secure-fields';
|
|
2
2
|
import { MutableRefObject } from 'react';
|
|
3
3
|
export type CardVaultFailureData = {
|
|
4
4
|
status: number;
|
|
@@ -11,6 +11,7 @@ export type Config = BaseConfig & {
|
|
|
11
11
|
onReady?: (config: {
|
|
12
12
|
version: string;
|
|
13
13
|
} & BaseConfig) => void;
|
|
14
|
+
onFormChange?: (data: FormChangeEventData) => void;
|
|
14
15
|
onCardVaultSuccess?: () => void;
|
|
15
16
|
onCardVaultFailure?: (data: CardVaultFailureData) => void;
|
|
16
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gr4vy/secure-fields-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-dom": ">=17.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@gr4vy/secure-fields": "^1.
|
|
42
|
+
"@gr4vy/secure-fields": "^1.8.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3dd41297bcc0af5d91326298bac10c544f4010c6"
|
|
55
55
|
}
|