@gr4vy/secure-fields-react 2.2.6 → 2.3.0--canary.1104.02821af.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/README.md +20 -0
- package/lib/components/CardNumber/CardNumber.d.ts +2 -2
- package/lib/components/CardNumber/CardNumber.js +5 -4
- package/lib/components/CardNumber/CardNumber.js.map +1 -1
- package/lib/components/ExpiryDate/ExpiryDate.d.ts +2 -2
- package/lib/components/ExpiryDate/ExpiryDate.js +5 -4
- package/lib/components/ExpiryDate/ExpiryDate.js.map +1 -1
- package/lib/components/Field/Field.d.ts +2 -2
- package/lib/components/Field/Field.js +7 -4
- package/lib/components/Field/Field.js.map +1 -1
- package/lib/components/SecurityCode/SecurityCode.d.ts +2 -2
- package/lib/components/SecurityCode/SecurityCode.js +5 -4
- package/lib/components/SecurityCode/SecurityCode.js.map +1 -1
- package/lib/components/ThreeDSecure/ThreeDSecure.d.ts +2 -0
- package/lib/components/ThreeDSecure/ThreeDSecure.js +22 -0
- package/lib/components/ThreeDSecure/ThreeDSecure.js.map +1 -0
- package/lib/components/ThreeDSecure/index.d.ts +1 -0
- package/lib/components/ThreeDSecure/index.js +6 -0
- package/lib/components/ThreeDSecure/index.js.map +1 -0
- package/lib/hooks/use-click-to-pay.js +2 -2
- package/lib/hooks/use-click-to-pay.js.map +1 -1
- package/lib/hooks/use-secure-fields.js +1 -12
- package/lib/hooks/use-secure-fields.js.map +1 -1
- package/lib/hooks/use-secure-input.js +7 -4
- package/lib/hooks/use-secure-input.js.map +1 -1
- package/lib/hooks/use-three-d-secure.d.ts +2 -0
- package/lib/hooks/use-three-d-secure.js +33 -0
- package/lib/hooks/use-three-d-secure.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +13 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -133,6 +133,26 @@ The available secure fields components are `CardNumber`, `ExpiryDate`, `Security
|
|
|
133
133
|
| `onFocus` | Attaches an event handler to the input, listening for the focus event. The data available in the passed callback includes an `id` representing the field type (e.g. `expiryDate`). |
|
|
134
134
|
| `onInput` | Attaches an event handler to the input, listening for the input event. The data available in the passed callback includes an `id` representing the field type (e.g. `expiryDate`) and some useful card validation information, such as the current scheme (e.g. `visa`) and security code label (e.g. `CVV`). |
|
|
135
135
|
|
|
136
|
+
Each field component supports a `ref` that exposes a `clear()` method to reset the value programmatically.
|
|
137
|
+
|
|
138
|
+
```jsx
|
|
139
|
+
import { useRef } from 'react'
|
|
140
|
+
import { CardNumber } from '@gr4vy/secure-fields-react'
|
|
141
|
+
|
|
142
|
+
const CardNumberWithClear = () => {
|
|
143
|
+
const cardNumberRef = useRef(null)
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<>
|
|
147
|
+
<CardNumber ref={cardNumberRef} />
|
|
148
|
+
<button type="button" onClick={() => cardNumberRef.current?.clear()}>
|
|
149
|
+
Clear
|
|
150
|
+
</button>
|
|
151
|
+
</>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
136
156
|
## Click to Pay
|
|
137
157
|
|
|
138
158
|
Click to Pay is the better way to pay online – featuring advanced payment technology built on secure remote commerce industry standards.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Field as FieldProps } from "../../types";
|
|
2
|
-
export declare const CardNumber: (
|
|
1
|
+
import { Field as FieldProps, FieldHandle } from "../../types";
|
|
2
|
+
export declare const CardNumber: import("react").ForwardRefExoticComponent<Omit<FieldProps, "ref" | "type"> & import("react").RefAttributes<FieldHandle>>;
|
|
@@ -13,9 +13,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.CardNumber = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
16
17
|
var Field_1 = require("../Field");
|
|
17
|
-
|
|
18
|
-
return (0, jsx_runtime_1.jsx)(Field_1.Field, __assign({ type: "number" }, props));
|
|
19
|
-
};
|
|
20
|
-
exports.CardNumber = CardNumber;
|
|
18
|
+
exports.CardNumber = (0, react_1.forwardRef)(function (props, ref) {
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(Field_1.Field, __assign({ ref: ref, type: "number" }, props));
|
|
20
|
+
});
|
|
21
|
+
exports.CardNumber.displayName = 'CardNumber';
|
|
21
22
|
//# sourceMappingURL=CardNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardNumber.js","sourceRoot":"","sources":["../../../src/components/CardNumber/CardNumber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAwC;
|
|
1
|
+
{"version":3,"file":"CardNumber.js","sourceRoot":"","sources":["../../../src/components/CardNumber/CardNumber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAkC;AAClC,kCAAwC;AAG3B,QAAA,UAAU,GAAG,IAAA,kBAAU,EAGlC,UAAC,KAAK,EAAE,GAAG;IACX,OAAO,uBAAC,aAAK,aAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,IAAK,KAAK,EAAI,CAAA;AACrD,CAAC,CAAC,CAAA;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Field as FieldProps } from "../../types";
|
|
2
|
-
export declare const ExpiryDate: (
|
|
1
|
+
import { Field as FieldProps, FieldHandle } from "../../types";
|
|
2
|
+
export declare const ExpiryDate: import("react").ForwardRefExoticComponent<Omit<FieldProps, "ref" | "type"> & import("react").RefAttributes<FieldHandle>>;
|
|
@@ -13,9 +13,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.ExpiryDate = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
16
17
|
var Field_1 = require("../Field");
|
|
17
|
-
|
|
18
|
-
return (0, jsx_runtime_1.jsx)(Field_1.Field, __assign({ type: "expiryDate" }, props));
|
|
19
|
-
};
|
|
20
|
-
exports.ExpiryDate = ExpiryDate;
|
|
18
|
+
exports.ExpiryDate = (0, react_1.forwardRef)(function (props, ref) {
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(Field_1.Field, __assign({ ref: ref, type: "expiryDate" }, props));
|
|
20
|
+
});
|
|
21
|
+
exports.ExpiryDate.displayName = 'ExpiryDate';
|
|
21
22
|
//# sourceMappingURL=ExpiryDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpiryDate.js","sourceRoot":"","sources":["../../../src/components/ExpiryDate/ExpiryDate.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAwC;
|
|
1
|
+
{"version":3,"file":"ExpiryDate.js","sourceRoot":"","sources":["../../../src/components/ExpiryDate/ExpiryDate.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAkC;AAClC,kCAAwC;AAG3B,QAAA,UAAU,GAAG,IAAA,kBAAU,EAGlC,UAAC,KAAK,EAAE,GAAG;IACX,OAAO,uBAAC,aAAK,aAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,YAAY,IAAK,KAAK,EAAI,CAAA;AACzD,CAAC,CAAC,CAAA;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Field as FieldProps } from "../../types";
|
|
2
|
-
export declare const Field: (
|
|
1
|
+
import { Field as FieldProps, FieldHandle } from "../../types";
|
|
2
|
+
export declare const Field: import("react").ForwardRefExoticComponent<Omit<FieldProps, "ref"> & import("react").RefAttributes<FieldHandle>>;
|
|
@@ -15,10 +15,13 @@ exports.Field = void 0;
|
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_1 = require("react");
|
|
17
17
|
var use_secure_input_1 = require("../../hooks/use-secure-input");
|
|
18
|
-
|
|
18
|
+
exports.Field = (0, react_1.forwardRef)(function (props, handleRef) {
|
|
19
19
|
var ref = (0, react_1.useRef)(null);
|
|
20
|
-
(0, use_secure_input_1.useSecureInput)(__assign(__assign({}, props), { ref: ref }));
|
|
20
|
+
var field = (0, use_secure_input_1.useSecureInput)(__assign(__assign({}, props), { ref: ref }));
|
|
21
|
+
(0, react_1.useImperativeHandle)(handleRef, function () { return ({
|
|
22
|
+
clear: function () { var _a; return (_a = field === null || field === void 0 ? void 0 : field.clear) === null || _a === void 0 ? void 0 : _a.call(field); },
|
|
23
|
+
}); }, [field]);
|
|
21
24
|
return (0, jsx_runtime_1.jsx)("input", __assign({ ref: ref }, props));
|
|
22
|
-
};
|
|
23
|
-
exports.Field = Field;
|
|
25
|
+
});
|
|
26
|
+
exports.Field.displayName = 'Field';
|
|
24
27
|
//# sourceMappingURL=Field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../src/components/Field/Field.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../src/components/Field/Field.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA+D;AAC/D,iEAAuD;AAG1C,QAAA,KAAK,GAAG,IAAA,kBAAU,EAC7B,UAAC,KAAK,EAAE,SAAS;IACf,IAAM,GAAG,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAA;IACxB,IAAM,KAAK,GAAG,IAAA,iCAAc,wBAAM,KAAK,KAAE,GAAG,KAAA,IAAG,CAAA;IAE/C,IAAA,2BAAmB,EACjB,SAAS,EACT,cAAM,OAAA,CAAC;QACL,KAAK,EAAE,sBAAM,OAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,qDAAI,CAAA,EAAA;KAC9B,CAAC,EAFI,CAEJ,EACF,CAAC,KAAK,CAAC,CACR,CAAA;IAED,OAAO,2CAAO,GAAG,EAAE,GAAG,IAAM,KAAK,EAAI,CAAA;AACvC,CAAC,CACF,CAAA;AAED,aAAK,CAAC,WAAW,GAAG,OAAO,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Field as FieldProps } from "../../types";
|
|
2
|
-
export declare const SecurityCode: (
|
|
1
|
+
import { Field as FieldProps, FieldHandle } from "../../types";
|
|
2
|
+
export declare const SecurityCode: import("react").ForwardRefExoticComponent<Omit<FieldProps, "ref" | "type"> & import("react").RefAttributes<FieldHandle>>;
|
|
@@ -13,9 +13,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.SecurityCode = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
16
17
|
var Field_1 = require("../Field");
|
|
17
|
-
|
|
18
|
-
return (0, jsx_runtime_1.jsx)(Field_1.Field, __assign({ type: "securityCode" }, props));
|
|
19
|
-
};
|
|
20
|
-
exports.SecurityCode = SecurityCode;
|
|
18
|
+
exports.SecurityCode = (0, react_1.forwardRef)(function (props, ref) {
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(Field_1.Field, __assign({ ref: ref, type: "securityCode" }, props));
|
|
20
|
+
});
|
|
21
|
+
exports.SecurityCode.displayName = 'SecurityCode';
|
|
21
22
|
//# sourceMappingURL=SecurityCode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityCode.js","sourceRoot":"","sources":["../../../src/components/SecurityCode/SecurityCode.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAwC;
|
|
1
|
+
{"version":3,"file":"SecurityCode.js","sourceRoot":"","sources":["../../../src/components/SecurityCode/SecurityCode.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAkC;AAClC,kCAAwC;AAG3B,QAAA,YAAY,GAAG,IAAA,kBAAU,EAGpC,UAAC,KAAK,EAAE,GAAG;IACX,OAAO,uBAAC,aAAK,aAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,cAAc,IAAK,KAAK,EAAI,CAAA;AAC3D,CAAC,CAAC,CAAA;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ThreeDSecure = void 0;
|
|
15
|
+
var react_1 = require("react");
|
|
16
|
+
var use_three_d_secure_1 = require("../../hooks/use-three-d-secure");
|
|
17
|
+
exports.ThreeDSecure = (0, react_1.forwardRef)(function (options, ref) {
|
|
18
|
+
(0, use_three_d_secure_1.useThreeDSecure)(__assign({ ref: ref }, options));
|
|
19
|
+
return null;
|
|
20
|
+
});
|
|
21
|
+
exports.ThreeDSecure.displayName = 'ThreeDSecure';
|
|
22
|
+
//# sourceMappingURL=ThreeDSecure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeDSecure.js","sourceRoot":"","sources":["../../../src/components/ThreeDSecure/ThreeDSecure.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAoD;AACpD,qEAA0D;AAG7C,QAAA,YAAY,GAAG,IAAA,kBAAU,EACpC,UAAC,OAAO,EAAE,GAAG;IACX,IAAA,oCAAe,aAAG,GAAG,EAAE,GAAoC,IAAK,OAAO,EAAG,CAAA;IAC1E,OAAO,IAAI,CAAA;AACb,CAAC,CACF,CAAA;AAED,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ThreeDSecure } from './ThreeDSecure';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThreeDSecure = void 0;
|
|
4
|
+
var ThreeDSecure_1 = require("./ThreeDSecure");
|
|
5
|
+
Object.defineProperty(exports, "ThreeDSecure", { enumerable: true, get: function () { return ThreeDSecure_1.ThreeDSecure; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ThreeDSecure/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,4GAAA,YAAY,OAAA"}
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-click-to-pay.js","sourceRoot":"","sources":["../../src/hooks/use-click-to-pay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AAEjC,yDAAqD;AAE9C,IAAM,aAAa,GAAG,UAAC,OAA0B;IAChD,IAAA,KAA8C,IAAA,mCAAe,GAAE,EAA7D,YAAY,kBAAA,EAAE,UAAU,gBAAA,EAAE,aAAa,mBAAsB,CAAA;IAC7D,IAAA,GAAG,GAAc,OAAO,IAArB,EAAK,IAAI,UAAK,OAAO,EAA1B,OAAgB,CAAF,CAAY;IAEhC,IAAM,QAAQ,GAAG;;;;;oBACf,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAA,IAAI,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"use-click-to-pay.js","sourceRoot":"","sources":["../../src/hooks/use-click-to-pay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AAEjC,yDAAqD;AAE9C,IAAM,aAAa,GAAG,UAAC,OAA0B;IAChD,IAAA,KAA8C,IAAA,mCAAe,GAAE,EAA7D,YAAY,kBAAA,EAAE,UAAU,gBAAA,EAAE,aAAa,mBAAsB,CAAA;IAC7D,IAAA,GAAG,GAAc,OAAO,IAArB,EAAK,IAAI,UAAK,OAAO,EAA1B,OAAgB,CAAF,CAAY;IAEhC,IAAM,QAAQ,GAAG;;;;;oBACf,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAA,IAAI,UAAU,EAAE,CAAC;wBACjD,sBAAM;oBACR,CAAC;oBACD,KAAA,aAAa,CAAA;oBACX,qBAAM,YAAY,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,wBACxC,IAAI,KACP,QAAQ,EAAE,0BAA0B,EACpC,MAAM,EAAE,uBAAuB,IAC/B,EAAA;;oBALJ,kBACE,SAIE,EACH,CAAA;;;;SACF,CAAA;IAED,IAAA,iBAAS,EAAC;QACR,QAAQ,EAAE,CAAA;QACV,uDAAuD;IACzD,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAElB,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAvBY,QAAA,aAAa,iBAuBzB"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -73,7 +62,7 @@ var SecureFieldsProvider = function (_a) {
|
|
|
73
62
|
};
|
|
74
63
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
64
|
}, [secureFields, handlersDeps]);
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(exports.SecureFieldsContext.Provider,
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(exports.SecureFieldsContext.Provider, { value: { secureFields: secureFields, debug: debug, clickToPay: clickToPay, setClickToPay: setClickToPay }, children: children }));
|
|
77
66
|
};
|
|
78
67
|
exports.SecureFieldsProvider = SecureFieldsProvider;
|
|
79
68
|
var useSecureFields = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-secure-fields.js","sourceRoot":"","sources":["../../src/hooks/use-secure-fields.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-secure-fields.js","sourceRoot":"","sources":["../../src/hooks/use-secure-fields.tsx"],"names":[],"mappings":"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"}
|
|
@@ -44,9 +44,12 @@ var useSecureInput = function (options) {
|
|
|
44
44
|
return secureFields.addField(ref.current, __assign({ type: type }, rest));
|
|
45
45
|
};
|
|
46
46
|
(0, react_1.useEffect)(function () {
|
|
47
|
+
if (!secureFields || !(ref === null || ref === void 0 ? void 0 : ref.current) || !(options === null || options === void 0 ? void 0 : options.type) || field) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
47
50
|
setField(addField(options === null || options === void 0 ? void 0 : options.type));
|
|
48
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
-
}, [secureFields]);
|
|
52
|
+
}, [secureFields, ref === null || ref === void 0 ? void 0 : ref.current, options === null || options === void 0 ? void 0 : options.type, field]);
|
|
50
53
|
(0, react_1.useEffect)(function () {
|
|
51
54
|
if (!field)
|
|
52
55
|
return;
|
|
@@ -54,9 +57,9 @@ var useSecureInput = function (options) {
|
|
|
54
57
|
onFocus && field.addEventListener('focus', onFocus);
|
|
55
58
|
onInput && field.addEventListener('input', onInput);
|
|
56
59
|
return function () {
|
|
57
|
-
onBlur && field.
|
|
58
|
-
onFocus && field.
|
|
59
|
-
onInput && field.
|
|
60
|
+
onBlur && field.removeEventListener('blur', onBlur);
|
|
61
|
+
onFocus && field.removeEventListener('focus', onFocus);
|
|
62
|
+
onInput && field.removeEventListener('input', onInput);
|
|
60
63
|
};
|
|
61
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
65
|
}, [secureFields, field]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-secure-input.js","sourceRoot":"","sources":["../../src/hooks/use-secure-input.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAA2C;AAC3C,yDAAyD;AAGzD,IAAM,WAAW,GAAG;IAClB,MAAM,EAAE,oBAAoB;IAC5B,UAAU,EAAE,oBAAoB;IAChC,YAAY,EAAE,sBAAsB;CACrC,CAAA;AAEM,IAAM,cAAc,GAAG,UAAC,OAAe;IACpC,IAAA,YAAY,GAAK,IAAA,mCAAe,GAAE,aAAtB,CAAsB;IACpC,IAAA,KAAoB,IAAA,gBAAQ,GAAe,EAA1C,KAAK,QAAA,EAAE,QAAQ,QAA2B,CAAA;IACzC,IAAA,GAAG,GAA8C,OAAO,IAArD,EAAE,IAAI,GAAwC,OAAO,KAA/C,EAAE,MAAM,GAAgC,OAAO,OAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,OAAO,GAAc,OAAO,QAArB,EAAK,IAAI,UAAK,OAAO,EAA1D,+CAAgD,CAAF,CAAY;IAEhE,IAAM,QAAQ,GAAG,UAAC,IAAmB;QACnC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAA,IAAI,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"use-secure-input.js","sourceRoot":"","sources":["../../src/hooks/use-secure-input.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAA2C;AAC3C,yDAAyD;AAGzD,IAAM,WAAW,GAAG;IAClB,MAAM,EAAE,oBAAoB;IAC5B,UAAU,EAAE,oBAAoB;IAChC,YAAY,EAAE,sBAAsB;CACrC,CAAA;AAEM,IAAM,cAAc,GAAG,UAAC,OAAe;IACpC,IAAA,YAAY,GAAK,IAAA,mCAAe,GAAE,aAAtB,CAAsB;IACpC,IAAA,KAAoB,IAAA,gBAAQ,GAAe,EAA1C,KAAK,QAAA,EAAE,QAAQ,QAA2B,CAAA;IACzC,IAAA,GAAG,GAA8C,OAAO,IAArD,EAAE,IAAI,GAAwC,OAAO,KAA/C,EAAE,MAAM,GAAgC,OAAO,OAAvC,EAAE,OAAO,GAAuB,OAAO,QAA9B,EAAE,OAAO,GAAc,OAAO,QAArB,EAAK,IAAI,UAAK,OAAO,EAA1D,+CAAgD,CAAF,CAAY;IAEhE,IAAM,QAAQ,GAAG,UAAC,IAAmB;QACnC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAA,IAAI,KAAK,EAAE,CAAC;YAC5C,OAAM;QACR,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,OAAO,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,eAAO,IAAI,EAAG,CAAA;QAClE,CAAC;QAED,OAAO,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,aAAI,IAAI,MAAA,IAAK,IAAI,EAAG,CAAA;IAC9D,CAAC,CAAA;IAED,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAA,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAA,IAAI,KAAK,EAAE,CAAC;YAC9D,OAAM;QACR,CAAC;QAED,QAAQ,CAAC,QAAQ,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC,CAAA;QACjC,uDAAuD;IACzD,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IAEtD,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,KAAK;YAAE,OAAM;QAElB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChD,OAAO,IAAI,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACnD,OAAO,IAAI,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAEnD,OAAO;YACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YACnD,OAAO,IAAI,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACtD,OAAO,IAAI,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACxD,CAAC,CAAA;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAA;IAEzB,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AA1CY,QAAA,cAAc,kBA0C1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useThreeDSecure = void 0;
|
|
4
|
+
var secure_fields_1 = require("@gr4vy/secure-fields");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var use_secure_fields_1 = require("./use-secure-fields");
|
|
7
|
+
var useThreeDSecure = function (options) {
|
|
8
|
+
var secureFields = (0, use_secure_fields_1.useSecureFields)().secureFields;
|
|
9
|
+
var _a = options || {}, ref = _a.ref, challengeWindowSize = _a.challengeWindowSize, onThreeDSFinish = _a.onThreeDSFinish, onThreeDSStart = _a.onThreeDSStart;
|
|
10
|
+
(0, react_1.useEffect)(function () {
|
|
11
|
+
if (!secureFields || !(ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
secureFields.addThreeDSecure(ref.current, { challengeWindowSize: challengeWindowSize });
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
}, [secureFields]);
|
|
17
|
+
(0, react_1.useEffect)(function () {
|
|
18
|
+
if (!secureFields)
|
|
19
|
+
return;
|
|
20
|
+
onThreeDSStart &&
|
|
21
|
+
secureFields.addEventListener(secure_fields_1.SecureFields.Events.THREE_DS_START, onThreeDSStart);
|
|
22
|
+
onThreeDSFinish &&
|
|
23
|
+
secureFields.addEventListener(secure_fields_1.SecureFields.Events.THREE_DS_FINISH, onThreeDSFinish);
|
|
24
|
+
return function () {
|
|
25
|
+
onThreeDSStart &&
|
|
26
|
+
secureFields.removeEventListener(secure_fields_1.SecureFields.Events.THREE_DS_START, onThreeDSStart);
|
|
27
|
+
onThreeDSFinish &&
|
|
28
|
+
secureFields.removeEventListener(secure_fields_1.SecureFields.Events.THREE_DS_FINISH, onThreeDSFinish);
|
|
29
|
+
};
|
|
30
|
+
}, [secureFields, onThreeDSStart, onThreeDSFinish]);
|
|
31
|
+
};
|
|
32
|
+
exports.useThreeDSecure = useThreeDSecure;
|
|
33
|
+
//# sourceMappingURL=use-three-d-secure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-three-d-secure.js","sourceRoot":"","sources":["../../src/hooks/use-three-d-secure.tsx"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,+BAAiC;AAEjC,yDAAqD;AAE9C,IAAM,eAAe,GAAG,UAAC,OAA6B;IACnD,IAAA,YAAY,GAAK,IAAA,mCAAe,GAAE,aAAtB,CAAsB;IACpC,IAAA,KACJ,OAAO,IAAI,EAAE,EADP,GAAG,SAAA,EAAE,mBAAmB,yBAAA,EAAE,eAAe,qBAAA,EAAE,cAAc,oBAClD,CAAA;IAEf,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAA,EAAE,CAAC;YACnC,OAAM;QACR,CAAC;QAED,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,mBAAmB,qBAAA,EAAE,CAAC,CAAA;QAClE,uDAAuD;IACzD,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAElB,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,YAAY;YAAE,OAAM;QAEzB,cAAc;YACZ,YAAY,CAAC,gBAAgB,CAC3B,4BAAY,CAAC,MAAM,CAAC,cAAc,EAClC,cAAc,CACf,CAAA;QACH,eAAe;YACb,YAAY,CAAC,gBAAgB,CAC3B,4BAAY,CAAC,MAAM,CAAC,eAAe,EACnC,eAAe,CAChB,CAAA;QAEH,OAAO;YACL,cAAc;gBACZ,YAAY,CAAC,mBAAmB,CAC9B,4BAAY,CAAC,MAAM,CAAC,cAAc,EAClC,cAAc,CACf,CAAA;YACH,eAAe;gBACb,YAAY,CAAC,mBAAmB,CAC9B,4BAAY,CAAC,MAAM,CAAC,eAAe,EACnC,eAAe,CAChB,CAAA;QACL,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC,CAAA;AACrD,CAAC,CAAA;AAzCY,QAAA,eAAe,mBAyC3B"}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export { ExpiryDate } from "./components/ExpiryDate";
|
|
|
5
5
|
export { SecureFields } from "./components/SecureFields";
|
|
6
6
|
export { SecurityCode } from "./components/SecurityCode";
|
|
7
7
|
export { Field } from "./components/Field";
|
|
8
|
+
export { ThreeDSecure } from "./components/ThreeDSecure";
|
|
9
|
+
export { useThreeDSecure } from "./hooks/use-three-d-secure";
|
|
8
10
|
export { useSecureFields } from "./hooks/use-secure-fields";
|
|
9
11
|
export { useSecureInput } from "./hooks/use-secure-input";
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSecureInput = exports.useSecureFields = exports.Field = exports.SecurityCode = exports.SecureFields = exports.ExpiryDate = exports.ClickToPaySignIn = exports.ClickToPay = exports.CardNumber = exports.CardForm = void 0;
|
|
3
|
+
exports.useSecureInput = exports.useSecureFields = exports.useThreeDSecure = exports.ThreeDSecure = exports.Field = exports.SecurityCode = exports.SecureFields = exports.ExpiryDate = exports.ClickToPaySignIn = exports.ClickToPay = exports.CardNumber = exports.CardForm = void 0;
|
|
4
4
|
var CardForm_1 = require("./components/CardForm");
|
|
5
5
|
Object.defineProperty(exports, "CardForm", { enumerable: true, get: function () { return CardForm_1.CardForm; } });
|
|
6
6
|
var CardNumber_1 = require("./components/CardNumber");
|
|
@@ -16,6 +16,10 @@ var SecurityCode_1 = require("./components/SecurityCode");
|
|
|
16
16
|
Object.defineProperty(exports, "SecurityCode", { enumerable: true, get: function () { return SecurityCode_1.SecurityCode; } });
|
|
17
17
|
var Field_1 = require("./components/Field");
|
|
18
18
|
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return Field_1.Field; } });
|
|
19
|
+
var ThreeDSecure_1 = require("./components/ThreeDSecure");
|
|
20
|
+
Object.defineProperty(exports, "ThreeDSecure", { enumerable: true, get: function () { return ThreeDSecure_1.ThreeDSecure; } });
|
|
21
|
+
var use_three_d_secure_1 = require("./hooks/use-three-d-secure");
|
|
22
|
+
Object.defineProperty(exports, "useThreeDSecure", { enumerable: true, get: function () { return use_three_d_secure_1.useThreeDSecure; } });
|
|
19
23
|
var use_secure_fields_1 = require("./hooks/use-secure-fields");
|
|
20
24
|
Object.defineProperty(exports, "useSecureFields", { enumerable: true, get: function () { return use_secure_fields_1.useSecureFields; } });
|
|
21
25
|
var use_secure_input_1 = require("./hooks/use-secure-input");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;AAAA,kDAA8C;AAArC,oGAAA,QAAQ,OAAA;AACjB,sDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,sDAAoE;AAA3D,wGAAA,UAAU,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACrC,sDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,0DAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,0DAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,4CAAwC;AAA/B,8FAAA,KAAK,OAAA;AACd,+DAAyD;AAAhD,oHAAA,eAAe,OAAA;AACxB,6DAAuD;AAA9C,kHAAA,cAAc,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;AAAA,kDAA8C;AAArC,oGAAA,QAAQ,OAAA;AACjB,sDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,sDAAoE;AAA3D,wGAAA,UAAU,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACrC,sDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,0DAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,0DAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,4CAAwC;AAA/B,8FAAA,KAAK,OAAA;AACd,0DAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,iEAA0D;AAAjD,qHAAA,eAAe,OAAA;AACxB,+DAAyD;AAAhD,oHAAA,eAAe,OAAA;AACxB,6DAAuD;AAA9C,kHAAA,cAAc,OAAA"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickToPayOptions as BaseClickToPayOptions, ClickToPayInstance, Config as BaseConfig, Field as BaseField, FormChangeEventData } from '@gr4vy/secure-fields';
|
|
1
|
+
import { ClickToPayOptions as BaseClickToPayOptions, ClickToPayInstance, Config as BaseConfig, Field as BaseField, FormChangeEventData, ThreeDSecureOptions as BaseThreeDSecureOptions } from '@gr4vy/secure-fields';
|
|
2
2
|
import { MutableRefObject } from 'react';
|
|
3
3
|
export type CardVaultFailureData = {
|
|
4
4
|
status: number;
|
|
@@ -33,9 +33,21 @@ export type Field = BaseField & {
|
|
|
33
33
|
onFocus?: (data: any) => void;
|
|
34
34
|
onInput?: (data: any) => void;
|
|
35
35
|
};
|
|
36
|
+
export type FieldHandle = {
|
|
37
|
+
clear: () => void;
|
|
38
|
+
};
|
|
36
39
|
export type ClickToPayOptions = BaseClickToPayOptions & {
|
|
37
40
|
ref?: MutableRefObject<HTMLElement>;
|
|
38
41
|
};
|
|
39
42
|
export type ClickToPayComponentProps = JSX.IntrinsicElements['div'] & {
|
|
40
43
|
onVisibilityChange?: (visible: boolean) => void;
|
|
41
44
|
};
|
|
45
|
+
export type ThreeDSEventData = {
|
|
46
|
+
element: HTMLElement;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
export type ThreeDSecureOptions = BaseThreeDSecureOptions & {
|
|
50
|
+
ref?: MutableRefObject<HTMLElement>;
|
|
51
|
+
onThreeDSStart?: (data: ThreeDSEventData) => void;
|
|
52
|
+
onThreeDSFinish?: (data: ThreeDSEventData) => void;
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gr4vy/secure-fields-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0--canary.1104.02821af.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",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"build": "tsc -p tsconfig.prod.json && cp ../secure-fields/src/style.css ./lib/style.css",
|
|
23
23
|
"clean": "rm -rf lib *.tgz",
|
|
24
24
|
"dev": "TOKEN=$(yarn --silent token) webpack serve --config webpack.dev.js",
|
|
25
|
-
"lint": "eslint src
|
|
25
|
+
"lint": "eslint src/**/*.{ts,tsx}",
|
|
26
26
|
"prebuild": "yarn clean",
|
|
27
27
|
"prepack": "yarn build",
|
|
28
28
|
"serve:watch": "yarn run watch",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"react-dom": ">=17.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@gr4vy/secure-fields": "
|
|
44
|
+
"@gr4vy/secure-fields": "2.3.0--canary.1104.02821af.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@testing-library/react": "^12.1.5",
|
|
48
48
|
"@testing-library/react-hooks": "^8.0.1",
|
|
49
49
|
"react": "^17.0.2",
|
|
50
50
|
"react-dom": "^17.0.2",
|
|
51
|
-
"ts-patch": "^
|
|
51
|
+
"ts-patch": "^3.3.0",
|
|
52
52
|
"typescript-transform-paths": "^3.5.6"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public",
|
|
56
56
|
"registry": "https://registry.npmjs.org"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "02821af8e20266bb75ffe2c1115829213181266b"
|
|
59
59
|
}
|