@gustavo-valsechi/client 1.4.202 → 1.4.204
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.
|
@@ -41,12 +41,11 @@ var import_utils = __toESM(require("@gustavo-valsechi/utils"));
|
|
|
41
41
|
var import_lodash = __toESM(require("lodash"));
|
|
42
42
|
var import_assets = __toESM(require("../assets"));
|
|
43
43
|
function CreditCardComponent(props) {
|
|
44
|
-
var _a
|
|
44
|
+
var _a;
|
|
45
45
|
const flagRef = (0, import_react.useRef)({});
|
|
46
46
|
(0, import_react.useEffect)(() => {
|
|
47
47
|
const content = (0, import_tools.getCardContent)(props.number);
|
|
48
|
-
|
|
49
|
-
if (props.onSetFlag) props.onSetFlag(content || { flag: props.flag, logo: props.flagIcon });
|
|
48
|
+
if (props.onSetFlag) props.onSetFlag(content.flag ? content : { flag: props.flag || "", logo: props.flagIcon || "" });
|
|
50
49
|
if (!flagRef.current) return;
|
|
51
50
|
if (!content.logo && !props.flagIcon) {
|
|
52
51
|
flagRef.current.style.backgroundImage = "";
|
|
@@ -58,7 +57,7 @@ function CreditCardComponent(props) {
|
|
|
58
57
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "credit-card-left", children: [
|
|
59
58
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-top", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "credit-card-chip", style: { backgroundImage: `url(${import_assets.default.Chip})` } }) }),
|
|
60
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "credit-card-bottom", children: [
|
|
61
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-number", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-elipse", children: import_utils.default.mask.loop(props.number
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-number", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-elipse", children: import_utils.default.mask.loop(props.number, { sequencyNumber: 4, maxSequency: 4, placeholder: "\u2022" }) }) }),
|
|
62
61
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-name", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-elipse", children: import_lodash.default.deburr((_a = props.cardholder) == null ? void 0 : _a.replace(/[^A-Za-zÀ-ÿ\s]/g, "").toUpperCase()) || "Nome do Titular" }) })
|
|
63
62
|
] })
|
|
64
63
|
] }),
|
|
@@ -66,15 +65,7 @@ function CreditCardComponent(props) {
|
|
|
66
65
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "credit-card-top", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "credit-card-flag", ref: flagRef }) }),
|
|
67
66
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "credit-card-bottom", children: [
|
|
68
67
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "validade" }),
|
|
69
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: import_utils.default.mask.loop(
|
|
70
|
-
props.expiry || `${((_b = String(props.validityMonth)) == null ? void 0 : _b.length) === 1 ? `0${props.validityMonth}` : props.validityMonth}/${props.validityYear}`,
|
|
71
|
-
{
|
|
72
|
-
sequencyNumber: 2,
|
|
73
|
-
maxSequency: 2,
|
|
74
|
-
placeholder: "\u2022",
|
|
75
|
-
separator: "/"
|
|
76
|
-
}
|
|
77
|
-
) })
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: import_utils.default.mask.loop(props.expiry, { sequencyNumber: 2, maxSequency: 2, placeholder: "\u2022", separator: "/" }) })
|
|
78
69
|
] })
|
|
79
70
|
] })
|
|
80
71
|
] });
|
|
@@ -8,12 +8,11 @@ import Utils from "@gustavo-valsechi/utils";
|
|
|
8
8
|
import _ from "lodash";
|
|
9
9
|
import assets from "../assets";
|
|
10
10
|
function CreditCardComponent(props) {
|
|
11
|
-
var _a
|
|
11
|
+
var _a;
|
|
12
12
|
const flagRef = useRef({});
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
const content = getCardContent(props.number);
|
|
15
|
-
|
|
16
|
-
if (props.onSetFlag) props.onSetFlag(content || { flag: props.flag, logo: props.flagIcon });
|
|
15
|
+
if (props.onSetFlag) props.onSetFlag(content.flag ? content : { flag: props.flag || "", logo: props.flagIcon || "" });
|
|
17
16
|
if (!flagRef.current) return;
|
|
18
17
|
if (!content.logo && !props.flagIcon) {
|
|
19
18
|
flagRef.current.style.backgroundImage = "";
|
|
@@ -25,7 +24,7 @@ function CreditCardComponent(props) {
|
|
|
25
24
|
/* @__PURE__ */ jsxs("div", { className: "credit-card-left", children: [
|
|
26
25
|
/* @__PURE__ */ jsx("div", { className: "credit-card-top", children: /* @__PURE__ */ jsx("div", { id: "credit-card-chip", style: { backgroundImage: `url(${assets.Chip})` } }) }),
|
|
27
26
|
/* @__PURE__ */ jsxs("div", { className: "credit-card-bottom", children: [
|
|
28
|
-
/* @__PURE__ */ jsx("div", { className: "credit-card-number", children: /* @__PURE__ */ jsx("div", { className: "credit-card-elipse", children: Utils.mask.loop(props.number
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: "credit-card-number", children: /* @__PURE__ */ jsx("div", { className: "credit-card-elipse", children: Utils.mask.loop(props.number, { sequencyNumber: 4, maxSequency: 4, placeholder: "\u2022" }) }) }),
|
|
29
28
|
/* @__PURE__ */ jsx("div", { className: "credit-card-name", children: /* @__PURE__ */ jsx("div", { className: "credit-card-elipse", children: _.deburr((_a = props.cardholder) == null ? void 0 : _a.replace(/[^A-Za-zÀ-ÿ\s]/g, "").toUpperCase()) || "Nome do Titular" }) })
|
|
30
29
|
] })
|
|
31
30
|
] }),
|
|
@@ -33,15 +32,7 @@ function CreditCardComponent(props) {
|
|
|
33
32
|
/* @__PURE__ */ jsx("div", { className: "credit-card-top", children: /* @__PURE__ */ jsx("div", { id: "credit-card-flag", ref: flagRef }) }),
|
|
34
33
|
/* @__PURE__ */ jsxs("div", { className: "credit-card-bottom", children: [
|
|
35
34
|
/* @__PURE__ */ jsx("span", { children: "validade" }),
|
|
36
|
-
/* @__PURE__ */ jsx("span", { children: Utils.mask.loop(
|
|
37
|
-
props.expiry || `${((_b = String(props.validityMonth)) == null ? void 0 : _b.length) === 1 ? `0${props.validityMonth}` : props.validityMonth}/${props.validityYear}`,
|
|
38
|
-
{
|
|
39
|
-
sequencyNumber: 2,
|
|
40
|
-
maxSequency: 2,
|
|
41
|
-
placeholder: "\u2022",
|
|
42
|
-
separator: "/"
|
|
43
|
-
}
|
|
44
|
-
) })
|
|
35
|
+
/* @__PURE__ */ jsx("span", { children: Utils.mask.loop(props.expiry, { sequencyNumber: 2, maxSequency: 2, placeholder: "\u2022", separator: "/" }) })
|
|
45
36
|
] })
|
|
46
37
|
] })
|
|
47
38
|
] });
|