@ton-pay/ui-react 0.2.0-beta.2 → 0.2.0-beta.3

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.mjs CHANGED
@@ -30,7 +30,7 @@ var TonIcon = ({ size = 24, className }) => /* @__PURE__ */ jsxs(
30
30
  {
31
31
  width: size,
32
32
  height: size,
33
- viewBox: "0 0 24 24",
33
+ viewBox: "0 0 24 26",
34
34
  fill: "none",
35
35
  xmlns: "http://www.w3.org/2000/svg",
36
36
  className,
@@ -59,7 +59,7 @@ var TonIcon = ({ size = 24, className }) => /* @__PURE__ */ jsxs(
59
59
  }
60
60
  )
61
61
  ] }),
62
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "ton-icon-clip", children: /* @__PURE__ */ jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
62
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "ton-icon-clip", children: /* @__PURE__ */ jsx("rect", { width: "24", height: "26", fill: "white" }) }) })
63
63
  ]
64
64
  }
65
65
  );
@@ -91,7 +91,7 @@ var TonIconBlue = ({ size = 24, className }) => /* @__PURE__ */ jsxs(
91
91
  ]
92
92
  }
93
93
  );
94
- var CloseIcon = ({
94
+ var DisconnectIcon = ({
95
95
  size = 24,
96
96
  color = "currentColor",
97
97
  className
@@ -109,26 +109,41 @@ var CloseIcon = ({
109
109
  /* @__PURE__ */ jsx(
110
110
  "path",
111
111
  {
112
- d: "M18 6L6 18",
113
- stroke: color,
114
- strokeWidth: "2",
115
- strokeLinecap: "round",
116
- strokeLinejoin: "round"
112
+ d: "M8.7624 3.10001C7.95435 3.1 7.29349 3.09999 6.75642 3.14387C6.2005 3.18929 5.69842 3.28617 5.22954 3.52508C4.4957 3.89899 3.89908 4.49561 3.52517 5.22944C3.28626 5.69833 3.18938 6.20041 3.14396 6.75632C3.10008 7.2934 3.10009 7.95424 3.1001 8.76229V15.2377C3.10009 16.0458 3.10008 16.7066 3.14396 17.2437C3.18938 17.7996 3.28626 18.3017 3.52517 18.7706C3.89908 19.5044 4.4957 20.101 5.22954 20.4749C5.69842 20.7138 6.2005 20.8107 6.75642 20.8561C7.29349 20.9 7.95434 20.9 8.76239 20.9H12.0001C12.4972 20.9 12.9001 20.4971 12.9001 20C12.9001 19.503 12.4972 19.1 12.0001 19.1H8.8001C7.94517 19.1 7.3581 19.0993 6.90299 19.0621C6.45839 19.0258 6.21956 18.9592 6.04672 18.8711C5.65158 18.6698 5.33032 18.3485 5.12898 17.9534C5.04092 17.7805 4.97431 17.5417 4.93798 17.0971C4.9008 16.642 4.9001 16.0549 4.9001 15.2V8.80001C4.9001 7.94508 4.9008 7.35801 4.93798 6.9029C4.97431 6.4583 5.04092 6.21947 5.12898 6.04663C5.33032 5.65149 5.65158 5.33023 6.04672 5.12889C6.21956 5.04082 6.45839 4.97422 6.90299 4.93789C7.3581 4.90071 7.94517 4.90001 8.8001 4.90001H12.0001C12.4972 4.90001 12.9001 4.49706 12.9001 4.00001C12.9001 3.50295 12.4972 3.10001 12.0001 3.10001H8.7624Z",
113
+ fill: color
117
114
  }
118
115
  ),
119
116
  /* @__PURE__ */ jsx(
120
117
  "path",
121
118
  {
122
- d: "M6 6L18 18",
123
- stroke: color,
124
- strokeWidth: "2",
125
- strokeLinecap: "round",
126
- strokeLinejoin: "round"
119
+ d: "M17.6364 7.3636C17.2849 7.01212 16.7151 7.01212 16.3636 7.3636C16.0121 7.71507 16.0121 8.28492 16.3636 8.63639L18.8272 11.1H9.00001C8.50295 11.1 8.10001 11.5029 8.10001 12C8.10001 12.497 8.50295 12.9 9.00001 12.9H18.8272L16.3636 15.3636C16.0121 15.7151 16.0121 16.2849 16.3636 16.6364C16.7151 16.9879 17.2849 16.9879 17.6364 16.6364L21.6364 12.6364C21.9879 12.2849 21.9879 11.7151 21.6364 11.3636L17.6364 7.3636Z",
120
+ fill: color
127
121
  }
128
122
  )
129
123
  ]
130
124
  }
131
125
  );
126
+ var CloseIcon = ({
127
+ size = 24,
128
+ color = "currentColor",
129
+ className
130
+ }) => /* @__PURE__ */ jsxs(
131
+ "svg",
132
+ {
133
+ width: size,
134
+ height: size,
135
+ viewBox: "0 0 32 32",
136
+ fill: "none",
137
+ xmlns: "http://www.w3.org/2000/svg",
138
+ className,
139
+ "aria-hidden": true,
140
+ children: [
141
+ /* @__PURE__ */ jsx("rect", { width: "32", height: "32", rx: "8", fill: "#F4F4F4" }),
142
+ /* @__PURE__ */ jsx("path", { d: "M8.99933 22.251L22.2501 9.00026", stroke: "#7A7A7A", strokeWidth: "1.5", strokeLinecap: "round" }),
143
+ /* @__PURE__ */ jsx("path", { d: "M8.99933 9.08296L22.2501 22.3337", stroke: "#7A7A7A", strokeWidth: "1.5", strokeLinecap: "round" })
144
+ ]
145
+ }
146
+ );
132
147
  var BackIcon = ({
133
148
  size = 24,
134
149
  color = "currentColor",
@@ -258,6 +273,72 @@ var ErrorDotIcon = ({
258
273
  ]
259
274
  }
260
275
  );
276
+ var CardIcon = ({
277
+ size = 20,
278
+ className
279
+ }) => /* @__PURE__ */ jsxs(
280
+ "svg",
281
+ {
282
+ width: size,
283
+ height: size,
284
+ viewBox: "0 0 20 20",
285
+ fill: "none",
286
+ xmlns: "http://www.w3.org/2000/svg",
287
+ className,
288
+ "aria-hidden": true,
289
+ children: [
290
+ /* @__PURE__ */ jsx("path", { d: "M15.4688 5H4.53125C3.68693 5 3 5.71369 3 6.59091V13.4091C3 14.2863 3.68693 15 4.53125 15H15.4688C16.3131 15 17 14.2863 17 13.4091V6.59091C17 5.71369 16.3131 5 15.4688 5ZM4.53125 5.90909H15.4688C15.8306 5.90909 16.125 6.21497 16.125 6.59091V7.5H3.875V6.59091C3.875 6.21497 4.16941 5.90909 4.53125 5.90909ZM15.4688 14.0909H4.53125C4.16941 14.0909 3.875 13.785 3.875 13.4091V8.40909H16.125V13.4091C16.125 13.785 15.8306 14.0909 15.4688 14.0909Z", fill: "white" }),
291
+ /* @__PURE__ */ jsx("path", { d: "M6.33333 13H5.66667C5.2985 13 5 12.7015 5 12.3333V11.6667C5 11.2985 5.2985 11 5.66667 11H6.33333C6.7015 11 7 11.2985 7 11.6667V12.3333C7 12.7015 6.7015 13 6.33333 13Z", fill: "white" })
292
+ ]
293
+ }
294
+ );
295
+ var CryptoIcon = ({
296
+ size = 20,
297
+ className
298
+ }) => /* @__PURE__ */ jsx(
299
+ "svg",
300
+ {
301
+ width: size,
302
+ height: size,
303
+ viewBox: "0 0 20 20",
304
+ fill: "none",
305
+ xmlns: "http://www.w3.org/2000/svg",
306
+ className,
307
+ "aria-hidden": true,
308
+ children: /* @__PURE__ */ jsx("path", { d: "M14.3896 3.5H5.61006C3.99582 3.5 2.97267 5.24122 3.7848 6.64885L9.20318 16.0401C9.55683 16.6533 10.4429 16.6533 10.7965 16.0401L16.216 6.64885C17.027 5.24347 16.0028 3.5 14.3896 3.5ZM9.19879 13.2238L8.01872 10.9401L5.17144 5.84782C4.98361 5.52189 5.21561 5.10422 5.60896 5.10422H9.19772V13.225L9.19879 13.2238ZM14.826 5.84671L11.9798 10.9412L10.7998 13.2238V5.10312H14.3885C14.7818 5.10312 15.0138 5.52078 14.826 5.84671Z", fill: "white" })
309
+ }
310
+ );
311
+ var InfoIcon = ({
312
+ size = 24,
313
+ color = "currentColor",
314
+ className
315
+ }) => /* @__PURE__ */ jsxs(
316
+ "svg",
317
+ {
318
+ width: size,
319
+ height: size,
320
+ viewBox: "0 0 24 24",
321
+ fill: "none",
322
+ xmlns: "http://www.w3.org/2000/svg",
323
+ className,
324
+ "aria-hidden": true,
325
+ children: [
326
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: color, strokeWidth: "2" }),
327
+ /* @__PURE__ */ jsx("path", { d: "M12 16V12", stroke: color, strokeWidth: "2", strokeLinecap: "round" }),
328
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "8", r: "1", fill: color })
329
+ ]
330
+ }
331
+ );
332
+ var TonPayLogo = ({ className }) => /* @__PURE__ */ jsxs("div", { className, style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
333
+ /* @__PURE__ */ jsx(TonIconBlue, { size: 26 }),
334
+ /* @__PURE__ */ jsx("span", { style: {
335
+ fontWeight: 600,
336
+ fontSize: "18px",
337
+ lineHeight: "24px",
338
+ color: "#000000",
339
+ letterSpacing: "-0.5px"
340
+ }, children: "Pay" })
341
+ ] });
261
342
 
