@fractalpay/fractalpay-next-dev 0.0.283 → 0.0.285

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.285",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -9636,6 +9636,40 @@ padding:0px !important;
9636
9636
  width: 100%;
9637
9637
  }
9638
9638
 
9639
+ .gpay-custom-btn {
9640
+ height: 48px;
9641
+ width: 100%;
9642
+
9643
+ background-color: #000;
9644
+ background-image: url("https://www.gstatic.com/instantbuy/svg/dark/pay/en.svg");
9645
+ background-repeat: no-repeat;
9646
+ background-position: center;
9647
+ background-size: contain;
9648
+
9649
+ border: none;
9650
+ border-radius: 8px;
9651
+ cursor: pointer;
9652
+ }
9653
+
9654
+ .gpay-custom-btn {
9655
+ background-size: 120px auto; /* tweak 65%\u201375% for perfect match */
9656
+ }
9657
+
9658
+
9659
+ .gpay-custom-btn:hover {
9660
+ opacity: 0.9;
9661
+ }
9662
+
9663
+ .gpay-custom-btn:active {
9664
+ transform: scale(0.98);
9665
+ }
9666
+
9667
+
9668
+ .gpay-custom-btn:disabled {
9669
+ opacity: 0.6;
9670
+ cursor: not-allowed;
9671
+ }
9672
+
9639
9673
 
9640
9674
  ` });
9641
9675
  }
@@ -9928,7 +9962,7 @@ var ErrorCardOverlay = ({ onClose, error, autoTrigger = false }) => {
9928
9962
  var ErrorCardOverlay_default = ErrorCardOverlay;
9929
9963
 
9930
9964
  // src/app/components/Atoms/Googlepay/Googlepay.tsx
9931
- import { useRef as useRef10 } from "react";
9965
+ import { useRef as useRef10, useState as useState10 } from "react";
9932
9966
 
9933
9967
  // src/app/components/Atoms/Googlepay/GooglePayScriptLoader.tsx
9934
9968
  import { useEffect as useEffect15 } from "react";
@@ -9978,8 +10012,8 @@ function GooglePayComponent({
9978
10012
  completeFractalFlow,
9979
10013
  setLoading
9980
10014
  }) {
9981
- const containerRef = useRef10(null);
9982
10015
  const paymentsClientRef = useRef10(null);
10016
+ const [isReady, setIsReady] = useState10(false);
9983
10017
  const baseRequest = {
9984
10018
  apiVersion: 2,
9985
10019
  apiVersionMinor: 0
@@ -10072,18 +10106,8 @@ function GooglePayComponent({
10072
10106
  const response = await client.isReadyToPay(
10073
10107
  getIsReadyToPayRequest()
10074
10108
  );
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);
10109
+ if (response.result) {
10110
+ setIsReady(true);
10087
10111
  }
10088
10112
  } catch (err) {
10089
10113
  console.error("Google Pay init error:", err);
@@ -10113,7 +10137,14 @@ function GooglePayComponent({
10113
10137
  }, 0);
10114
10138
  };
10115
10139
  return /* @__PURE__ */ jsxs20(Fragment19, { children: [
10116
- /* @__PURE__ */ jsx34("div", { ref: containerRef, className: "text-center" }),
10140
+ isReady && /* @__PURE__ */ jsx34(
10141
+ "button",
10142
+ {
10143
+ className: "gpay-custom-btn",
10144
+ onClick: onGooglePayClick,
10145
+ disabled: !amount
10146
+ }
10147
+ ),
10117
10148
  /* @__PURE__ */ jsx34(GooglePayScriptLoader, { onLoad: onScriptLoad })
10118
10149
  ] });
10119
10150
  }