@swype-org/react-sdk 0.1.300 → 0.1.301

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
@@ -6666,6 +6666,10 @@ function resolveHeaderFlowPhase(screen, phase, authenticated) {
6666
6666
  return raw;
6667
6667
  }
6668
6668
  var DEFAULT_MIN_DEPOSIT_USD = 0.25;
6669
+ var GUEST_PREAUTH_LOGIN_HERO_TITLE = "Create an account to complete one tap setup";
6670
+ function isGuestPreauthLogin(state) {
6671
+ return state.isGuestFlow && (state.guestPreauthSessionId != null || state.guestPreauthAccountId != null);
6672
+ }
6669
6673
  function StepRenderer(props) {
6670
6674
  const screen = screenForPhase(props.flow.state.phase);
6671
6675
  const flowPhase = resolveHeaderFlowPhase(
@@ -6745,7 +6749,8 @@ function StepRendererContent({
6745
6749
  sending: activeOtpStatus === "sending-code",
6746
6750
  error: state.error,
6747
6751
  onBack,
6748
- merchantInitials: merchantName ? merchantName.slice(0, 2).toUpperCase() : void 0
6752
+ merchantInitials: merchantName ? merchantName.slice(0, 2).toUpperCase() : void 0,
6753
+ heroTitle: isGuestPreauthLogin(state) ? GUEST_PREAUTH_LOGIN_HERO_TITLE : void 0
6749
6754
  }
6750
6755
  );
6751
6756
  case "otp-verify":
@@ -7922,9 +7927,6 @@ function useProviderHandlers(deps) {
7922
7927
  useWalletConnector: useWalletConnectorProp,
7923
7928
  userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
7924
7929
  });
7925
- if (!isMobile) {
7926
- dispatch({ type: "PAY_STARTED" });
7927
- }
7928
7930
  try {
7929
7931
  let accountId;
7930
7932
  let sessionId;
@@ -7963,6 +7965,11 @@ function useProviderHandlers(deps) {
7963
7965
  triggerDeeplink(sessionUri);
7964
7966
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: sessionUri });
7965
7967
  } else {
7968
+ dispatch({
7969
+ type: "SELECT_ACCOUNT",
7970
+ accountId,
7971
+ walletId: null
7972
+ });
7966
7973
  await authExecutor.executeSessionById(sessionId);
7967
7974
  await reloadAccounts();
7968
7975
  }
@@ -7971,10 +7978,6 @@ function useProviderHandlers(deps) {
7971
7978
  const msg = err instanceof Error ? err.message : "Failed to set up wallet";
7972
7979
  dispatch({ type: "PAY_ERROR", error: msg });
7973
7980
  onError?.(msg);
7974
- } finally {
7975
- if (!isMobile) {
7976
- dispatch({ type: "PAY_ENDED" });
7977
- }
7978
7981
  }
7979
7982
  }, [
7980
7983
  authenticated,
@@ -9711,7 +9714,9 @@ function useGuestDesktopPreauthSessionEffect(deps) {
9711
9714
  function useGuestPreauthPhaseSyncEffect(deps) {
9712
9715
  const { state, dispatch, authExecutor, isDesktop, privyAuthenticated } = deps;
9713
9716
  useEffect(() => {
9714
- if (!state.guestPreauthorizing || !isDesktop) return;
9717
+ if (!isDesktop) return;
9718
+ const standardDesktopAuth = privyAuthenticated && state.activeCredentialId != null && !state.guestPreauthorizing;
9719
+ if (!state.guestPreauthorizing && !standardDesktopAuth) return;
9715
9720
  const pending = authExecutor.pendingSelectSource;
9716
9721
  if (pending) {
9717
9722
  if (state.phase.step === "token-picker") {
@@ -9735,7 +9740,7 @@ function useGuestPreauthPhaseSyncEffect(deps) {
9735
9740
  dispatch({ type: "SET_USER_INTENT", intent: { step: "one-tap-setup", action: null } });
9736
9741
  return;
9737
9742
  }
9738
- if (!privyAuthenticated && authExecutor.executing && state.guestPreauthAccountId) {
9743
+ if (state.guestPreauthorizing && !privyAuthenticated && authExecutor.executing && state.guestPreauthAccountId) {
9739
9744
  const accountId = state.guestPreauthAccountId;
9740
9745
  const p = state.phase;
9741
9746
  if (p.step === "wallet-setup" && p.mobile == null && p.guestDesktopExtension && p.accountId === accountId) {
@@ -9763,6 +9768,7 @@ function useGuestPreauthPhaseSyncEffect(deps) {
9763
9768
  state.guestPreauthorizing,
9764
9769
  state.phase,
9765
9770
  state.guestPreauthAccountId,
9771
+ state.activeCredentialId,
9766
9772
  isDesktop,
9767
9773
  privyAuthenticated,
9768
9774
  authExecutor.pendingSelectSource,