262
343
  // src/components/notification/Notification.tsx
263
344
  import "react";
@@ -831,7 +912,7 @@ var BottomSheet_default = BottomSheet;
831
912
 
832
913
  // src/components/payment-modal/PaymentModal.css
833
914
  import styleInject2 from "#style-inject";
834
- styleInject2('.pm-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n font-family: "Inter", sans-serif;\n color: #000000;\n --pm-bg: #FFFFFF;\n --pm-text: #000000;\n --pm-text-secondary: #666666;\n --pm-text-muted: #8C8C8C;\n --pm-border: rgba(0, 0, 0, 0.1);\n --pm-order-bg: #E9F5FA;\n --pm-order-border: rgba(0, 100, 153, 0.03);\n --pm-order-text: #004062;\n --pm-hover-bg: #F9F9F9;\n --pm-iframe-bg: #f9f9f9;\n --pm-spinner-track: #E5E7EB;\n}\n@media (prefers-color-scheme: dark) {\n .pm-content {\n color: #FFFFFF;\n --pm-bg: #1f2937;\n --pm-text: #FFFFFF;\n --pm-text-secondary: #9CA3AF;\n --pm-text-muted: #6B7280;\n --pm-border: rgba(255, 255, 255, 0.1);\n --pm-order-bg: rgba(0, 152, 234, 0.15);\n --pm-order-border: rgba(0, 152, 234, 0.2);\n --pm-order-text: #7DD3FC;\n --pm-hover-bg: rgba(255, 255, 255, 0.05);\n --pm-iframe-bg: #111827;\n --pm-spinner-track: #374151;\n }\n}\n.pm-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n padding: 16px;\n box-sizing: border-box;\n position: relative;\n}\n.pm-title {\n font-weight: 600;\n font-size: 18px;\n line-height: 22px;\n text-align: center;\n flex: 1;\n}\n.pm-close-btn,\n.pm-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--pm-text, #000000);\n opacity: 0.6;\n}\n.pm-close-btn:hover,\n.pm-back-btn:hover {\n opacity: 1;\n}\n.pm-body-main {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n padding: 0 16px 24px;\n gap: 20px;\n box-sizing: border-box;\n}\n.pm-order-info {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 8px 13px;\n gap: 10px;\n background: var(--pm-order-bg, #E9F5FA);\n border: 1px solid var(--pm-order-border, rgba(0, 100, 153, 0.03));\n border-radius: 9px;\n margin-bottom: 10px;\n}\n.pm-order-text {\n font-size: 13px;\n line-height: 16px;\n color: var(--pm-order-text, #004062);\n text-align: center;\n}\n.pm-amount-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n margin-bottom: 10px;\n}\n.pm-amount-label {\n font-weight: 500;\n font-size: 12px;\n line-height: 15px;\n color: var(--pm-text-muted, #8C8C8C);\n}\n.pm-amount-value {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 500;\n font-size: 20px;\n line-height: 24px;\n color: var(--pm-text, #000000);\n}\n.pm-actions {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n}\n.pm-btn {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 13px 10px;\n gap: 10px;\n width: 100%;\n height: 44px;\n border-radius: 8px;\n border: none;\n cursor: pointer;\n font-weight: 500;\n font-size: 16px;\n line-height: 19px;\n transition: opacity 0.2s;\n}\n.pm-btn:hover {\n opacity: 0.9;\n}\n.pm-btn-primary {\n background: #0098EA;\n color: #FFFFFF;\n}\n.pm-btn-black {\n background: #000000;\n color: #FFFFFF;\n}\n.pm-footer {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 8px;\n margin-top: 10px;\n font-size: 14px;\n line-height: 17px;\n}\n.pm-footer-text {\n color: var(--pm-text-muted, #808080);\n}\n.pm-footer-link {\n color: #0098EA;\n cursor: pointer;\n text-decoration: none;\n}\n.pm-footer-link:hover {\n text-decoration: underline;\n}\n.pm-providers-list {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0;\n}\n.pm-provider-item {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding: 13px 16px 13px 32px;\n width: 100%;\n height: 52px;\n background: var(--pm-bg, #FFFFFF);\n border: none;\n border-bottom: 1px solid var(--pm-border, rgba(0, 0, 0, 0.1));\n cursor: pointer;\n box-sizing: border-box;\n position: relative;\n}\n.pm-provider-item:hover {\n background-color: var(--pm-hover-bg, #F9F9F9);\n}\n.pm-provider-item.selected {\n background: var(--pm-hover-bg, #F9F9F9);\n}\n.pm-provider-left {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.pm-provider-icon {\n width: 32px;\n height: 32px;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n}\n.pm-provider-name {\n font-size: 16px;\n color: var(--pm-text, #000000);\n}\n.pm-check-icon {\n color: #0098EA;\n opacity: 0;\n}\n.pm-provider-item.selected .pm-check-icon {\n opacity: 1;\n}\n.pm-desktop-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.44);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n animation: fadeIn 0.2s ease-out;\n}\n.pm-desktop-modal {\n width: 100%;\n max-width: 414px;\n margin: 16px;\n background: var(--pm-bg, #FFFFFF);\n border-radius: 16px;\n box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.25);\n overflow: hidden;\n position: relative;\n animation: scaleIn 0.2s ease-out;\n}\n@media (prefers-color-scheme: dark) {\n .pm-desktop-modal {\n box-shadow: 0px 4px 32px rgba(0, 0, 0, 0.5);\n }\n}\n@keyframes scaleIn {\n from {\n transform: scale(0.95);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n}\n.pm-iframe-container {\n width: 100%;\n height: 100%;\n min-height: 400px;\n display: flex;\n flex-direction: column;\n background: var(--pm-iframe-bg, #f9f9f9);\n position: relative;\n}\n.pm-iframe-container iframe {\n flex: 1;\n width: 100%;\n height: 100%;\n border: none;\n display: block;\n}\n.pm-menu-dropdown {\n position: absolute;\n top: 100%;\n right: 0;\n background: var(--pm-bg, #FFFFFF);\n border: 1px solid var(--pm-border, rgba(0, 0, 0, 0.1));\n border-radius: 8px;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);\n z-index: 1001;\n min-width: 150px;\n overflow: hidden;\n}\n@media (prefers-color-scheme: dark) {\n .pm-menu-dropdown {\n box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.4);\n }\n}\n.pm-menu-item {\n padding: 10px 16px;\n font-size: 14px;\n cursor: pointer;\n color: var(--pm-text, #000000);\n}\n.pm-menu-item:hover {\n background: var(--pm-hover-bg, #F9F9F9);\n}\n.pm-menu-item.danger {\n color: #E74C3C;\n}\n.pm-menu-item.disabled {\n cursor: default;\n color: var(--pm-text-muted, #8C8C8C);\n}\n.pm-menu-item.disabled:hover {\n background: transparent;\n}\n.icon-moonpay {\n background: #7D00FF;\n color: white;\n}\n.icon-onramper {\n background: #000000;\n color: white;\n}\n.icon-transak {\n background:\n linear-gradient(\n 120deg,\n #348BED 22.91%,\n #2B80E8 36.09%,\n #1461DB 60.25%,\n #0E57D7 66.11%);\n color: white;\n}\n.icon-mercurio {\n background: #000000;\n color: white;\n}\n.pm-success-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 24px;\n text-align: center;\n}\n.pm-success-icon {\n width: 64px;\n height: 64px;\n background: #0098EA;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 20px;\n color: white;\n}\n.pm-success-icon svg {\n width: 32px;\n height: 32px;\n}\n.pm-success-title {\n font-size: 24px;\n font-weight: 600;\n color: var(--pm-text, #000000);\n margin: 0 0 8px;\n}\n.pm-success-text {\n font-size: 16px;\n color: var(--pm-text-secondary, #666666);\n margin: 0;\n}\n.pm-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 24px;\n text-align: center;\n}\n.pm-error-icon {\n width: 64px;\n height: 64px;\n background: #E74C3C;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 20px;\n color: white;\n}\n.pm-error-icon svg {\n width: 32px;\n height: 32px;\n}\n.pm-error-title {\n font-size: 24px;\n font-weight: 600;\n color: var(--pm-text, #000000);\n margin: 0 0 8px;\n}\n.pm-error-text {\n font-size: 16px;\n color: var(--pm-text-secondary, #666666);\n margin: 0 0 24px;\n max-width: 300px;\n}\n.pm-error-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n max-width: 280px;\n}\n.pm-error-inline {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n padding: 40px 20px;\n text-align: center;\n color: #E74C3C;\n}\n.pm-error-inline svg {\n width: 48px;\n height: 48px;\n margin-bottom: 16px;\n}\n.pm-error-inline p {\n margin: 0 0 20px;\n color: var(--pm-text-secondary, #666666);\n font-size: 14px;\n}\n.pm-btn-outline {\n background: transparent;\n color: #0098EA;\n border: 1px solid #0098EA;\n}\n.pm-btn-outline:hover {\n background: rgba(0, 152, 234, 0.08);\n}\n.pm-loading-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--pm-text-muted, #6b7280);\n}\n.pm-loading-container p {\n margin: 16px 0 0;\n font-size: 14px;\n}\n.pm-loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--pm-iframe-bg, #f9f9f9);\n z-index: 1;\n}\n.pm-spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--pm-spinner-track, #E5E7EB);\n border-top-color: #0098EA;\n border-radius: 50%;\n animation: pm-spin 0.8s linear infinite;\n}\n@keyframes pm-spin {\n to {\n transform: rotate(360deg);\n }\n}\n');
915
+ styleInject2('.pm-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n font-family: "Inter", sans-serif;\n color: #000000;\n --pm-bg: #FFFFFF;\n --pm-text: #000000;\n --pm-text-secondary: #666666;\n --pm-text-muted: #8C8C8C;\n --pm-border: rgba(0, 0, 0, 0.1);\n --pm-order-bg: #E9F5FA;\n --pm-order-border: rgba(0, 100, 153, 0.03);\n --pm-order-text: #004062;\n --pm-hover-bg: #F9F9F9;\n --pm-iframe-bg: #f9f9f9;\n --pm-spinner-track: #E5E7EB;\n}\n@media (prefers-color-scheme: dark) {\n .pm-content {\n color: #FFFFFF;\n --pm-bg: #1f2937;\n --pm-text: #FFFFFF;\n --pm-text-secondary: #9CA3AF;\n --pm-text-muted: #6B7280;\n --pm-border: rgba(255, 255, 255, 0.1);\n --pm-order-bg: rgba(0, 152, 234, 0.15);\n --pm-order-border: rgba(0, 152, 234, 0.2);\n --pm-order-text: #7DD3FC;\n --pm-hover-bg: rgba(255, 255, 255, 0.05);\n --pm-iframe-bg: #111827;\n --pm-spinner-track: #374151;\n }\n}\n.pm-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n padding: 16px;\n box-sizing: border-box;\n position: relative;\n}\n.bottom-sheet .pm-header {\n padding: 0 16px;\n}\n.pm-header-left,\n.pm-header-right {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 40px;\n}\n.pm-header-right {\n justify-content: flex-end;\n}\n.pm-title {\n font-weight: 600;\n font-size: 18px;\n line-height: 22px;\n text-align: center;\n flex: 1;\n}\n.pm-close-btn,\n.pm-back-btn {\n background: none;\n border: none;\n cursor: pointer;\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--pm-text, #000000);\n opacity: 0.6;\n}\n.pm-close-btn:hover,\n.pm-back-btn:hover {\n opacity: 1;\n}\n.pm-body-main {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n padding: 0;\n gap: 0;\n box-sizing: border-box;\n}\n.pm-main-container {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n padding: 0 16px;\n}\n.pm-main-title {\n font-size: 18px;\n font-weight: 600;\n line-height: 20px;\n text-align: center;\n margin: 0 0 8px;\n color: var(--pm-text, #000000);\n}\n.pm-amount-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n margin-bottom: 16px;\n}\n.pm-amount-label {\n font-weight: 500;\n font-size: 12px;\n line-height: 15px;\n color: var(--pm-text-muted, #8C8C8C);\n}\n.pm-amount-value {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 600;\n font-size: 24px;\n line-height: 29px;\n color: var(--pm-text, #000000);\n}\n.pm-order-info {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 36px;\n padding: 8px 16px;\n margin-bottom: 24px;\n gap: 4px;\n background: #E9F5FA;\n border-radius: 9px;\n box-sizing: border-box;\n border: none;\n}\n.pm-order-text {\n font-family: "Inter", sans-serif;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 15px;\n text-align: center;\n color: #004062;\n flex: none;\n}\n.pm-info-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n cursor: help;\n opacity: 1;\n}\n.pm-info-icon:hover {\n opacity: 1;\n}\n.pm-actions-card {\n width: 100%;\n background: #F9F9F9;\n border-top: 1px solid hsl(0, 0%, 92%);\n padding: 16px;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .pm-actions-card {\n background: var(--pm-hover-bg, rgba(255, 255, 255, 0.05));\n }\n}\n.pm-actions {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n}\n.pm-btn {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 13px 10px;\n gap: 4px;\n width: 100%;\n height: 44px;\n border-radius: 8px;\n border: none;\n cursor: pointer;\n font-weight: 500;\n font-size: 14px;\n line-height: 19px;\n transition: opacity 0.2s;\n}\n.pm-btn:hover {\n opacity: 0.9;\n}\n.pm-btn-primary {\n background: #0098EA;\n color: #FFFFFF;\n}\n.pm-btn-black {\n background: #000000;\n color: #FFFFFF;\n}\n.pm-btn.processing {\n background: #E6E6E6;\n color: #7A7A7A;\n cursor: default;\n}\n.pm-btn.processing:hover {\n opacity: 1;\n}\n.pm-footer {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 8px;\n margin-top: 12px;\n font-size: 12px;\n line-height: 15px;\n}\n.pm-footer-text {\n color: var(--pm-text-muted, #808080);\n}\n.pm-footer-link {\n color: #0098EA;\n cursor: pointer;\n text-decoration: none;\n}\n.pm-footer-link:hover {\n text-decoration: underline;\n}\n.pm-desktop-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.44);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n animation: fadeIn 0.2s ease-out;\n}\n.pm-desktop-modal {\n width: 100%;\n max-width: 414px;\n margin: 16px;\n background: var(--pm-bg, #FFFFFF);\n border-radius: 32px;\n box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.25);\n overflow: hidden;\n position: relative;\n animation: scaleIn 0.2s ease-out;\n}\n@media (prefers-color-scheme: dark) {\n .pm-desktop-modal {\n box-shadow: 0px 4px 32px rgba(0, 0, 0, 0.5);\n }\n}\n@keyframes scaleIn {\n from {\n transform: scale(0.95);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n}\n.pm-iframe-container {\n width: 100%;\n height: 100%;\n min-height: 400px;\n display: flex;\n flex-direction: column;\n background: var(--pm-iframe-bg, #f9f9f9);\n position: relative;\n}\n.pm-iframe-container iframe {\n flex: 1;\n width: 100%;\n height: 100%;\n border: none;\n display: block;\n}\n.pm-menu-dropdown {\n position: absolute;\n top: 100%;\n right: 0;\n background: var(--pm-bg, #FFFFFF);\n border: 1px solid var(--pm-border, rgba(0, 0, 0, 0.1));\n border-radius: 8px;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);\n z-index: 1001;\n min-width: 150px;\n overflow: hidden;\n}\n@media (prefers-color-scheme: dark) {\n .pm-menu-dropdown {\n box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.4);\n }\n}\n.pm-menu-item {\n padding: 10px 16px;\n font-size: 14px;\n cursor: pointer;\n color: var(--pm-text, #000000);\n}\n.pm-menu-item:hover {\n background: var(--pm-hover-bg, #F9F9F9);\n}\n.pm-menu-item.danger {\n color: #E74C3C;\n}\n.pm-menu-item.disabled {\n cursor: default;\n color: var(--pm-text-muted, #8C8C8C);\n}\n.pm-menu-item.disabled:hover {\n background: transparent;\n}\n.icon-moonpay {\n background: #7D00FF;\n color: white;\n}\n.icon-onramper {\n background: #000000;\n color: white;\n}\n.icon-transak {\n background:\n linear-gradient(\n 120deg,\n #348BED 22.91%,\n #2B80E8 36.09%,\n #1461DB 60.25%,\n #0E57D7 66.11%);\n color: white;\n}\n.icon-mercurio {\n background: #000000;\n color: white;\n}\n.pm-success-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 24px;\n text-align: center;\n}\n.pm-success-icon {\n width: 64px;\n height: 64px;\n background: #0098EA;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 20px;\n color: white;\n}\n.pm-success-icon svg {\n width: 32px;\n height: 32px;\n}\n.pm-success-title {\n font-size: 24px;\n font-weight: 600;\n color: var(--pm-text, #000000);\n margin: 0 0 8px;\n}\n.pm-success-text {\n font-size: 16px;\n color: var(--pm-text-secondary, #666666);\n margin: 0;\n}\n.pm-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 24px;\n text-align: center;\n}\n.pm-error-icon {\n width: 64px;\n height: 64px;\n background: #E74C3C;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 20px;\n color: white;\n}\n.pm-error-icon svg {\n width: 32px;\n height: 32px;\n}\n.pm-error-title {\n font-size: 24px;\n font-weight: 600;\n color: var(--pm-text, #000000);\n margin: 0 0 8px;\n}\n.pm-error-text {\n font-size: 16px;\n color: var(--pm-text-secondary, #666666);\n margin: 0 0 24px;\n max-width: 300px;\n}\n.pm-error-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n max-width: 280px;\n}\n.pm-error-inline {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n padding: 40px 20px;\n text-align: center;\n color: #E74C3C;\n}\n.pm-error-inline svg {\n width: 48px;\n height: 48px;\n margin-bottom: 16px;\n}\n.pm-error-inline p {\n margin: 0 0 20px;\n color: var(--pm-text-secondary, #666666);\n font-size: 14px;\n}\n.pm-btn-outline {\n background: transparent;\n color: #0098EA;\n border: 1px solid #0098EA;\n}\n.pm-btn-outline:hover {\n background: rgba(0, 152, 234, 0.08);\n}\n.pm-loading-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--pm-text-muted, #6b7280);\n}\n.pm-loading-container p {\n margin: 16px 0 0;\n font-size: 14px;\n}\n.pm-loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--pm-iframe-bg, #f9f9f9);\n z-index: 1;\n}\n.pm-spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--pm-spinner-track, #E5E7EB);\n border-top-color: #0098EA;\n border-radius: 50%;\n animation: pm-spin 0.8s linear infinite;\n}\n.pm-btn-spinner {\n width: 16px;\n height: 16px;\n border: 2px solid rgba(122, 122, 122, 0.3);\n border-top-color: #7A7A7A;\n border-radius: 50%;\n animation: pm-spin 0.8s linear infinite;\n}\n@keyframes pm-spin {\n to {\n transform: rotate(360deg);\n }\n}\n.pm-retry-link {\n font-family: "Inter Variable", sans-serif;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 15px;\n text-align: center;\n color: #004062;\n margin-top: 0px;\n}\n.pm-retry-action {\n cursor: pointer;\n text-decoration: underline;\n color: #0098EA;\n}\n');
835
916
 
