Skip to content

おすそわけ登録フォームの「支払先」にログイン中のアカウント名を自動入力する #171

Description

@yu23ki14

一行説明

おすそわけ新規登録の Google Form へ遷移する際、「支払先」欄にログイン中のアカウント名が自動入力されるようにする。

詳細

現在 /osusowake/newpackages/frontend/app/routes/osusowake.new.tsx)では、https://forms.gle/BWy74cG4KemRi4DZ7 へ遷移して商品を登録する。
Google Form には「支払先」欄があり、ユーザーが自分のアカウント名(ENS ラベル)またはウォレットアドレスを手入力する必要がある。

この値はスプレッドシート経由で loadOsusowakeItems()recipient として読み込まれ、resolveRecipientAddress() がアドレス or ENS ラベルとして解決する(packages/frontend/app/lib/osusowake.server.ts)。
手入力のため誤記のリスクがあり、解決に失敗すると支払いが fundWallet にフォールバックしてしまう。

そこで、Google Form の事前入力(prefilled link)機能を使い、遷移時に「支払先」欄へログイン中のアカウント名を埋め込む。

  • 入力する値: useProfileByAddress(address) で取得した profile.name(ENS ラベル)を第一候補とし、未設定の場合はウォレットアドレス(useActiveWallet()address)を使う
    • resolveRecipientAddress() がラベル・アドレスどちらも解決できるため、どちらでも整合する
  • URL 形式: https://docs.google.com/forms/d/e/<FORM_ID>/viewform?usp=pp_url&entry.<ENTRY_ID>=<値>
    • 「支払先」欄の entry.<ENTRY_ID> はフォームの「事前入力したURLを取得」から確認する必要がある

要件

  • Google Form の「支払先」欄の entry ID を取得し、短縮URL(forms.gle)を事前入力可能な docs.google.com/forms/d/e/.../viewform 形式に置き換える
  • /osusowake/new で、ログイン中ユーザーの ENS ラベル(なければウォレットアドレス)を「支払先」欄に事前入力した URL を生成して遷移する
  • プロフィール取得中/未取得の場合でもボタンが機能する(事前入力なしでフォームを開けるなど、壊れない挙動にする)
  • 値は URL エンコードして埋め込む

補足

  • 対象ファイル: packages/frontend/app/routes/osusowake.new.tsx
  • 参考: packages/frontend/app/routes/mypage.tsxdisplayName 算出、packages/frontend/app/hooks/useProfileByAddress.ts
  • 注意: Google Form の事前入力値はユーザーが編集可能なため、正しさを保証するものではない(入力補助という位置づけ)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrontendFrontend development

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions