コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
バージョン管理
変更ログ
API バージョンのアップグレード
SDK バージョンをアップグレードする
開発者向けのツール
SDK
API
テスト
ワークベンチ
イベントの送信先
ワークフロー
Stripe CLI
Stripe Shell
開発者ダッシュボード
エージェントツールキット
LLM を使用した構築Visual Studio Code をご利用の場合Stripe 健全性アラートファイルのアップロード
セキュリティとプライバシー
セキュリティ
プライバシー
Stripe を拡張する
Stripe Apps
    概要
    始める
    アプリを作成する
    Stripe アプリの仕組み
    サンプルアプリ
    アプリを構築する
    シークレットを保存
    API 認証方法
    認証フロー
    サーバー側のロジック
    イベントのリッスン
    さまざまな環境を処理
    サンドボックスのサポートを有効にする
    アプリの設定ページ
    UI を構築する
    アカウント登録
    アプリを配布する
    配布オプション
    アプリをアップロード
    バージョンとリリース
    アプリをテストする
    アプリを公開する
    自分のアプリを宣伝する
    ディープリンクを追加する
    インストールリンクを作成
    UI 拡張機能で役割を割り当て
    インストール後のアクション
    アプリのアナリティクス
    アプリの埋め込みコンポーネント
    サードパーティーの Stripe アプリを埋め込む
    Stripe Apps に移行
    拡張機能を移行または構築
    Stripe Apps または Stripe Connect にプラグインを移行
    参照情報
    アプリマニフェスト
    CLI
    拡張 SDK
    権限
    ビューポート
    設計パターン
    コンポーネント
      アコーディオン
      バッジ
      バナー
      BarChart
      ボックス
      ボタン
      ButtonGroup
      チェックボックス
      チップ
      ContextView
      DateField
      ディバイダー
      FocusView
      FormFieldGroup
      アイコン
      Img
      インライン
      LineChart
      Link
      リスト
      メニュー
      PropertyList
      ラジオ
      選択してください
      SettingsView
      SignInView
      Sparkline
      スピナー
      切り替える
      テーブル
      タブ
      タスクリスト
      テキスト領域
      テキストフィールド
      トースト
      ツールチップ
Stripe のコネクター
パートナー
Partner Ecosystem
パートナー認定
ホーム開発者向けのツールStripe AppsComponents

注

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

Stripe Apps の SettingsView コンポーネント

アカウントでのアプリの機能に関して、顧客が詳細を変更できるようにします。

ページをコピー

You can define a specialized settings view to let users change specific details about how the app works with their account. For example, an app that uses a third-party API like Zendesk could use SettingsView to authorize a user with their Zendesk account. For more details, learn how to add a settings page for your app.

SettingsView のデザイン

SettingsView は、ContextView と同様に、その他すべての UI エレメントを含むビューのルートコンポーネントです。特定のオブジェクトに関連付けられていない唯一のビューですが、settings ビューポートに関連付けられています。settings ビューポートは、アプリドロワー以外の、ダッシュボードの事前設定された場所にマッピングされます。

SettingsView renders on the app settings page in the Dashboard after you upload an app. While previewing your app locally, you can preview the SettingsView in the Dashboard at https://dashboard.stripe.com/apps/settings-preview.

SettingsView を使用するには、settings ビューポートでアプリマニフェストにビューを追加する必要があります。SettingsView があるアプリケーションには、以下のような ui_extension フィールドを含むアプリマニフェストがあります。

{ ..., "ui_extension": { "views": [ ..., { "viewport": "settings", "component": "AppSettings" } ], } }

SettingsView プロパティ

プロパティータイプ

children

必須

React.ReactNode

コンポーネントのコンテンツ。

onSave

オプション

((values: { [x: string]: string; }) => void) | undefined

If provided, a “Save” Button will be rendered with the SettingsView. This callback will be called when the Button is clicked.

statusMessage

オプション

string | undefined

A string to display a status such as “Saved” or “Error” in the header of the view.

例

この例は、外部 API から設定を取得して表示し、変更を保存する方法を示しています。

import React from 'react'; import {ExtensionContextValue} from '@stripe/ui-extension-sdk/context'; import {Box, SettingsView, TextField} from '@stripe/ui-extension-sdk/ui'; type FormStatus = 'initial' | 'saving' | 'saved' | 'error'; const AppSettings = ({userContext}: ExtensionContextValue) => { const [storedValue, setStoredValue] = React.useState<string>(''); const [status, setStatus] = React.useState<FormStatus>('initial'); // use the current user id to retrieve the stored value from an external api const key = userContext.id; React.useEffect(() => { if (!key) { return; } const fetchSetting = async (key: string) => { try { const response = await fetch(`https://www.my-api.com/${key}`); const storedSettingValue = await response.text(); if (storedSettingValue) { setStoredValue(storedSettingValue); } } catch (error) { console.log('Error fetching setting: ', error); } }; fetchSetting(key); }, [key]); const saveSettings = React.useCallback(async (values) => { setStatus('saving'); try { const {greeting} = values; const result = await fetch('https://www.my-api.com/', { method: 'POST', body: JSON.stringify(values), }); await result.text(); setStatus('saved'); setStoredValue(greeting); } catch (error) { console.error(error); setStatus('error'); } }, []); const getStatusLabel = React.useCallback(() => { switch (status) { case 'saving': return 'Saving...'; case 'saved': return 'Saved!'; case 'error': return 'Error: There was an error saving your settings.'; case 'initial': default: return ''; } }, [status]); const statusLabel = getStatusLabel(); return ( <SettingsView onSave={saveSettings} statusMessage={statusLabel}> <Box css={{ padding: 'medium', backgroundColor: 'container', }} > <Box css={{ font: 'lead', }} > Please enter a greeting </Box> <Box css={{ marginBottom: 'medium', font: 'caption', }} > Saved value: {storedValue || 'None'} </Box> <TextField name="greeting" type="text" label="Greeting:" size="medium" /> </Box> </SettingsView> ); };

参照情報

  • 従うべき設計パターン
  • アプリのスタイル設定
  • UI テスト
このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc