@teamrepeat/card-token 1.0.9 → 1.0.10

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.
@@ -15,6 +15,8 @@ interface RepeatCardTokenWidgetProps {
15
15
  errorColor?: string;
16
16
  fontFamily?: string;
17
17
  };
18
+ onWidgetMount?: () => void;
19
+ onWidgetMountError?: (error: React.SyntheticEvent<HTMLIFrameElement, Event>) => void;
18
20
  }
19
21
  export declare const RepeatCardTokenWidget: React.FC<RepeatCardTokenWidgetProps>;
20
22
  export {};
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
- export const RepeatCardTokenWidget = ({ language, styles, isLocal, shopUUID, onTokenSuccess, onTokenError, }) => {
4
- console.log("isLocal", isLocal);
3
+ export const RepeatCardTokenWidget = ({ language, styles, isLocal, shopUUID, onTokenSuccess, onTokenError, onWidgetMount, onWidgetMountError, }) => {
5
4
  const { borderRadius, buttonBackground, buttonColor, color, errorColor, fontFamily, } = styles || {};
6
5
  const [isLoaded, setIsLoaded] = useState(false);
7
6
  useEffect(() => {
@@ -53,5 +52,8 @@ export const RepeatCardTokenWidget = ({ language, styles, isLocal, shopUUID, onT
53
52
  display: isLoaded ? "block" : "none",
54
53
  }, title: "Kort", onLoad: () => {
55
54
  setIsLoaded(true);
55
+ onWidgetMount?.();
56
+ }, onError: (error) => {
57
+ onWidgetMountError?.(error);
56
58
  } })] }), ")"] }));
57
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamrepeat/card-token",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "React hook and iframe component to fetch card tokens",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",