@fractalpay/fractalpay-next-dev 0.0.283 → 0.0.284

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/dist/index.js CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports, module) {
40
40
  module.exports = {
41
41
  name: "@fractalpay/fractalpay-next-dev",
42
- version: "0.0.283",
42
+ version: "0.0.284",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -9928,7 +9928,7 @@ var ErrorCardOverlay = ({ onClose, error, autoTrigger = false }) => {
9928
9928
  var ErrorCardOverlay_default = ErrorCardOverlay;
9929
9929
 
9930
9930
  // src/app/components/Atoms/Googlepay/Googlepay.tsx
9931
- import { useRef as useRef10 } from "react";
9931
+ import { useRef as useRef10, useState as useState10 } from "react";
9932
9932
 
9933
9933
  // src/app/components/Atoms/Googlepay/GooglePayScriptLoader.tsx
9934
9934
  import { useEffect as useEffect15 } from "react";
@@ -9978,8 +9978,8 @@ function GooglePayComponent({
9978
9978
  completeFractalFlow,
9979
9979
  setLoading
9980
9980
  }) {
9981
- const containerRef = useRef10(null);
9982
9981
  const paymentsClientRef = useRef10(null);
9982
+ const [isReady, setIsReady] = useState10(false);
9983
9983
  const baseRequest = {
9984
9984
  apiVersion: 2,
9985
9985
  apiVersionMinor: 0
@@ -10072,18 +10072,8 @@ function GooglePayComponent({
10072
10072
  const response = await client.isReadyToPay(
10073
10073
  getIsReadyToPayRequest()
10074
10074
  );
10075
- if (response.result && containerRef.current) {
10076
- const button = client.createButton({
10077
- onClick: onGooglePayClick,
10078
- allowedPaymentMethods: [baseCardPaymentMethod],
10079
- buttonType: "pay",
10080
- buttonColor: "black",
10081
- buttonRadius: 8
10082
- });
10083
- if (containerRef.current) {
10084
- containerRef.current.innerHTML = "";
10085
- }
10086
- containerRef.current.appendChild(button);
10075
+ if (response.result) {
10076
+ setIsReady(true);
10087
10077
  }
10088
10078
  } catch (err) {
10089
10079
  console.error("Google Pay init error:", err);
@@ -10113,7 +10103,14 @@ function GooglePayComponent({
10113
10103
  }, 0);
10114
10104
  };
10115
10105
  return /* @__PURE__ */ jsxs20(Fragment19, { children: [
10116
- /* @__PURE__ */ jsx34("div", { ref: containerRef, className: "text-center" }),
10106
+ isReady && /* @__PURE__ */ jsx34(
10107
+ "button",
10108
+ {
10109
+ className: "gpay-custom-btn",
10110
+ onClick: onGooglePayClick,
10111
+ disabled: !amount
10112
+ }
10113
+ ),
10117
10114
  /* @__PURE__ */ jsx34(GooglePayScriptLoader, { onLoad: onScriptLoad })
10118
10115
  ] });
10119
10116
  }
@@ -12347,6 +12344,41 @@ padding:0px !important;
12347
12344
  min-width: 300px;
12348
12345
  }
12349
12346
 
12347
+ .gpay-custom-btn {
12348
+ height: 48px;
12349
+ width: 100%;
12350
+ max-width: 320px;
12351
+
12352
+ background-color: #000;
12353
+ background-image: url("https://www.gstatic.com/instantbuy/svg/dark/pay/en.svg");
12354
+ background-repeat: no-repeat;
12355
+ background-position: center;
12356
+ background-size: contain;
12357
+
12358
+ border: none;
12359
+ border-radius: 8px;
12360
+ cursor: pointer;
12361
+ }
12362
+
12363
+ .gpay-custom-btn {
12364
+ background-size: 120px auto; /* tweak 65%\u201375% for perfect match */
12365
+ }
12366
+
12367
+
12368
+ .gpay-custom-btn:hover {
12369
+ opacity: 0.9;
12370
+ }
12371
+
12372
+ .gpay-custom-btn:active {
12373
+ transform: scale(0.98);
12374
+ }
12375
+
12376
+
12377
+ .gpay-custom-btn:disabled {
12378
+ opacity: 0.6;
12379
+ cursor: not-allowed;
12380
+ }
12381
+
12350
12382
 
12351
12383
  ${extraCustomCSS}
12352
12384