@gustavo-valsechi/client 1.4.190 → 1.4.191

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.
@@ -45,13 +45,14 @@ function CreditCardComponent(props) {
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
+ if (props.onSetFlag) props.onSetFlag(content);
48
49
  if (!flagRef.current) return;
49
50
  if (!content.logo) {
50
51
  flagRef.current.style.backgroundImage = "";
51
52
  return;
52
53
  }
53
54
  flagRef.current.style.backgroundImage = `url(${content.logo})`;
54
- }, [flagRef, props.number]);
55
+ }, [flagRef, props.number, props.onSetFlag]);
55
56
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { children: [
56
57
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "credit-card-left", children: [
57
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})` } }) }),
@@ -12,13 +12,14 @@ function CreditCardComponent(props) {
12
12
  const flagRef = useRef({});
13
13
  useEffect(() => {
14
14
  const content = getCardContent(props.number);
15
+ if (props.onSetFlag) props.onSetFlag(content);
15
16
  if (!flagRef.current) return;
16
17
  if (!content.logo) {
17
18
  flagRef.current.style.backgroundImage = "";
18
19
  return;
19
20
  }
20
21
  flagRef.current.style.backgroundImage = `url(${content.logo})`;
21
- }, [flagRef, props.number]);
22
+ }, [flagRef, props.number, props.onSetFlag]);
22
23
  return /* @__PURE__ */ jsxs(Container, { children: [
23
24
  /* @__PURE__ */ jsxs("div", { className: "credit-card-left", children: [
24
25
  /* @__PURE__ */ jsx("div", { className: "credit-card-top", children: /* @__PURE__ */ jsx("div", { id: "credit-card-chip", style: { backgroundImage: `url(${assets.Chip})` } }) }),
@@ -3,6 +3,10 @@ export interface ICreditCard {
3
3
  name: string;
4
4
  number: string;
5
5
  expiry: string;
6
+ onSetFlag?: (content: {
7
+ flag: string;
8
+ logo: string;
9
+ }) => any;
6
10
  onEdit?: () => any;
7
11
  onConfig?: () => any;
8
12
  onRemove?: () => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.190",
3
+ "version": "1.4.191",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",