@swype-org/react-sdk 0.1.109 → 0.1.112
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.cjs +217 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +217 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -202,7 +202,7 @@ interface UserConfig {
|
|
|
202
202
|
/** Theme mode */
|
|
203
203
|
type ThemeMode = 'light' | 'dark';
|
|
204
204
|
/** Steps in the payment flow */
|
|
205
|
-
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'wallet-picker' | 'open-wallet' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
205
|
+
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'wallet-picker' | 'open-wallet' | 'setup-status' | 'setup' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
206
206
|
/** User-selected advanced settings for chain/asset override */
|
|
207
207
|
interface AdvancedSettings {
|
|
208
208
|
/** Override asset (e.g. 'USDC', 'USDT'). Null = let backend decide. */
|
package/dist/index.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ interface UserConfig {
|
|
|
202
202
|
/** Theme mode */
|
|
203
203
|
type ThemeMode = 'light' | 'dark';
|
|
204
204
|
/** Steps in the payment flow */
|
|
205
|
-
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'wallet-picker' | 'open-wallet' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
205
|
+
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'wallet-picker' | 'open-wallet' | 'setup-status' | 'setup' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
206
206
|
/** User-selected advanced settings for chain/asset override */
|
|
207
207
|
interface AdvancedSettings {
|
|
208
208
|
/** Override asset (e.g. 'USDC', 'USDT'). Null = let backend decide. */
|
package/dist/index.js
CHANGED
|
@@ -2204,7 +2204,7 @@ var containerStyle = {
|
|
|
2204
2204
|
display: "flex",
|
|
2205
2205
|
alignItems: "center",
|
|
2206
2206
|
justifyContent: "center",
|
|
2207
|
-
|
|
2207
|
+
height: "100%",
|
|
2208
2208
|
flex: 1,
|
|
2209
2209
|
background: "transparent"
|
|
2210
2210
|
};
|
|
@@ -2246,7 +2246,7 @@ function ScreenLayout({ children, footer }) {
|
|
|
2246
2246
|
var containerStyle2 = (bg) => ({
|
|
2247
2247
|
display: "flex",
|
|
2248
2248
|
flexDirection: "column",
|
|
2249
|
-
|
|
2249
|
+
height: "100%",
|
|
2250
2250
|
maxWidth: 420,
|
|
2251
2251
|
width: "100%",
|
|
2252
2252
|
margin: "0 auto",
|
|
@@ -3813,7 +3813,7 @@ var dividerTextStyle = (color) => ({
|
|
|
3813
3813
|
whiteSpace: "nowrap"
|
|
3814
3814
|
});
|
|
3815
3815
|
var DEFAULT_MAX = 500;
|
|
3816
|
-
var ABSOLUTE_MIN =
|
|
3816
|
+
var ABSOLUTE_MIN = 0.01;
|
|
3817
3817
|
function SetupScreen({
|
|
3818
3818
|
availableBalance,
|
|
3819
3819
|
tokenCount,
|
|
@@ -3827,7 +3827,7 @@ function SetupScreen({
|
|
|
3827
3827
|
error
|
|
3828
3828
|
}) {
|
|
3829
3829
|
const { tokens } = useSwypeConfig();
|
|
3830
|
-
const effectiveMax =
|
|
3830
|
+
const effectiveMax = DEFAULT_MAX;
|
|
3831
3831
|
const effectiveMin = Math.min(ABSOLUTE_MIN, effectiveMax);
|
|
3832
3832
|
const [limit, setLimit] = useState(() => effectiveMax);
|
|
3833
3833
|
const [editing, setEditing] = useState(false);
|
|
@@ -3921,11 +3921,15 @@ function SetupScreen({
|
|
|
3921
3921
|
] }) : /* @__PURE__ */ jsxs(
|
|
3922
3922
|
"div",
|
|
3923
3923
|
{
|
|
3924
|
-
style:
|
|
3924
|
+
style: editableLimitStyle(tokens.text),
|
|
3925
3925
|
onClick: startEditing,
|
|
3926
3926
|
children: [
|
|
3927
3927
|
"$",
|
|
3928
|
-
limit.toFixed(2)
|
|
3928
|
+
limit.toFixed(2),
|
|
3929
|
+
/* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", style: pencilIconStyle(tokens.textMuted), children: [
|
|
3930
|
+
/* @__PURE__ */ jsx("path", { d: "M16.474 5.408l2.118 2.117m-.756-3.982L12.109 9.27a2.118 2.118 0 00-.58 1.082L11 13l2.648-.53c.41-.082.786-.283 1.082-.579l5.727-5.727a1.853 1.853 0 10-2.621-2.621z", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
3931
|
+
/* @__PURE__ */ jsx("path", { d: "M19 15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2h3", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3932
|
+
] })
|
|
3929
3933
|
]
|
|
3930
3934
|
}
|
|
3931
3935
|
)
|
|
@@ -4033,6 +4037,18 @@ var limitValueStyle = (color) => ({
|
|
|
4033
4037
|
color,
|
|
4034
4038
|
marginBottom: 12
|
|
4035
4039
|
});
|
|
4040
|
+
var editableLimitStyle = (color) => ({
|
|
4041
|
+
...limitValueStyle(color),
|
|
4042
|
+
cursor: "pointer",
|
|
4043
|
+
display: "inline-flex",
|
|
4044
|
+
alignItems: "center",
|
|
4045
|
+
gap: 6
|
|
4046
|
+
});
|
|
4047
|
+
var pencilIconStyle = (color) => ({
|
|
4048
|
+
color,
|
|
4049
|
+
opacity: 0.6,
|
|
4050
|
+
flexShrink: 0
|
|
4051
|
+
});
|
|
4036
4052
|
var limitInputStyle = (color) => ({
|
|
4037
4053
|
fontSize: "2.2rem",
|
|
4038
4054
|
fontWeight: 700,
|
|
@@ -4060,6 +4076,108 @@ var linkStyle = (color) => ({
|
|
|
4060
4076
|
padding: 0,
|
|
4061
4077
|
marginBottom: 16
|
|
4062
4078
|
});
|
|
4079
|
+
function SetupStatusScreen({
|
|
4080
|
+
complete,
|
|
4081
|
+
limit,
|
|
4082
|
+
tokensApproved,
|
|
4083
|
+
merchantName,
|
|
4084
|
+
onContinue,
|
|
4085
|
+
onLogout,
|
|
4086
|
+
error
|
|
4087
|
+
}) {
|
|
4088
|
+
const { tokens } = useSwypeConfig();
|
|
4089
|
+
const steps = complete ? [
|
|
4090
|
+
{
|
|
4091
|
+
label: "One-Tap ready",
|
|
4092
|
+
detail: `$${limit} limit \xB7 ${tokensApproved} token${tokensApproved !== 1 ? "s" : ""} approved`,
|
|
4093
|
+
status: "complete"
|
|
4094
|
+
},
|
|
4095
|
+
{ label: "Done", status: "complete" }
|
|
4096
|
+
] : [
|
|
4097
|
+
{
|
|
4098
|
+
label: "Setting up Wallet",
|
|
4099
|
+
status: "active"
|
|
4100
|
+
},
|
|
4101
|
+
{ label: "Done", status: "pending" }
|
|
4102
|
+
];
|
|
4103
|
+
return /* @__PURE__ */ jsxs(
|
|
4104
|
+
ScreenLayout,
|
|
4105
|
+
{
|
|
4106
|
+
footer: complete ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4107
|
+
/* @__PURE__ */ jsx(PrimaryButton, { onClick: onContinue, children: merchantName ? `Return to ${merchantName}` : "Continue" }),
|
|
4108
|
+
/* @__PURE__ */ jsx("p", { style: swipeHintStyle(tokens.textMuted), children: "Swipe to deposit \u2014 no approvals needed." })
|
|
4109
|
+
] }) : void 0,
|
|
4110
|
+
children: [
|
|
4111
|
+
/* @__PURE__ */ jsx(ScreenHeader, { right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) }),
|
|
4112
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle5, children: [
|
|
4113
|
+
complete ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4114
|
+
/* @__PURE__ */ jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.success }) }) }),
|
|
4115
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle6(tokens.text), children: "You're all set!" })
|
|
4116
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4117
|
+
/* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
4118
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle6(tokens.text), children: "Setting up One-Tap..." })
|
|
4119
|
+
] }),
|
|
4120
|
+
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle4(tokens), children: error }),
|
|
4121
|
+
/* @__PURE__ */ jsx("div", { style: stepsWrapStyle, children: /* @__PURE__ */ jsx(StepList, { steps }) }),
|
|
4122
|
+
!complete && /* @__PURE__ */ jsx("p", { style: waitHintStyle(tokens.textMuted), children: "Usually takes a few seconds" }),
|
|
4123
|
+
complete && /* @__PURE__ */ jsx("p", { style: readyHintStyle(tokens.textSecondary), children: "You can now deposit instantly from any partner app." })
|
|
4124
|
+
] })
|
|
4125
|
+
]
|
|
4126
|
+
}
|
|
4127
|
+
);
|
|
4128
|
+
}
|
|
4129
|
+
var contentStyle5 = {
|
|
4130
|
+
flex: 1,
|
|
4131
|
+
display: "flex",
|
|
4132
|
+
flexDirection: "column",
|
|
4133
|
+
alignItems: "center",
|
|
4134
|
+
justifyContent: "center",
|
|
4135
|
+
textAlign: "center",
|
|
4136
|
+
padding: "0 24px 32px"
|
|
4137
|
+
};
|
|
4138
|
+
var headingStyle6 = (color) => ({
|
|
4139
|
+
fontSize: "1.45rem",
|
|
4140
|
+
fontWeight: 700,
|
|
4141
|
+
letterSpacing: "-0.02em",
|
|
4142
|
+
color,
|
|
4143
|
+
margin: "20px 0 16px"
|
|
4144
|
+
});
|
|
4145
|
+
var errorBannerStyle4 = (tokens) => ({
|
|
4146
|
+
background: tokens.errorBg,
|
|
4147
|
+
border: `1px solid ${tokens.error}66`,
|
|
4148
|
+
borderRadius: 16,
|
|
4149
|
+
padding: "11px 14px",
|
|
4150
|
+
color: tokens.error,
|
|
4151
|
+
fontSize: "0.84rem",
|
|
4152
|
+
marginBottom: 14,
|
|
4153
|
+
lineHeight: 1.5,
|
|
4154
|
+
width: "100%",
|
|
4155
|
+
textAlign: "left"
|
|
4156
|
+
});
|
|
4157
|
+
var stepsWrapStyle = {
|
|
4158
|
+
width: "100%",
|
|
4159
|
+
maxWidth: 280,
|
|
4160
|
+
textAlign: "left",
|
|
4161
|
+
marginBottom: 16
|
|
4162
|
+
};
|
|
4163
|
+
var waitHintStyle = (color) => ({
|
|
4164
|
+
fontSize: "0.82rem",
|
|
4165
|
+
color,
|
|
4166
|
+
margin: 0
|
|
4167
|
+
});
|
|
4168
|
+
var readyHintStyle = (color) => ({
|
|
4169
|
+
fontSize: "0.88rem",
|
|
4170
|
+
color,
|
|
4171
|
+
margin: "8px 0 0",
|
|
4172
|
+
lineHeight: 1.5,
|
|
4173
|
+
maxWidth: 280
|
|
4174
|
+
});
|
|
4175
|
+
var swipeHintStyle = (color) => ({
|
|
4176
|
+
textAlign: "center",
|
|
4177
|
+
fontSize: "0.8rem",
|
|
4178
|
+
color,
|
|
4179
|
+
margin: "12px 0 0"
|
|
4180
|
+
});
|
|
4063
4181
|
var MIN_DEPOSIT = 0.25;
|
|
4064
4182
|
function DepositScreen({
|
|
4065
4183
|
merchantName,
|
|
@@ -4237,7 +4355,7 @@ function DepositScreen({
|
|
|
4237
4355
|
"%)"
|
|
4238
4356
|
] }) : /* @__PURE__ */ jsx("div", { style: detailRowStyle(tokens.textMuted), children: "Fees calculated at time of transfer" })
|
|
4239
4357
|
] }),
|
|
4240
|
-
error && /* @__PURE__ */ jsx("div", { style:
|
|
4358
|
+
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle5(tokens), children: error })
|
|
4241
4359
|
]
|
|
4242
4360
|
}
|
|
4243
4361
|
);
|
|
@@ -4305,7 +4423,7 @@ var detailRowStyle = (color) => ({
|
|
|
4305
4423
|
color,
|
|
4306
4424
|
marginBottom: 4
|
|
4307
4425
|
});
|
|
4308
|
-
var
|
|
4426
|
+
var errorBannerStyle5 = (tokens) => ({
|
|
4309
4427
|
background: tokens.errorBg,
|
|
4310
4428
|
border: `1px solid ${tokens.error}66`,
|
|
4311
4429
|
borderRadius: 16,
|
|
@@ -4404,10 +4522,10 @@ function SuccessScreen({
|
|
|
4404
4522
|
right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout })
|
|
4405
4523
|
}
|
|
4406
4524
|
),
|
|
4407
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
4525
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle6, children: [
|
|
4408
4526
|
succeeded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4409
4527
|
/* @__PURE__ */ jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.success }) }) }),
|
|
4410
|
-
/* @__PURE__ */ jsxs("h2", { style:
|
|
4528
|
+
/* @__PURE__ */ jsxs("h2", { style: headingStyle7(tokens.text), children: [
|
|
4411
4529
|
"$",
|
|
4412
4530
|
amount.toFixed(2),
|
|
4413
4531
|
" deposited"
|
|
@@ -4418,7 +4536,7 @@ function SuccessScreen({
|
|
|
4418
4536
|
] })
|
|
4419
4537
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4420
4538
|
/* @__PURE__ */ jsx(IconCircle, { variant: "error", size: 64, children: /* @__PURE__ */ jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z", fill: tokens.error }) }) }),
|
|
4421
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
4539
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle7(tokens.text), children: "Transfer failed" }),
|
|
4422
4540
|
error && /* @__PURE__ */ jsx("p", { style: subtitleStyle6(tokens.error), children: error })
|
|
4423
4541
|
] }),
|
|
4424
4542
|
/* @__PURE__ */ jsxs("div", { style: summaryCardStyle(tokens), children: [
|
|
@@ -4451,14 +4569,14 @@ function SuccessScreen({
|
|
|
4451
4569
|
}
|
|
4452
4570
|
);
|
|
4453
4571
|
}
|
|
4454
|
-
var
|
|
4572
|
+
var contentStyle6 = {
|
|
4455
4573
|
flex: 1,
|
|
4456
4574
|
display: "flex",
|
|
4457
4575
|
flexDirection: "column",
|
|
4458
4576
|
alignItems: "center",
|
|
4459
4577
|
paddingTop: 16
|
|
4460
4578
|
};
|
|
4461
|
-
var
|
|
4579
|
+
var headingStyle7 = (color) => ({
|
|
4462
4580
|
fontSize: "1.5rem",
|
|
4463
4581
|
fontWeight: 700,
|
|
4464
4582
|
letterSpacing: "-0.02em",
|
|
@@ -4743,7 +4861,7 @@ function AdvancedSourceScreen({
|
|
|
4743
4861
|
right: /* @__PURE__ */ jsx("span", { style: advancedBadgeStyle(tokens.accent), children: "Advanced" })
|
|
4744
4862
|
}
|
|
4745
4863
|
),
|
|
4746
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
4864
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle8(tokens.text), children: "Set up One-Tap deposits" }),
|
|
4747
4865
|
/* @__PURE__ */ jsx("p", { style: subtitleStyle8(tokens.textSecondary), children: "Select a token source for your One-Tap deposits." }),
|
|
4748
4866
|
/* @__PURE__ */ jsx("label", { style: labelStyle3(tokens.textSecondary), children: "Select tokens to approve" }),
|
|
4749
4867
|
/* @__PURE__ */ jsx("div", { style: chainListStyle, children: choices.map((chain) => {
|
|
@@ -4807,7 +4925,7 @@ var advancedBadgeStyle = (color) => ({
|
|
|
4807
4925
|
padding: "3px 10px",
|
|
4808
4926
|
letterSpacing: "0.02em"
|
|
4809
4927
|
});
|
|
4810
|
-
var
|
|
4928
|
+
var headingStyle8 = (color) => ({
|
|
4811
4929
|
fontSize: "1.3rem",
|
|
4812
4930
|
fontWeight: 700,
|
|
4813
4931
|
letterSpacing: "-0.02em",
|
|
@@ -4942,16 +5060,16 @@ function TransferStatusScreen({
|
|
|
4942
5060
|
const steps = buildSteps(phase);
|
|
4943
5061
|
return /* @__PURE__ */ jsxs(ScreenLayout, { children: [
|
|
4944
5062
|
/* @__PURE__ */ jsx(ScreenHeader, { right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) }),
|
|
4945
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
5063
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle7, children: [
|
|
4946
5064
|
/* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
4947
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
4948
|
-
error && /* @__PURE__ */ jsx("div", { style:
|
|
4949
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
4950
|
-
/* @__PURE__ */ jsx("p", { style:
|
|
5065
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle9(tokens.text), children: "Processing Transfer..." }),
|
|
5066
|
+
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle6(tokens), children: error }),
|
|
5067
|
+
/* @__PURE__ */ jsx("div", { style: stepsWrapStyle2, children: /* @__PURE__ */ jsx(StepList, { steps }) }),
|
|
5068
|
+
/* @__PURE__ */ jsx("p", { style: waitHintStyle2(tokens.textMuted), children: "Usually takes a few seconds" })
|
|
4951
5069
|
] })
|
|
4952
5070
|
] });
|
|
4953
5071
|
}
|
|
4954
|
-
var
|
|
5072
|
+
var contentStyle7 = {
|
|
4955
5073
|
flex: 1,
|
|
4956
5074
|
display: "flex",
|
|
4957
5075
|
flexDirection: "column",
|
|
@@ -4960,14 +5078,14 @@ var contentStyle6 = {
|
|
|
4960
5078
|
textAlign: "center",
|
|
4961
5079
|
padding: "0 24px"
|
|
4962
5080
|
};
|
|
4963
|
-
var
|
|
5081
|
+
var headingStyle9 = (color) => ({
|
|
4964
5082
|
fontSize: "1.45rem",
|
|
4965
5083
|
fontWeight: 700,
|
|
4966
5084
|
letterSpacing: "-0.02em",
|
|
4967
5085
|
color,
|
|
4968
5086
|
margin: "20px 0 16px"
|
|
4969
5087
|
});
|
|
4970
|
-
var
|
|
5088
|
+
var errorBannerStyle6 = (tokens) => ({
|
|
4971
5089
|
background: tokens.errorBg,
|
|
4972
5090
|
border: `1px solid ${tokens.error}66`,
|
|
4973
5091
|
borderRadius: 16,
|
|
@@ -4979,13 +5097,13 @@ var errorBannerStyle5 = (tokens) => ({
|
|
|
4979
5097
|
width: "100%",
|
|
4980
5098
|
textAlign: "left"
|
|
4981
5099
|
});
|
|
4982
|
-
var
|
|
5100
|
+
var stepsWrapStyle2 = {
|
|
4983
5101
|
width: "100%",
|
|
4984
5102
|
maxWidth: 280,
|
|
4985
5103
|
textAlign: "left",
|
|
4986
5104
|
marginBottom: 16
|
|
4987
5105
|
};
|
|
4988
|
-
var
|
|
5106
|
+
var waitHintStyle2 = (color) => ({
|
|
4989
5107
|
fontSize: "0.82rem",
|
|
4990
5108
|
color,
|
|
4991
5109
|
margin: 0
|
|
@@ -5027,9 +5145,9 @@ function OpenWalletScreen({
|
|
|
5027
5145
|
] }),
|
|
5028
5146
|
children: [
|
|
5029
5147
|
/* @__PURE__ */ jsx(ScreenHeader, { right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) }),
|
|
5030
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
5148
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle8, children: [
|
|
5031
5149
|
logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: displayName, style: logoStyle }) : /* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
5032
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
5150
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle10(tokens.text), children: loading ? "Connecting..." : `Open ${displayName}` }),
|
|
5033
5151
|
/* @__PURE__ */ jsx("p", { style: subtitleStyle9(tokens.textSecondary), children: loading ? "Creating transfer and preparing your wallet link..." : `Continue in ${displayName} to authorize this connection.` }),
|
|
5034
5152
|
!loading && /* @__PURE__ */ jsxs("div", { style: waitingBadgeStyle(tokens), children: [
|
|
5035
5153
|
/* @__PURE__ */ jsx(Spinner, { size: 14 }),
|
|
@@ -5040,7 +5158,7 @@ function OpenWalletScreen({
|
|
|
5040
5158
|
}
|
|
5041
5159
|
);
|
|
5042
5160
|
}
|
|
5043
|
-
var
|
|
5161
|
+
var contentStyle8 = {
|
|
5044
5162
|
flex: 1,
|
|
5045
5163
|
display: "flex",
|
|
5046
5164
|
flexDirection: "column",
|
|
@@ -5060,7 +5178,7 @@ var logoStyle = {
|
|
|
5060
5178
|
borderRadius: 14,
|
|
5061
5179
|
objectFit: "contain"
|
|
5062
5180
|
};
|
|
5063
|
-
var
|
|
5181
|
+
var headingStyle10 = (color) => ({
|
|
5064
5182
|
fontSize: "1.45rem",
|
|
5065
5183
|
fontWeight: 700,
|
|
5066
5184
|
letterSpacing: "-0.02em",
|
|
@@ -5111,9 +5229,9 @@ function ConfirmSignScreen({
|
|
|
5111
5229
|
] }),
|
|
5112
5230
|
children: [
|
|
5113
5231
|
/* @__PURE__ */ jsx(ScreenHeader, { right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) }),
|
|
5114
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
5232
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle9, children: [
|
|
5115
5233
|
logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
5116
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
5234
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle11(tokens.text), children: "Wallet authorized" }),
|
|
5117
5235
|
/* @__PURE__ */ jsxs("p", { style: subtitleStyle10(tokens.textSecondary), children: [
|
|
5118
5236
|
displayName,
|
|
5119
5237
|
" approved the connection. Tap below to confirm your payment."
|
|
@@ -5127,7 +5245,7 @@ function ConfirmSignScreen({
|
|
|
5127
5245
|
}
|
|
5128
5246
|
);
|
|
5129
5247
|
}
|
|
5130
|
-
var
|
|
5248
|
+
var contentStyle9 = {
|
|
5131
5249
|
flex: 1,
|
|
5132
5250
|
display: "flex",
|
|
5133
5251
|
flexDirection: "column",
|
|
@@ -5142,7 +5260,7 @@ var logoStyle2 = {
|
|
|
5142
5260
|
borderRadius: 14,
|
|
5143
5261
|
objectFit: "contain"
|
|
5144
5262
|
};
|
|
5145
|
-
var
|
|
5263
|
+
var headingStyle11 = (color) => ({
|
|
5146
5264
|
fontSize: "1.45rem",
|
|
5147
5265
|
fontWeight: 700,
|
|
5148
5266
|
letterSpacing: "-0.02em",
|
|
@@ -5218,7 +5336,10 @@ function StepRenderer({
|
|
|
5218
5336
|
if (!ready) {
|
|
5219
5337
|
return /* @__PURE__ */ jsx(SwypeLoadingScreen, {});
|
|
5220
5338
|
}
|
|
5221
|
-
if (step === "login"
|
|
5339
|
+
if (step === "login") {
|
|
5340
|
+
if (authenticated) {
|
|
5341
|
+
return /* @__PURE__ */ jsx(SwypeLoadingScreen, {});
|
|
5342
|
+
}
|
|
5222
5343
|
return /* @__PURE__ */ jsx(
|
|
5223
5344
|
LoginScreen,
|
|
5224
5345
|
{
|
|
@@ -5289,6 +5410,35 @@ function StepRenderer({
|
|
|
5289
5410
|
}
|
|
5290
5411
|
);
|
|
5291
5412
|
}
|
|
5413
|
+
if (step === "setup-status") {
|
|
5414
|
+
return /* @__PURE__ */ jsx(
|
|
5415
|
+
SetupStatusScreen,
|
|
5416
|
+
{
|
|
5417
|
+
complete: false,
|
|
5418
|
+
limit: state.oneTapLimit,
|
|
5419
|
+
tokensApproved: 0,
|
|
5420
|
+
merchantName,
|
|
5421
|
+
onContinue: () => handlers.onNavigate("setup"),
|
|
5422
|
+
onLogout: handlers.onLogout,
|
|
5423
|
+
error: state.error || authExecutorError
|
|
5424
|
+
}
|
|
5425
|
+
);
|
|
5426
|
+
}
|
|
5427
|
+
if (step === "setup") {
|
|
5428
|
+
return /* @__PURE__ */ jsx(
|
|
5429
|
+
SetupScreen,
|
|
5430
|
+
{
|
|
5431
|
+
availableBalance: selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5432
|
+
tokenCount,
|
|
5433
|
+
sourceName,
|
|
5434
|
+
onSetupOneTap: handlers.onSetupOneTap,
|
|
5435
|
+
onBack: () => handlers.onNavigate("deposit"),
|
|
5436
|
+
onLogout: handlers.onLogout,
|
|
5437
|
+
loading: state.creatingTransfer,
|
|
5438
|
+
error: state.error
|
|
5439
|
+
}
|
|
5440
|
+
);
|
|
5441
|
+
}
|
|
5292
5442
|
if (step === "confirm-sign") {
|
|
5293
5443
|
const providerName = state.providers.find((p) => p.id === state.selectedProviderId)?.name ?? null;
|
|
5294
5444
|
return /* @__PURE__ */ jsx(
|
|
@@ -5437,7 +5587,7 @@ var PaymentErrorBoundary = class extends Component {
|
|
|
5437
5587
|
/* @__PURE__ */ jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
5438
5588
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
5439
5589
|
] }) }),
|
|
5440
|
-
/* @__PURE__ */ jsx("h2", { style:
|
|
5590
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle12, children: "Something went wrong" }),
|
|
5441
5591
|
/* @__PURE__ */ jsx("p", { style: messageStyle, children: "An unexpected error occurred. Please try again." }),
|
|
5442
5592
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: this.handleReset, style: buttonStyle3, children: "Try again" })
|
|
5443
5593
|
] });
|
|
@@ -5457,7 +5607,7 @@ var containerStyle8 = {
|
|
|
5457
5607
|
var iconStyle4 = {
|
|
5458
5608
|
marginBottom: 20
|
|
5459
5609
|
};
|
|
5460
|
-
var
|
|
5610
|
+
var headingStyle12 = {
|
|
5461
5611
|
fontSize: "1.25rem",
|
|
5462
5612
|
fontWeight: 700,
|
|
5463
5613
|
color: "#1a1a1a",
|
|
@@ -5993,7 +6143,16 @@ function SwypePaymentInner({
|
|
|
5993
6143
|
}
|
|
5994
6144
|
const provider = state.providers.find((p) => p.id === providerId);
|
|
5995
6145
|
const providerName = provider?.name ?? "Wallet";
|
|
5996
|
-
|
|
6146
|
+
const isMobile = !shouldUseWalletConnector({
|
|
6147
|
+
useWalletConnector: useWalletConnectorProp,
|
|
6148
|
+
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
6149
|
+
});
|
|
6150
|
+
if (isMobile) {
|
|
6151
|
+
dispatch({ type: "PAY_STARTED", isSetupRedirect: true });
|
|
6152
|
+
} else {
|
|
6153
|
+
dispatch({ type: "PAY_STARTED", isSetupRedirect: false });
|
|
6154
|
+
dispatch({ type: "NAVIGATE", step: "setup-status" });
|
|
6155
|
+
}
|
|
5997
6156
|
try {
|
|
5998
6157
|
const token = await getAccessToken();
|
|
5999
6158
|
if (!token) throw new Error("Not authenticated");
|
|
@@ -6006,10 +6165,6 @@ function SwypePaymentInner({
|
|
|
6006
6165
|
});
|
|
6007
6166
|
const session = account.authorizationSessions?.[0];
|
|
6008
6167
|
if (!session) throw new Error("No authorization session returned.");
|
|
6009
|
-
const isMobile = !shouldUseWalletConnector({
|
|
6010
|
-
useWalletConnector: useWalletConnectorProp,
|
|
6011
|
-
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
6012
|
-
});
|
|
6013
6168
|
if (isMobile) {
|
|
6014
6169
|
handlingMobileReturnRef.current = false;
|
|
6015
6170
|
mobileSetupFlowRef.current = true;
|
|
@@ -6026,7 +6181,7 @@ function SwypePaymentInner({
|
|
|
6026
6181
|
} else {
|
|
6027
6182
|
await authExecutor.executeSessionById(session.id);
|
|
6028
6183
|
await reloadAccounts();
|
|
6029
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
6184
|
+
dispatch({ type: "NAVIGATE", step: "setup" });
|
|
6030
6185
|
}
|
|
6031
6186
|
} catch (err) {
|
|
6032
6187
|
captureException(err);
|
|
@@ -6070,6 +6225,20 @@ function SwypePaymentInner({
|
|
|
6070
6225
|
},
|
|
6071
6226
|
[state.accounts, depositAmount]
|
|
6072
6227
|
);
|
|
6228
|
+
const handleSetupOneTap = useCallback(async (limit) => {
|
|
6229
|
+
try {
|
|
6230
|
+
const token = await getAccessToken();
|
|
6231
|
+
if (!token) throw new Error("Not authenticated");
|
|
6232
|
+
await updateUserConfig(apiBaseUrl, token, { defaultAllowance: limit });
|
|
6233
|
+
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
6234
|
+
} catch (err) {
|
|
6235
|
+
captureException(err);
|
|
6236
|
+
dispatch({
|
|
6237
|
+
type: "SET_ERROR",
|
|
6238
|
+
error: err instanceof Error ? err.message : "Failed to save One-Tap limit"
|
|
6239
|
+
});
|
|
6240
|
+
}
|
|
6241
|
+
}, [getAccessToken, apiBaseUrl]);
|
|
6073
6242
|
const handleNewPayment = useCallback(() => {
|
|
6074
6243
|
clearMobileFlowState();
|
|
6075
6244
|
processingStartedAtRef.current = null;
|
|
@@ -6306,6 +6475,7 @@ function SwypePaymentInner({
|
|
|
6306
6475
|
checkPasskey();
|
|
6307
6476
|
return () => {
|
|
6308
6477
|
cancelled = true;
|
|
6478
|
+
checkingPasskeyRef.current = false;
|
|
6309
6479
|
};
|
|
6310
6480
|
}, [ready, authenticated, state.step, apiBaseUrl, state.activeCredentialId]);
|
|
6311
6481
|
useEffect(() => {
|
|
@@ -6517,7 +6687,7 @@ function SwypePaymentInner({
|
|
|
6517
6687
|
initializedSelectSourceActionRef.current = pendingSelectSourceAction.id;
|
|
6518
6688
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
6519
6689
|
useEffect(() => {
|
|
6520
|
-
if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet")) {
|
|
6690
|
+
if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet" || state.step === "setup-status")) {
|
|
6521
6691
|
preSelectSourceStepRef.current = state.step;
|
|
6522
6692
|
dispatch({ type: "NAVIGATE", step: "select-source" });
|
|
6523
6693
|
} else if (!pendingSelectSourceAction && state.step === "select-source") {
|
|
@@ -6553,7 +6723,8 @@ function SwypePaymentInner({
|
|
|
6553
6723
|
},
|
|
6554
6724
|
onSelectSourceChainChange: handleSelectSourceChainChange,
|
|
6555
6725
|
onSetSelectSourceTokenSymbol: setSelectSourceTokenSymbol,
|
|
6556
|
-
onConfirmSelectSource: handleConfirmSelectSource
|
|
6726
|
+
onConfirmSelectSource: handleConfirmSelectSource,
|
|
6727
|
+
onSetupOneTap: handleSetupOneTap
|
|
6557
6728
|
}), [
|
|
6558
6729
|
handleSendLoginCode,
|
|
6559
6730
|
handleVerifyLoginCode,
|
|
@@ -6571,7 +6742,8 @@ function SwypePaymentInner({
|
|
|
6571
6742
|
handleLogout,
|
|
6572
6743
|
handleNewPayment,
|
|
6573
6744
|
handleSelectSourceChainChange,
|
|
6574
|
-
handleConfirmSelectSource
|
|
6745
|
+
handleConfirmSelectSource,
|
|
6746
|
+
handleSetupOneTap
|
|
6575
6747
|
]);
|
|
6576
6748
|
return /* @__PURE__ */ jsx(
|
|
6577
6749
|
StepRenderer,
|