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