@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 CHANGED
@@ -571,6 +571,7 @@ async function createTransfer(apiBaseUrl, token, params) {
571
571
  throw new Error("merchantAuthorization is required for transfer creation.");
572
572
  }
573
573
  const body = {
574
+ type: "standard",
574
575
  id: params.id ?? crypto.randomUUID(),
575
576
  credentialId: params.credentialId,
576
577
  merchantAuthorization: params.merchantAuthorization,
@@ -4488,41 +4489,14 @@ function SuccessScreen({
4488
4489
  onLogout,
4489
4490
  onIncreaseLimits,
4490
4491
  onManageAccount,
4491
- onPreauthorize,
4492
- autoCloseSeconds
4492
+ onPreauthorize
4493
4493
  }) {
4494
4494
  const { tokens } = useBlinkConfig();
4495
- const effectiveAutoClose = succeeded ? autoCloseSeconds : void 0;
4496
- const [countdown, setCountdown] = react.useState(effectiveAutoClose ?? 0);
4497
- const doneCalledRef = react.useRef(false);
4498
- const handleDone = react.useCallback(() => {
4499
- if (doneCalledRef.current) return;
4500
- doneCalledRef.current = true;
4501
- onDone();
4502
- }, [onDone]);
4503
- react.useEffect(() => {
4504
- if (!effectiveAutoClose || effectiveAutoClose <= 0) return;
4505
- const intervalId = window.setInterval(() => {
4506
- setCountdown((prev) => {
4507
- if (prev <= 1) {
4508
- window.clearInterval(intervalId);
4509
- return 0;
4510
- }
4511
- return prev - 1;
4512
- });
4513
- }, 1e3);
4514
- return () => window.clearInterval(intervalId);
4515
- }, [effectiveAutoClose]);
4516
- react.useEffect(() => {
4517
- if (effectiveAutoClose && countdown === 0) {
4518
- handleDone();
4519
- }
4520
- }, [effectiveAutoClose, countdown, handleDone]);
4521
4495
  return /* @__PURE__ */ jsxRuntime.jsxs(
4522
4496
  ScreenLayout,
4523
4497
  {
4524
4498
  footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4525
- /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: handleDone, children: succeeded ? "Done" : "Try again" }),
4499
+ /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onDone, children: succeeded ? "Done" : "Try again" }),
4526
4500
  succeeded && onPreauthorize && /* @__PURE__ */ jsxRuntime.jsx(
4527
4501
  "button",
4528
4502
  {
@@ -4532,11 +4506,6 @@ function SuccessScreen({
4532
4506
  children: "Preauthorize future transfers"
4533
4507
  }
4534
4508
  ),
4535
- effectiveAutoClose != null && effectiveAutoClose > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: countdownStyle(tokens.textMuted), children: [
4536
- "Returning to app in ",
4537
- countdown,
4538
- "s\u2026"
4539
- ] }),
4540
4509
  onManageAccount && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onManageAccount, style: manageStyle(tokens.textMuted), children: "Manage Blink account \u2192" }),
4541
4510
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
4542
4511
  ] }),
@@ -4674,12 +4643,6 @@ var preauthorizeStyle = (accentColor, borderColor) => ({
4674
4643
  cursor: "pointer",
4675
4644
  fontFamily: "inherit"
4676
4645
  });
4677
- var countdownStyle = (color) => ({
4678
- fontSize: "0.82rem",
4679
- color,
4680
- margin: "10px 0 0",
4681
- textAlign: "center"
4682
- });
4683
4646
  var manageStyle = (color) => ({
4684
4647
  background: "transparent",
4685
4648
  border: "none",
@@ -5875,7 +5838,6 @@ function StepRendererContent({
5875
5838
  merchantName,
5876
5839
  onBack,
5877
5840
  onDismiss,
5878
- autoCloseSeconds,
5879
5841
  depositAmount,
5880
5842
  handlers
5881
5843
  }) {
@@ -5948,6 +5910,9 @@ function StepRendererContent({
5948
5910
  );
5949
5911
  }
5950
5912
  if (step === "wallet-picker") {
5913
+ if (state.isGuestFlow && state.selectedProviderId && state.activeCredentialId) {
5914
+ return /* @__PURE__ */ jsxRuntime.jsx(BlinkLoadingScreen, {});
5915
+ }
5951
5916
  const isEntryPoint = !state.isGuestFlow && !authenticated;
5952
5917
  return /* @__PURE__ */ jsxRuntime.jsx(
5953
5918
  WalletPickerScreen,
@@ -6152,8 +6117,7 @@ function StepRendererContent({
6152
6117
  })() : void 0,
6153
6118
  onDone: onDismiss ?? handlers.onNewPayment,
6154
6119
  onLogout: handlers.onLogout,
6155
- onPreauthorize: state.isGuestFlow ? handlers.onPreauthorize : void 0,
6156
- autoCloseSeconds
6120
+ onPreauthorize: state.isGuestFlow ? handlers.onPreauthorize : void 0
6157
6121
  }
6158
6122
  );
6159
6123
  }
@@ -8429,8 +8393,7 @@ function BlinkPaymentInner({
8429
8393
  merchantAuthorization,
8430
8394
  merchantName,
8431
8395
  onBack,
8432
- onDismiss,
8433
- autoCloseSeconds
8396
+ onDismiss
8434
8397
  }) {
8435
8398
  const { apiBaseUrl, depositAmount } = useBlinkConfig();
8436
8399
  const { ready, authenticated, logout, getAccessToken } = reactAuth.usePrivy();
@@ -8604,6 +8567,21 @@ function BlinkPaymentInner({
8604
8567
  oneTapLimitSavedDuringSetupRef: oneTapSetup.oneTapLimitSavedDuringSetupRef,
8605
8568
  handleAuthorizedMobileReturn: mobileFlow.handleAuthorizedMobileReturn
8606
8569
  });
8570
+ const autoSelectingRef = react.useRef(false);
8571
+ react.useEffect(() => {
8572
+ if (state.step !== "wallet-picker" || !state.isGuestFlow || !state.selectedProviderId || !state.activeCredentialId || !authenticated || autoSelectingRef.current) return;
8573
+ autoSelectingRef.current = true;
8574
+ provider.handleSelectProvider(state.selectedProviderId).finally(() => {
8575
+ autoSelectingRef.current = false;
8576
+ });
8577
+ }, [
8578
+ state.step,
8579
+ state.isGuestFlow,
8580
+ state.selectedProviderId,
8581
+ state.activeCredentialId,
8582
+ authenticated,
8583
+ provider
8584
+ ]);
8607
8585
  const handlers = react.useMemo(() => ({
8608
8586
  onSendLoginCode: auth.handleSendLoginCode,
8609
8587
  onVerifyLoginCode: auth.handleVerifyLoginCode,
@@ -8686,7 +8664,6 @@ function BlinkPaymentInner({
8686
8664
  merchantName,
8687
8665
  onBack,
8688
8666
  onDismiss,
8689
- autoCloseSeconds,
8690
8667
  depositAmount,
8691
8668
  handlers
8692
8669
  }