@teamrepeat/card-token 1.0.7 → 1.0.9

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 CHANGED
@@ -0,0 +1 @@
1
+
package/TEAM_README.md ADDED
@@ -0,0 +1,9 @@
1
+ # Team Documentation - Card Token Widget
2
+
3
+ ## Internal Development Guide
4
+
5
+ ### How to deploy to NPM
6
+
7
+ 1. Change the version in `package.json`
8
+ 2. Run `npm run build` to build the package
9
+ 3. Run `npm publish` to publish the package to NPX
@@ -1,12 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect } from "react";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
3
  export const RepeatCardTokenWidget = ({ language, styles, isLocal, shopUUID, onTokenSuccess, onTokenError, }) => {
4
+ console.log("isLocal", isLocal);
4
5
  const { borderRadius, buttonBackground, buttonColor, color, errorColor, fontFamily, } = styles || {};
6
+ const [isLoaded, setIsLoaded] = useState(false);
5
7
  useEffect(() => {
6
8
  const handleMessage = (event) => {
7
9
  const data = event.data;
8
10
  if ("repeatCardSaveSuccess" in data) {
9
- console.log("event", event);
10
11
  const success = data.repeatCardSaveSuccess;
11
12
  const token = data.cardToken;
12
13
  if (success) {
@@ -35,5 +36,22 @@ export const RepeatCardTokenWidget = ({ language, styles, isLocal, shopUUID, onT
35
36
  url += `&errorColor=${encodeURIComponent(errorColor)}`;
36
37
  if (fontFamily)
37
38
  url += `&fontFamily=${fontFamily}`;
38
- return (_jsx("div", { style: { width: "100%", height: 600 }, children: _jsx("iframe", { src: url, style: { width: "100%", height: "100%", border: "none" }, title: "Kort" }) }));
39
+ return (_jsxs("div", { style: { width: "100%", height: 600 }, children: ["(", _jsxs("div", { style: {
40
+ width: "100%",
41
+ height: "100%",
42
+ display: "flex",
43
+ alignItems: "center",
44
+ justifyContent: "center",
45
+ }, children: [_jsx("div", { className: "skeletonBox", style: {
46
+ width: 100,
47
+ height: 100,
48
+ display: isLoaded ? "none" : "block",
49
+ } }), _jsx("iframe", { src: url, style: {
50
+ width: "100%",
51
+ height: "100%",
52
+ border: "none",
53
+ display: isLoaded ? "block" : "none",
54
+ }, title: "Kort", onLoad: () => {
55
+ setIsLoaded(true);
56
+ } })] }), ")"] }));
39
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamrepeat/card-token",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",