@swype-org/react-sdk 0.1.221 → 0.1.223
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 +23 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +23 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -568,6 +568,7 @@ async function createTransfer(apiBaseUrl, token, params) {
|
|
|
568
568
|
throw new Error("merchantAuthorization is required for transfer creation.");
|
|
569
569
|
}
|
|
570
570
|
const body = {
|
|
571
|
+
type: "standard",
|
|
571
572
|
id: params.id ?? crypto.randomUUID(),
|
|
572
573
|
credentialId: params.credentialId,
|
|
573
574
|
merchantAuthorization: params.merchantAuthorization,
|
|
@@ -4485,41 +4486,14 @@ function SuccessScreen({
|
|
|
4485
4486
|
onLogout,
|
|
4486
4487
|
onIncreaseLimits,
|
|
4487
4488
|
onManageAccount,
|
|
4488
|
-
onPreauthorize
|
|
4489
|
-
autoCloseSeconds
|
|
4489
|
+
onPreauthorize
|
|
4490
4490
|
}) {
|
|
4491
4491
|
const { tokens } = useBlinkConfig();
|
|
4492
|
-
const effectiveAutoClose = succeeded ? autoCloseSeconds : void 0;
|
|
4493
|
-
const [countdown, setCountdown] = useState(effectiveAutoClose ?? 0);
|
|
4494
|
-
const doneCalledRef = useRef(false);
|
|
4495
|
-
const handleDone = useCallback(() => {
|
|
4496
|
-
if (doneCalledRef.current) return;
|
|
4497
|
-
doneCalledRef.current = true;
|
|
4498
|
-
onDone();
|
|
4499
|
-
}, [onDone]);
|
|
4500
|
-
useEffect(() => {
|
|
4501
|
-
if (!effectiveAutoClose || effectiveAutoClose <= 0) return;
|
|
4502
|
-
const intervalId = window.setInterval(() => {
|
|
4503
|
-
setCountdown((prev) => {
|
|
4504
|
-
if (prev <= 1) {
|
|
4505
|
-
window.clearInterval(intervalId);
|
|
4506
|
-
return 0;
|
|
4507
|
-
}
|
|
4508
|
-
return prev - 1;
|
|
4509
|
-
});
|
|
4510
|
-
}, 1e3);
|
|
4511
|
-
return () => window.clearInterval(intervalId);
|
|
4512
|
-
}, [effectiveAutoClose]);
|
|
4513
|
-
useEffect(() => {
|
|
4514
|
-
if (effectiveAutoClose && countdown === 0) {
|
|
4515
|
-
handleDone();
|
|
4516
|
-
}
|
|
4517
|
-
}, [effectiveAutoClose, countdown, handleDone]);
|
|
4518
4492
|
return /* @__PURE__ */ jsxs(
|
|
4519
4493
|
ScreenLayout,
|
|
4520
4494
|
{
|
|
4521
4495
|
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4522
|
-
/* @__PURE__ */ jsx(PrimaryButton, { onClick:
|
|
4496
|
+
/* @__PURE__ */ jsx(PrimaryButton, { onClick: onDone, children: succeeded ? "Done" : "Try again" }),
|
|
4523
4497
|
succeeded && onPreauthorize && /* @__PURE__ */ jsx(
|
|
4524
4498
|
"button",
|
|
4525
4499
|
{
|
|
@@ -4529,11 +4503,6 @@ function SuccessScreen({
|
|
|
4529
4503
|
children: "Preauthorize future transfers"
|
|
4530
4504
|
}
|
|
4531
4505
|
),
|
|
4532
|
-
effectiveAutoClose != null && effectiveAutoClose > 0 && /* @__PURE__ */ jsxs("p", { style: countdownStyle(tokens.textMuted), children: [
|
|
4533
|
-
"Returning to app in ",
|
|
4534
|
-
countdown,
|
|
4535
|
-
"s\u2026"
|
|
4536
|
-
] }),
|
|
4537
4506
|
onManageAccount && /* @__PURE__ */ jsx("button", { type: "button", onClick: onManageAccount, style: manageStyle(tokens.textMuted), children: "Manage Blink account \u2192" }),
|
|
4538
4507
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
4539
4508
|
] }),
|
|
@@ -4671,12 +4640,6 @@ var preauthorizeStyle = (accentColor, borderColor) => ({
|
|
|
4671
4640
|
cursor: "pointer",
|
|
4672
4641
|
fontFamily: "inherit"
|
|
4673
4642
|
});
|
|
4674
|
-
var countdownStyle = (color) => ({
|
|
4675
|
-
fontSize: "0.82rem",
|
|
4676
|
-
color,
|
|
4677
|
-
margin: "10px 0 0",
|
|
4678
|
-
textAlign: "center"
|
|
4679
|
-
});
|
|
4680
4643
|
var manageStyle = (color) => ({
|
|
4681
4644
|
background: "transparent",
|
|
4682
4645
|
border: "none",
|
|
@@ -5872,7 +5835,6 @@ function StepRendererContent({
|
|
|
5872
5835
|
merchantName,
|
|
5873
5836
|
onBack,
|
|
5874
5837
|
onDismiss,
|
|
5875
|
-
autoCloseSeconds,
|
|
5876
5838
|
depositAmount,
|
|
5877
5839
|
handlers
|
|
5878
5840
|
}) {
|
|
@@ -5945,6 +5907,9 @@ function StepRendererContent({
|
|
|
5945
5907
|
);
|
|
5946
5908
|
}
|
|
5947
5909
|
if (step === "wallet-picker") {
|
|
5910
|
+
if (state.isGuestFlow && state.selectedProviderId && state.activeCredentialId) {
|
|
5911
|
+
return /* @__PURE__ */ jsx(BlinkLoadingScreen, {});
|
|
5912
|
+
}
|
|
5948
5913
|
const isEntryPoint = !state.isGuestFlow && !authenticated;
|
|
5949
5914
|
return /* @__PURE__ */ jsx(
|
|
5950
5915
|
WalletPickerScreen,
|
|
@@ -6149,8 +6114,7 @@ function StepRendererContent({
|
|
|
6149
6114
|
})() : void 0,
|
|
6150
6115
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
6151
6116
|
onLogout: handlers.onLogout,
|
|
6152
|
-
onPreauthorize: state.isGuestFlow ? handlers.onPreauthorize : void 0
|
|
6153
|
-
autoCloseSeconds
|
|
6117
|
+
onPreauthorize: state.isGuestFlow ? handlers.onPreauthorize : void 0
|
|
6154
6118
|
}
|
|
6155
6119
|
);
|
|
6156
6120
|
}
|
|
@@ -8426,8 +8390,7 @@ function BlinkPaymentInner({
|
|
|
8426
8390
|
merchantAuthorization,
|
|
8427
8391
|
merchantName,
|
|
8428
8392
|
onBack,
|
|
8429
|
-
onDismiss
|
|
8430
|
-
autoCloseSeconds
|
|
8393
|
+
onDismiss
|
|
8431
8394
|
}) {
|
|
8432
8395
|
const { apiBaseUrl, depositAmount } = useBlinkConfig();
|
|
8433
8396
|
const { ready, authenticated, logout, getAccessToken } = usePrivy();
|
|
@@ -8601,6 +8564,21 @@ function BlinkPaymentInner({
|
|
|
8601
8564
|
oneTapLimitSavedDuringSetupRef: oneTapSetup.oneTapLimitSavedDuringSetupRef,
|
|
8602
8565
|
handleAuthorizedMobileReturn: mobileFlow.handleAuthorizedMobileReturn
|
|
8603
8566
|
});
|
|
8567
|
+
const autoSelectingRef = useRef(false);
|
|
8568
|
+
useEffect(() => {
|
|
8569
|
+
if (state.step !== "wallet-picker" || !state.isGuestFlow || !state.selectedProviderId || !state.activeCredentialId || !authenticated || autoSelectingRef.current) return;
|
|
8570
|
+
autoSelectingRef.current = true;
|
|
8571
|
+
provider.handleSelectProvider(state.selectedProviderId).finally(() => {
|
|
8572
|
+
autoSelectingRef.current = false;
|
|
8573
|
+
});
|
|
8574
|
+
}, [
|
|
8575
|
+
state.step,
|
|
8576
|
+
state.isGuestFlow,
|
|
8577
|
+
state.selectedProviderId,
|
|
8578
|
+
state.activeCredentialId,
|
|
8579
|
+
authenticated,
|
|
8580
|
+
provider
|
|
8581
|
+
]);
|
|
8604
8582
|
const handlers = useMemo(() => ({
|
|
8605
8583
|
onSendLoginCode: auth.handleSendLoginCode,
|
|
8606
8584
|
onVerifyLoginCode: auth.handleVerifyLoginCode,
|
|
@@ -8683,7 +8661,6 @@ function BlinkPaymentInner({
|
|
|
8683
8661
|
merchantName,
|
|
8684
8662
|
onBack,
|
|
8685
8663
|
onDismiss,
|
|
8686
|
-
autoCloseSeconds,
|
|
8687
8664
|
depositAmount,
|
|
8688
8665
|
handlers
|
|
8689
8666
|
}
|