tapimo 0.13.0 → 0.14.0
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/App.d.ts +6064 -4829
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +1 -0
- package/dist/App.js.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +1008 -917
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +48 -0
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +2 -1
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +92 -3
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +69 -7
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +74 -74
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +69 -69
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/apps/Zones.d.ts +12 -12
- package/dist/apps/Zones.js +3 -3
- package/dist/apps/data/App.d.ts +2909 -2523
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +11 -6
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +22 -22
- package/dist/apps/data/routes/earn.d.ts +183 -7
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +434 -75
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +15 -0
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +180 -114
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +18 -19
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +93 -93
- package/dist/apps/data/routes/transfers.d.ts +12 -12
- package/dist/apps/data/routes/valuation.d.ts +30 -30
- package/dist/apps/data/routes/verified-tokens.d.ts +5 -5
- package/dist/apps/data/routes/webhooks.d.ts +805 -102
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +47 -5
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/funding/App.d.ts +456 -45
- package/dist/apps/funding/App.d.ts.map +1 -1
- package/dist/apps/funding/App.js +1 -1
- package/dist/apps/funding/App.js.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts +17 -17
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.js +1 -1
- package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
- package/dist/apps/funding/routes/transfers.d.ts +654 -73
- package/dist/apps/funding/routes/transfers.d.ts.map +1 -1
- package/dist/apps/funding/routes/transfers.js +211 -5
- package/dist/apps/funding/routes/transfers.js.map +1 -1
- package/dist/apps/management/App.d.ts +831 -387
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/Billing.d.ts +1 -1
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +17 -1
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +76 -76
- package/dist/apps/management/routes/billing.d.ts +76 -76
- package/dist/apps/management/routes/faucet.d.ts +12 -12
- package/dist/apps/management/routes/invitations.d.ts +24 -24
- package/dist/apps/management/routes/invite-links.d.ts +46 -46
- package/dist/apps/management/routes/members.d.ts +46 -46
- package/dist/apps/management/routes/orgs.d.ts +20 -20
- package/dist/apps/management/routes/projects.d.ts +44 -44
- package/dist/apps/management/routes/usage.d.ts +32 -32
- package/dist/apps/management/routes/verified-token-requests.d.ts +16 -16
- package/dist/apps/management/routes/webhooks.d.ts +707 -57
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +21 -21
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +115 -23
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +27 -1
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +22 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +8 -3
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +16 -1
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/fundingTransferTransactions.d.ts +38 -0
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +1 -1
- package/dist/db/tables/fundingTransferTransactions.js +44 -3
- package/dist/db/tables/fundingTransferTransactions.js.map +1 -1
- package/dist/db/tables/fundingTransfers.d.ts +17 -0
- package/dist/db/tables/fundingTransfers.d.ts.map +1 -1
- package/dist/db/tables/fundingTransfers.js +21 -0
- package/dist/db/tables/fundingTransfers.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +24 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +27 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +25 -1
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +26 -0
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +44 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +146 -13
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +10 -6
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +9 -6
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/internal/EarnVaults.js +5 -5
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/Log.d.ts +1 -1
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/Viem.d.ts +16 -1
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +12 -2
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/funding/DepositWebhook.d.ts.map +1 -1
- package/dist/internal/funding/DepositWebhook.js +2 -1
- package/dist/internal/funding/DepositWebhook.js.map +1 -1
- package/dist/internal/funding/Evidence.d.ts.map +1 -1
- package/dist/internal/funding/Evidence.js +2 -10
- package/dist/internal/funding/Evidence.js.map +1 -1
- package/dist/internal/funding/Provider.d.ts +40 -0
- package/dist/internal/funding/Provider.d.ts.map +1 -1
- package/dist/internal/funding/Provider.js +5 -0
- package/dist/internal/funding/Provider.js.map +1 -1
- package/dist/internal/funding/SourceObservation.d.ts.map +1 -1
- package/dist/internal/funding/SourceObservation.js +5 -7
- package/dist/internal/funding/SourceObservation.js.map +1 -1
- package/dist/internal/funding/Transfer.d.ts +101 -6
- package/dist/internal/funding/Transfer.d.ts.map +1 -1
- package/dist/internal/funding/Transfer.js +162 -34
- package/dist/internal/funding/Transfer.js.map +1 -1
- package/dist/internal/funding/TransferReconciliation.d.ts +52 -0
- package/dist/internal/funding/TransferReconciliation.d.ts.map +1 -0
- package/dist/internal/funding/TransferReconciliation.js +192 -0
- package/dist/internal/funding/TransferReconciliation.js.map +1 -0
- package/dist/internal/funding/TransferWebhook.d.ts +21 -0
- package/dist/internal/funding/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/funding/TransferWebhook.js +43 -0
- package/dist/internal/funding/TransferWebhook.js.map +1 -0
- package/dist/internal/funding/index.d.ts +1 -0
- package/dist/internal/funding/index.d.ts.map +1 -1
- package/dist/internal/funding/index.js +1 -0
- package/dist/internal/funding/index.js.map +1 -1
- package/dist/internal/funding/providers/relay.d.ts.map +1 -1
- package/dist/internal/funding/providers/relay.js +3 -12
- package/dist/internal/funding/providers/relay.js.map +1 -1
- package/dist/internal/funding/providers/stargate.d.ts +99 -0
- package/dist/internal/funding/providers/stargate.d.ts.map +1 -1
- package/dist/internal/funding/providers/stargate.js +337 -35
- package/dist/internal/funding/providers/stargate.js.map +1 -1
- package/dist/internal/webhookDestinations/slack.d.ts.map +1 -1
- package/dist/internal/webhookDestinations/slack.js +16 -0
- package/dist/internal/webhookDestinations/slack.js.map +1 -1
- package/package.json +1 -1
- package/src/App.ts +1 -0
- package/src/Client.test-d.ts +83 -2
- package/src/Webhooks.ts +2 -2
- package/src/admin/apps/earn-vaults.ts +2 -1
- package/src/admin/apps/organizations.test.ts +53 -1
- package/src/admin/apps/organizations.ts +90 -5
- package/src/admin/ui/src/lib/organizations.test.ts +112 -1
- package/src/admin/ui/src/lib/organizations.ts +55 -0
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +116 -0
- package/src/admin/ui.generated.ts +69 -69
- package/src/apps/Zones.test.ts +3 -3
- package/src/apps/Zones.ts +3 -3
- package/src/apps/composition.test.ts +1 -0
- package/src/apps/data/App.ts +15 -6
- package/src/apps/data/routes/earn.test.ts +369 -14
- package/src/apps/data/routes/earn.ts +548 -79
- package/src/apps/data/routes/exchanges.test.ts +740 -15
- package/src/apps/data/routes/exchanges.ts +954 -753
- package/src/apps/data/routes/fee-amm.ts +17 -18
- package/src/apps/data/routes/webhooks.test.ts +21 -5
- package/src/apps/data/routes/webhooks.ts +63 -8
- package/src/apps/funding/App.ts +12 -2
- package/src/apps/funding/routes/deposit-addresses.test.ts +4 -4
- package/src/apps/funding/routes/deposit-addresses.ts +2 -2
- package/src/apps/funding/routes/transfers.test.ts +510 -19
- package/src/apps/funding/routes/transfers.ts +271 -5
- package/src/apps/management/Billing.ts +18 -5
- package/src/apps/management/routes/webhooks.test.ts +3 -3
- package/src/apps/management/routes/webhooks.ts +24 -25
- package/src/apps/relay/App.test.ts +212 -1
- package/src/apps/relay/App.ts +158 -29
- package/src/apps/relay/Sponsorships.ts +24 -1
- package/src/db/Db.ts +35 -0
- package/src/db/Schema.ts +17 -2
- package/src/db/tables/fundingTransferTransactions.test.ts +43 -0
- package/src/db/tables/fundingTransferTransactions.ts +79 -3
- package/src/db/tables/fundingTransfers.test.ts +26 -0
- package/src/db/tables/fundingTransfers.ts +36 -0
- package/src/db/tables/organizations.test.ts +41 -0
- package/src/db/tables/organizations.ts +49 -0
- package/src/db/tables/projects.test.ts +55 -0
- package/src/db/tables/projects.ts +46 -1
- package/src/db/tables/sponsoredTransactions.test.ts +338 -0
- package/src/db/tables/sponsoredTransactions.ts +197 -13
- package/src/db/tables/webhookSubscriptions.ts +18 -11
- package/src/internal/EarnVaults.ts +5 -5
- package/src/internal/Log.test-d.ts +2 -0
- package/src/internal/Log.ts +2 -0
- package/src/internal/Viem.ts +39 -3
- package/src/internal/Webhooks.test.ts +45 -0
- package/src/internal/funding/DepositWebhook.ts +2 -1
- package/src/internal/funding/Evidence.ts +2 -13
- package/src/internal/funding/Provider.ts +43 -0
- package/src/internal/funding/SourceObservation.ts +5 -9
- package/src/internal/funding/Transfer.test.ts +155 -0
- package/src/internal/funding/Transfer.ts +254 -37
- package/src/internal/funding/TransferReconciliation.test.ts +147 -0
- package/src/internal/funding/TransferReconciliation.ts +264 -0
- package/src/internal/funding/TransferWebhook.test.ts +128 -0
- package/src/internal/funding/TransferWebhook.ts +67 -0
- package/src/internal/funding/index.test.ts +1 -0
- package/src/internal/funding/index.ts +1 -0
- package/src/internal/funding/providers/relay.ts +3 -15
- package/src/internal/funding/providers/stargate.test.ts +169 -4
- package/src/internal/funding/providers/stargate.ts +498 -51
- package/src/internal/webhookDestinations/slack.ts +15 -0
|
@@ -26,6 +26,10 @@ type SponsorshipResponse = InferResponseType<
|
|
|
26
26
|
(typeof client)['organizations'][':orgId']['sponsorship']['$get'],
|
|
27
27
|
200
|
|
28
28
|
>
|
|
29
|
+
type SponsorshipSubsidyResponse = InferResponseType<
|
|
30
|
+
(typeof client)['organizations'][':orgId']['sponsorship']['$put'],
|
|
31
|
+
200
|
|
32
|
+
>
|
|
29
33
|
type UsageResponse = InferResponseType<
|
|
30
34
|
(typeof client)['organizations'][':orgId']['usage']['$get'],
|
|
31
35
|
200
|
|
@@ -172,6 +176,24 @@ export declare namespace withEnabledSources {
|
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
|
|
179
|
+
/** Returns organization detail with its sponsorship subsidy policy replaced. */
|
|
180
|
+
export function withSponsorshipSubsidy(options: withSponsorshipSubsidy.Options): Detail {
|
|
181
|
+
return {
|
|
182
|
+
...options.detail,
|
|
183
|
+
sponsorshipSubsidy: options.sponsorshipSubsidy,
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export declare namespace withSponsorshipSubsidy {
|
|
188
|
+
/** Inputs for replacing an organization's cached subsidy policy. */
|
|
189
|
+
type Options = {
|
|
190
|
+
/** Organization detail to update. */
|
|
191
|
+
detail: Detail
|
|
192
|
+
/** Current sponsorship subsidy policy. */
|
|
193
|
+
sponsorshipSubsidy: Detail['sponsorshipSubsidy']
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
175
197
|
/** Enable an organization-wide billing source. */
|
|
176
198
|
export namespace enableBillingSource {
|
|
177
199
|
/** Billing source to enable for an organization. */
|
|
@@ -236,6 +258,39 @@ export namespace disableBillingSource {
|
|
|
236
258
|
}
|
|
237
259
|
}
|
|
238
260
|
|
|
261
|
+
/** Replace an organization's sponsorship subsidy policy. */
|
|
262
|
+
export namespace setSponsorshipSubsidy {
|
|
263
|
+
/** Sponsorship subsidy policy accepted by the admin API. */
|
|
264
|
+
export type Input = { enabled: false } | { enabled: true; projectSpendLimit?: string | undefined }
|
|
265
|
+
|
|
266
|
+
/** Replaces the policy and returns its current value. */
|
|
267
|
+
export async function fn(options: Input & { orgId: string }) {
|
|
268
|
+
const json = ((): Input => {
|
|
269
|
+
if (!options.enabled) return { enabled: false }
|
|
270
|
+
if (!options.projectSpendLimit) return { enabled: true }
|
|
271
|
+
return { enabled: true, projectSpendLimit: options.projectSpendLimit }
|
|
272
|
+
})()
|
|
273
|
+
const response = await client.organizations[':orgId'].sponsorship.$put({
|
|
274
|
+
json,
|
|
275
|
+
param: { orgId: options.orgId },
|
|
276
|
+
})
|
|
277
|
+
if (!response.ok) throw new Error('Failed to update sponsorship subsidy.')
|
|
278
|
+
return (await response.json()) as SponsorshipSubsidyResponse
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** Creates a mutation that replaces the subsidy policy. */
|
|
282
|
+
export function useMutation(orgId: string) {
|
|
283
|
+
const queryClient = ReactQuery.useQueryClient()
|
|
284
|
+
return ReactQuery.useMutation({
|
|
285
|
+
mutationFn: (input: Input) => fn({ ...input, orgId }),
|
|
286
|
+
onSuccess: (response) =>
|
|
287
|
+
queryClient.setQueryData(get.key(orgId), (detail: Detail | undefined) =>
|
|
288
|
+
detail ? withSponsorshipSubsidy({ detail, sponsorshipSubsidy: response }) : detail,
|
|
289
|
+
),
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
239
294
|
/** List members for one organization. */
|
|
240
295
|
export namespace members {
|
|
241
296
|
export function key(orgId: string) {
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '@tanstack/react-router'
|
|
15
15
|
import { Button, Rows, Select } from 'regen-ui'
|
|
16
16
|
import { ArrowLeft, RefreshCw } from 'lucide-react'
|
|
17
|
+
import { useEffect, useState } from 'react'
|
|
17
18
|
|
|
18
19
|
import { Card, Notice, Page } from '../components/Page.js'
|
|
19
20
|
import * as core_Format from '../lib/format.js'
|
|
@@ -34,6 +35,7 @@ function PageComponent() {
|
|
|
34
35
|
const period = period_search ?? '7d'
|
|
35
36
|
const disableBillingSource = Organizations.disableBillingSource.useMutation(orgId)
|
|
36
37
|
const enableBillingSource = Organizations.enableBillingSource.useMutation(orgId)
|
|
38
|
+
const setSponsorshipSubsidy = Organizations.setSponsorshipSubsidy.useMutation(orgId)
|
|
37
39
|
const organizationQuery = useSuspenseQuery(Organizations.get.options(orgId))
|
|
38
40
|
const organization = organizationQuery.data
|
|
39
41
|
const members = useInfiniteQuery(Organizations.members.options(orgId))
|
|
@@ -198,6 +200,12 @@ function PageComponent() {
|
|
|
198
200
|
onChange={setBillingSource}
|
|
199
201
|
pending={billingSourcePending}
|
|
200
202
|
/>
|
|
203
|
+
<SponsorshipSubsidyCard
|
|
204
|
+
error={setSponsorshipSubsidy.error}
|
|
205
|
+
onSave={(policy) => setSponsorshipSubsidy.mutate(policy)}
|
|
206
|
+
pending={setSponsorshipSubsidy.isPending}
|
|
207
|
+
policy={organization.sponsorshipSubsidy}
|
|
208
|
+
/>
|
|
201
209
|
<div className="grid gap-3 md:grid-cols-2">
|
|
202
210
|
<BillingCard
|
|
203
211
|
environment="Production"
|
|
@@ -655,6 +663,114 @@ export declare namespace BillingSourcesCard {
|
|
|
655
663
|
}
|
|
656
664
|
}
|
|
657
665
|
|
|
666
|
+
/** Organization-wide per-project sponsorship subsidy controls. */
|
|
667
|
+
export function SponsorshipSubsidyCard(options: SponsorshipSubsidyCard.Props) {
|
|
668
|
+
const [enabled, setEnabled] = useState(options.policy.durationDays !== null)
|
|
669
|
+
const [projectSpendLimit, setProjectSpendLimit] = useState(options.policy.projectSpendLimit ?? '')
|
|
670
|
+
|
|
671
|
+
useEffect(() => {
|
|
672
|
+
setEnabled(options.policy.durationDays !== null)
|
|
673
|
+
setProjectSpendLimit(options.policy.projectSpendLimit ?? '')
|
|
674
|
+
}, [options.policy.durationDays, options.policy.projectSpendLimit])
|
|
675
|
+
|
|
676
|
+
return (
|
|
677
|
+
<Card>
|
|
678
|
+
<form
|
|
679
|
+
onSubmit={(event) => {
|
|
680
|
+
event.preventDefault()
|
|
681
|
+
if (!enabled) return options.onSave({ enabled: false })
|
|
682
|
+
if (!projectSpendLimit) return options.onSave({ enabled: true })
|
|
683
|
+
return options.onSave({ enabled: true, projectSpendLimit })
|
|
684
|
+
}}
|
|
685
|
+
>
|
|
686
|
+
<div className="flex items-start justify-between gap-4 p-4">
|
|
687
|
+
<div className="min-w-0">
|
|
688
|
+
<h3 className="text-label-14 text-foreground">Sponsorship subsidy</h3>
|
|
689
|
+
<p className="mt-1 text-copy-13 text-foreground-secondary">
|
|
690
|
+
Waive sponsored transaction charges for each project's first 90 days.
|
|
691
|
+
</p>
|
|
692
|
+
</div>
|
|
693
|
+
<Switch.Root
|
|
694
|
+
aria-label="Sponsorship subsidy"
|
|
695
|
+
checked={enabled}
|
|
696
|
+
className="flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-border bg-secondary p-0.5 outline-none transition-colors hover:bg-secondary-hover focus-visible:border-focus data-[checked]:bg-invert disabled:cursor-not-allowed disabled:opacity-50"
|
|
697
|
+
disabled={options.pending}
|
|
698
|
+
onCheckedChange={setEnabled}
|
|
699
|
+
>
|
|
700
|
+
<Switch.Thumb className="block size-4 translate-x-0 rounded-full bg-foreground-secondary transition-transform data-[checked]:translate-x-4 data-[checked]:bg-on-invert" />
|
|
701
|
+
</Switch.Root>
|
|
702
|
+
</div>
|
|
703
|
+
{enabled ? (
|
|
704
|
+
<div className="grid gap-4 border-t border-border p-4 md:grid-cols-2">
|
|
705
|
+
<label className="flex min-w-0 flex-col gap-2">
|
|
706
|
+
<span className="text-label-13 text-foreground-secondary">Duration per project</span>
|
|
707
|
+
<input
|
|
708
|
+
className="h-10 rounded-body border-2 border-transparent bg-secondary px-3 text-copy-14 text-foreground-secondary"
|
|
709
|
+
disabled
|
|
710
|
+
value="90 days"
|
|
711
|
+
/>
|
|
712
|
+
<span className="text-label-12 text-foreground-secondary">
|
|
713
|
+
Starts with the project's first mainnet sponsorship.
|
|
714
|
+
</span>
|
|
715
|
+
</label>
|
|
716
|
+
<label className="flex min-w-0 flex-col gap-2">
|
|
717
|
+
<span className="text-label-13 text-foreground-secondary">
|
|
718
|
+
Per-project spend cap (optional)
|
|
719
|
+
</span>
|
|
720
|
+
<span className="flex h-10 items-center rounded-body border-2 border-transparent bg-secondary px-3 focus-within:border-focus">
|
|
721
|
+
<span className="text-copy-14 text-foreground-secondary">$</span>
|
|
722
|
+
<input
|
|
723
|
+
aria-label="Per-project spend cap"
|
|
724
|
+
className="min-w-0 flex-1 bg-transparent px-2 text-copy-14 text-foreground outline-none"
|
|
725
|
+
disabled={options.pending}
|
|
726
|
+
inputMode="decimal"
|
|
727
|
+
min="0"
|
|
728
|
+
onChange={(event) => setProjectSpendLimit(event.target.value)}
|
|
729
|
+
placeholder="No cap"
|
|
730
|
+
step="0.000001"
|
|
731
|
+
type="number"
|
|
732
|
+
value={projectSpendLimit}
|
|
733
|
+
/>
|
|
734
|
+
</span>
|
|
735
|
+
<span className="text-label-12 text-foreground-secondary">
|
|
736
|
+
Leave blank for no spend cap.
|
|
737
|
+
</span>
|
|
738
|
+
</label>
|
|
739
|
+
</div>
|
|
740
|
+
) : (
|
|
741
|
+
<p className="border-t border-border p-4 text-copy-13 text-foreground-secondary">
|
|
742
|
+
New sponsorships for this organization are billed normally.
|
|
743
|
+
</p>
|
|
744
|
+
)}
|
|
745
|
+
<div className="flex items-center justify-end gap-3 border-t border-border p-4">
|
|
746
|
+
{options.error ? (
|
|
747
|
+
<p className="mr-auto text-copy-13 text-negative" role="alert">
|
|
748
|
+
{options.error.message}
|
|
749
|
+
</p>
|
|
750
|
+
) : null}
|
|
751
|
+
<Button loading={options.pending} type="submit">
|
|
752
|
+
Save policy
|
|
753
|
+
</Button>
|
|
754
|
+
</div>
|
|
755
|
+
</form>
|
|
756
|
+
</Card>
|
|
757
|
+
)
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export declare namespace SponsorshipSubsidyCard {
|
|
761
|
+
/** Sponsorship subsidy control properties. */
|
|
762
|
+
type Props = {
|
|
763
|
+
/** Latest mutation error. */
|
|
764
|
+
error: Error | null
|
|
765
|
+
/** Saves a replacement policy. */
|
|
766
|
+
onSave: (policy: Organizations.setSponsorshipSubsidy.Input) => void
|
|
767
|
+
/** Whether a policy change is pending. */
|
|
768
|
+
pending: boolean
|
|
769
|
+
/** Current organization policy. */
|
|
770
|
+
policy: Organizations.Detail['sponsorshipSubsidy']
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
658
774
|
function BillingCard(options: BillingCard.Props) {
|
|
659
775
|
const { settings, source } = options.record
|
|
660
776
|
const remaining =
|