836
917
  // src/components/payment-modal/PaymentModal.tsx
837
918
  import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -843,12 +924,13 @@ var PaymentModal = ({
843
924
  onPayWithCrypto,
844
925
  amount = "0.1",
845
926
  currency = "TON",
846
- itemTitle = "Pay to Guitar from Demo Store",
927
+ itemTitle = "Item",
847
928
  walletAddress,
848
929
  onDisconnect,
849
930
  fetchOnRampLink,
850
931
  onRampAvailable = false,
851
- onPaymentSuccess
932
+ onPaymentSuccess,
933
+ isLoading = false
852
934
  }) => {
853
935
  const [view, setView] = useState2("main");
854
936
  const [isMobile, setIsMobile] = useState2(false);
@@ -972,6 +1054,10 @@ var PaymentModal = ({
972
1054
  useEffect2(() => {
973
1055
  if (!isMobile || !isOpen) return;
974
1056
  const updateHeight = () => {
1057
+ if (view === "card") {
1058
+ setSheetDetent([0.9]);
1059
+ return;
1060
+ }
975
1061
  if (contentRef.current) {
976
1062
  const height = contentRef.current.scrollHeight;
977
1063
  const windowHeight = window.innerHeight;
@@ -997,9 +1083,9 @@ var PaymentModal = ({
997
1083
  handlePaymentError("Failed to load payment service. Please try again.");
998
1084
  };
999
1085
  const renderHeader = () => /* @__PURE__ */ jsxs4("div", { className: "pm-header", children: [
1000
- view !== "main" ? /* @__PURE__ */ jsx5("button", { className: "pm-back-btn", onClick: handleBack, children: /* @__PURE__ */ jsx5(BackIcon, {}) }) : /* @__PURE__ */ jsx5("div", { style: { width: 32 } }),
1001
- /* @__PURE__ */ jsx5("div", { className: "pm-title", children: "New Purchase" }),
1002
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 8 }, children: [
1086
+ /* @__PURE__ */ jsx5("div", { className: "pm-header-left", children: view !== "main" ? /* @__PURE__ */ jsx5("button", { className: "pm-back-btn", onClick: handleBack, children: /* @__PURE__ */ jsx5(BackIcon, {}) }) : /* @__PURE__ */ jsx5(TonPayLogo, {}) }),
1087
+ view !== "main" && /* @__PURE__ */ jsx5("div", { className: "pm-title", children: "New Purchase" }),
1088
+ /* @__PURE__ */ jsxs4("div", { className: "pm-header-right", children: [
1003
1089
  walletAddress && view === "main" && /* @__PURE__ */ jsxs4("div", { style: { position: "relative" }, children: [
1004
1090
  /* @__PURE__ */ jsx5("button", { className: "pm-close-btn", onClick: () => setShowMenu(!showMenu), children: /* @__PURE__ */ jsx5(MenuIcon, {}) }),
1005
1091
  showMenu && /* @__PURE__ */ jsxs4("div", { className: "pm-menu-dropdown", children: [
@@ -1021,29 +1107,60 @@ var PaymentModal = ({
1021
1107
  )
1022
1108
  ] })
1023
1109
  ] }),
1024
- /* @__PURE__ */ jsx5("button", { className: "pm-close-btn", onClick: onClose, children: /* @__PURE__ */ jsx5(CloseIcon, {}) })
1110
+ /* @__PURE__ */ jsx5("button", { className: "pm-close-btn", onClick: onClose, children: /* @__PURE__ */ jsx5(CloseIcon, { size: 32 }) })
1025
1111
  ] })
1026
1112
  ] });
1027
1113
  const renderMainView = () => /* @__PURE__ */ jsxs4("div", { className: "pm-body-main", children: [
1028
- /* @__PURE__ */ jsx5("div", { className: "pm-order-info", children: /* @__PURE__ */ jsx5("span", { className: "pm-order-text", children: itemTitle }) }),
1029
- /* @__PURE__ */ jsxs4("div", { className: "pm-amount-container", children: [
1030
- /* @__PURE__ */ jsx5("span", { className: "pm-amount-label", children: "Amount" }),
1031
- /* @__PURE__ */ jsxs4("div", { className: "pm-amount-value", children: [
1032
- amount,
1033
- " ",
1034
- currency,
1035
- " ",
1036
- /* @__PURE__ */ jsx5(TonIconBlue, {})
1114
+ /* @__PURE__ */ jsxs4("div", { className: "pm-main-container", children: [
1115
+ /* @__PURE__ */ jsx5("h2", { className: "pm-main-title", children: "New Purchase" }),
1116
+ /* @__PURE__ */ jsxs4("div", { className: "pm-amount-container", children: [
1117
+ /* @__PURE__ */ jsx5("span", { className: "pm-amount-label", children: "Amount" }),
1118
+ /* @__PURE__ */ jsxs4("div", { className: "pm-amount-value", children: [
1119
+ amount,
1120
+ " ",
1121
+ currency,
1122
+ " ",
1123
+ /* @__PURE__ */ jsx5(TonIconBlue, {})
1124
+ ] })
1125
+ ] }),
1126
+ /* @__PURE__ */ jsxs4("div", { className: "pm-order-info", children: [
1127
+ /* @__PURE__ */ jsx5("span", { className: "pm-order-text", children: itemTitle }),
1128
+ /* @__PURE__ */ jsx5("div", { className: "pm-info-icon", children: /* @__PURE__ */ jsx5(InfoIcon, { size: 14, color: "#004062" }) })
1037
1129
  ] })
1038
1130
  ] }),
1039
- /* @__PURE__ */ jsxs4("div", { className: "pm-actions", children: [
1040
- /* @__PURE__ */ jsx5("button", { className: "pm-btn pm-btn-primary", onClick: onPayWithCrypto, children: "Pay with Crypto" }),
1041
- onRampAvailable && /* @__PURE__ */ jsx5("button", { className: "pm-btn pm-btn-black", onClick: () => setView("card"), children: "Pay with Card" })
1042
- ] }),
1043
- onRampAvailable && /* @__PURE__ */ jsx5("div", { className: "pm-footer", children: /* @__PURE__ */ jsxs4("span", { className: "pm-footer-text", children: [
1044
- "Processed by ",
1045
- PROVIDER.name
1046
- ] }) })
1131
+ /* @__PURE__ */ jsxs4("div", { className: "pm-actions-card", children: [
1132
+ /* @__PURE__ */ jsxs4("div", { className: "pm-actions", children: [
1133
+ /* @__PURE__ */ jsx5(
1134
+ "button",
1135
+ {
1136
+ className: `pm-btn ${isLoading ? "processing" : "pm-btn-primary"}`,
1137
+ onClick: isLoading ? void 0 : onPayWithCrypto,
1138
+ disabled: isLoading,
1139
+ children: isLoading ? /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
1140
+ /* @__PURE__ */ jsx5("div", { className: "pm-btn-spinner" }),
1141
+ /* @__PURE__ */ jsx5("span", { children: "Processing" })
1142
+ ] }) : /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
1143
+ /* @__PURE__ */ jsx5(CryptoIcon, {}),
1144
+ /* @__PURE__ */ jsx5("span", { children: "Pay with Crypto" })
1145
+ ] })
1146
+ }
1147
+ ),
1148
+ isLoading && /* @__PURE__ */ jsxs4("div", { className: "pm-retry-link", children: [
1149
+ "Did the wallet fail to open?",
1150
+ " ",
1151
+ /* @__PURE__ */ jsx5("span", { className: "pm-retry-action", onClick: onPayWithCrypto, children: "Click here" }),
1152
+ "."
1153
+ ] }),
1154
+ onRampAvailable && !isLoading && /* @__PURE__ */ jsxs4("button", { className: "pm-btn pm-btn-black", onClick: () => setView("card"), children: [
1155
+ /* @__PURE__ */ jsx5(CardIcon, {}),
1156
+ /* @__PURE__ */ jsx5("span", { children: "Pay with Card" })
1157
+ ] })
1158
+ ] }),
1159
+ onRampAvailable && !isLoading && /* @__PURE__ */ jsx5("div", { className: "pm-footer", children: /* @__PURE__ */ jsxs4("span", { className: "pm-footer-text", children: [
1160
+ "Processed by ",
1161
+ PROVIDER.name
1162
+ ] }) })
1163
+ ] })
1047
1164
  ] });
1048
1165
  const renderCardView = () => /* @__PURE__ */ jsxs4("div", { className: "pm-iframe-container", children: [
1049
1166
  isOnRampLoading && /* @__PURE__ */ jsxs4("div", { className: "pm-loading-container", children: [
@@ -1091,13 +1208,20 @@ var PaymentModal = ({
1091
1208
  /* @__PURE__ */ jsx5("button", { className: "pm-btn pm-btn-outline", onClick: onPayWithCrypto, children: "Pay with Crypto Instead" })
1092
1209
  ] })
1093
1210
  ] });
1094
- const renderContent = () => /* @__PURE__ */ jsxs4("div", { className: "pm-content", children: [
1095
- view !== "success" && view !== "error" && renderHeader(),
1096
- view === "main" && renderMainView(),
1097
- view === "card" && renderCardView(),
1098
- view === "success" && renderSuccessView(),
1099
- view === "error" && renderErrorView()
1100
- ] });
1211
+ const renderContent = () => /* @__PURE__ */ jsxs4(
1212
+ "div",
1213
+ {
1214
+ className: "pm-content",
1215
+ style: { height: view === "card" ? "100%" : "auto" },
1216
+ children: [
1217
+ view !== "success" && view !== "error" && renderHeader(),
1218
+ view === "main" && renderMainView(),
1219
+ view === "card" && renderCardView(),
1220
+ view === "success" && renderSuccessView(),
1221
+ view === "error" && renderErrorView()
1222
+ ]
1223
+ }
1224
+ );
1101
1225
  if (isMobile) {
1102
1226
  return /* @__PURE__ */ jsx5(
1103
1227
  BottomSheet_default,
@@ -1107,7 +1231,14 @@ var PaymentModal = ({
1107
1231
  detents: sheetDetent,
1108
1232
  initialDetent: 0,
1109
1233
  enableSwipeToClose: view === "main",
1110
- children: /* @__PURE__ */ jsx5("div", { ref: contentRef, children: renderContent() })
1234
+ children: /* @__PURE__ */ jsx5(
1235
+ "div",
1236
+ {
1237
+ ref: contentRef,
1238
+ style: { height: view === "card" ? "100%" : "auto" },
1239
+ children: renderContent()
1240
+ }
1241
+ )
1111
1242
  }
1112
1243
  );
1113
1244
  }
@@ -1309,11 +1440,15 @@ var buttonStyles = `
1309
1440
  .tp-btn.with-menu{padding-left:calc(10px + (var(--tp-height,44px))/2)}
1310
1441
  .tp-btn.no-menu{border-radius:var(--tp-radius,8px)}
1311
1442
  .tp-btn-content{display:flex;flex-direction:row;align-items:center;padding:0;gap:5px;white-space:nowrap;margin-top:-4px}
1312
- .tp-btn-content svg{margin-top:4px}
1313
1443
  .tp-btn:hover:not(:disabled){filter:brightness(0.92)}
1314
1444
  .tp-btn:active:not(:disabled){filter:brightness(0.85);transform:translateY(1px)}
1315
1445
  .tp-btn:disabled{cursor:not-allowed;opacity:.85}
1316
1446
  .tp-btn.loading{animation:none}
1447
+ .tp-btn.processing{background:#E6E6E6;color:#7A7A7A;cursor:default;opacity:1}
1448
+ .tp-btn.processing .tp-spinner{border-color:rgba(122,122,122,0.3);border-top-color:#7A7A7A}
1449
+
1450
+ .tp-retry-text{font-weight:400;font-size:12px;line-height:15px;text-align:center;color:#004062;margin-top:8px}
1451
+ .tp-retry-link{cursor:pointer;text-decoration:underline;color:#0098EA}
1317
1452
 
1318
1453
  .tp-arrow{display:flex;align-items:center;justify-content:center;padding:13px 10px;min-width:calc(var(--tp-height,44px));min-height:var(--tp-height,44px);background:var(--tp-bg,#0098EA);color:var(--tp-text,#fff);border:none;border-left:1px solid rgba(255,255,255,.2);border-radius:0 var(--tp-radius,8px) var(--tp-radius,8px) 0;cursor:pointer;transition:filter .12s ease,transform .12s ease;font-size:14px}
1319
1454
  .tp-arrow:hover:not(:disabled){filter:brightness(0.92)}
@@ -1375,11 +1510,15 @@ var TonPayButton = ({
1375
1510
  }) => {
1376
1511
  const address = useTonAddress(true);
1377
1512
  const [tonConnectUI] = useTonConnectUI();
1513
+ const [showMenu, setShowMenu] = useState4(false);
1378
1514
  const [isModalOpen, setIsModalOpen] = useState4(false);
1379
1515
  const [onRampAvailable, setOnRampAvailable] = useState4(false);
1380
1516
  const [errorMessage, setErrorMessage] = useState4(null);
1381
1517
  const [internalLoading, setInternalLoading] = useState4(false);
1382
1518
  const [userIp, setUserIp] = useState4("");
1519
+ const [redirectToWallet, setRedirectToWallet] = useState4(
1520
+ null
1521
+ );
1383
1522
  const { checkAvailability, fetchOnRampLink } = useMoonPayIframe({
1384
1523
  apiKey,
1385
1524
  chain: "mainnet"
@@ -1419,13 +1558,22 @@ var TonPayButton = ({
1419
1558
  isActive = false;
1420
1559
  };
1421
1560
  }, [apiKey, amount, currency, isOnRampAvailable, checkAvailability, userIp]);
1561
+ useEffect3(() => {
1562
+ const handleClickOutside = (event) => {
1563
+ if (showMenu && !event.target.closest(".tp-wrap")) {
1564
+ setShowMenu(false);
1565
+ }
1566
+ };
1567
+ document.addEventListener("mousedown", handleClickOutside);
1568
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1569
+ }, [showMenu]);
1422
1570
  const handleDisconnect = useCallback4(() => {
1423
1571
  tonConnectUI.disconnect();
1424
1572
  }, [tonConnectUI]);
1425
1573
  const handlePayWithCrypto = useCallback4(async () => {
1426
- setIsModalOpen(false);
1427
1574
  try {
1428
- await handlePay();
1575
+ setRedirectToWallet(null);
1576
+ await handlePay((redirect) => setRedirectToWallet(() => redirect));
1429
1577
  } catch (err) {
1430
1578
  onError?.(err);
1431
1579
  if (showErrorNotification) {
@@ -1441,6 +1589,9 @@ var TonPayButton = ({
1441
1589
  handlePayWithCrypto();
1442
1590
  }
1443
1591
  }, [onRampAvailable, handlePayWithCrypto]);
1592
+ const handleRetry = useCallback4(() => {
1593
+ handlePayWithCrypto();
1594
+ }, [handlePayWithCrypto]);
1444
1595
  const handleFetchOnRampLink = useCallback4(
1445
1596
  async (_providerId) => {
1446
1597
  return fetchOnRampLink({
@@ -1465,6 +1616,7 @@ var TonPayButton = ({
1465
1616
  "--tp-height": toCssSize(height)
1466
1617
  };
1467
1618
  const isDisabled = isLoading || disabled || internalLoading;
1619
+ const showDropdown = !onRampAvailable && !!address && !isLoading;
1468
1620
  const renderContent = () => {
1469
1621
  if (text) return /* @__PURE__ */ jsx6("span", { children: text });
1470
1622
  if (variant === "short") {
@@ -1485,19 +1637,74 @@ var TonPayButton = ({
1485
1637
  style: { ...cssVars, ...style },
1486
1638
  className: classNames("tp-wrap", className),
1487
1639
  children: [
1488
- /* @__PURE__ */ jsx6("div", { className: "tp-btn-container", children: /* @__PURE__ */ jsx6(
1489
- "button",
1490
- {
1491
- type: "button",
1492
- className: classNames("tp-btn", isLoading && "loading", "no-menu"),
1493
- onClick: isDisabled ? void 0 : onPayClick,
1494
- disabled: isDisabled,
1495
- children: isLoading ? /* @__PURE__ */ jsxs5("div", { className: "tp-btn-content", children: [
1496
- /* @__PURE__ */ jsx6("span", { className: "tp-spinner" }),
1497
- /* @__PURE__ */ jsx6("span", { children: loadingText })
1498
- ] }) : renderContent()
1499
- }
1500
- ) }),
1640
+ /* @__PURE__ */ jsxs5("div", { className: "tp-btn-container", children: [
1641
+ /* @__PURE__ */ jsx6(
1642
+ "button",
1643
+ {
1644
+ type: "button",
1645
+ className: classNames(
1646
+ "tp-btn",
1647
+ isLoading && "processing",
1648
+ isLoading && "loading",
1649
+ showDropdown ? "with-menu" : "no-menu"
1650
+ ),
1651
+ onClick: isDisabled ? void 0 : onPayClick,
1652
+ disabled: isDisabled,
1653
+ children: isLoading ? /* @__PURE__ */ jsxs5("div", { className: "tp-btn-content", children: [
1654
+ /* @__PURE__ */ jsx6("span", { className: "tp-spinner" }),
1655
+ /* @__PURE__ */ jsx6("span", { children: loadingText })
1656
+ ] }) : renderContent()
1657
+ }
1658
+ ),
1659
+ showDropdown && /* @__PURE__ */ jsx6(
1660
+ "button",
1661
+ {
1662
+ type: "button",
1663
+ className: "tp-arrow",
1664
+ onClick: (e) => {
1665
+ e.stopPropagation();
1666
+ setShowMenu(!showMenu);
1667
+ },
1668
+ disabled: isDisabled,
1669
+ children: "\u25BC"
1670
+ }
1671
+ )
1672
+ ] }),
1673
+ isLoading && /* @__PURE__ */ jsxs5("div", { className: "tp-retry-text", children: [
1674
+ "Did the wallet fail to open?",
1675
+ " ",
1676
+ /* @__PURE__ */ jsx6(
1677
+ "span",
1678
+ {
1679
+ className: "tp-retry-link",
1680
+ onClick: () => redirectToWallet ? redirectToWallet() : handleRetry(),
1681
+ children: "Click here"
1682
+ }
1683
+ ),
1684
+ "."
1685
+ ] }),
1686
+ showMenu && showDropdown && /* @__PURE__ */ jsxs5("div", { className: "tp-menu", children: [
1687
+ /* @__PURE__ */ jsx6("div", { className: "tp-menu-arrow" }),
1688
+ /* @__PURE__ */ jsxs5("div", { className: "tp-menu-address", children: [
1689
+ address?.slice(0, 4),
1690
+ "...",
1691
+ address?.slice(-4)
1692
+ ] }),
1693
+ /* @__PURE__ */ jsxs5(
1694
+ "button",
1695
+ {
1696
+ className: "tp-menu-item danger",
1697
+ onClick: () => {
1698
+ handleDisconnect();
1699
+ setShowMenu(false);
1700
+ },
1701
+ children: [
1702
+ /* @__PURE__ */ jsx6("div", { className: "tp-menu-icon", children: /* @__PURE__ */ jsx6(DisconnectIcon, { size: 16 }) }),
1703
+ /* @__PURE__ */ jsx6("span", { children: "Disconnect" })
1704
+ ]
1705
+ }
1706
+ )
1707
+ ] }),
1501
1708
  /* @__PURE__ */ jsx6(
1502
1709
  PaymentModal,
1503
1710
  {
@@ -1511,7 +1718,8 @@ var TonPayButton = ({
1511
1718
  itemTitle,
1512
1719
  fetchOnRampLink: handleFetchOnRampLink,
1513
1720
  onRampAvailable,
1514
- onPaymentSuccess: onCardPaymentSuccess
1721
+ onPaymentSuccess: onCardPaymentSuccess,
1722
+ isLoading
1515
1723
  }
1516
1724
  ),
1517
1725
  errorMessage && /* @__PURE__ */ jsx6(NotificationRoot, { children: /* @__PURE__ */ jsx6(ErrorTransactionNotification, { text: errorMessage }) })
@@ -1562,15 +1770,20 @@ function useTonPay() {
1562
1770
  });
1563
1771
  }, [address, modal, tonConnectUI]);
1564
1772
  const pay = React8.useCallback(
1565
- async (getMessage) => {
1773
+ async (getMessage, options) => {
1566
1774
  const walletAddress = await waitForWalletConnection();
1567
1775
  const validUntil = Math.floor(Date.now() / 1e3) + TX_VALID_DURATION;
1568
1776
  const messageResult = await getMessage(walletAddress);
1569
- const txResult = await tonConnectUI.sendTransaction({
1570
- messages: [messageResult.message],
1571
- validUntil,
1572
- from: walletAddress
1573
- });
1777
+ const txResult = await tonConnectUI.sendTransaction(
1778
+ {
1779
+ messages: [messageResult.message],
1780
+ validUntil,
1781
+ from: walletAddress
1782
+ },
1783
+ {
1784
+ onRequestSent: options?.onRequestSent
1785
+ }
1786
+ );
1574
1787
  return { ...messageResult, txResult };
1575
1788
  },
1576
1789
  [waitForWalletConnection, tonConnectUI]